Package edu.wisc.ssec.mcidasv.ui
Class JythonEditor
java.lang.Object
edu.wisc.ssec.mcidasv.ui.JythonEditor
- All Implemented Interfaces:
EventListener,UndoableEditListener
A bare-bones text editor that can do relatively robust syntax highlighting
of Jython code.
This class relies very heavily upon the wonderful RSyntaxTextArea project.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final org.slf4j.Loggerprivate final org.fife.ui.rtextarea.RTextScrollPaneScroll pane fortextArea.private final JythonEditor.McvJythonTextAreaText area that contains the syntax-highlighted text.private final UndoManagerUndo manager. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given undoable edit listener totextArea.voidcopy()Copies selected text into system clipboard.Returns the defaultJPopupMenucreated byRSyntaxTextArea.createPopupMenu().Returns the component (aka "the gutter" that contains optional information like line numbers.Returns theJScrollPanethat containstextArea.getText()Returns a string containing the text oftextArea.Returns the text area responsible for syntax highlighting.voidinsertText(String textToInsert) Insert the given text at the caret.booleanWhether or not changes can be made totextArea.voidRemove the given undoable edit listener fromtextArea.voidsetEnabled(boolean enabled) Controls whether or not changes can be made to the contents oftextArea.voidSets the text of this document to the givenString.voidHandles undoable edits
-
Field Details
-
logger
-
textArea
Text area that contains the syntax-highlighted text. -
scrollPane
Scroll pane fortextArea. -
undo
Undo manager.
-
-
Constructor Details
-
JythonEditor
public JythonEditor()Creates a new JythonEditor.
-
-
Method Details
-
getTextComponent
Returns the text area responsible for syntax highlighting.- Returns:
- Reference to
textArea.
-
getScrollPane
Returns theJScrollPanethat containstextArea.- Returns:
JScrollPanewith the text area. Suitable for adding to aJPanel.
-
setText
Sets the text of this document to the givenString.- Parameters:
text- New text to use intextArea.
-
getText
Returns a string containing the text oftextArea.- Returns:
- The current contents of the text area.
-
setEnabled
Controls whether or not changes can be made to the contents oftextArea.- Parameters:
enabled-trueif the editor should be enabled,falseotherwise.
-
getLineNumberComponent
Returns the component (aka "the gutter" that contains optional information like line numbers.- Returns:
JPanelthat contains the line numbers.
-
copy
Copies selected text into system clipboard. -
isEnabled
Whether or not changes can be made totextArea.- Returns:
trueif changes are allowed,falseotherwise.
-
insertText
Insert the given text at the caret.- Parameters:
textToInsert- Text to insert.
-
undoableEditHappened
Handles undoable edits- Specified by:
undoableEditHappenedin interfaceUndoableEditListener- Parameters:
e- Event that represents the undoable edit.
-
addUndoableEditListener
Adds the given undoable edit listener totextArea.- Parameters:
l- Listener to add.
-
removeUndoableEditListener
Remove the given undoable edit listener fromtextArea.- Parameters:
l- Listener to remove.
-
createPopupMenu
Returns the defaultJPopupMenucreated byRSyntaxTextArea.createPopupMenu().- Returns:
- Popup menu.
-