|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--javax.swing.JComponent | +--javax.swing.text.JTextComponent | +--javax.swing.JEditorPane | +--edu.rice.cs.drjava.ui.DefinitionsPane
The pane in which work on a given OpenDefinitionsDocument occurs. A DefinitionsPane is tied to a single document, which cannot be changed.
Inner Class Summary | |
private class |
DefinitionsPane.BackgroundColorOptionListener
The OptionListener for DEFINITIONS_BACKGROUND_COLOR |
private class |
DefinitionsPane.BreakpointColorOptionListener
The OptionListener for DEBUG_BREAKPOINT_COLOR |
private class |
DefinitionsPane.ErrorColorOptionListener
The OptionListener for COMPILER_ERROR_COLOR |
private class |
DefinitionsPane.IndentKeyAction
Used for indent action spawned by pressing the enter key, '{', or '}'. |
private class |
DefinitionsPane.IndentKeyActionTab
An action to handle indentation spawned by pressing the tab key. |
private class |
DefinitionsPane.MatchColorOptionListener
The OptionListener for DEFINITIONS_MATCH_COLOR |
private class |
DefinitionsPane.OurUndoManager
Is used to be able to call editToBeUndone and editToBeRedone since they are protected methods in UndoManager |
private class |
DefinitionsPane.PopupMenuMouseAdapter
|
private class |
DefinitionsPane.RedoAction
Redo action. |
private class |
DefinitionsPane.ThreadColorOptionListener
The OptionListener for DEBUG_THREAD_COLOR |
private class |
DefinitionsPane.UndoAction
The undo action. |
private class |
DefinitionsPane.UndoWithPosition
Wrapper for UndoableEdit that pairs UndoableEdits with their caret positions |
Inner classes inherited from class javax.swing.JEditorPane |
JEditorPane.AccessibleJEditorPane, JEditorPane.AccessibleJEditorPaneHTML, JEditorPane.HeaderParser, JEditorPane.JEditorPaneAccessibleHypertextSupport, JEditorPane.PageLoader, JEditorPane.PlainEditorKit |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent, JComponent.ActionStandin, JComponent.IntVector, JComponent.KeyboardState |
Inner classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.AWTTreeLock |
Field Summary | |
private OpenDefinitionsDocument |
_doc
|
private HighlightManager.HighlightInfo |
_errorHighlightTag
Our current error matching highlight. |
private CompilerErrorCaretListener |
_errorListener
Listens to caret to highlight errors as appropriate. |
private boolean |
_hasWarnedAboutModified
Flag used to determine if the user has already been warned about debugging when the document within this defpane has been modified since its last save. |
private HighlightManager |
_highlightManager
|
private Action |
_indentKeyActionColon
|
private Action |
_indentKeyActionLine
Because the "default" action for the enter key is special, it must be grabbed from the Keymap using getAction(KeyStroke), which returns the "default" action for all keys which have behavior extending beyond regular text keys. |
private Action |
_indentKeyActionOpenSquiggly
|
private Action |
_indentKeyActionSquiggly
Likewise, regular text keys like '{', '}', and ':' do not have special actions that are returned by getAction(KeyStroke). |
private Action |
_indentKeyActionTab
Special action to take care of case when tab key is pressed. |
private JUnitErrorCaretListener |
_junitErrorListener
Listens to caret to highlight JUnit errors as appropriate. |
private MainFrame |
_mainFrame
Our parent window. |
private HighlightManager.HighlightInfo |
_matchHighlight
Our current paren/brace/bracket matching highlight. |
private CaretListener |
_matchListener
Looks for changes in the caret position to see if a paren/brace/bracket highlight is needed. |
private GlobalModel |
_model
|
private JPopupMenu |
_popMenu
The contextual popup menu for the Definitions Pane. |
private DefinitionsPane.PopupMenuMouseAdapter |
_popupMenuMA
The mouse adapter for handling a popup menu |
private DefinitionsPane.RedoAction |
_redoAction
|
private ActionListener |
_setSizeListener
|
private JMenuItem |
_toggleBreakpointMenuItem
The menu item for the "Toggle Breakpoint" option. |
private DefinitionsPane.UndoAction |
_undoAction
|
private UndoableEditListener |
_undoListener
|
private DefinitionsPane.OurUndoManager |
_undoManager
|
private boolean |
_updatePending
Used by the centering source mechanism to ensure paints |
static DefaultHighlighter.DefaultHighlightPainter |
BREAKPOINT_PAINTER
Highlight painter for breakpoints |
private static EditorKit |
EDITOR_KIT
|
static DefaultHighlighter.DefaultHighlightPainter |
ERROR_PAINTER
Highlight painter for selected errors in the defs doc. |
static DefaultHighlighter.DefaultHighlightPainter |
MATCH_PAINTER
Paren/brace/bracket matching highlight color. |
static DefaultHighlighter.DefaultHighlightPainter |
THREAD_PAINTER
Highlight painter for thread's current location |
private static int |
UNDO_LIMIT
|
Fields inherited from class javax.swing.JEditorPane |
charSetName, kit, kitLoaderRegistryKey, kitRegistryKey, kitTypeRegistryKey, managingFocus, pageLoadedListener, pageProperties, typeHandlers, uiClassID |
Fields inherited from class javax.swing.text.JTextComponent |
caret, caretColor, caretEvent, composedText, composedTextCaret, composedTextContent, composedTextEnd, composedTextStart, DEFAULT_KEYMAP, defaultClipboardOwner, disabledTextColor, editable, editor, FOCUS_ACCELERATOR_KEY, focusAccelerator, focusedComponent, highlighter, inputMethodRequestsHandler, keymap, keymapTable, margin, model, needToSendKeyTypedEvent, originalCaret, selectedTextColor, selectionColor |
Fields inherited from class java.awt.Container |
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, needsPaint, printing, printingThreads, serialVersionUID |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
DefinitionsPane(MainFrame mf,
GlobalModel model,
OpenDefinitionsDocument doc)
Constructor. |
Method Summary | |
private void |
_addHighlight(int from,
int to)
Adds a highlight to the document. |
private void |
_indent()
Perform an indent either on the current line or on the given selected box of text. |
private void |
_indentLines()
Indents the lines contained within the given selection. |
private void |
_removePreviousHighlight()
Removes the previous highlight so document is cleared when caret position changes. |
private void |
_resetUndo()
Reset the document Undo list. |
private void |
_updateMatchHighlight()
Updates the highlight if there is any. |
(package private) static void |
|
void |
addBreakpointHighlight(Breakpoint bp)
|
void |
addErrorCaretListener(CompilerErrorCaretListener listener)
Add a CompilerErrorCaretListener to this pane, keeping it accessible so its error model can be updated later. |
void |
addErrorHighlight(int from,
int to)
Adds an error highlight to the document. |
void |
addJUnitErrorCaretListener(JUnitErrorCaretListener listener)
Add a JUnitErrorCaretListener to this pane, keeping it accessible so its error model can be updated later. |
void |
addSetSizeListener(ActionListener listener)
|
void |
centerViewOnLine(int lineNumber)
|
void |
centerViewOnOffset(int offset)
|
protected EditorKit |
createDefaultEditorKit()
Overriding this method ensures that all new documents created in this editor pane use our editor kit (and thus our model). |
private void |
createPopupMenu()
Creates the popup menu for the DefinitionsPane |
int |
getCurrentCol()
|
int |
getCurrentLine()
|
CompilerErrorCaretListener |
getErrorCaretListener()
Gets the CompilerErrorCaretListener for this pane. |
HighlightManager |
getHighlightManager()
Access to the pane's HighlightManager |
JUnitErrorCaretListener |
getJUnitErrorCaretListener()
Gets the JUnitErrorCaretListener for this pane. |
OpenDefinitionsDocument |
getOpenDocument()
Get the OpenDefinitionsDocument contained in this DefinitionsPane. |
Action |
getRedoAction()
|
Action |
getUndoAction()
|
boolean |
hasWarnedAboutModified()
|
void |
hasWarnedAboutModified(boolean hasWarned)
|
void |
processKeyEvent(KeyEvent e)
Takes in any keyboard input, checks to see if it is in the keyToActionMap in KeybindingManager, if so executes the action, otherwise checks if it contains the current platform's menu shortcut modifier and if so, ignores that command (this disallows the execution of the UI's default actions such as cut/copy/paste/select all), otherwise does whatever normally would be done |
void |
removeBreakpointHighlight(Breakpoint bp)
|
void |
removeErrorHighlight()
Removes the previous error highlight from the document after the cursor has moved. |
void |
removeSetSizeListener()
|
void |
resetUndo()
Reset the document Undo list. |
void |
setCaretPosition(int pos)
Be sure to update the document (and thus the reduced model) any time the caret position changes. |
void |
setDocument(Document doc)
Override JEditorPane's setDocument to make sure only the Document in our final OpenDefinitionsDocument can be used. |
private void |
setDocument(OpenDefinitionsDocument doc)
Reset undo machinery on setDocument. |
void |
setPositionAndScroll(int pos)
Set the caret position and also scroll to make sure the location is visible. |
void |
setSize(int width,
int height)
|
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait |
Field Detail |
private static final EditorKit EDITOR_KIT
private static final int UNDO_LIMIT
private MainFrame _mainFrame
private GlobalModel _model
private final OpenDefinitionsDocument _doc
private DefinitionsPane.OurUndoManager _undoManager
private DefinitionsPane.UndoAction _undoAction
private DefinitionsPane.RedoAction _redoAction
private HighlightManager _highlightManager
private boolean _hasWarnedAboutModified
private HighlightManager.HighlightInfo _matchHighlight
private boolean _updatePending
public static DefaultHighlighter.DefaultHighlightPainter MATCH_PAINTER
private HighlightManager.HighlightInfo _errorHighlightTag
public static DefaultHighlighter.DefaultHighlightPainter ERROR_PAINTER
public static DefaultHighlighter.DefaultHighlightPainter BREAKPOINT_PAINTER
public static DefaultHighlighter.DefaultHighlightPainter THREAD_PAINTER
private JMenuItem _toggleBreakpointMenuItem
private JPopupMenu _popMenu
private DefinitionsPane.PopupMenuMouseAdapter _popupMenuMA
private CompilerErrorCaretListener _errorListener
private JUnitErrorCaretListener _junitErrorListener
private ActionListener _setSizeListener
private CaretListener _matchListener
private UndoableEditListener _undoListener
private Action _indentKeyActionTab
private Action _indentKeyActionLine
private Action _indentKeyActionSquiggly
private Action _indentKeyActionOpenSquiggly
private Action _indentKeyActionColon
Constructor Detail |
public DefinitionsPane(MainFrame mf, GlobalModel model, OpenDefinitionsDocument doc)
mf
- the parent windowMethod Detail |
static void()
private void _updateMatchHighlight() throws BadLocationException
BadLocationException
- private void _addHighlight(int from, int to)
from
- start of highlightto
- end of highlightBadLocationException
- private void _removePreviousHighlight()
public void processKeyEvent(KeyEvent e)
processKeyEvent
in class JEditorPane
public void setCaretPosition(int pos)
setCaretPosition
in class JTextComponent
pos
- private void createPopupMenu()
private void _indentLines()
public Action getUndoAction()
public Action getRedoAction()
public OpenDefinitionsDocument getOpenDocument()
public HighlightManager getHighlightManager()
public void setPositionAndScroll(int pos)
pos
- Location to scroll to.public void setDocument(Document doc)
setDocument
in class JTextComponent
public void addErrorCaretListener(CompilerErrorCaretListener listener)
public void addJUnitErrorCaretListener(JUnitErrorCaretListener listener)
public CompilerErrorCaretListener getErrorCaretListener()
public JUnitErrorCaretListener getJUnitErrorCaretListener()
public void addErrorHighlight(int from, int to)
BadLocationException
- public void removeErrorHighlight()
public boolean hasWarnedAboutModified()
public void hasWarnedAboutModified(boolean hasWarned)
public void addBreakpointHighlight(Breakpoint bp)
public void removeBreakpointHighlight(Breakpoint bp)
private void setDocument(OpenDefinitionsDocument doc)
public int getCurrentLine()
public int getCurrentCol()
public void setSize(int width, int height)
setSize
in class Component
public void addSetSizeListener(ActionListener listener)
public void removeSetSizeListener()
public void centerViewOnOffset(int offset)
public void centerViewOnLine(int lineNumber)
public void resetUndo()
private void _resetUndo()
protected EditorKit createDefaultEditorKit()
createDefaultEditorKit
in class JEditorPane
private void _indent()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |