I have time. For now they work and it's rather slick.
for auto quotes in JEdit:
-------------
buffer_mode = buffer.getMode().toString();
if (buffer_mode.equals("java")
||buffer_mode.equals("xml")
||buffer_mode.equals("html")) {
textArea.setSelectedText("\"\"");
textArea.goToPrevCharacter(false);
} else {
textArea.setSelectedText("\"");
}
-------------
for auto brackets:
-------------
buffer_mode = buffer.getMode().toString();
if (buffer_mode.equals("java")) {
textArea.setSelectedText("{");
textArea.insertEnterAndIndent();
textArea.setSelectedText("}");
textArea.shiftIndentLeft();
textArea.goToPrevLine(false);
textArea.goToEndOfWhiteSpace(false);
textArea.insertEnterAndIndent();
} else{
textArea.setSelectedText("{");
}
--------------
for auto parenthesis:
--------------
buffer_mode = buffer.getMode().toString();
if (buffer_mode.equals("java")) {
textArea.setSelectedText("()");
textArea.goToPrevCharacter(false);
} else {
textArea.setSelectedText("(");
}
--------------
for auto LOG debug statements:
--------------
textArea.setSelectedText("if(LOG.isDebugEnabled()){");
textArea.insertEnterAndIndent();
textArea.setSelectedText("LOG.debug()");
textArea.goToEndOfWhiteSpace(false);
textArea.setSelectedText(";");
textArea.insertEnterAndIndent();
textArea.setSelectedText("}");
textArea.shiftIndentLeft();
--------------
No comments:
Post a Comment