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
javax.swing.JTextPane
edu.rice.cs.drjava.ui.AbstractDJPane
edu.rice.cs.drjava.ui.DefinitionsPane
- All Implemented Interfaces:
- OptionConstants, Finalizable<DefinitionsPane>, DropTargetListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, Scrollable
public class DefinitionsPane
- extends AbstractDJPane
- implements Finalizable<DefinitionsPane>
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 5548 2012-04-29 20:07:19Z rcartwright $
- See Also:
- Serialized Form
| Nested classes/interfaces inherited from interface edu.rice.cs.drjava.config.OptionConstants |
OptionConstants.AccessLevelChoices, OptionConstants.COMPILER_PREFERENCE_CONTROL, OptionConstants.ConcJUnitCheckChoices, OptionConstants.DefaultFont, OptionConstants.DeleteLLClassFileChoices, OptionConstants.DynamicJavaAccessControlChoices, OptionConstants.FileExtRegistrationChoices, OptionConstants.HeapSizeChoices, OptionConstants.LookAndFeels, OptionConstants.PlasticThemes, OptionConstants.to, OptionConstants.VersionNotificationChoices |
|
Field Summary |
private boolean |
_antiAliasText
Whether to draw text as antialiased. |
private List<Pair<Option<Boolean>,OptionListener<Boolean>>> |
_booleanOptionListeners
|
private List<Pair<Option<Color>,OptionListener<Color>>> |
_colorOptionListeners
Saved option listeners kept in this field so they can be removed for garbage collection. |
private int |
_compoundEditKey
|
private boolean |
_displayRightMargin
Whether to display the right margin. |
private OpenDefinitionsDocument |
_doc
Our corresponding ODD |
private HighlightManager.HighlightInfo |
_errorHighlightTag
Our current compiler error matching highlight. |
private ErrorCaretListener |
_errorListener
Listens to caret to highlight errors as appropriate. |
private List<FinalizationListener<DefinitionsPane>> |
_finalizationListeners
This list of listeners to notify when we are finalized |
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. |
boolean |
_inCompoundEdit
Tells us whether we currently are in the middle of a CompoundEdit for regular keystrokes. |
private Action |
_indentKeyActionColon
|
private Action |
_indentKeyActionCurly
Likewise, regular text keys like '{', '}', and ':' do not have special actions that are returned by
getAction(KeyStroke). |
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 |
_indentKeyActionOpenCurly
|
private Action |
_indentKeyActionTab
Special action to take care of case when tab key is pressed. |
private List<Pair<Option<Integer>,OptionListener<Integer>>> |
_integerOptionListeners
|
private boolean |
_isCtrlShiftBracketDown
|
private boolean |
_isDeleteCompoundEdit
|
private MainFrame |
_mainFrame
Our parent window. |
private static int |
_maxCharWidth
Maximum character width of the current main font. |
private int |
_numRightMarginColumns
After how many columns to display the right margin. |
private JPopupMenu |
_popMenu
The contextual popup menu for the Definitions Pane. |
private DefinitionsPane.PopupMenuMouseAdapter |
_popupMenuMA
The mouse adapter for handling a popup menu. |
private int |
_position
|
private DefinitionsPane.RedoAction |
_redoAction
|
private Color |
_rightMarginColor
Color of the right margin. |
private int |
_savedHScroll
|
private int |
_savedVScroll
Used to save the caret position, selection, and scroll when setting the definitions pane to be inactive |
private JScrollPane |
_scrollPane
This instance of the scroll pane is here in order to allow for the definitions pane to save the
horizontal and vertical scroll |
private int |
_selEnd
|
private int |
_selStart
|
private ActionListener |
_setSizeListener
|
private DefinitionsPane.UndoAction |
_undoAction
|
private UndoableEditListener |
_undoListener
Listens to any undoable events in the document, and adds them to the undo manager. |
(package private) static ReverseHighlighter.DefaultUnderlineHighlightPainter |
BOOKMARK_PAINTER
Highlight painter for bookmarks. |
(package private) static ReverseHighlighter.DrJavaHighlightPainter |
BREAKPOINT_PAINTER
Highlight painter for breakpoints. |
(package private) static ReverseHighlighter.DrJavaHighlightPainter |
DISABLED_BREAKPOINT_PAINTER
Highlight painter for disabled breakpoints. |
private static DefinitionsEditorKit |
EDITOR_KIT
This field NEEDS to be set by setEditorKit() BEFORE any DefinitonsPanes are created. |
(package private) static LayeredHighlighter.LayerPainter[] |
FIND_RESULTS_PAINTERS
Highlight painter for find results. |
(package private) static int[] |
FIND_RESULTS_PAINTERS_USAGE
How many find result panels are using the highlight painters. |
static String |
INDENT_KEYMAP_NAME
The name of the keymap added to the super class (saved so it can be removed). |
private static int |
INDENT_WARNING_THRESHOLD
|
(package private) Keymap |
ourMap
Our keymap containing key bindings. |
private boolean |
testVariable
|
(package private) static ReverseHighlighter.DrJavaHighlightPainter |
THREAD_PAINTER
Highlight painter for thread's current location. |
| Fields inherited from interface edu.rice.cs.drjava.config.OptionConstants |
accessLevelChoices, ADVANCED_LEVEL, ALLOW_PRIVATE_ACCESS, ALWAYS_COMPILE_BEFORE_JAVADOC, ALWAYS_COMPILE_BEFORE_JUNIT, ALWAYS_SAVE_BEFORE_COMPILE, ALWAYS_SAVE_BEFORE_DEBUG, ALWAYS_SAVE_BEFORE_JAVADOC, ALWAYS_SAVE_BEFORE_RUN, apiJavadocChoices, apiJavadocDeprecated, apiJavadocVersionChoices, apiJavadocVersionDeprecated, AUTO_CLOSE_COMMENTS, AUTO_STEP_RATE, BACKUP_FILES, BOOKMARK_COLOR, BROWSER_FILE, BROWSER_HISTORY_MAX_SIZE, BROWSER_STRING, CLIPBOARD_HISTORY_SIZE, COMPILER_ERROR_COLOR, CONCJUNIT_CHECKS_ENABLED, concJUnitCheckChoices, CUSTOM_DRJAVA_JAR_VERSION_SUFFIX, DEBUG_AUTO_IMPORT, DEBUG_BREAKPOINT_COLOR, DEBUG_BREAKPOINT_DISABLED_COLOR, DEBUG_EXPRESSIONS_AND_METHODS_IN_WATCHES, DEBUG_MESSAGE_COLOR, DEBUG_PANEL_HEIGHT, DEBUG_SOURCEPATH, DEBUG_STEP_DRJAVA, DEBUG_STEP_EXCLUDE, DEBUG_STEP_INTERPRETER, DEBUG_STEP_JAVA, DEBUG_THREAD_COLOR, DEFAULT_COMPILER_PREFERENCE, DEFINITIONS_BACKGROUND_COLOR, DEFINITIONS_COMMENT_COLOR, DEFINITIONS_DOUBLE_QUOTED_COLOR, DEFINITIONS_KEYWORD_COLOR, DEFINITIONS_LINE_NUMBER_BACKGROUND_COLOR, DEFINITIONS_LINE_NUMBER_COLOR, DEFINITIONS_MATCH_COLOR, DEFINITIONS_NORMAL_COLOR, DEFINITIONS_NUMBER_COLOR, DEFINITIONS_SINGLE_QUOTED_COLOR, DEFINITIONS_TYPE_COLOR, DELETE_LL_CLASS_FILES, DELETE_LL_CLASS_FILES_CHOICES, DETACH_DEBUGGER, DETACH_TABBEDPANES, DIALOG_AUTOIMPORT_ENABLED, DIALOG_AUTOIMPORT_STATE, DIALOG_AUTOIMPORT_STORE_POSITION, DIALOG_CLIPBOARD_HISTORY_STATE, DIALOG_CLIPBOARD_HISTORY_STORE_POSITION, DIALOG_COMPLETE_JAVAAPI, DIALOG_COMPLETE_SCAN_CLASS_FILES, DIALOG_COMPLETE_WORD_STATE, DIALOG_COMPLETE_WORD_STORE_POSITION, DIALOG_DEBUGFRAME_STATE, DIALOG_DEBUGFRAME_STORE_POSITION, DIALOG_DRJAVA_ERROR_POPUP_ENABLED, DIALOG_DRJAVA_SURVEY_ENABLED, DIALOG_EDITEXTERNALPROCESS_STATE, DIALOG_EDITEXTERNALPROCESS_STORE_POSITION, DIALOG_EXTERNALPROCESS_STATE, DIALOG_EXTERNALPROCESS_STORE_POSITION, DIALOG_GOTOFILE_FULLY_QUALIFIED, DIALOG_GOTOFILE_STATE, DIALOG_GOTOFILE_STORE_POSITION, DIALOG_JAROPTIONS_STATE, DIALOG_JAROPTIONS_STORE_POSITION, DIALOG_LIGHTWEIGHT_PARSING_DELAY, DIALOG_OPENJAVADOC_STATE, DIALOG_OPENJAVADOC_STORE_POSITION, DIALOG_TABBEDPANES_STATE, DIALOG_TABBEDPANES_STORE_POSITION, DISPLAY_ALL_COMPILER_VERSIONS, DISPLAY_RIGHT_MARGIN, DJ_FILE_EXTENSION, DOC_LIST_WIDTH, DRJAVA_ERRORS_BUTTON_COLOR, DRJAVA_SURVEY_DAYS, DRJAVA_USE_FORCE_QUIT, DYNAMICJAVA_ACCESS_CONTROL, DYNAMICJAVA_ACCESS_CONTROL_CHOICES, DYNAMICJAVA_REQUIRE_SEMICOLON, DYNAMICJAVA_REQUIRE_VARIABLE_TYPE, ELEMENTARY_LEVEL, EXTERNAL_SAVED_CMDLINES, EXTERNAL_SAVED_COUNT, EXTERNAL_SAVED_ENCLOSING_DJAPP_FILES, EXTERNAL_SAVED_NAMES, EXTERNAL_SAVED_PREFIX, EXTERNAL_SAVED_WORKDIRS, EXTPROCESS_FILE_EXTENSION, EXTPROCESS_FILE_NAME_INSIDE_JAR, EXTRA_CLASSPATH, EXTRA_COMPILERS, FILE_EXT_REGISTRATION, FILE_EXT_REGISTRATION_CHOICES, FIND_ALL_DOCUMENTS, FIND_MATCH_CASE, FIND_NO_COMMENTS_STRINGS, FIND_NO_TEST_CASES, FIND_ONLY_SELECTION, FIND_REPLACE_FOCUS_IN_DEFPANE, FIND_RESULTS_COLOR1, FIND_RESULTS_COLOR2, FIND_RESULTS_COLOR3, FIND_RESULTS_COLOR4, FIND_RESULTS_COLOR5, FIND_RESULTS_COLOR6, FIND_RESULTS_COLOR7, FIND_RESULTS_COLOR8, FIND_RESULTS_COLORS, FIND_SEARCH_BACKWARDS, FIND_WHOLE_WORD, FIXED_INTERACTIONS_DIRECTORY, FOLLOW_FILE_DELAY, FOLLOW_FILE_LINES, FONT_DOCLIST, FONT_LINE_NUMBERS, FONT_MAIN, FONT_TOOLBAR, FORCE_TEST_SUFFIX, FULL_JAVA, FUNCTIONAL_JAVA_LEVEL, heapSizeChoices, HISTORY_MAX_SIZE, INDENT_LEVEL, INTERACTIONS_AUTO_IMPORT_CLASSES, INTERACTIONS_ERROR_COLOR, INTERACTIONS_EXIT_PROMPT, INTERACTIONS_RESET_PROMPT, INTERMEDIATE_LEVEL, JAVA_FILE_EXTENSION, JAVAC_LOCATION, JAVADOC_1_3_LINK, JAVADOC_1_3_TEXT, JAVADOC_1_4_LINK, JAVADOC_1_4_TEXT, JAVADOC_1_5_LINK, JAVADOC_1_5_TEXT, JAVADOC_1_6_LINK, JAVADOC_1_6_TEXT, JAVADOC_1_7_LINK, JAVADOC_1_7_TEXT, JAVADOC_ACCESS_LEVEL, JAVADOC_ADDITIONAL_LINKS, JAVADOC_API_REF_VERSION, JAVADOC_AUTO_TEXT, JAVADOC_CUSTOM_PARAMS, JAVADOC_DESTINATION, JAVADOC_FROM_ROOTS, JAVADOC_LINK_VERSION, JAVADOC_NONE_TEXT, JAVADOC_PROMPT_FOR_DESTINATION, JUNIT_LINK, JUNIT_LOCATION, JUNIT_LOCATION_ENABLED, KEY_ABOUT, KEY_AUTO_REFRESH_PROJECT, KEY_BACKWARD, KEY_BACKWARD_SELECT, KEY_BEGIN_DOCUMENT, KEY_BEGIN_DOCUMENT_SELECT, KEY_BEGIN_LINE, KEY_BEGIN_LINE_SELECT, KEY_BOOKMARKS_PANEL, KEY_BOOKMARKS_TOGGLE, KEY_BROWSE_BACK, KEY_BROWSE_FORWARD, KEY_CHECK_NEW_VERSION, KEY_CLEAN_PROJECT, KEY_CLEAR_CONSOLE, KEY_CLEAR_HISTORY, KEY_CLEAR_LINE, KEY_CLOSE_ALL_FILES, KEY_CLOSE_FILE, KEY_CLOSE_PROJECT, KEY_CLOSE_SYSTEM_IN, KEY_CLOSING_BRACE, KEY_COMMENT_LINES, KEY_COMPILE, KEY_COMPILE_ALL, KEY_COMPILE_PROJECT, KEY_COMPLETE_FILE, KEY_COPY, KEY_CUT, KEY_CUT_LINE, KEY_DEBUG_AUTOMATIC_TRACE, KEY_DEBUG_BREAKPOINT_PANEL, KEY_DEBUG_BREAKPOINT_TOGGLE, KEY_DEBUG_CLEAR_ALL_BREAKPOINTS, 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_DETACH_DEBUGGER, KEY_DETACH_TABBEDPANES, KEY_DOWN, KEY_DOWN_SELECT, KEY_DRJAVA_ERRORS, KEY_DRJAVA_SURVEY, KEY_END_DOCUMENT, KEY_END_DOCUMENT_SELECT, KEY_END_LINE, KEY_END_LINE_SELECT, KEY_EXEC_PROCESS, KEY_EXECUTE_HISTORY, KEY_EXPORT_OLD, KEY_FIND_NEXT, KEY_FIND_PREV, KEY_FIND_REPLACE, KEY_FOLLOW_FILE, KEY_FOR_UNIT_TESTS_ONLY, KEY_FORCE_QUIT, KEY_FORWARD, KEY_FORWARD_SELECT, KEY_GENERATE_CUSTOM_DRJAVA, KEY_GOTO_FILE, KEY_GOTO_FILE_UNDER_CURSOR, KEY_GOTO_LINE, KEY_HELP, KEY_JAR_PROJECT, KEY_JAVADOC_ALL, KEY_JAVADOC_CURRENT, KEY_JUNIT_PROJECT, KEY_LIFT_CURRENT_INTERACTION, KEY_LOAD_HISTORY_SCRIPT, KEY_NEW_CLASS_FILE, KEY_NEW_DRJAVA_INSTANCE, KEY_NEW_FILE, KEY_NEW_PROJECT, KEY_NEW_TEST, KEY_NEXT_DOCUMENT, KEY_NEXT_PANE, KEY_NEXT_WORD, KEY_NEXT_WORD_SELECT, KEY_OPEN_FILE, KEY_OPEN_FOLDER, KEY_OPEN_JAVADOC, KEY_OPEN_JAVADOC_UNDER_CURSOR, KEY_OPEN_PROJECT, KEY_OPENING_BRACE, KEY_PAGE_DOWN, KEY_PAGE_SETUP, KEY_PAGE_UP, KEY_PASTE, KEY_PASTE_FROM_HISTORY, KEY_PREFERENCES, KEY_PREVIOUS_DOCUMENT, KEY_PREVIOUS_PANE, KEY_PREVIOUS_WORD, KEY_PREVIOUS_WORD_SELECT, KEY_PRINT, KEY_PRINT_CONSOLE, KEY_PRINT_INTERACTIONS, KEY_PRINT_PREVIEW, KEY_PROJECT_PROPERTIES, KEY_QUICKSTART, KEY_QUIT, KEY_REDO, KEY_RENAME_FILE, KEY_RESET_INTERACTIONS, KEY_REVERT_FILE, KEY_RUN, KEY_RUN_APPLET, KEY_RUN_PROJECT, KEY_SAVE_ALL_FILES, KEY_SAVE_AS_PROJECT, KEY_SAVE_CONSOLE_COPY, KEY_SAVE_FILE, KEY_SAVE_FILE_AS, KEY_SAVE_FILE_COPY, KEY_SAVE_HISTORY, KEY_SAVE_INTERACTIONS_COPY, KEY_SAVE_PROJECT, KEY_SELECT_ALL, KEY_SHIFT_DELETE_NEXT, KEY_SHIFT_DELETE_PREVIOUS, KEY_TABBED_NEXT_REGION, KEY_TABBED_PREV_REGION, KEY_TEST, KEY_TEST_ALL, KEY_UNCOMMENT_LINES, KEY_UNDO, KEY_UP, KEY_UP_SELECT, KEY_VIEW_INTERACTIONS_CLASSPATH, LANGUAGE_LEVEL, LANGUAGE_LEVEL_EXTENSIONS, LAST_DIRECTORY, LAST_DRJAVA_SURVEY, LAST_DRJAVA_SURVEY_RESULT, LAST_INTERACTIONS_DIRECTORY, LAST_NEW_VERSION_NOTIFICATION, LIGHTWEIGHT_PARSING_ENABLED, LINEENUM_ENABLED, linkChoices, linkDeprecated, linkVersionChoices, linkVersionDeprecated, LOOK_AND_FEEL, MASK, MASTER_JVM_ARGS, MASTER_JVM_XMX, NEW_VERSION_ALLOWED, NEW_VERSION_NOTIFICATION, NEW_VERSION_NOTIFICATION_CHOICES, NEW_VERSION_NOTIFICATION_DAYS, OLD_DJ0_FILE_EXTENSION, OLD_DJ1_FILE_EXTENSION, OLD_DJ2_FILE_EXTENSION, OLD_PROJECT_FILE_EXTENSION, OPEN_FOLDER_RECURSIVE, PLASTIC_THEMES, PROJECT_FILE_EXTENSION, PROJECT_FILE_EXTENSION2, PROMPT_BEFORE_CLEAN, PROMPT_RENAME_LL_FILES, QUIT_PROMPT, RECENT_FILES, RECENT_FILES_MAX_SIZE, RECENT_PROJECTS, REMOTE_CONTROL_ENABLED, REMOTE_CONTROL_PORT, RESET_CLEAR_CONSOLE, RIGHT_MARGIN_COLOR, RIGHT_MARGIN_COLUMNS, RT_CONCJUNIT_LOCATION, RUN_WITH_ASSERT, SHOW_CODE_PREVIEW_POPUPS, SHOW_DEBUG_CONSOLE, SHOW_DEPRECATION_WARNINGS, SHOW_FALLTHROUGH_WARNINGS, SHOW_FINALLY_WARNINGS, SHOW_PATH_WARNINGS, SHOW_SERIAL_WARNINGS, SHOW_SOURCE_WHEN_SWITCHING, SHOW_UNCHECKED_WARNINGS, SLAVE_JVM_ARGS, SLAVE_JVM_XMX, SMART_RUN_FOR_APPLETS_AND_PROGRAMS, STICKY_INTERACTIONS_DIRECTORY, SYSTEM_ERR_COLOR, SYSTEM_IN_COLOR, SYSTEM_OUT_COLOR, TABS_HEIGHT, TEXT_ANTIALIAS, TEXT_FILE_EXTENSION, TOOLBAR_ENABLED, TOOLBAR_ICONS_ENABLED, TOOLBAR_TEXT_ENABLED, WARN_BREAKPOINT_OUT_OF_SYNC, WARN_CHANGE_DCP, WARN_CHANGE_INTERACTIONS, WARN_CHANGE_LAF, WARN_CHANGE_MISC, WARN_CHANGE_THEME, WARN_DEBUG_MODIFIED_FILE, WARN_IF_COMPIZ, WARN_PATH_CONTAINS_POUND, WINDOW_HEIGHT, WINDOW_STATE, WINDOW_STORE_POSITION, WINDOW_WIDTH, WINDOW_X, WINDOW_Y |
|
Method Summary |
private void |
_commentLines()
Comments out the lines contained within the given selection. |
private String |
_matchText(int braceIndex)
|
private void |
_resetUndo()
Reset the document Undo list. |
private void |
_uncommentLines()
Uncomments the lines contained within the given selection. |
void |
addBreakpointHighlight(Breakpoint bp)
|
void |
addErrorCaretListener(ErrorCaretListener eListener)
Add a ErrorCaretListener to this pane, keeping it accessible so its error model can be updated later. |
void |
addErrorHighlight(int from,
int to)
Switches the location of the error highlight in the document if there was one. |
void |
addFinalizationListener(FinalizationListener<DefinitionsPane> fl)
Registers a finalization listener with the specific instance of the ddoc. |
void |
centerViewOnLine(int lineNumber)
|
void |
centerViewOnOffset(int offset)
Centers the view (pane) on the specified offset. |
boolean |
checkAltKey()
|
void |
close()
Called when the definitions pane is released from duty. |
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. |
void |
endCompoundEdit()
Ends a compound edit. |
protected void |
finalize()
This method is called when this object becomes unreachable. |
int |
getCurrentCol()
|
int |
getCurrentLine()
Returns the current line of the definitions pane. |
int |
getCurrentLinefromDoc()
Determines current line using logic in DefinitionsDocument. |
DJDocument |
getDJDocument()
Get the DJDocument (OpenDefinitionsDocument) contained in this pane. |
ErrorCaretListener |
getErrorCaretListener()
Gets the ErrorCaretListener for this pane. |
List<FinalizationListener<DefinitionsPane>> |
getFinalizationListeners()
|
HighlightManager |
getHighlightManager()
Access to the pane's HighlightManager |
int |
getHorizontalScroll()
|
OpenDefinitionsDocument |
getOpenDefDocument()
Get the OpenDefinitionsDocument contained in this DefinitionsPane. |
DefinitionsPane.RedoAction |
getRedoAction()
|
int |
getSelectionEnd()
|
int |
getSelectionStart()
|
DefinitionsPane.UndoAction |
getUndoAction()
|
int |
getVerticalScroll()
|
boolean |
hasWarnedAboutModified()
|
void |
hasWarnedAboutModified(boolean hasWarned)
|
protected void |
indentLines(int selStart,
int selEnd,
Indenter.IndentReason reason,
ProgressMonitor pm)
Indent the given selection, for the given reason, in the current document. |
protected void |
matchUpdate(int offset,
boolean opening)
Updates match highlights. |
void |
notifyActive()
This function is called when switching a pane to be the active document pane. |
void |
notifyInactive()
This function is called when the active document is changed. |
protected void |
paintComponent(Graphics g)
Enable anti-aliased text by overriding paintComponent. |
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 compiler error highlight from the document after the cursor has moved. |
void |
resetUndo()
Reset the document Undo list. |
void |
select(int selectionStart,
int selectionEnd)
This method overrides a broken version in JTextComponent. |
void |
setDocument(Document d)
Override JEditorPane's setDocument to make sure only the Document in our final OpenDefinitionsDocument
can be used. |
static void |
setEditorKit(DefinitionsEditorKit editorKit)
Sets the editor kit that will be used by all DefinitionsPanes. |
void |
setPositionAndScroll(int pos)
Set the caret position and also scroll to make sure the location is visible. |
void |
setScrollPane(JScrollPane s)
|
void |
setSize(int width,
int height)
|
protected boolean |
shouldIndent(int selStart,
int selEnd)
Prompts the user whether or not they wish to indent, if the selection size is very large. |
void |
updateCurrentLocationInDoc()
Updates the current location stored in the document by setting it to the caret position. |
static void |
updateMaxCharWidth(FontMetrics metrics)
Update the maximum character width of the current font. |
protected void |
updateStatusField()
Updates status fields in the main frame (title bar, selected file name) when document is modified. |
| Methods inherited from class edu.rice.cs.drjava.ui.AbstractDJPane |
_addHighlight, _removePreviousHighlight, disableAltCntlMetaChars, dragEnter, dragExit, dragOver, drop, dropActionChanged, getScrollableUnitIncrement, indent, indent, setCaretPos |
| Methods inherited from class javax.swing.JTextPane |
addStyle, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getStyledEditorKit, getUIClassID, insertComponent, insertIcon, paramString, removeStyle, replaceSelection, setCharacterAttributes, setEditorKit, setLogicalStyle, setParagraphAttributes, setStyledDocument |
| Methods inherited from class javax.swing.JEditorPane |
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getStream, getText, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKitForContentType, setPage, setPage, setText |
| Methods inherited from class javax.swing.text.JTextComponent |
addCaretListener, addInputMethodListener, addKeymap, copy, cut, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getHighlighter, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getScrollableBlockIncrement, getSelectedText, getSelectedTextColor, getSelectionColor, getText, getToolTipText, getUI, isEditable, loadKeymap, modelToView, moveCaretPosition, paste, print, print, print, processInputMethodEvent, read, removeCaretListener, removeKeymap, removeNotify, selectAll, setCaret, setCaretColor, setCaretPosition, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setEditable, setFocusAccelerator, setHighlighter, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, updateUI, viewToModel, write |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
EDITOR_KIT
private static volatile DefinitionsEditorKit EDITOR_KIT
- This field NEEDS to be set by setEditorKit() BEFORE any DefinitonsPanes are created.
INDENT_WARNING_THRESHOLD
private static final int INDENT_WARNING_THRESHOLD
- See Also:
- Constant Field Values
_mainFrame
private final MainFrame _mainFrame
- Our parent window.
_doc
private final OpenDefinitionsDocument _doc
- Our corresponding ODD
_undoAction
private volatile DefinitionsPane.UndoAction _undoAction
_redoAction
private volatile DefinitionsPane.RedoAction _redoAction
testVariable
private volatile boolean testVariable
_hasWarnedAboutModified
private volatile 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.
_isDeleteCompoundEdit
private volatile boolean _isDeleteCompoundEdit
_isCtrlShiftBracketDown
private volatile boolean _isCtrlShiftBracketDown
_antiAliasText
private volatile boolean _antiAliasText
- Whether to draw text as antialiased.
_displayRightMargin
private volatile boolean _displayRightMargin
- Whether to display the right margin.
_numRightMarginColumns
private volatile int _numRightMarginColumns
- After how many columns to display the right margin.
_maxCharWidth
private static volatile int _maxCharWidth
- Maximum character width of the current main font.
_rightMarginColor
private volatile Color _rightMarginColor
- Color of the right margin.
_errorHighlightTag
private volatile HighlightManager.HighlightInfo _errorHighlightTag
- Our current compiler error matching highlight.
BOOKMARK_PAINTER
static volatile ReverseHighlighter.DefaultUnderlineHighlightPainter BOOKMARK_PAINTER
- Highlight painter for bookmarks.
FIND_RESULTS_PAINTERS
static volatile LayeredHighlighter.LayerPainter[] FIND_RESULTS_PAINTERS
- Highlight painter for find results.
Keep in mind that, while the array is volatile, the elements inside of it are not!
FIND_RESULTS_PAINTERS_USAGE
static volatile int[] FIND_RESULTS_PAINTERS_USAGE
- How many find result panels are using the highlight painters.
Keep in mind that, while the array is volatile, the elements inside of it are not!
BREAKPOINT_PAINTER
static volatile ReverseHighlighter.DrJavaHighlightPainter BREAKPOINT_PAINTER
- Highlight painter for breakpoints.
DISABLED_BREAKPOINT_PAINTER
static volatile ReverseHighlighter.DrJavaHighlightPainter DISABLED_BREAKPOINT_PAINTER
- Highlight painter for disabled breakpoints.
THREAD_PAINTER
static volatile ReverseHighlighter.DrJavaHighlightPainter THREAD_PAINTER
- Highlight painter for thread's current location.
INDENT_KEYMAP_NAME
public static final String INDENT_KEYMAP_NAME
- The name of the keymap added to the super class (saved so it can be removed).
- See Also:
- Constant Field Values
_undoListener
private final UndoableEditListener _undoListener
- Listens to any undoable events in the document, and adds them to the undo manager. Must be done in the view
because the edits are stored along with the caret position at the time of the edit. Correction: document
cursor position should be used instead of caret position. Perhaps this listener should be attached to the
document.
_popMenu
private volatile JPopupMenu _popMenu
- The contextual popup menu for the Definitions Pane.
_popupMenuMA
private volatile DefinitionsPane.PopupMenuMouseAdapter _popupMenuMA
- The mouse adapter for handling a popup menu.
_errorListener
private volatile ErrorCaretListener _errorListener
- Listens to caret to highlight errors as appropriate.
_setSizeListener
private volatile ActionListener _setSizeListener
_indentKeyActionTab
private final Action _indentKeyActionTab
- Special action to take care of case when tab key is pressed.
_indentKeyActionLine
private final 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.
_indentKeyActionCurly
private final Action _indentKeyActionCurly
- 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.
_indentKeyActionOpenCurly
private final Action _indentKeyActionOpenCurly
_indentKeyActionColon
private final Action _indentKeyActionColon
_inCompoundEdit
public volatile boolean _inCompoundEdit
- Tells us whether we currently are in the middle of a CompoundEdit for regular keystrokes.
Helps us with granular undo.
_compoundEditKey
private volatile int _compoundEditKey
ourMap
final Keymap ourMap
- Our keymap containing key bindings. Takes precedence over the default map.
_scrollPane
private volatile JScrollPane _scrollPane
- This instance of the scroll pane is here in order to allow for the definitions pane to save the
horizontal and vertical scroll
_savedVScroll
private volatile int _savedVScroll
- Used to save the caret position, selection, and scroll when setting the definitions pane to be inactive
_savedHScroll
private volatile int _savedHScroll
_position
private volatile int _position
_selStart
private volatile int _selStart
_selEnd
private volatile int _selEnd
_colorOptionListeners
private final List<Pair<Option<Color>,OptionListener<Color>>> _colorOptionListeners
- Saved option listeners kept in this field so they can be removed for garbage collection. The bindings
of these variables to Lists are immuatable, but the internals of the data structures are mutated.
_booleanOptionListeners
private final List<Pair<Option<Boolean>,OptionListener<Boolean>>> _booleanOptionListeners
_integerOptionListeners
private final List<Pair<Option<Integer>,OptionListener<Integer>>> _integerOptionListeners
_finalizationListeners
private final List<FinalizationListener<DefinitionsPane>> _finalizationListeners
- This list of listeners to notify when we are finalized
DefinitionsPane
public DefinitionsPane(MainFrame mf,
OpenDefinitionsDocument doc)
- Standard Constructor. Sets up all the defaults.
- Parameters:
mf - the parent window
matchUpdate
protected void matchUpdate(int offset,
boolean opening)
- Updates match highlights. Only runs in the event thread.
- Specified by:
matchUpdate in class AbstractDJPane
- Parameters:
offset - caret position immediately following some form of brace; hence offset > 0.opening - true if the the preceding brace is "opening"
updateStatusField
protected void updateStatusField()
- Updates status fields in the main frame (title bar, selected file name) when document is modified.
- Specified by:
updateStatusField in class AbstractDJPane
_matchText
private String _matchText(int braceIndex)
updateCurrentLocationInDoc
public void updateCurrentLocationInDoc()
- Updates the current location stored in the document by setting it to the caret position.
endCompoundEdit
public void endCompoundEdit()
- Ends a compound edit.
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 JComponent
setEditorKit
public static void setEditorKit(DefinitionsEditorKit editorKit)
- Sets the editor kit that will be used by all DefinitionsPanes.
- Parameters:
editorKit - The editor kit to use for new DefinitionsPanes.
updateMaxCharWidth
public static void updateMaxCharWidth(FontMetrics metrics)
- Update the maximum character width of the current font. We can make this static, because DrJava
only supports one font for all panes anyway.
paintComponent
protected void paintComponent(Graphics g)
- Enable anti-aliased text by overriding paintComponent.
- Overrides:
paintComponent in class JComponent
createPopupMenu
private void createPopupMenu()
- Creates the popup menu for the DefinitionsPane.
_commentLines
private void _commentLines()
- Comments out the lines contained within the given selection.
_uncommentLines
private void _uncommentLines()
- Uncomments the lines contained within the given selection.
getUndoAction
public DefinitionsPane.UndoAction getUndoAction()
- Returns:
- the undo action.
getRedoAction
public DefinitionsPane.RedoAction getRedoAction()
- Returns:
- the redo action.
getOpenDefDocument
public OpenDefinitionsDocument getOpenDefDocument()
- Get the OpenDefinitionsDocument contained in this DefinitionsPane.
getDJDocument
public DJDocument getDJDocument()
- Get the DJDocument (OpenDefinitionsDocument) contained in this pane.
Required by the super class AbstractDJPane.
- Specified by:
getDJDocument in class AbstractDJPane
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. Should only run in the event
thread.
- Parameters:
pos - Location to scroll to.
setDocument
public void setDocument(Document d)
- Override JEditorPane's setDocument to make sure only the Document in our final OpenDefinitionsDocument
can be used.
- Overrides:
setDocument in class JTextPane
checkAltKey
public boolean checkAltKey()
addErrorCaretListener
public void addErrorCaretListener(ErrorCaretListener eListener)
- Add a ErrorCaretListener to this pane, keeping it accessible so its error model can be updated later.
getErrorCaretListener
public ErrorCaretListener getErrorCaretListener()
- Gets the ErrorCaretListener for this pane.
addErrorHighlight
public void addErrorHighlight(int from,
int to)
- Switches the location of the error highlight in the document if there was one. Otherwise adds the
highlight. The invariant is that there are zero or one error highlights at any time.
removeErrorHighlight
public void removeErrorHighlight()
- Removes the previous compiler 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)
setScrollPane
public void setScrollPane(JScrollPane s)
notifyInactive
public void notifyInactive()
- This function is called when the active document is changed. this function is called on the pane that is
replaced by the new active pane. It allows the pane to "shutdown" when not in use. Currently, this procedure
replaces the Definitions Document with a blank dummy document to help conserve memory (so that the pane will
not be holding onto the last reference of a definitions document not allowing it to be garbage collected)
notifyActive
public void notifyActive()
- This function is called when switching a pane to be the active document pane. It allows the pane to do whatever
"startUp" is required. Since setInactive swapped out the document for a dummy document, we need to reload the
actual document and reset its caret position to the saved location. Only runs in event thread.
getSelectionStart
public int getSelectionStart()
- Overrides:
getSelectionStart in class JTextComponent
getSelectionEnd
public int getSelectionEnd()
- Overrides:
getSelectionEnd in class JTextComponent
getVerticalScroll
public int getVerticalScroll()
getHorizontalScroll
public int getHorizontalScroll()
getCurrentLine
public int getCurrentLine()
- Returns the current line of the definitions pane. This is a 1-based number.
- Returns:
- current line of the definitions pane, >=1
getCurrentLinefromDoc
public int getCurrentLinefromDoc()
- Determines current line using logic in DefinitionsDocument. Does it differ from getCurrentLine()?
getCurrentCol
public int getCurrentCol()
setSize
public void setSize(int width,
int height)
- Overrides:
setSize in class Component
centerViewOnOffset
public void centerViewOnOffset(int offset)
- Centers the view (pane) on the specified offset.
centerViewOnLine
public void centerViewOnLine(int lineNumber)
select
public void select(int selectionStart,
int selectionEnd)
- This method overrides a broken version in JTextComponent. It allows selection to proceed backwards as well as
forwards. If selection is backwards, then the caret ends up at the start of the selection rather than the end.
- Overrides:
select in class JTextComponent
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 JTextPane
shouldIndent
protected boolean shouldIndent(int selStart,
int selEnd)
- Prompts the user whether or not they wish to indent, if the selection size is very large.
- Specified by:
shouldIndent in class AbstractDJPane
- Parameters:
selStart - - the selection startselEnd - - the selection end
- Returns:
- true if the indent is to be completed
indentLines
protected void indentLines(int selStart,
int selEnd,
Indenter.IndentReason reason,
ProgressMonitor pm)
- Indent the given selection, for the given reason, in the current document.
- Specified by:
indentLines in class AbstractDJPane
- Parameters:
selStart - - the selection startselEnd - - the selection endreason - - the reason for the indentpm - - the ProgressMonitor used by the indenter
close
public void close()
- Called when the definitions pane is released from duty. This frees up any option listeners that are holding
references to this object so this can be garbage collected.
addFinalizationListener
public void addFinalizationListener(FinalizationListener<DefinitionsPane> fl)
- Registers a finalization listener with the specific instance of the ddoc. NOTE: this should only be used by test
cases. This policy ensures that we don't spring memory leaks by allowing our unit tests to keep track of
whether objects are being finalized (garbage collected).
- Specified by:
addFinalizationListener in interface Finalizable<DefinitionsPane>
- Parameters:
fl - the listener to register
getFinalizationListeners
public List<FinalizationListener<DefinitionsPane>> getFinalizationListeners()
- Specified by:
getFinalizationListeners in interface Finalizable<DefinitionsPane>
- Returns:
- the list of registered FinalizationListeners
finalize
protected void finalize()
- This method is called when this object becomes unreachable. Since this class implements
edu.rice.cs.drjava.model.Finalizable, it must notify its listeners.
- Overrides:
finalize in class Object