Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

oracle.javatools.editor
Class BasicEditorPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.text.JTextComponent
                  extended by javax.swing.JEditorPane
                      extended by oracle.javatools.editor.BasicEditorPane
All Implemented Interfaces:
java.awt.dnd.Autoscroll, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.Scrollable, ActionInvoker

public class BasicEditorPane
extends javax.swing.JEditorPane
implements ActionInvoker, java.awt.dnd.Autoscroll, java.beans.PropertyChangeListener

A BasicEditorPane is an extension of the JEditorPane to provide more flexible syntax and background highlighting functionality at a reduced memory and performance footprint. It can be used anywhere a JEditorPane instance can be used. Clients are strongly encouraged to call dispose() when the the editor pane is no longer needed, but this is not an absolute requirement. This allows us to clean up as well as notify editor plugins that the editor is no longer being used.

Undo Support:

The editor framework provides some support for naming edits, grouping together similar edits, and undo of navigation. When making a change to the document using insertString() or remove(), or through the editor using replaceSelection(), cut(), or paste(), you can specify a name for the edit by creating an EditDescriptor for the edit, and passing it to BasicEditorPane.beginEdit(EditDescriptor). Additionally, you can use it for grouping together a group of edits as a single undoable unit by placing your edits between a call to BasicEditorPane.beginEdit(EditDescriptor) and BasicEditorPane.endEdit(EditDescriptor).

The edit name which you specify through the EditDescriptor is made available through the UndoableEdit using getPresentationName(). This allows you to name your edits like "Add Button", or "Add Field" so that it better describes the edit operation the Undo or Redo applies to.

Built-in actions have pre-defined names used for the EditDescriptor already. Additionally, the editor provides automatic support for merging simple edits. Currently, the simple edit consists of a key-typed insert (insert mode), a key-typed replace (overwrite mode), delete next (Delete key), or delete previous (Backspace key). These simple edits may be merged with other consecutive simple edits of the same type. That means two inserts in a row will be automatically merged if merging for key-typed inserts is enabled, and the merge count allowed is set to greater than two. Look in EditorProperties for the properties to set to enable merging of simple edits, and for setting the merge count.

The editor also provides support for undoing navigation (without associated document changes) using beginNavigation() and endNavigation(). Client code which causes a navigation in the editor (such as "Go to Line", or "Find") should always wrap their navigation commands with calls to beginNavigation() and endNavigation. The current default for the editor is to generate undo events for navigation, though this can be disabled with the appropriate property in EditorProperties. If the editor is set to not generate undos for navigation, the beginNavigation() and endNavigation() will just be NOP calls.

As with the Swing text framework, the UndoableEditListener should be attached to the document (BasicDocument). Undo edits (including navigation) will be delivered through the document. Highlight Support:

For highlight and underline support, refer to the documentation for the HighlightLayer class.

Tooltip Support:

For tooltip support, refer to the documentation for the TooltipProvider interface.

Popup Support:

For popup (context) menu support, refer to the documentation for the PopupManager interface.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JEditorPane
javax.swing.JEditorPane.AccessibleJEditorPane, javax.swing.JEditorPane.AccessibleJEditorPaneHTML, javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport
 
Nested classes/interfaces inherited from class javax.swing.text.JTextComponent
javax.swing.text.JTextComponent.AccessibleJTextComponent, javax.swing.text.JTextComponent.DropLocation, javax.swing.text.JTextComponent.KeyBinding
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class javax.swing.JEditorPane
HONOR_DISPLAY_PROPERTIES, W3C_LENGTH_UNITS
 
Fields inherited from class javax.swing.text.JTextComponent
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
BasicEditorPane()
          Creates a new instance of a BasicEditorPane.
 
Method Summary
 void addActionHookInvoker(ActionHookInvoker invoker)
          Adds an ActionHookInvoker to the list so that it has a chance to override the default action temporarily.
 void addActionPostInvoker(ActionPostInvoker invoker)
          Adds an ActionPostInvoker to the list so that it gets notified of successfully completed actions just after the fact.
 void addCharacterTypedListener(CharacterTypedListener listener)
          Adds a character typed listener to the list so that it can receive notifications of characters typed into this editor pane.
 void addFeedbackManager(FeedbackManager manager)
          Installs the given FeedbackManager for displaying feedback messages to the user for this editor pane.
 void addNavigationListener(NavigationListener navigationListener)
          Add a listener for navigation events.
 void addPopupManager(PopupManager manager)
          Installs the given PopupManager for managing popup menus for this editor pane.
 void addPreActionInvoker(ActionPreInvoker invoker, double weight)
          Adds an actionInvoker that will be called before anyone else.
The ActionInvoker will be invoked for any action, including actions that would normally be handled by the IDE.
 void addToolTipProvider(ToolTipProvider provider)
          Installs the given ToolTipProvider for providing tooltips for the editor pane.
 void autoscroll(java.awt.Point location)
          Notify the Component to autoscroll.
 void beginEdit(EditDescriptor editDescriptor)
          Marks the start of an Undoable edit applied through this editor.
 void beginFormatEdit(EditDescriptor editDescriptor)
          This is a special form of beginEdit without calling beginEdit in realTextBuffer
 void beginNavigation()
          Marks the start of a navigation through this editor.
 boolean canCopy()
          Fetches whether a copy operation can be performed by calling copy().
 boolean canCut()
          Fetches whether a cut operation can be performed by calling cut().
 boolean canPaste()
          Fetches whether the paste operation can be performed by calling paste().
 void copy()
           
protected  javax.swing.text.EditorKit createDefaultEditorKit()
          Creates the default editor kit for when the component is first created.
 HighlightLayer createHighlightLayer()
          Creates a new highlight layer that can be used for highlighting text in this editor pane.
 javax.swing.JToolTip createToolTip()
          Overriden to provide a MultiLineToolTip by default.
 void cut()
           
protected  void deinstallAllPlugins()
          Utility routine to deinstall all plugins.
protected  void deinstallKeyboardSupport()
          Support routine to deinitialize the keyboard support for this editor pane instance.
 void deinstallPlugin(EditorPlugin plugin)
          This deinstalls an editor plugin from the editor.
 void destroyHighlightLayer(HighlightLayer layer)
          Destroys a highlight layer that is no longer needed.
 void dispose()
          Instructs this editor pane that it is no longer needed, and that it can clear up resources and references.
 void duplicateSelection()
          Copies the selected text amd places the copy immediately after he original selection.
 void endEdit()
          Marks the end of an Undoable edit applied through this editor.
 void endEdit(boolean mergeIntoPrevious)
          Marks the end of an Undoable edit applied through this editor.
 void endEdit(boolean mergeIntoPrevious, javax.swing.undo.UndoableEdit wrappedEdit)
          Marks the end of an Undoable edit applied through this editor.
 void endFormatEdit(boolean mergeIntoPrevious, javax.swing.undo.UndoableEdit formattedEdit)
          This is a special endEdit without calling endEdit in realTextBuffer.
 void endNavigation()
          Marks the end of a navigation through this editor.
 void ensureCaretVisible()
          Recenters the parent viewport vertically and horizontally around the caret, if the caret position is offscreen.
 void ensurePositionVisible(int position)
          Recenters the parent viewport vertically and horizontally around the specified position, if the position is offscreen.
protected  void ensureVisibleAndCentered(int location)
           
protected  void ensureVisibleAndCentered(java.awt.Rectangle positionRect)
          Utility routine to ensure that the given position is visible vertically and horizontally.
protected  void ensureVisibleAndCentered(java.awt.Rectangle positionRect, boolean force)
          Utility routine to ensure that the given position is visible vertically and horizontally.
protected  void finalize()
          Finalizer to clean up the editor in case it was not disposed of properly.
protected  void fireCharacterTypedEvent(int offset, char charTyped)
          Utility routine used to notify listeners that a character was typed.
protected  void fireNavigationEvent(int offset)
          Inform listeners that the caret has moved in response to an external event.
 ActionInvoker getActionInvoker()
          Fetches the action invoker to use to execute some particular action.
 java.awt.Insets getAutoscrollInsets()
          This method returns the Insets describing the autoscrolling region or border relative to the geometry of the implementing Component.
 boolean getBooleanProperty(java.lang.String key)
          Fetch the boolean property stored by the given key.
 FeedbackManager getFeedbackManager()
          Fetches the current installed FeedbackManager.
 FontHelper getFontHelper()
          Convenience method for getting the current font helper.
 javax.swing.text.Highlighter getHighlighter()
          Fetches the object responsible for making highlights.
protected  java.util.Iterator getHighlightLayers()
          Fetches an iterator to access the highlight layers associated with this editor pane.
 HighlightRegistry getHighlightRegistry()
          Fetch the global highlight registry used for all editor panes.
 int getIntegerProperty(java.lang.String key)
          Fetch the integer property stored by the given key.
 int getLineCount()
          Fetches the number of lines in this TextBuffer.
 int getLineEndOffset(int line)
          Given a specified line, returns the offset from the beginning of a TextBuffer that the line ends at.
 int getLineFromOffset(int offset)
          Given an offset from the beginning of the underlying TextBuffer, fetches the line number containing that offset using a Forward bias.
 int getLineFromRow(int row)
          Fetch the first line that occurs on this row, taking in to account folded blocks.
 int getLineStartOffset(int line)
          Given a specified line, returns the offset from the beginning of the TextBuffer for the start of the line.
 PopupManager getPopupManager()
          Fetches the current installed PopupManager.
 java.lang.Object getProperty(java.lang.String key)
          Get the property associated with the given key.
 int getRowForLine(int line)
          Return the row that the given line appears on.
 int getScrollableBlockIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
          Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation.
 int getScrollableUnitIncrement(java.awt.Rectangle visibleRect, int orientation, int direction)
          Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation.
 java.lang.String getSelectedText()
           
 StyleRegistry getStyleRegistry()
          Fetch the global style registry used for all editor panes.
 ToolTipProvider getToolTipProvider()
          Fetches the current installed ToolTipProvider.
 java.lang.String getToolTipText()
          Returns the tooltip string that has been set with setToolTipText().
 java.lang.String getToolTipText(java.awt.event.MouseEvent event)
          Returns the string to be used as the tooltip for event.
 int getValidOffsetEnd()
           
 int getValidOffsetStart()
           
 boolean hasSelection()
          Fetches whether there is currently a selection in the editor.
 void insertString(int offs, java.lang.String str, javax.swing.text.AttributeSet a)
          Insert the given string into the document at the given offset.
protected  void installBuiltInPlugins()
          Utility routine to install known, built-in plugins.
protected  void installKeyboardSupport()
          Support routine to initialize the keyboard support for this editor pane instance.
 void installPlugin(EditorPlugin plugin)
          This installs an editor plugin into the editor.
 void invokeAction(java.lang.String actionKey)
          Invokes the Action corresponding to the given actionKey.
protected  boolean isCutCopyLineEnabled()
          Checks whether Cut/Copy on current line with no selection is enabled.
 boolean isProtected()
          Fetches whether the editor's content is protected or not - this may be used by clients to indicate that the document is some sort of protected content, and that changes cannot be made directly through the editor, but through other wizards or dialogs instead.
 boolean isUndoInProgress()
          Fetches whether the editor is in the middle of having an undo/redo applied to it.
 boolean isValidClipboardContent()
          Checks if the current content of the clipboard can be pasted into the editor.
 boolean makeEditable()
          Attempts to makes the document editable through consumers registered as VetoableChangeListeners.
 void mergeReplaceSelection(java.lang.String content)
          Like replaceSelection(String content), except it mergres this edit to the previous edit.
 void moveCaretPosition(int position)
          Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called.
 void moveCaretPositionCenter(int position)
          Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called.
 void paste()
           
protected  void pasteFromClipboard(java.awt.Toolkit toolkit, java.awt.datatransfer.Clipboard clipboard)
          Utility routine to perform a paste operation from the given clipboard.
 boolean preInvokeAction(java.lang.String actionKey)
          Invoke the pre-actionInvokers for an action.
protected  void processInputMethodEvent(java.awt.event.InputMethodEvent e)
           
 void propertyChange(java.beans.PropertyChangeEvent event)
          This method gets called when a bound property is changed.
 void putBooleanProperty(java.lang.String key, boolean value)
          Sets the boolean property and value in the property table.
 void putIntegerProperty(java.lang.String key, int value)
          Sets the integer property and value in the property table.
 void putProperty(java.lang.String key, java.lang.Object value)
          Store the property associated with the given key.
 void remove(int offs, int len)
          Remove the given section from the document.
 void removeActionHookInvoker(ActionHookInvoker invoker)
          Removes an ActionHookInvoker from our list.
 void removeActionPostInvoker(ActionPostInvoker invoker)
          Removes an ActionPostInvoker from our list.
 void removeCharacterTypedListener(CharacterTypedListener listener)
          Removes a character typed listener from the list so that it no longer receives notifications.
 void removeFeedbackManager(FeedbackManager manager)
          Deinstalls the given FeedbackManager that was previously installed for handling feedback messages for this editor pane.
 void removeNavigationListener(NavigationListener navigationListener)
           
 void removePopupManager(PopupManager manager)
          Deinstalls the given PopupManager that was previously installed for managing popup menus for the editor pane.
 void removePreActionInvoker(ActionPreInvoker invoker, double weight)
          Remove a pre-actionInvoker.
 void removeToolTipProvider(ToolTipProvider provider)
          Deinstalls the given ToolTipProvider that was previously installed for getting tooltip info for the editor pane.
 void replaceSelection(java.lang.String content)
          Replaces the currently selected content with the new content represented by the given String.
 void select(int selectionStart, int selectionEnd)
          Selects the text found between the specified start and end locations.
 void selectAll()
          Selects all the text in the TextComponent.
 void setBaseFont(java.lang.String fontFamily, int fontSize)
          Set the base font of this editor pane independently from the global base font.
 void setCaretPosition(int position)
          Sets the position of the text insertion caret for the TextComponent.
 void setCaretPosition(int position, boolean isNavigation)
          Sets the position of the text insertion caret for the TextComponent.
 void setCaretPositionCenter(int position)
          Sets the position of the text insertion caret for the TextComponent.
protected  void setClipboardContents(java.lang.String contentText)
          Utility routine to set the contents of the given text into the clipboard.
 void setDocument(javax.swing.text.Document doc)
          Associates the editor with the text document.
 void setEditable(boolean editable)
          Sets the specified boolean to indicate whether or not this TextComponent should be editable.
 void setFont(java.awt.Font font)
          We override the setFont implementation, as the font handling in the editor framework is different.
 void setHighlighter(javax.swing.text.Highlighter h)
          Sets the highlighter to be used.
 void setHighlightRegistry(HighlightRegistry registry)
          Replace the global highlight registry used for all editor panes.
 void setLanguageSupport(java.lang.String fileName)
          Sets the LanguageSupport for editing the type of content indicated by the specified filename.
 void setProtected(boolean makeProtected)
          Sets the editor in protected mode or not.
 void setStyleRegistry(StyleRegistry registry)
          Replace the global style registry used for all editor panes.
 void setText(java.lang.String text)
          Sets the text of this TextComponent to the specified content.
 void setToolTipText(java.lang.String text)
          Registers the text to display in a tool tip.
 void setValidOffsetBounds(int startOffset, int endOffset)
          Set the bounds between which user editing and caret navigation is permitted.
 void unselect()
          Unselects the current text selection (if any), but leaves the caret where it is.
protected  void updateColors()
          Utility routine to update our Swing color stuff.
 void updateUI()
          Reloads the pluggable UI.
protected  boolean useDefaultKeyHandling()
          Fetches whether the default use of the multi-key handler should be used.
protected  void validateVisibleRect(java.awt.Rectangle visibleRect)
          Utility method to ensure that the visible rectangle does not go beyond the edges of the editor view.
 
Methods inherited from class javax.swing.JEditorPane
addHyperlinkListener, createEditorKitForContentType, fireHyperlinkUpdate, getAccessibleContext, getContentType, getEditorKit, getEditorKitClassNameForContentType, getEditorKitForContentType, getHyperlinkListeners, getPage, getPreferredSize, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getStream, getText, getUIClassID, paramString, read, registerEditorKitForContentType, registerEditorKitForContentType, removeHyperlinkListener, scrollToReference, setContentType, setEditorKit, setEditorKitForContentType, setPage, setPage
 
Methods inherited from class javax.swing.text.JTextComponent
addCaretListener, addInputMethodListener, addKeymap, fireCaretUpdate, getActions, getCaret, getCaretColor, getCaretListeners, getCaretPosition, getDisabledTextColor, getDocument, getDragEnabled, getDropLocation, getDropMode, getFocusAccelerator, getInputMethodRequests, getKeymap, getKeymap, getMargin, getNavigationFilter, getPreferredScrollableViewportSize, getPrintable, getSelectedTextColor, getSelectionColor, getSelectionEnd, getSelectionStart, getText, getUI, isEditable, loadKeymap, modelToView, print, print, print, read, removeCaretListener, removeKeymap, removeNotify, setCaret, setCaretColor, setComponentOrientation, setDisabledTextColor, setDragEnabled, setDropMode, setFocusAccelerator, setKeymap, setMargin, setNavigationFilter, setSelectedTextColor, setSelectionColor, setSelectionEnd, setSelectionStart, setUI, viewToModel, write
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, 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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, 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, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicEditorPane

public BasicEditorPane()
Creates a new instance of a BasicEditorPane. Note, it is strongly encouraged that clients that use the BasicEditorPane call dispose() when it is no longer necessary.

See Also:
dispose()
Method Detail

setLanguageSupport

public void setLanguageSupport(java.lang.String fileName)
Sets the LanguageSupport for editing the type of content indicated by the specified filename.

Parameters:
fileName - the name of the file

beginEdit

public void beginEdit(EditDescriptor editDescriptor)
Marks the start of an Undoable edit applied through this editor. This instructs the editor to record its caret information into the undoable edit so that when the edit is undone or redone, the caret position is restored appropriately.

Parameters:
editDescriptor - the edit descriptor describes this edit, such as providing a human-readable name

beginFormatEdit

public void beginFormatEdit(EditDescriptor editDescriptor)
This is a special form of beginEdit without calling beginEdit in realTextBuffer


endEdit

public void endEdit(boolean mergeIntoPrevious,
                    javax.swing.undo.UndoableEdit wrappedEdit)
Marks the end of an Undoable edit applied through this editor. If mergeIntoPrevious is true, the editor will attempt to combine this editor into the last UndoableEdit if that edit was also performed through this editor

Parameters:
mergeIntoPrevious - whether the edit should be merged into the previous edit
wrappedEdit - an edit to wrap.

endFormatEdit

public void endFormatEdit(boolean mergeIntoPrevious,
                          javax.swing.undo.UndoableEdit formattedEdit)
This is a special endEdit without calling endEdit in realTextBuffer.

Parameters:
mergeIntoPrevious - sets whether to merge this edit into the previous edit.
formattedEdit - is the formatted undoable edit.

endEdit

public void endEdit()
Marks the end of an Undoable edit applied through this editor.


endEdit

public void endEdit(boolean mergeIntoPrevious)
Marks the end of an Undoable edit applied through this editor. If mergeIntoPrevious is true, the editor will attempt to combine this editor into the last UndoableEdit if that edit was also performed through this editor

Parameters:
mergeIntoPrevious - whether the edit should be merged into the previous edit

beginNavigation

public void beginNavigation()
Marks the start of a navigation through this editor. If navigation is marked as undoable, then this instructs the editor to generate the start of an Undo event.


endNavigation

public void endNavigation()
Marks the end of a navigation through this editor. If navigation is marked as undoable, then this instructs the editor to generate the end of an Undo event.


unselect

public void unselect()
Unselects the current text selection (if any), but leaves the caret where it is.


setCaretPositionCenter

public void setCaretPositionCenter(int position)
Sets the position of the text insertion caret for the TextComponent. This works the same way as setCaretPosition() except that if the new caret position is offscreen, it recenters the new position vertically into the center of the parent view port.

Parameters:
position - the position

moveCaretPositionCenter

public void moveCaretPositionCenter(int position)
Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called. This is similar to setCaretPositionCenter in that if the new position is offscreen, it recenters the new position vertically into the center of the parent view port.

Parameters:
position - the position

ensureCaretVisible

public void ensureCaretVisible()
Recenters the parent viewport vertically and horizontally around the caret, if the caret position is offscreen. If the caret position is not offscreen, the viewport is not moved.


ensurePositionVisible

public void ensurePositionVisible(int position)
Recenters the parent viewport vertically and horizontally around the specified position, if the position is offscreen. If the position is not offscreen, the viewport is not moved.

Parameters:
position - the position

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalizer to clean up the editor in case it was not disposed of properly.

Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

dispose

public void dispose()
Instructs this editor pane that it is no longer needed, and that it can clear up resources and references. This is strongly encouraged so that the editor can clean up its resources and deinstall all editor plugins properly.


isProtected

public boolean isProtected()
Fetches whether the editor's content is protected or not - this may be used by clients to indicate that the document is some sort of protected content, and that changes cannot be made directly through the editor, but through other wizards or dialogs instead. From a user's point of view, this is equivalent to making something read-only, except that the status bar will show "Protected" when it is protected, or "Read Only" when it is read only.

Returns:
whether the editor is in protected mode or not

setProtected

public void setProtected(boolean makeProtected)
Sets the editor in protected mode or not.

Parameters:
makeProtected - true to set the editor in protected mode

isCutCopyLineEnabled

protected boolean isCutCopyLineEnabled()
Checks whether Cut/Copy on current line with no selection is enabled.

Returns:
true if cut or copy on current line with no selection is enabled.

canCut

public boolean canCut()
Fetches whether a cut operation can be performed by calling cut(). This checks to make sure the editor is editable, and that there is a selection to cut.

Returns:
whether the cut() operation can be performed

canCopy

public boolean canCopy()
Fetches whether a copy operation can be performed by calling copy(). This checks to make that there is a selection currently in the editor to copy.

Returns:
whether the copy() operation can be performed

canPaste

public boolean canPaste()
Fetches whether the paste operation can be performed by calling paste(). This checks to make sure that the editor is editable, but does not check if the contents are pasteable as that can be an expensive operation.

Returns:
whether the paste() operation can be performed

isValidClipboardContent

public boolean isValidClipboardContent()
Checks if the current content of the clipboard can be pasted into the editor.

Returns:
true if the content of the clipboard can be pasted.

hasSelection

public boolean hasSelection()
Fetches whether there is currently a selection in the editor.

Returns:
whether there is a selection in the editor

getFontHelper

public FontHelper getFontHelper()
Convenience method for getting the current font helper.

Returns:
the current FontHelper instance

setBaseFont

public void setBaseFont(java.lang.String fontFamily,
                        int fontSize)
Set the base font of this editor pane independently from the global base font. Note that changes to the global base font will override this custom font set in this editor.

Parameters:
fontFamily - the font family of the base font
fontSize - the font size of the base font

getStyleRegistry

public StyleRegistry getStyleRegistry()
Fetch the global style registry used for all editor panes.

Returns:
the global style registry

setStyleRegistry

public void setStyleRegistry(StyleRegistry registry)
Replace the global style registry used for all editor panes.

Parameters:
registry - the new registry to use

getHighlightRegistry

public HighlightRegistry getHighlightRegistry()
Fetch the global highlight registry used for all editor panes.

Returns:
the global highlight registry

setHighlightRegistry

public void setHighlightRegistry(HighlightRegistry registry)
Replace the global highlight registry used for all editor panes.

Parameters:
registry - the new registry to use

setFont

public void setFont(java.awt.Font font)
We override the setFont implementation, as the font handling in the editor framework is different. Since this editor is capable of rendering different styles for the same font, and since we are using global fonts from our properties, we ignore the normal Swing/AWT set font mechanism. To change the base font of this editor by itself, use BasicEditorPane.setBaseFont(). To change the global base font of the editor framework, use EditorProperties.setBaseFont().

Overrides:
setFont in class javax.swing.JComponent
Parameters:
font - the font to set

setEditable

public void setEditable(boolean editable)
Sets the specified boolean to indicate whether or not this TextComponent should be editable. A PropertyChange event ("editable") is fired when the state is changed. We override this to track whether the clients have made the editor read only through this, so that if the editor's protected or the text buffer's read only mode changes, we can still honor user's programmatic changes

Overrides:
setEditable in class javax.swing.text.JTextComponent
Parameters:
editable - the boolean to be set

createDefaultEditorKit

protected javax.swing.text.EditorKit createDefaultEditorKit()
Creates the default editor kit for when the component is first created.

Overrides:
createDefaultEditorKit in class javax.swing.JEditorPane
Returns:
the editor kit

updateUI

public void updateUI()
Reloads the pluggable UI. Override this here as we have our own custom UI that takes care of locking the document properly.

Overrides:
updateUI in class javax.swing.text.JTextComponent

setDocument

public void setDocument(javax.swing.text.Document doc)
Associates the editor with the text document. We override this to do proper reference cleanup.

Overrides:
setDocument in class javax.swing.text.JTextComponent
Parameters:
doc - the new document

getSelectedText

public java.lang.String getSelectedText()
Overrides:
getSelectedText in class javax.swing.text.JTextComponent

setClipboardContents

protected void setClipboardContents(java.lang.String contentText)
Utility routine to set the contents of the given text into the clipboard.

Parameters:
contentText - the content text to set

cut

public void cut()
Overrides:
cut in class javax.swing.text.JTextComponent

copy

public void copy()
Overrides:
copy in class javax.swing.text.JTextComponent

paste

public void paste()
Overrides:
paste in class javax.swing.text.JTextComponent

duplicateSelection

public void duplicateSelection()
Copies the selected text amd places the copy immediately after he original selection. Aft er the operation completes the newly inserted region will be selected. The clipboard contents are unnaffected by this operation. If there is no selection thsis operation will do nothing.


pasteFromClipboard

protected void pasteFromClipboard(java.awt.Toolkit toolkit,
                                  java.awt.datatransfer.Clipboard clipboard)
Utility routine to perform a paste operation from the given clipboard.

Parameters:
clipboard - the clipboard to paste from

setText

public void setText(java.lang.String text)
Sets the text of this TextComponent to the specified content.

Overrides:
setText in class javax.swing.JEditorPane
Parameters:
text -

mergeReplaceSelection

public void mergeReplaceSelection(java.lang.String content)
Like replaceSelection(String content), except it mergres this edit to the previous edit.

Parameters:
content - to be replaced

replaceSelection

public void replaceSelection(java.lang.String content)
Replaces the currently selected content with the new content represented by the given String. We override the implementation of JTextComponent so that the whole replace can be a single undoable operation.

Overrides:
replaceSelection in class javax.swing.JEditorPane
Parameters:
content - the new content to replace the current selection

selectAll

public void selectAll()
Selects all the text in the TextComponent. Does nothing on a null or empty document. We override the default implementation so that navigation movement is registered

Overrides:
selectAll in class javax.swing.text.JTextComponent

select

public void select(int selectionStart,
                   int selectionEnd)
Selects the text found between the specified start and end locations.

Overrides:
select in class javax.swing.text.JTextComponent
Parameters:
selectionStart - the start position of the text >= 0
selectionEnd - the end position of the text >= 0
See Also:
setCaretPosition(int), moveCaretPosition(int)

getHighlighter

public javax.swing.text.Highlighter getHighlighter()
Fetches the object responsible for making highlights. Highlighting is now done through HighlightLayers instead of through the Swing text highlighters.

Overrides:
getHighlighter in class javax.swing.text.JTextComponent
Returns:
the highlighter

setHighlighter

public void setHighlighter(javax.swing.text.Highlighter h)
Sets the highlighter to be used. Highlighting is now done through HighlightLayers instead of through the Swing text highlighters.

Overrides:
setHighlighter in class javax.swing.text.JTextComponent
Parameters:
h - the highlighter

setToolTipText

public void setToolTipText(java.lang.String text)
Registers the text to display in a tool tip. This method does not do anything as tool tips for the editor are done using the ToolTipProvider instead.

Overrides:
setToolTipText in class javax.swing.JComponent
Parameters:
text - the text to display in a tool tip.

getToolTipText

public java.lang.String getToolTipText()
Returns the tooltip string that has been set with setToolTipText(). We currently do not provide tooltip information that does not correspond to a mouse event.

Overrides:
getToolTipText in class javax.swing.JComponent
Returns:
the tooltip text

createToolTip

public javax.swing.JToolTip createToolTip()
Overriden to provide a MultiLineToolTip by default.

Overrides:
createToolTip in class javax.swing.JComponent
Returns:

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
Returns the string to be used as the tooltip for event. By default this returns any string set using setToolTipText(). If a component provides more extensive API to support differing tooltips at different locations, this method should be overridden.

Overrides:
getToolTipText in class javax.swing.text.JTextComponent

getScrollableUnitIncrement

public int getScrollableUnitIncrement(java.awt.Rectangle visibleRect,
                                      int orientation,
                                      int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one new row or column, depending on the value of orientation. Ideally, components should handle a partially exposed row or column by returning the distance required to completely expose the item.

Specified by:
getScrollableUnitIncrement in interface javax.swing.Scrollable
Overrides:
getScrollableUnitIncrement in class javax.swing.text.JTextComponent
Parameters:
visibleRect - The view area visible within the viewport
orientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
direction - Less than zero to scroll up/left, greater than zero for down/right.
Returns:
The "unit" increment for scrolling in the specified direction
See Also:
JScrollBar.setUnitIncrement(int)

getScrollableBlockIncrement

public int getScrollableBlockIncrement(java.awt.Rectangle visibleRect,
                                       int orientation,
                                       int direction)
Components that display logical rows or columns should compute the scroll increment that will completely expose one block of rows or columns, depending on the value of orientation.

Specified by:
getScrollableBlockIncrement in interface javax.swing.Scrollable
Overrides:
getScrollableBlockIncrement in class javax.swing.text.JTextComponent
Parameters:
visibleRect - The view area visible within the viewport
orientation - Either SwingConstants.VERTICAL or SwingConstants.HORIZONTAL.
direction - Less than zero to scroll up/left, greater than zero for down/right.
Returns:
The "block" increment for scrolling in the specified direction.
See Also:
JScrollBar.setBlockIncrement(int)

setCaretPosition

public void setCaretPosition(int position)
Sets the position of the text insertion caret for the TextComponent. We override the default behavior so that instead of throwing the exception (which most clients probably are not expecting), we just quietly move the caret to the closest valid offset. Calling this method does not fire a navigation event

Overrides:
setCaretPosition in class javax.swing.text.JTextComponent
Parameters:
position - the position

setCaretPosition

public void setCaretPosition(int position,
                             boolean isNavigation)
Sets the position of the text insertion caret for the TextComponent. We override the default behavior so that instead of throwing the exception (which most clients probably are not expecting), we just quietly move the caret to the closest valid offset.

Parameters:
position - the position
isNavigation - if true this change is considered a navigation and a navigation event isfired.

remove

public void remove(int offs,
                   int len)
            throws javax.swing.text.BadLocationException
Remove the given section from the document. Unlike calling document remove directly this call will obey any limits set via setViewLimits

Parameters:
offs - the start offset to remove
len - the number of characters to remove
Throws:
javax.swing.text.BadLocationException - if the removal is outside of any view limits, or if the document itself throws a BadLocationException.

insertString

public void insertString(int offs,
                         java.lang.String str,
                         javax.swing.text.AttributeSet a)
                  throws javax.swing.text.BadLocationException
Insert the given string into the document at the given offset. Unlike calling document insertString directly this call will obey any limits set via EditorProperties.PROPERTY_VIEW_START_OFFSET and EditorProperties.PROPERTY_VIEW_END_OFFSET and will reject edits outside the bounds.

Parameters:
offs - the start offset to insert
str - the string to insert
a - the attribute set to use
Throws:
javax.swing.text.BadLocationException - if the insert is outside of any view limits, or if the document itself throws a BadLocationException.

moveCaretPosition

public void moveCaretPosition(int position)
Moves the caret to a new position, leaving behind a mark defined by the last time setCaretPosition was called. This forms a selection. Again, we override the default behavior to make sure that the position is valid. If not, we move it to the closest valid offset.

Overrides:
moveCaretPosition in class javax.swing.text.JTextComponent
Parameters:
position -

getAutoscrollInsets

public java.awt.Insets getAutoscrollInsets()
This method returns the Insets describing the autoscrolling region or border relative to the geometry of the implementing Component.

This value is read once by the DropTarget upon entry of the drag Cursor into the associated Component.

Specified by:
getAutoscrollInsets in interface java.awt.dnd.Autoscroll
Returns:
the Insets

autoscroll

public void autoscroll(java.awt.Point location)
Notify the Component to autoscroll.

Specified by:
autoscroll in interface java.awt.dnd.Autoscroll
Parameters:
location - the Point location that triggered this autoscroll.

validateVisibleRect

protected void validateVisibleRect(java.awt.Rectangle visibleRect)
Utility method to ensure that the visible rectangle does not go beyond the edges of the editor view.

Parameters:
visibleRect - the visible rect to validate

getProperty

public final java.lang.Object getProperty(java.lang.String key)
Get the property associated with the given key.

Parameters:
key - the property to get
Returns:
the property
See Also:
EditorProperties

putProperty

public final void putProperty(java.lang.String key,
                              java.lang.Object value)
Store the property associated with the given key.

Parameters:
key - the property to store
value - the value to store
See Also:
EditorProperties

getBooleanProperty

public boolean getBooleanProperty(java.lang.String key)
Fetch the boolean property stored by the given key. This may throw a ClassCastException if the property is not a boolean property

Parameters:
key - the property to get
Throws:
java.lang.ClassCastException - if the property is not a boolean property

putBooleanProperty

public void putBooleanProperty(java.lang.String key,
                               boolean value)
Sets the boolean property and value in the property table.

Parameters:
key - the property name
value - the property value

getIntegerProperty

public int getIntegerProperty(java.lang.String key)
Fetch the integer property stored by the given key. This may throw a ClassCastException if the property is not a integer property

Parameters:
key - the property to get
Throws:
java.lang.ClassCastException - if the property is not a integer property

putIntegerProperty

public void putIntegerProperty(java.lang.String key,
                               int value)
Sets the integer property and value in the property table.

Parameters:
key - the property name
value - the property value

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - A PropertyChangeEvent object describing the event source and the property that has changed.

getLineCount

public int getLineCount()
Fetches the number of lines in this TextBuffer. For example, a 5-line TextBuffer has lines 0 through 4.

Returns:
number of lines in TextBuffer

getLineFromOffset

public int getLineFromOffset(int offset)
Given an offset from the beginning of the underlying TextBuffer, fetches the line number containing that offset using a Forward bias. This means if line A starts with offset B, and previous line A-1 ends with offset B, getLineFromOffset(B) will return line A.

Returns:
the line containing an offset

getLineStartOffset

public int getLineStartOffset(int line)
Given a specified line, returns the offset from the beginning of the TextBuffer for the start of the line.

Parameters:
line - a line in the TextBuffer
Returns:
the starting offset of the specified line

getLineEndOffset

public int getLineEndOffset(int line)
Given a specified line, returns the offset from the beginning of a TextBuffer that the line ends at.

Parameters:
line - a line in the TextBuffer
Returns:
the ending offset of the specified line

getLineFromRow

public int getLineFromRow(int row)
Fetch the first line that occurs on this row, taking in to account folded blocks. This returns a 1-based line. Only truly safe for EditorPanes that contains a oracle.javatools.editor.BasicView

Parameters:
row - the row to get the line for
Returns:
the line for this row

getRowForLine

public int getRowForLine(int line)
Return the row that the given line appears on. Folded blocks mean that many lines can map to one row. safe for EditorPanes that contains a oracle.javatools.editor.BasicView Other views will return -1.

Parameters:
line -
Returns:
the row of the editor on where the line is represented

addPreActionInvoker

public void addPreActionInvoker(ActionPreInvoker invoker,
                                double weight)
Adds an actionInvoker that will be called before anyone else.
The ActionInvoker will be invoked for any action, including actions that would normally be handled by the IDE.

The weight defines the priority. Invokers with a lowest weight are called first.
If two invokers have the same priority, the last one to be added is called first. This is the behavior of a stack.

Pre-invokers should be used for temporary situations where actions must be intercepted before to reach their normal destination. A typical example is the coordination of popups where one popup needs to receive its input before another.

Parameters:
invoker - The invoker to add
weight - The wheight defines the priority.

removePreActionInvoker

public void removePreActionInvoker(ActionPreInvoker invoker,
                                   double weight)
Remove a pre-actionInvoker.

See Also:
addPreActionInvoker(ActionPreInvoker, double)

preInvokeAction

public boolean preInvokeAction(java.lang.String actionKey)
Invoke the pre-actionInvokers for an action.

Parameters:
actionKey - the name of the action.
Returns:
true if the action was handled.
See Also:
addPreActionInvoker(ActionPreInvoker, double)

addActionHookInvoker

public void addActionHookInvoker(ActionHookInvoker invoker)
Adds an ActionHookInvoker to the list so that it has a chance to override the default action temporarily.

Parameters:
invoker - the invoker to add

removeActionHookInvoker

public void removeActionHookInvoker(ActionHookInvoker invoker)
Removes an ActionHookInvoker from our list.

Parameters:
invoker - the invoker to remove

addActionPostInvoker

public void addActionPostInvoker(ActionPostInvoker invoker)
Adds an ActionPostInvoker to the list so that it gets notified of successfully completed actions just after the fact.

Parameters:
invoker - the invoker to add

removeActionPostInvoker

public void removeActionPostInvoker(ActionPostInvoker invoker)
Removes an ActionPostInvoker from our list.

Parameters:
invoker - the invoker to remove

getActionInvoker

public ActionInvoker getActionInvoker()
Fetches the action invoker to use to execute some particular action.

Returns:
the action invoker

invokeAction

public void invokeAction(java.lang.String actionKey)
Invokes the Action corresponding to the given actionKey.

Specified by:
invokeAction in interface ActionInvoker
Parameters:
actionKey - the published key for the action

installPlugin

public void installPlugin(EditorPlugin plugin)
This installs an editor plugin into the editor. This will call the install() method of the plugin as well as add the plugin as a PropertyChangeListener of the editor to receive property change events.

Parameters:
plugin - the plugin to install

deinstallPlugin

public void deinstallPlugin(EditorPlugin plugin)
This deinstalls an editor plugin from the editor. This will call the deinstall() method of the plugin as well as remove the plugin from being a PropertyChangeListener of the editor.

Parameters:
plugin - the plugin to deinstall

installBuiltInPlugins

protected void installBuiltInPlugins()
Utility routine to install known, built-in plugins.


deinstallAllPlugins

protected void deinstallAllPlugins()
Utility routine to deinstall all plugins.


createHighlightLayer

public HighlightLayer createHighlightLayer()
Creates a new highlight layer that can be used for highlighting text in this editor pane. Make sure to remove the highlight layer when it is no longer needed (even if it contains no highlights) so that it can be released.

Returns:
a newly created HighlightLayer that can be used for adding highlights to this editor pane

destroyHighlightLayer

public void destroyHighlightLayer(HighlightLayer layer)
Destroys a highlight layer that is no longer needed. This will also remove all highlights in that layer from this editor pane.

Parameters:
layer - the highlight layer to remove

getHighlightLayers

protected java.util.Iterator getHighlightLayers()
Fetches an iterator to access the highlight layers associated with this editor pane. This is needed by the view renderers to get access to the highlight layers for rendering the highlights for this editor pane.

Returns:
an iterator for accessing the highlight layers

addPopupManager

public void addPopupManager(PopupManager manager)
Installs the given PopupManager for managing popup menus for this editor pane. When the user requests a popup menu, usually by right-clicking in the editor content, the showPopup() method of the PopupManager will be called. Only one PopupManager can be installed at any given time (but this is not enforced programmatically at the current time.)

Parameters:
manager - the popup manager to install

removePopupManager

public void removePopupManager(PopupManager manager)
Deinstalls the given PopupManager that was previously installed for managing popup menus for the editor pane.

Parameters:
manager - the popup manager to de-install

getPopupManager

public PopupManager getPopupManager()
Fetches the current installed PopupManager. This is primarily used within the editor component, for example by the BasicCaret, to notify the appropriate PopupManager for handling events related to popup menus. This will return null if there is no popup manager installed.

Returns:
the currently installed PopupMenu

addToolTipProvider

public void addToolTipProvider(ToolTipProvider provider)
Installs the given ToolTipProvider for providing tooltips for the editor pane. When the user requests a tooltip (by moving the mouse over text in the editor and waiting), the getToolTipText() method of the ToolTipProvider will be called. Only one ToolTipProvider can be installed at any given time (but this is not enforced programmatically currently.)

Parameters:
provider - the tool tip provider to install

removeToolTipProvider

public void removeToolTipProvider(ToolTipProvider provider)
Deinstalls the given ToolTipProvider that was previously installed for getting tooltip info for the editor pane.

Parameters:
provider - the tooltip provider to de-install.

getToolTipProvider

public ToolTipProvider getToolTipProvider()
Fetches the current installed ToolTipProvider. This is primarily used within the editor component, for example when a tool tip needs to be popped up. This will return null if there is no popup manager installed.

Returns:
the currently installed ToolTipProvider

addFeedbackManager

public void addFeedbackManager(FeedbackManager manager)
Installs the given FeedbackManager for displaying feedback messages to the user for this editor pane. Only one FeedbackManager can be installed at any given time (this is not enforce programmatically however.)

Parameters:
manager - the feedback manager to install

removeFeedbackManager

public void removeFeedbackManager(FeedbackManager manager)
Deinstalls the given FeedbackManager that was previously installed for handling feedback messages for this editor pane.

Parameters:
manager - the feedback manager to de-install

getFeedbackManager

public FeedbackManager getFeedbackManager()
Fetches the current installed FeedbackManager. This is can be used for displaying feedback messages to the user associated with this editor pane. This will return null if there is no feedback manager installed.

Returns:
the currently installed FeedbackMenu

addCharacterTypedListener

public void addCharacterTypedListener(CharacterTypedListener listener)
Adds a character typed listener to the list so that it can receive notifications of characters typed into this editor pane.

Parameters:
listener - the listener to add

removeCharacterTypedListener

public void removeCharacterTypedListener(CharacterTypedListener listener)
Removes a character typed listener from the list so that it no longer receives notifications.

Parameters:
listener - the listener to remove

fireCharacterTypedEvent

protected void fireCharacterTypedEvent(int offset,
                                       char charTyped)
Utility routine used to notify listeners that a character was typed. This is protected so that it can be called by the DefaultKeyTypedAction rather than passing the listeners off to the action.

Parameters:
offset - the offset where the character was typed
charTyped - the character that was typed

addNavigationListener

public void addNavigationListener(NavigationListener navigationListener)
Add a listener for navigation events. This is not intended to report caret changes due to typing or other internal changes, for that use a CaretListener

Parameters:
navigationListener - the NavigationListener to receive events

removeNavigationListener

public void removeNavigationListener(NavigationListener navigationListener)

fireNavigationEvent

protected void fireNavigationEvent(int offset)
Inform listeners that the caret has moved in response to an external event. This is not intended to report caret changes due to typing or other internal changes, for that use a CaretListener

Parameters:
offset - the new offset after navigation

setValidOffsetBounds

public void setValidOffsetBounds(int startOffset,
                                 int endOffset)
Set the bounds between which user editing and caret navigation is permitted. While clients can make direct edits to the document and text buffer, edits routed via this editor component will be restricted to the given bounds

Parameters:
startOffset - the start of the limited bounds, or -1 for no limit
endOffset - the end of the limited bounds, or -1 for no limit

getValidOffsetStart

public int getValidOffsetStart()
Returns:
the first offset at which editing and caret movement via this editor is permitted.

getValidOffsetEnd

public int getValidOffsetEnd()
Returns:
the last offset at which editing and caret movement via this editor is permitted.

updateColors

protected void updateColors()
Utility routine to update our Swing color stuff. This happens when we change StyleRegistry's, or when our style registry styles are changed.


useDefaultKeyHandling

protected boolean useDefaultKeyHandling()
Fetches whether the default use of the multi-key handler should be used. Subclasses can return false to override the key handling behavior.

Returns:
true to use the default key handling mechanism

installKeyboardSupport

protected void installKeyboardSupport()
Support routine to initialize the keyboard support for this editor pane instance. This can be overrided by subclasses to change the way keymap support is done within the editor.


deinstallKeyboardSupport

protected void deinstallKeyboardSupport()
Support routine to deinitialize the keyboard support for this editor pane instance. This can be overrided by subclasses to change the way keymap support is done within the editor.


ensureVisibleAndCentered

protected void ensureVisibleAndCentered(int location)

ensureVisibleAndCentered

protected void ensureVisibleAndCentered(java.awt.Rectangle positionRect)
Utility routine to ensure that the given position is visible vertically and horizontally. if the position is not entirely visible in either direction, the viewport is recentered in the to center it (vertically, horizontally, or both.)

Parameters:
positionRect - the rectangle to make sure if visible

ensureVisibleAndCentered

protected void ensureVisibleAndCentered(java.awt.Rectangle positionRect,
                                        boolean force)
Utility routine to ensure that the given position is visible vertically and horizontally. if the position is not entirely visible in either direction, the viewport is recentered in the to center it (vertically, horizontally, or both.)

Parameters:
positionRect - the rectangle to make sure if visible
force - whether to force centering

makeEditable

public boolean makeEditable()
Attempts to makes the document editable through consumers registered as VetoableChangeListeners.

Returns:
true if the document was successfully made editable.

processInputMethodEvent

protected void processInputMethodEvent(java.awt.event.InputMethodEvent e)
Overrides:
processInputMethodEvent in class javax.swing.text.JTextComponent

isUndoInProgress

public boolean isUndoInProgress()
Fetches whether the editor is in the middle of having an undo/redo applied to it.

Returns:
whether in undo or not

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

Copyright © 1997, 2013, Oracle. All rights reserved.