|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.core.commands.common.EventManager
org.eclipse.ui.part.WorkbenchPart
org.eclipse.ui.part.EditorPart
org.eclipse.ui.texteditor.AbstractTextEditor
Abstract base implementation of a text editor.
Subclasses are responsible for configuring the editor appropriately.
The standard text editor, TextEditor, is one such example.
If a subclass calls setEditorContextMenuId the argument is
used as the id under which the editor's context menu is registered for extensions.
If no id is set, the context menu is registered under [editor_id].EditorContext
whereby [editor_id] is replaced with the editor's part id. If the editor is instructed to
run in version 1.0 context menu registration compatibility mode, the latter form of the
registration even happens if a context menu id has been set via setEditorContextMenuId.
If no id is set while in compatibility mode, the menu is registered under
DEFAULT_EDITOR_CONTEXT_MENU_ID.
If a subclass calls setRulerContextMenuId the argument is
used as the id under which the ruler's context menu is registered for extensions.
If no id is set, the context menu is registered under [editor_id].RulerContext
whereby [editor_id] is replaced with the editor's part id. If the editor is instructed to
run in version 1.0 context menu registration compatibility mode, the latter form of the
registration even happens if a context menu id has been set via setRulerContextMenuId.
If no id is set while in compatibility mode, the menu is registered under
DEFAULT_RULER_CONTEXT_MENU_ID.
| Nested Class Summary | |
|---|---|
protected class |
AbstractTextEditor.AbstractSelectionChangedListener
Internal implementation class for a change listener. |
protected static class |
AbstractTextEditor.ColumnSupport
Implements the ruler column support of for the given editor. |
protected static class |
AbstractTextEditor.IdMapEntry
Maps an action definition id to an StyledText action. |
protected class |
AbstractTextEditor.LineEndAction
This action implements smart end. |
protected class |
AbstractTextEditor.LineStartAction
This action implements smart home. |
protected static class |
AbstractTextEditor.TextEditorSavable
This text editor's savable. |
| Nested classes inherited from class org.eclipse.ui.texteditor.ITextEditorExtension3 |
|---|
ITextEditorExtension3.InsertMode |
| Field Summary | |
|---|---|
protected static AbstractTextEditor.IdMapEntry[] |
ACTION_MAP
The complete mapping between action definition IDs used by eclipse and StyledText actions. |
static String |
DEFAULT_EDITOR_CONTEXT_MENU_ID
Menu id for the editor context menu. |
static String |
DEFAULT_RULER_CONTEXT_MENU_ID
Menu id for the ruler context menu. |
protected String |
fErrorLabel
The error message shown in the status line in case of failed information look up. |
static String |
PREFERENCE_COLOR_BACKGROUND
Key used to look up background color preference. |
static String |
PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT
Key used to look up background color system default preference. |
static String |
PREFERENCE_COLOR_FIND_SCOPE
Key used to look up find scope background color preference. |
static String |
PREFERENCE_COLOR_FOREGROUND
Key used to look up foreground color preference. |
static String |
PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT
Key used to look up foreground color system default preference. |
static String |
PREFERENCE_COLOR_SELECTION_BACKGROUND
Key used to look up selection background color preference. |
static String |
PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT
Key used to look up selection background color system default preference. |
static String |
PREFERENCE_COLOR_SELECTION_FOREGROUND
Key used to look up selection foreground color preference. |
static String |
PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT
Key used to look up selection foreground color system default preference. |
static String |
PREFERENCE_FONT
Deprecated. As of 2.1, replaced by JFaceResources.TEXT_FONT |
static String |
PREFERENCE_HYPERLINK_KEY_MODIFIER
A named preference that controls the key modifier for hyperlinks. |
static String |
PREFERENCE_HYPERLINK_KEY_MODIFIER_MASK
A named preference that controls the key modifier mask for hyperlinks. |
static String |
PREFERENCE_HYPERLINKS_ENABLED
A named preference that controls if hyperlinks are turned on or off. |
static String |
PREFERENCE_NAVIGATION_SMART_HOME_END
Key used to look up smart home/end preference. |
static String |
PREFERENCE_RULER_CONTRIBUTIONS
A named preference that controls the visible ruler column contributions. |
static String |
PREFERENCE_SHOW_WHITESPACE_CHARACTERS
A named preference that controls the display of whitespace characters. |
static String |
PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED
A named preference that controls whether text drag and drop is enabled. |
static String |
PREFERENCE_USE_CUSTOM_CARETS
Key used to look up the custom caret preference. |
static String |
PREFERENCE_WIDE_CARET
Key used to look up the caret width preference. |
protected static String |
TAG_SELECTION_LENGTH
|
protected static String |
TAG_SELECTION_OFFSET
Tags used in the IMemento when saving and
restoring editor state. |
protected static int |
VERTICAL_RULER_WIDTH
The width of the vertical ruler. |
| Fields inherited from interface org.eclipse.ui.IEditorPart |
|---|
PROP_DIRTY, PROP_INPUT |
| Fields inherited from interface org.eclipse.ui.IWorkbenchPart |
|---|
PROP_TITLE |
| Fields inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3 |
|---|
INSERT, SMART_INSERT |
| Constructor Summary | |
|---|---|
protected |
AbstractTextEditor()
Creates a new text editor. |
| Method Summary | |
|---|---|
protected void |
addAction(IMenuManager menu,
String actionId)
Convenience method to add the action installed under the given action id to the given menu. |
protected void |
addAction(IMenuManager menu,
String group,
String actionId)
Convenience method to add the action installed under the given action id to the specified group of the menu. |
protected void |
addGroup(IMenuManager menu,
String existingGroup,
String newGroup)
Convenience method to add a new group after the specified group. |
void |
addRulerContextMenuListener(IMenuListener listener)
Adds a ruler context menu listener to the editor. |
protected void |
adjustHighlightRange(int offset,
int length)
Adjusts the highlight range so that at least the specified range is highlighted. |
protected boolean |
affectsTextPresentation(PropertyChangeEvent event)
Determines whether the given preference change affects the editor's presentation. |
protected boolean |
canHandleMove(IEditorInput originalElement,
IEditorInput movedElement)
Returns whether this editor can handle the move of the original element so that it ends up being the moved element. |
void |
close(boolean save)
Closes this text editor after optionally saving changes. |
protected void |
configureInsertMode(ITextEditorExtension3.InsertMode mode,
boolean legal)
Configures the given insert mode as legal or illegal. |
protected boolean |
containsSavedState(IMemento memento)
Returns whether the given memento contains saved state Subclasses may extend or override this method. |
protected void |
createActions()
Creates this editor's standard actions and connects them with the global workbench actions. |
protected IColumnSupport |
createColumnSupport()
Creates the column support to be used by this editor to manage the contributed ruler columns. |
INavigationLocation |
createEmptyNavigationLocation()
Creates an empty navigation location. |
protected void |
createNavigationActions()
Creates action entries for all SWT StyledText actions as defined in org.eclipse.swt.custom.ST. |
INavigationLocation |
createNavigationLocation()
Creates a navigation location describing the current state. |
void |
createPartControl(Composite parent)
The AbstractTextEditor implementation of this
IWorkbenchPart method creates the vertical ruler and
source viewer.
|
protected ISourceViewer |
createSourceViewer(Composite parent,
IVerticalRuler ruler,
int styles)
Creates the source viewer to be used by this editor. |
protected void |
createUndoRedoActions()
Creates this editor's undo/redo actions. |
protected IVerticalRuler |
createVerticalRuler()
Creates the vertical ruler to be used by this editor. |
void |
dispose()
The AbstractTextEditor implementation of this
IWorkbenchPart method may be extended by subclasses.
|
protected void |
disposeDocumentProvider()
Disposes of the connection with the document provider. |
protected ISelection |
doGetSelection()
Returns the current selection. |
protected void |
doRestoreState(IMemento memento)
Restores this editor's state using the given memento. |
void |
doRevertToSaved()
The AbstractTextEditor implementation of this
ITextEditor method may be extended by subclasses. |
void |
doSave(IProgressMonitor progressMonitor)
The AbstractTextEditor implementation of this
IEditorPart method may be extended by subclasses. |
void |
doSaveAs()
The AbstractTextEditor implementation of this
IEditorPart method calls performSaveAs.
|
protected void |
doSetInput(IEditorInput input)
Called directly from setInput and from within a workspace
runnable from init, this method does the actual setting
of the editor input. |
protected void |
doSetSelection(ISelection selection)
Sets the given selection. |
protected void |
editorContextMenuAboutToShow(IMenuManager menu)
Sets up this editor's context menu before it is made visible. |
protected void |
editorSaved()
Hook which gets called when the editor has been saved. |
protected void |
enableOverwriteMode(boolean enable)
Sets the overwrite mode enablement. |
protected void |
enableSanityChecking(boolean enable)
Enables/disables sanity checking. |
protected void |
enableStateValidation(boolean enable)
Enables/disables state validation. |
protected Annotation |
findAnnotation(int offset,
int length,
boolean forward,
Position annotationPosition)
Returns the annotation closest to the given range respecting the given direction. |
protected void |
firePropertyChange(int property)
Fires a property changed event. |
IAction |
getAction(String actionID)
Returns the action installed under the given action id. |
Saveable[] |
getActiveSaveables()
Returns the saveables currently active in the workbench part. |
Object |
getAdapter(Class required)
Returns an object which is an instance of the given class associated with this object. |
protected IMenuListener |
getContextMenuListener()
Creates and returns the listener on this editor's context menus. |
protected static IRegion |
getCoverage(ISourceViewer viewer)
Returns the minimal region of the given source viewer's document that completely comprises everything that is visible in the viewer's widget. |
protected org.eclipse.ui.texteditor.AbstractTextEditor.ICursorListener |
getCursorListener()
Returns this editor's "cursor" listener to be installed on the editor's source viewer. |
protected String |
getCursorPosition()
Returns a description of the cursor position. |
IDocumentProvider |
getDocumentProvider()
Returns this text editor's document provider. |
protected String |
getEditorContextMenuId()
Returns the editor's context menu id. |
protected String |
getFontPropertyPreferenceKey()
Returns the property preference key for the editor font. |
protected String |
getHelpContextId()
Returns the editor's help context id or null if none has
been set. |
IRegion |
getHighlightRange()
Returns the highlighted range of this text editor. |
ITextEditorExtension3.InsertMode |
getInsertMode()
Returns the current input mode of this editor. |
protected List |
getLegalInsertModes()
Returns the set of legal insert modes. |
protected IPreferenceStore |
getPreferenceStore()
Returns this editor's preference store or null if none has
been set. |
protected IProgressMonitor |
getProgressMonitor()
Returns the progress monitor related to this editor. |
protected Annotation |
getRangeIndicator()
Returns the editor's range indicator. |
protected String |
getRulerContextMenuId()
Returns the ruler's context menu id. |
protected MouseListener |
getRulerMouseListener()
Creates and returns the listener on this editor's vertical ruler. |
Saveable[] |
getSaveables()
Returns the saveables presented by the workbench part. |
protected ISelectionChangedListener |
getSelectionChangedListener()
Returns this editor's selection changed listener to be installed on the editor's source viewer. |
ISelectionProvider |
getSelectionProvider()
Returns this text editor's selection provider. Repeated calls to this method return the same selection provider. Returns null after disposal.
|
protected ISourceViewer |
getSourceViewer()
Returns the editor's source viewer. |
protected SourceViewerConfiguration |
getSourceViewerConfiguration()
Returns the editor's source viewer configuration. |
protected IStatusField |
getStatusField(String category)
Returns the current status field for the given status category. |
protected IStatusLineManager |
getStatusLineManager()
Returns the status line manager of this editor. |
protected IOperationApprover |
getUndoRedoOperationApprover(IUndoContext undoContext)
Return an IOperationApprover appropriate for approving the undo and
redo of operations that have the specified undo context.
|
protected IVerticalRuler |
getVerticalRuler()
Returns the editor's vertical ruler. |
Annotation |
gotoAnnotation(boolean forward)
Jumps to the next annotation according to the given direction. |
protected void |
handleCursorPositionChanged()
Handles a potential change of the cursor position. |
protected void |
handleEditorInputChanged()
Handles an external change of the editor's input element. |
protected void |
handleElementContentReplaced()
Performs any additional action necessary to perform after the input document's content has been replaced. |
protected void |
handleExceptionOnSave(CoreException exception,
IProgressMonitor progressMonitor)
Handles the given exception. |
protected void |
handleInsertModeChanged()
Handles a change of the editor's insert mode. |
protected void |
handlePreferenceStoreChanged(PropertyChangeEvent event)
Handles a property change event describing a change of the editor's preference store and updates the preference related editor properties. |
void |
init(IEditorSite site,
IEditorInput input)
Initializes this editor with the given editor site and input. |
protected void |
initializeDragAndDrop(ISourceViewer viewer)
Initializes the drag and drop support for the given viewer based on provided editor adapter for drop target listeners. |
protected void |
initializeViewerColors(ISourceViewer viewer)
Initializes the fore- and background colors of the given viewer for both normal and selected text. |
protected void |
installTabsToSpacesConverter()
Installs a tabs to spaces converter. |
protected void |
installTextDragAndDrop(ISourceViewer viewer)
Installs text drag and drop on the given source viewer. |
protected void |
internalInit(IWorkbenchWindow window,
IEditorSite site,
IEditorInput input)
Implements the init method of IEditorPart.
|
boolean |
isChangeInformationShowing()
Returns the quick diff display state. |
boolean |
isDirty()
Returns whether the contents of this part have changed since the last save operation. |
boolean |
isEditable()
Returns whether the text in this text editor can be changed by the user. |
protected boolean |
isEditorInputIncludedInContextMenu()
Tells whether the editor input should be included when adding object contributions to this editor's context menu. |
boolean |
isEditorInputModifiable()
Returns whether the editor's input can be persistently be modified. |
boolean |
isEditorInputReadOnly()
Returns whether the editor's input is read-only. |
protected boolean |
isInInsertMode()
Returns whether this editor is in overwrite or insert mode. |
protected boolean |
isNavigationTarget(Annotation annotation)
Returns whether the given annotation is configured as a target for the "Go to Next/Previous Annotation" actions. |
boolean |
isSaveAsAllowed()
The AbstractTextEditor implementation of this
IEditorPart method returns false.
|
protected boolean |
isTabsToSpacesConversionEnabled()
Tells whether tabs should be converted to spaces while editing inside this editor. |
protected static boolean |
isVisible(ISourceViewer viewer,
int offset,
int length)
Tells whether the given region is visible in the given source viewer. |
void |
markAsContentDependentAction(String actionId,
boolean mark)
Marks or unmarks the given action to be updated on content changes. |
void |
markAsPropertyDependentAction(String actionId,
boolean mark)
Marks or unmarks the given action to be updated on property changes. |
void |
markAsSelectionDependentAction(String actionId,
boolean mark)
Marks or unmarks the given action to be updated on text selection changes. |
void |
markAsStateDependentAction(String actionId,
boolean mark)
Marks or unmarks the given action to be updated on state changes. |
protected void |
markInNavigationHistory()
Writes a check mark of the given situation into the navigation history. |
protected static int |
modelOffset2WidgetOffset(ISourceViewer viewer,
int modelOffset)
Returns the offset of the given source viewer's text widget that corresponds to the given model offset or -1 if there is no such offset. |
protected void |
openSaveErrorDialog(String title,
String message,
CoreException exception)
Presents an error dialog to the user when a problem happens during save. |
protected void |
performRevert()
Performs revert and handles errors appropriately. |
protected void |
performSave(boolean overwrite,
IProgressMonitor progressMonitor)
Performs the save and handles errors appropriately. |
protected void |
performSaveAs(IProgressMonitor progressMonitor)
Performs a save as and reports the result state back to the given progress monitor. |
protected void |
rememberSelection()
Remembers the current selection of this editor. |
void |
removeActionActivationCode(String actionID)
Removes any installed activation code for the specified action. |
void |
removeRulerContextMenuListener(IMenuListener listener)
Removes a ruler context menu listener from the editor. |
void |
resetHighlightRange()
Resets the highlighted range of this text editor. |
protected void |
restoreSelection()
Restores a selection previously remembered by rememberSelection.
|
void |
restoreState(IMemento memento)
Called with a memento for this editor. |
protected void |
rulerContextMenuAboutToShow(IMenuManager menu)
Sets up the ruler context menu before it is made visible. |
protected void |
safelySanityCheckState(IEditorInput input)
Checks the state of the given editor input if sanity checking is enabled. |
protected void |
sanityCheckState(IEditorInput input)
Checks the state of the given editor input. |
void |
saveState(IMemento memento)
Saves the state of the object in the given memento. |
void |
selectAndReveal(int start,
int length)
Selects and reveals the specified range in this text editor. |
protected void |
selectAndReveal(int selectionStart,
int selectionLength,
int revealStart,
int revealLength)
Selects and reveals the specified ranges in this text editor. |
void |
setAction(String actionID,
IAction action)
Installs the given action under the given action id. |
void |
setActionActivationCode(String actionID,
char activationCharacter,
int activationKeyCode,
int activationStateMask)
Sets the given activation code for the specified action. |
protected void |
setCompatibilityMode(boolean compatible)
Sets the context menu registration 1.0 compatibility mode. |
protected void |
setDocumentProvider(IDocumentProvider provider)
Sets this editor's document provider. |
protected void |
setDocumentProvider(IEditorInput input)
Hook method for setting the document provider for the given input. |
protected void |
setEditorContextMenuId(String contextMenuId)
Sets this editor's context menu id. |
void |
setFocus()
Asks this part to take focus within the workbench. |
protected void |
setHelpContextId(String helpContextId)
Sets the editor's help context id. |
void |
setHighlightRange(int offset,
int length,
boolean moveCursor)
Sets the highlighted range of this text editor to the specified region. |
void |
setInput(IEditorInput input)
Sets the input to this editor. |
protected void |
setInputWithNotify(IEditorInput input)
Sets the input to this editor and fires a PROP_INPUT property change if the input has changed. |
void |
setInsertMode(ITextEditorExtension3.InsertMode newMode)
Sets the insert mode of this editor. |
protected void |
setKeyBindingScopes(String[] scopes)
Sets the key binding scopes for this editor. |
protected void |
setPreferenceStore(IPreferenceStore store)
Sets this editor's preference store. |
protected void |
setRangeIndicator(Annotation rangeIndicator)
Sets the annotation which this editor uses to represent the highlight range if the editor is configured to show the entire document. |
protected void |
setRulerContextMenuId(String contextMenuId)
Sets the ruler's context menu id. |
protected void |
setSourceViewerConfiguration(SourceViewerConfiguration configuration)
Sets this editor's source viewer configuration used to configure its internal source viewer. |
void |
setStatusField(IStatusField field,
String category)
Informs the editor which status field is to be used when posting status information in the given category. |
protected void |
setStatusLineErrorMessage(String message)
Sets the given message as error message to this editor's status line. |
protected void |
setStatusLineMessage(String message)
Sets the given message as message to this editor's status line. |
void |
showChangeInformation(boolean show)
Sets the display of quick diff information. |
void |
showHighlightRangeOnly(boolean showHighlightRangeOnly)
Configures this text editor to show only the highlighted range of the text. |
void |
showRevisionInformation(RevisionInformation info,
String quickDiffProviderId)
Shows revision information in this editor. |
boolean |
showsHighlightRangeOnly()
Returns whether this text editor is configured to show only the highlighted range of the text. |
protected void |
uninstallTabsToSpacesConverter()
Installs a tabs to spaces converter. |
protected void |
uninstallTextDragAndDrop(ISourceViewer viewer)
Uninstalls text drag and drop from the given source viewer. |
protected void |
updateContentDependentActions()
Updates all content dependent actions. |
protected void |
updateContributedRulerColumns(CompositeRuler ruler)
Adds enabled ruler contributions to the vertical ruler. |
protected void |
updateIndentPrefixes()
Updates the source viewer's indent prefixes with the values provided by the source viewer configuration. |
protected void |
updatePropertyDependentActions()
Updates all property dependent actions. |
protected void |
updateSelectionDependentActions()
Updates all selection dependent actions. |
protected void |
updateState(IEditorInput input)
Updates the state of the given editor input such as read-only flag. |
protected void |
updateStateDependentActions()
Updates all state dependent actions. |
protected void |
updateStatusField(String category)
Updates the status fields for the given category. |
protected void |
updateStatusFields()
Updates all status fields. |
boolean |
validateEditorInputState()
Validates the state of the given editor input. |
protected void |
validateState(IEditorInput input)
Validates the state of the given editor input. |
protected static int |
widgetOffset2ModelOffset(ISourceViewer viewer,
int widgetOffset)
Returns the offset of the given source viewer's document that corresponds to the given widget offset or -1 if there is no such offset. |
| Methods inherited from class org.eclipse.ui.part.EditorPart |
|---|
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setPartName |
| Methods inherited from class org.eclipse.ui.part.WorkbenchPart |
|---|
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy |
| Methods inherited from class org.eclipse.core.commands.common.EventManager |
|---|
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.eclipse.ui.IEditorPart |
|---|
getEditorInput, getEditorSite |
| Methods inherited from interface org.eclipse.ui.IWorkbenchPart |
|---|
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener |
| Methods inherited from interface org.eclipse.ui.ISaveablePart |
|---|
isSaveOnCloseNeeded |
| Field Detail |
protected static final String TAG_SELECTION_OFFSET
IMemento when saving and
restoring editor state.
saveState(IMemento),
restoreState(IMemento),
Constant Field Valuesprotected static final String TAG_SELECTION_LENGTH
public static final String PREFERENCE_FONT
JFaceResources.TEXT_FONT
"org.eclipse.jface.textfont"
public static final String PREFERENCE_COLOR_FOREGROUND
AbstractTextEditor.Color.Foreground
public static final