edu.rice.cs.drjava.ui
Class DefinitionsPane

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
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, OptionConstants, Scrollable, Serializable

public class DefinitionsPane
extends JEditorPane
implements OptionConstants

The pane in which work on a given OpenDefinitionsDocument occurs. A DefinitionsPane is tied to a single document, which cannot be changed.

Version:
$Id: DefinitionsPane.java,v 1.90 2002/09/02 21:24:12 csreis Exp $
See Also:
Serialized Form

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.text.JTextComponent
JTextComponent.AccessibleJTextComponent, JTextComponent.ClipboardObserver, JTextComponent.ComposedTextCaret, JTextComponent.DefaultKeymap, JTextComponent.InputMethodRequestsHandler, JTextComponent.KeyBinding, JTextComponent.KeymapActionMap, JTextComponent.KeymapWrapper, JTextComponent.MutableCaretEvent
 
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 javax.swing.JComponent
_bounds, accessibleContext, actionMap, ACTIONMAP_CREATED, alignmentX, alignmentY, ANCESTOR_INPUTMAP_CREATED, ANCESTOR_USING_BUFFER, ancestorInputMap, ancestorNotifier, autoscroller, border, changeSupport, clientProperties, CREATED_DOUBLE_BUFFER, flags, FOCUS_INPUTMAP_CREATED, focusInputMap, HAS_FOCUS, htmlKey, htmlView, inputVerifier, IS_DOUBLE_BUFFERED, IS_OPAQUE, IS_PAINTING_TILE, IS_PRINTING, IS_PRINTING_ALL, KEY_EVENTS_ENABLED, KEYBOARD_BINDINGS_KEY, listenerList, maximumSize, minimumSize, NEXT_FOCUS, paintImmediatelyClip, paintingChild, preferredSize, readObjectCallbacks, REQUEST_FOCUS_DISABLED, tmpRect, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, verifyInputWhenFocusTarget, vetoableChangeSupport, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW, WHEN_IN_FOCUSED_WINDOW_BINDINGS, WIF_INPUTMAP_CREATED, windowInputMap
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dbg, dispatcher, layoutMgr, listeningBoundsChildren, listeningChildren, maxSize, ncomponents, needsPaint, printing, printingThreads, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, graphicsConfig, hasFocus, height, hierarchyBoundsListener, hierarchyBoundsListenerK, hierarchyListener, hierarchyListenerK, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, metrics, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, privateKey, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowClosingException, windowListenerK, x, y
 
Fields inherited from interface edu.rice.cs.drjava.config.OptionConstants
COMPILER_ERROR_COLOR, DEBUG_BREAKPOINT_COLOR, DEBUG_SHOW_THREADS, DEBUG_SOURCEPATH, DEBUG_STEP_DRJAVA, DEBUG_STEP_INTERPRETER, DEBUG_STEP_JAVA, DEBUG_THREAD_COLOR, DEFINITIONS_BACKGROUND_COLOR, DEFINITIONS_COMMENT_COLOR, DEFINITIONS_DOUBLE_QUOTED_COLOR, DEFINITIONS_KEYWORD_COLOR, DEFINITIONS_MATCH_COLOR, DEFINITIONS_NORMAL_COLOR, DEFINITIONS_NUMBER_COLOR, DEFINITIONS_SINGLE_QUOTED_COLOR, DEFINITIONS_TYPE_COLOR, EXTRA_CLASSPATH, FONT_DOCLIST, FONT_MAIN, FONT_TOOLBAR, HISTORY_MAX_SIZE, INDENT_LEVEL, INTERACTIONS_EXIT_PROMPT, JAVAC_ALLOW_ASSERT, JAVAC_LOCATION, JSR14_COLLECTIONSPATH, JSR14_LOCATION, KEY_BACKWARD, KEY_BEGIN_DOCUMENT, KEY_BEGIN_LINE, KEY_CLOSE_FILE, KEY_COMPILE, KEY_COMPILE_ALL, KEY_COPY, KEY_CUT, KEY_CUT_LINE, KEY_DEBUG_BREAKPOINT_TOGGLE, KEY_DEBUG_MODE_TOGGLE, KEY_DEBUG_RESUME, KEY_DEBUG_STEP_INTO, KEY_DEBUG_STEP_OUT, KEY_DEBUG_STEP_OVER, KEY_DELETE_NEXT, KEY_DELETE_PREVIOUS, KEY_DOWN, KEY_END_DOCUMENT, KEY_END_LINE, KEY_FIND_NEXT, KEY_FIND_REPLACE, KEY_FORWARD, KEY_GOTO_LINE, KEY_NEW_FILE, KEY_NEXT_DOCUMENT, KEY_NEXT_WORD, KEY_OPEN_FILE, KEY_PAGE_DOWN, KEY_PAGE_UP, KEY_PASTE, KEY_PREVIOUS_DOCUMENT, KEY_PREVIOUS_WORD, KEY_PRINT, KEY_PRINT_PREVIEW, KEY_QUIT, KEY_REDO, KEY_SAVE_FILE, KEY_SAVE_FILE_AS, KEY_SELECT_ALL, KEY_UNDO, KEY_UP, LINEENUM_ENABLED, mask, QUIT_PROMPT, RECENT_FILES, RECENT_FILES_MAX_SIZE, TOOLBAR_ICONS_ENABLED, TOOLBAR_TEXT_ENABLED, WORKING_DIRECTORY
 
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 javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, finalize, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getKitLoaderRegistry, getKitRegisty, getKitTypeRegistry, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getStream, getText, getUIClassID, isFocusCycleRoot, isManagingFocus, loadDefaultKitsIfNecessary, paramString, processComponentKeyEvent, read, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, replaceSelection, scrollToReference, setCharsetFromContentTypeParameters, setContentType, setEditorKit, setEditorKitForContentType, setPage, setPage, setText, writeObject
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, copy, createComposedString, cut, exchangeCaret, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretPosition, getDisabledTextColor, getDocument, getFocusAccelerator, getFocusedComponent, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getPreferredScrollableViewportSize, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getUI, isEditable, isFocusTraversable, isProcessInputMethodEventOverridden, loadKeymap, mapCommittedTextToAction, modelToView, moveCaretPosition, paste, processInputMethodEvent, read, readObject, removeCaretListener, removeKeymap, removeNotify, replaceInputMethodText, select, selectAll, setCaret, setCaretColor, setDisabledTextColor, setEditable, setFocusAccelerator, setHighlighter, setInputMethodCaretPosition, setKeymap, setMargin, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateInputMap, updateUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
_paintImmediately, addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, adjustPaintFlags, alwaysOnTop, checkIfChildObscuredBySibling, clearFocusOwners, componentInputMapChanged, computeVisibleRect, computeVisibleRect, compWriteObjectNotify, contains, createToolTip, disable, enable, enableSerialization, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperties, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getCreatedDoubleBuffer, getDebugGraphicsOptions, getFlag, getGraphics, getHeight, getInputMap, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isLightweightComponent, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paintWithBuffer, print, printAll, printBorder, printChildren, printComponent, processFocusEvent, processKeyBinding, processKeyBindings, processKeyBindingsForAllComponents, processMouseMotionEvent, putClientProperty, rectangleIsObscured, rectangleIsObscuredBySibling, registerKeyboardAction, registerKeyboardAction, registerWithKeyboardManager, registerWithKeyboardManager, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setCreatedDoubleBuffer, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFlag, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPaintingChild, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, shouldDebugGraphics, superProcessMouseMotionEvent, unregisterKeyboardAction, unregisterWithKeyboardManager, unregisterWithKeyboardManager, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, adjustListeningChildren, applyOrientation, checkGD, countComponents, createChildHierarchyEvents, createHierarchyEvents, deliverEvent, dispatchEventImpl, dispatchEventToSelf, doLayout, eventEnabled, findComponentAt, findComponentAt, findComponentAt, getAccessibleAt, getAccessibleChild, getAccessibleChildrenCount, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getLayout, getMouseEventTarget, getWindow, initIDs, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPaint, lightweightPrint, list, list, locate, minimumSize, nextFocus, numListening, paintComponents, paintHeavyweightComponents, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, printHeavyweightComponents, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFocusOwner, setLayout, transferFocus, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, areInputMethodsEnabled, bounds, checkImage, checkImage, checkWindowClosingException, coalesceEvents, constructComponentName, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getAccessibleIndexInParent, getAccessibleStateSet, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getLocale, getLocation, getLocationOnScreen_NoTreeLock, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getToolkit, getToolkitImpl, getTreeLock, getWindowForObject, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isEnabledImpl, isLightweight, isRecursivelyVisible, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resetGC, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

EDITOR_KIT

private static final EditorKit EDITOR_KIT

UNDO_LIMIT

private static final int UNDO_LIMIT

_mainFrame

private MainFrame _mainFrame
Our parent window.

_model

private GlobalModel _model

_doc

private final OpenDefinitionsDocument _doc

_undoManager

private DefinitionsPane.OurUndoManager _undoManager

_undoAction

private DefinitionsPane.UndoAction _undoAction

_redoAction

private DefinitionsPane.RedoAction _redoAction

_highlightManager

private HighlightManager _highlightManager

_hasWarnedAboutModified

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.

_matchHighlight

private HighlightManager.HighlightInfo _matchHighlight
Our current paren/brace/bracket matching highlight.

_updatePending

private boolean _updatePending
Used by the centering source mechanism to ensure paints

MATCH_PAINTER

public static DefaultHighlighter.DefaultHighlightPainter MATCH_PAINTER
Paren/brace/bracket matching highlight color.

_errorHighlightTag

private HighlightManager.HighlightInfo _errorHighlightTag
Our current error matching highlight.

ERROR_PAINTER

public static DefaultHighlighter.DefaultHighlightPainter ERROR_PAINTER
Highlight painter for selected errors in the defs doc.

BREAKPOINT_PAINTER

public static DefaultHighlighter.DefaultHighlightPainter BREAKPOINT_PAINTER
Highlight painter for breakpoints

THREAD_PAINTER

public static DefaultHighlighter.DefaultHighlightPainter THREAD_PAINTER
Highlight painter for thread's current location

_toggleBreakpointMenuItem

private JMenuItem _toggleBreakpointMenuItem
The menu item for the "Toggle Breakpoint" option. Stored in field so that it may be enabled and disabled depending on Debug Mode

_popMenu

private JPopupMenu _popMenu
The contextual popup menu for the Definitions Pane.

_popupMenuMA

private DefinitionsPane.PopupMenuMouseAdapter _popupMenuMA
The mouse adapter for handling a popup menu

_errorListener

private CompilerErrorCaretListener _errorListener
Listens to caret to highlight errors as appropriate.

_junitErrorListener

private JUnitErrorCaretListener _junitErrorListener
Listens to caret to highlight JUnit errors as appropriate.

_setSizeListener

private ActionListener _setSizeListener

_matchListener

private CaretListener _matchListener
Looks for changes in the caret position to see if a paren/brace/bracket highlight is needed.

_undoListener

private UndoableEditListener _undoListener

_indentKeyActionTab

private Action _indentKeyActionTab
Special action to take care of case when tab key is pressed.

_indentKeyActionLine

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.

_indentKeyActionSquiggly

private Action _indentKeyActionSquiggly
Likewise, regular text keys like '{', '}', and ':' do not have special actions that are returned by getAction(KeyStroke). To make sure these behave right, we use getDefaultAction() instead.

_indentKeyActionOpenSquiggly

private Action _indentKeyActionOpenSquiggly

_indentKeyActionColon

private Action _indentKeyActionColon
Constructor Detail

DefinitionsPane

public DefinitionsPane(MainFrame mf,
                       GlobalModel model,
                       OpenDefinitionsDocument doc)
Constructor. Sets up all the defaults.
Parameters:
mf - the parent window
Method Detail

static void ()

_updateMatchHighlight

private void _updateMatchHighlight()
                            throws BadLocationException
Updates the highlight if there is any.
Throws:
BadLocationException -  

_addHighlight

private void _addHighlight(int from,
                           int to)
Adds a highlight to the document. Called by _updateMatchHighlight().
Parameters:
from - start of highlight
to - end of highlight
Throws:
BadLocationException -  

_removePreviousHighlight

private void _removePreviousHighlight()
Removes the previous highlight so document is cleared when caret position changes.

processKeyEvent

public 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
Overrides:
processKeyEvent in class JEditorPane

setCaretPosition

public void setCaretPosition(int pos)
Be sure to update the document (and thus the reduced model) any time the caret position changes.
Overrides:
setCaretPosition in class JTextComponent
Parameters:
pos -  

createPopupMenu

private void createPopupMenu()
Creates the popup menu for the DefinitionsPane

_indentLines

private void _indentLines()
Indents the lines contained within the given selection.

getUndoAction

public Action getUndoAction()
Returns:
the undo action

getRedoAction

public Action getRedoAction()
Returns:
the redo action

getOpenDocument

public OpenDefinitionsDocument getOpenDocument()
Get the OpenDefinitionsDocument contained in this DefinitionsPane.

getHighlightManager

public HighlightManager getHighlightManager()
Access to the pane's HighlightManager

setPositionAndScroll

public void setPositionAndScroll(int pos)
Set the caret position and also scroll to make sure the location is visible.
Parameters:
pos - Location to scroll to.

setDocument

public void setDocument(Document doc)
Override JEditorPane's setDocument to make sure only the Document in our final OpenDefinitionsDocument can be used.
Overrides:
setDocument in class JTextComponent

addErrorCaretListener

public void addErrorCaretListener(CompilerErrorCaretListener listener)
Add a CompilerErrorCaretListener to this pane, keeping it accessible so its error model can be updated later.

addJUnitErrorCaretListener

public void addJUnitErrorCaretListener(JUnitErrorCaretListener listener)
Add a JUnitErrorCaretListener to this pane, keeping it accessible so its error model can be updated later.

getErrorCaretListener

public CompilerErrorCaretListener getErrorCaretListener()
Gets the CompilerErrorCaretListener for this pane.

getJUnitErrorCaretListener

public JUnitErrorCaretListener getJUnitErrorCaretListener()
Gets the JUnitErrorCaretListener for this pane.

addErrorHighlight

public void addErrorHighlight(int from,
                              int to)
Adds an error highlight to the document.
Throws:
BadLocationException -  

removeErrorHighlight

public void removeErrorHighlight()
Removes the previous error highlight from the document after the cursor has moved.

hasWarnedAboutModified

public boolean hasWarnedAboutModified()

hasWarnedAboutModified

public void hasWarnedAboutModified(boolean hasWarned)

addBreakpointHighlight

public void addBreakpointHighlight(Breakpoint bp)

removeBreakpointHighlight

public void removeBreakpointHighlight(Breakpoint bp)

setDocument

private void setDocument(OpenDefinitionsDocument doc)
Reset undo machinery on setDocument.

getCurrentLine

public int getCurrentLine()

getCurrentCol

public int getCurrentCol()

setSize

public void setSize(int width,
                    int height)
Overrides:
setSize in class Component

addSetSizeListener

public void addSetSizeListener(ActionListener listener)

removeSetSizeListener

public void removeSetSizeListener()

centerViewOnOffset

public void centerViewOnOffset(int offset)

centerViewOnLine

public void centerViewOnLine(int lineNumber)

resetUndo

public void resetUndo()
Reset the document Undo list.

_resetUndo

private void _resetUndo()
Reset the document Undo list.

createDefaultEditorKit

protected EditorKit createDefaultEditorKit()
Overriding this method ensures that all new documents created in this editor pane use our editor kit (and thus our model).
Overrides:
createDefaultEditorKit in class JEditorPane

_indent

private void _indent()
Perform an indent either on the current line or on the given selected box of text. Calls are sent to GlobalModel which are then forwarded on to DefinitionsDocument. Hopefully the indent code will be fixed and corrected so this doesn't look so ugly. The purpose is to divorce the pane from the document so we can just pass a document to DefinitionsPane and that's all it cares about.