|
Eclipse Platform Release 3.7 |
|||||||||
| 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
public abstract class 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.
As of 3.5, contributers can contribute editor and ruler context menu actions to all subclasses of
this class by using COMMON_EDITOR_CONTEXT_MENU_ID and
COMMON_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 class |
AbstractTextEditor.SelectionProvider
Editor specific selection provider which wraps the source viewer's selection provider. |
protected static class |
AbstractTextEditor.TextEditorSavable
This text editor's savable. |
| Nested classes/interfaces inherited from interface 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 |
COMMON_EDITOR_CONTEXT_MENU_ID
Menu id used to contribute to the editor context menu of all textual editors. |
static String |
COMMON_RULER_CONTEXT_MENU_ID
Menu id used to contribute to the ruler context menu of all textual editors. |
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_HOVER_ENRICH_MODE
A named preference that controls if hovers should automatically be closed when the mouse is moved into them, or when they should be enriched. |
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_CARRIAGE_RETURN
A named preference that controls the display of Carriage Return characters. |
static String |
PREFERENCE_SHOW_ENCLOSED_IDEOGRAPHIC_SPACES
A named preference that controls the display of enclosed Ideographic Space characters. |
static String |
PREFERENCE_SHOW_ENCLOSED_SPACES
A named preference that controls the display of enclosed Space characters. |
static String |
PREFERENCE_SHOW_ENCLOSED_TABS
A named preference that controls the display of enclosed Tab characters. |
static String |
PREFERENCE_SHOW_LEADING_IDEOGRAPHIC_SPACES
A named preference that controls the display of leading Ideographic Space characters. |
static String |
PREFERENCE_SHOW_LEADING_SPACES
A named preference that controls the display of leading Space characters. |
static String |
PREFERENCE_SHOW_LEADING_TABS
A named preference that controls the display of leading Tab characters. |
static String |
PREFERENCE_SHOW_LINE_FEED
A named preference that controls the display of Line Feed characters. |
static String |
PREFERENCE_SHOW_TRAILING_IDEOGRAPHIC_SPACES
A named preference that controls the display of trailing Ideographic Space characters. |
static String |
PREFERENCE_SHOW_TRAILING_SPACES
A named preference that controls the display of trailing Space characters. |
static String |
PREFERENCE_SHOW_TRAILING_TABS
A named preference that controls the display of trailing Tab characters. |
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_WHITESPACE_CHARACTER_ALPHA_VALUE
A named preference that controls the alpha value of whitespace characters. |
static String |
PREFERENCE_WIDE_CARET
Key used to look up the caret width preference. |
protected static String |
TAG_SELECTION_HORIZONTAL_PIXEL
Tag used in the IMemento when saving and restoring the editor's horizontal pixel
value. |
protected static String |
TAG_SELECTION_LENGTH
Tag used in the IMemento when saving and restoring the editor's selection length. |
protected static String |
TAG_SELECTION_OFFSET
Tag used in the IMemento when saving and restoring the editor's selection offset. |
protected static String |
TAG_SELECTION_TOP_PIXEL
Tag used in the IMemento when saving and restoring the editor's top pixel value. |
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.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. |
protected IMenuListener |
createContextMenuListener()
Creates the listener on this editor's context menus. |
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. Subclasses may override this method (however, if they do so, they should invoke the method on their superclass to ensure that the Platform's adapter manager is consulted). |
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. 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 |
isBlockSelectionModeEnabled()
Returns true if the receiver is in block (aka column) selection mode,
false otherwise. |
protected boolean |
isBlockSelectionModeSupported()
Tells whether selection mode is supported. |
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. |
void |
setBlockSelectionMode(boolean enable)
Sets the block selection mode state of the receiver to state. |
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 |
| 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 the editor's selection offset.
saveState(IMemento),
restoreState(IMemento),
doRestoreState(IMemento),
Constant Field Valuesprotected static final String TAG_SELECTION_LENGTH
IMemento when saving and restoring the editor's selection length.
saveState(IMemento),
restoreState(IMemento),
doRestoreState(IMemento),
Constant Field Valuesprotected static final String TAG_SELECTION_TOP_PIXEL
IMemento when saving and restoring the editor's top pixel value.
saveState(IMemento),
restoreState(IMemento),
doRestoreState(IMemento),
Constant Field Valuesprotected static final String TAG_SELECTION_HORIZONTAL_PIXEL
IMemento when saving and restoring the editor's horizontal pixel
value.
saveState(IMemento),
restoreState(IMemento),
doRestoreState(IMemento),
Constant Field Valuespublic 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 String PREFERENCE_COLOR_BACKGROUND
AbstractTextEditor.Color.Background
public static final String PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT
AbstractTextEditor.Color.Foreground.SystemDefault
public static final String PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT
AbstractTextEditor.Color.Background.SystemDefault
public static final String PREFERENCE_COLOR_SELECTION_FOREGROUND
AbstractTextEditor.Color.SelectionForeground
public static final String PREFERENCE_COLOR_SELECTION_BACKGROUND
AbstractTextEditor.Color.SelectionBackground
public static final String PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT
AbstractTextEditor.Color.SelectionForeground.SystemDefault
public static final String PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT
AbstractTextEditor.Color.SelectionBackground.SystemDefault
public static final String PREFERENCE_COLOR_FIND_SCOPE
AbstractTextEditor.Color.FindScope
public static final String PREFERENCE_NAVIGATION_SMART_HOME_END
AbstractTextEditor.Navigation.SmartHomeEnd
public static final String PREFERENCE_USE_CUSTOM_CARETS
public static final String PREFERENCE_WIDE_CARET
public static final String PREFERENCE_HYPERLINKS_ENABLED
Value is of type Boolean.
public static final String PREFERENCE_HYPERLINK_KEY_MODIFIER
Value is of type String.
public static final String PREFERENCE_HYPERLINK_KEY_MODIFIER_MASK
PREFERENCE_HYPERLINK_KEY_MODIFIER
cannot be resolved to valid SWT modifier bits.
Value is of type String.
PREFERENCE_HYPERLINK_KEY_MODIFIER,
Constant Field Valuespublic static final String PREFERENCE_RULER_CONTRIBUTIONS
Value is of type String and should be read using a RulerColumnPreferenceAdapter.
public static final String PREFERENCE_SHOW_WHITESPACE_CHARACTERS
Value is of type Boolean.
The following preferences can be used for fine-grained configuration when enabled.
PREFERENCE_SHOW_LEADING_SPACESPREFERENCE_SHOW_ENCLOSED_SPACESPREFERENCE_SHOW_TRAILING_SPACESPREFERENCE_SHOW_LEADING_IDEOGRAPHIC_SPACESPREFERENCE_SHOW_ENCLOSED_IDEOGRAPHIC_SPACESPREFERENCE_SHOW_TRAILING_IDEOGRAPHIC_SPACESPREFERENCE_SHOW_LEADING_TABSPREFERENCE_SHOW_ENCLOSED_TABSPREFERENCE_SHOW_TRAILING_TABSPREFERENCE_SHOW_CARRIAGE_RETURNPREFERENCE_SHOW_LINE_FEEDPREFERENCE_WHITESPACE_CHARACTER_ALPHA_VALUE
public static final String PREFERENCE_SHOW_LEADING_SPACES
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_ENCLOSED_SPACES
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_TRAILING_SPACES
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_LEADING_IDEOGRAPHIC_SPACES
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is
true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_ENCLOSED_IDEOGRAPHIC_SPACES
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is
true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_TRAILING_IDEOGRAPHIC_SPACES
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is
true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_LEADING_TABS
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_ENCLOSED_TABS
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_TRAILING_TABS
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_CARRIAGE_RETURN
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is true.
Value is of type Boolean.
public static final String PREFERENCE_SHOW_LINE_FEED
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is true.
Value is of type Boolean.
public static final String PREFERENCE_WHITESPACE_CHARACTER_ALPHA_VALUE
PREFERENCE_SHOW_WHITESPACE_CHARACTERS is true.
Value is of type Integer.
public static final String PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED
Value is of type Boolean.
public static final String PREFERENCE_HOVER_ENRICH_MODE
Value is of type Integer and maps to the following
ITextViewerExtension8.EnrichMode:
null (don't allow moving the mouse into a hover),ITextViewerExtension8.EnrichMode.AFTER_DELAY,ITextViewerExtension8.EnrichMode.IMMEDIATELY,ITextViewerExtension8.EnrichMode.ON_CLICK.
public static final String DEFAULT_EDITOR_CONTEXT_MENU_ID
public static final String DEFAULT_RULER_CONTEXT_MENU_ID
public static final String COMMON_EDITOR_CONTEXT_MENU_ID
public static final String COMMON_RULER_CONTEXT_MENU_ID
protected static final int VERTICAL_RULER_WIDTH
protected static final AbstractTextEditor.IdMapEntry[] ACTION_MAP
protected final String fErrorLabel
| Constructor Detail |
|---|
protected AbstractTextEditor()
SourceViewerConfiguration to configure its
source viewer. This viewer does not have a range indicator installed,
nor any menu id set. By default, the created editor runs in 1.0 context
menu registration compatibility mode.
| Method Detail |
|---|
public IDocumentProvider getDocumentProvider()
ITextEditor
getDocumentProvider in interface ITextEditornull if none, e.g. after closing the editorprotected final Annotation getRangeIndicator()
null if no
range indicator is installed.
nullprotected final SourceViewerConfiguration getSourceViewerConfiguration()
null
before the editor's part has been created and after disposal.
nullprotected final ISourceViewer getSourceViewer()
null before
the editor's part has been created and after disposal.
nullprotected final IVerticalRuler getVerticalRuler()
null before
the editor's part has been created and after disposal.
nullprotected final String getEditorContextMenuId()
null before
the editor's part has been created.
nullprotected final String getRulerContextMenuId()
null before
the editor's part has been created.
nullprotected final String getHelpContextId()
null if none has
been set.
nullprotected final IPreferenceStore getPreferenceStore()
null if none has
been set.
nullprotected void setDocumentProvider(IDocumentProvider provider)
provider - the document providerprotected void setSourceViewerConfiguration(SourceViewerConfiguration configuration)
SourceViewerConfiguration.
configuration - the source viewer configuration objectprotected void setRangeIndicator(Annotation rangeIndicator)
rangeIndicator - the annotationprotected void setEditorContextMenuId(String contextMenuId)
contextMenuId - the context menu idprotected void setRulerContextMenuId(String contextMenuId)
contextMenuId - the context menu idprotected final void setCompatibilityMode(boolean compatible)
compatible - true if compatibility mode is enabledprotected void setHelpContextId(String helpContextId)
helpContextId - the help context idprotected void setKeyBindingScopes(String[] scopes)
scopes - a non-empty array of key binding scope identifiersprotected void setPreferenceStore(IPreferenceStore store)
store - the preference store or null to remove the
preference storepublic boolean isEditable()
ITextEditor
isEditable in interface ITextEditortrue if it can be edited, and false if it is read-onlypublic ISelectionProvider getSelectionProvider()
Returns null after disposal.
getSelectionProvider in interface ITextEditornull if the editor has
been disposedprotected void rememberSelection()
Subclasses should implement this method including all necessary state. This default implementation remembers the textual range only and is thus purely syntactic.
restoreSelection()protected ISelection doGetSelection()
protected void restoreSelection()
rememberSelection.
Subclasses may reimplement this method and thereby semantically adapt the
remembered selection. This default implementation just selects the
remembered textual range.
rememberSelection()protected void doSetSelection(ISelection selection)
selection - the selectionprotected IMenuListener createContextMenuListener()
protected final IMenuListener getContextMenuListener()
protected final MouseListener getRulerMouseListener()
protected final ISelectionChangedListener getSelectionChangedListener()
protected final org.eclipse.ui.texteditor.AbstractTextEditor.ICursorListener getCursorListener()
handleCursorPositionChanged().
protected final void internalInit(IWorkbenchWindow window,
IEditorSite site,
IEditorInput input)
throws PartInitException
init method of IEditorPart.
Subclasses replacing init may choose to call this method in
their implementation.
window - the workbench windowsite - the editor's siteinput - the editor input for the editor being created
PartInitException - if doSetInput(IEditorInput) fails or gets canceledIEditorPart.init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
public void init(IEditorSite site,
IEditorInput input)
throws PartInitException
IEditorPart
This method is automatically called shortly after the part is instantiated.
It marks the start of the part's lifecycle. The
IWorkbenchPart.dispose method will be called
automically at the end of the lifecycle. Clients must not call this method.
Implementors of this method must examine the editor input object type to
determine if it is understood. If not, the implementor must throw
a PartInitException
init in interface IEditorPartinit in class EditorPartsite - the editor siteinput - the editor input
PartInitException - if this editor was not initialized successfullyprotected IVerticalRuler createVerticalRuler()
protected void updateContributedRulerColumns(CompositeRuler ruler)
Clients may extend or replace.
ruler - the composite ruler to add contributions toprotected IColumnSupport createColumnSupport()
AbstractTextEditor.ColumnSupport,
e.g. by returning new ColumnSupport(this, RulerColumnRegistry.getDefault());.
Note: If you override this method to provide column support you will
also need to override createVerticalRuler() to return a CompositeRuler.
Out of the box this class does not install this support and hence this
implementation always returns null.
null if none
protected ISourceViewer createSourceViewer(Composite parent,
IVerticalRuler ruler,
int styles)
parent - the parent controlruler - the vertical rulerstyles - style bits, SWT.WRAP is currently not supported
protected void initializeDragAndDrop(ISourceViewer viewer)
viewer - the viewerpublic void createPartControl(Composite parent)
AbstractTextEditor implementation of this
IWorkbenchPart method creates the vertical ruler and
source viewer.
Subclasses may extend this method. Besides extending this method, the
behavior of createPartControl may be customized by
calling, extending or replacing the following methods:
Subclasses may supply customized implementations for some members using
the following methods before createPartControl is invoked:
createPartControl:
createPartControl:
createPartControl in interface IWorkbenchPartcreatePartControl in class WorkbenchPartparent - the parent compositeprotected void installTextDragAndDrop(ISourceViewer viewer)
viewer - the viewerprotected void uninstallTextDragAndDrop(ISourceViewer viewer)
viewer - the viewerprotected boolean isEditorInputIncludedInContextMenu()
This implementation always returns true.
true if the editor input should be consideredprotected void initializeViewerColors(ISourceViewer viewer)
viewer - the viewer to be initializedprotected void setDocumentProvider(IEditorInput input)
input - the input of this editor.
protected void doSetInput(IEditorInput input)
throws CoreException
setInput and from within a workspace
runnable from init, this method does the actual setting
of the editor input. Closes the editor if input is
null. Disconnects from any previous editor input and its
document provider and connects to the new one.
Subclasses may extend.
input - the input to be set
CoreException - if input cannot be connected to the document
providerprotected final void setInputWithNotify(IEditorInput input)
EditorPartNote that firing a property change may cause other objects to reach back and invoke methods on the editor. Care should be taken not to call this method until the editor has fully updated its internal state to reflect the new input.
setInputWithNotify in class EditorPartinput - the editor inputpublic final void setInput(IEditorInput input)
EditorPartUnlike most of the other set methods on this class, this method does not fire a property change. Clients that call this method from a subclass must ensure that they fire an IWorkbenchPartConstants.PROP_INPUT property change after calling this method but before leaving whatever public method they are in. Clients that expose this method as public API must fire the property change within their implementation of setInput.
Note that firing a property change may cause listeners to immediately reach back and call methods on this editor. Care should be taken not to fire the property change until the editor has fully updated its internal state to reflect the new input.
setInput in interface IReusableEditorsetInput in class EditorPartinput - the editor inputEditorPart.setInputWithNotify(IEditorInput)public void close(boolean save)
ITextEditor
close in interface ITextEditorsave - true if unsaved changed should be saved, and
false if unsaved changed should be discardedpublic void dispose()
AbstractTextEditor implementation of this
IWorkbenchPart method may be extended by subclasses.
Subclasses must call super.dispose().
Note that many methods may return null after the editor is
disposed.
dispose in interface IWorkbenchPartdispose in class WorkbenchPartprotected void disposeDocumentProvider()
protected boolean affectsTextPresentation(PropertyChangeEvent event)
false.
May be reimplemented by subclasses.
event - the event which should be investigated
true if the event describes a preference change affecting the editor's presentationprotected final String getFontPropertyPreferenceKey()
If the editor is defined with a symbolicFontName then this name is returned and
the font is looked up in the JFace resource registry. Otherwise,
JFaceResources.TEXT_FONT is returned and the font is looked up in this editor's
preference store.
protected void handlePreferenceStoreChanged(PropertyChangeEvent event)
Subclasses may extend.
event - the property change eventprotected IProgressMonitor getProgressMonitor()
protected void handleEditorInputChanged()
public void doSaveAs()
AbstractTextEditor implementation of this
IEditorPart method calls performSaveAs.
Subclasses may reimplement.
doSaveAs in interface ISaveablePartdoSaveAs in class EditorPartprotected void performSaveAs(IProgressMonitor progressMonitor)
progressMonitor - the progress monitor for communicating result state or nullpublic void doSave(IProgressMonitor progressMonitor)
AbstractTextEditor implementation of this
IEditorPart method may be extended by subclasses.
doSave in interface ISaveablePartdoSave in class EditorPartprogressMonitor - the progress monitor for communicating result state or nullprotected void enableSanityChecking(boolean enable)
enable - true if sanity checking should be enabled, false otherwiseprotected void safelySanityCheckState(IEditorInput input)
input - the editor input whose state is to be checkedprotected void sanityCheckState(IEditorInput input)
input - the editor input whose state is to be checkedprotected void enableStateValidation(boolean enable)
enable - true if state validation should be enabled, false otherwiseprotected void validateState(IEditorInput input)
input - the input to be validatedpublic boolean validateEditorInputState()
ITextEditorExtension2
validateEditorInputState in interface ITextEditorExtension2true if the input was validated, false otherwiseprotected void updateState(IEditorInput input)
input - the input to be validated
protected void performSave(boolean overwrite,
IProgressMonitor progressMonitor)
overwrite - indicates whether or not overwriting is allowedprogressMonitor - the monitor in which to run the operation
protected void handleExceptionOnSave(CoreException exception,
IProgressMonitor progressMonitor)
exception - the exception to handleprogressMonitor - the progress monitor
protected void openSaveErrorDialog(String title,
String message,
CoreException exception)
Subclasses can decide to override the given title and message.
title - the dialog titlemessage - the message to displayexception - the exception to handlepublic boolean isSaveAsAllowed()
AbstractTextEditor implementation of this
IEditorPart method returns false.
Subclasses may override.
isSaveAsAllowed in interface ISaveablePartisSaveAsAllowed in class EditorPartfalsepublic boolean isDirty()
ISaveablePartPROP_DIRTY.
Note: this method is called often on a part open or part activation switch, for example by actions to determine their enabled status.
isDirty in interface ISaveablePartisDirty in class EditorParttrue if the contents have been modified and need
saving, and false if they have not changed since the last
savepublic void doRevertToSaved()
AbstractTextEditor implementation of this
ITextEditor method may be extended by subclasses.
doRevertToSaved in interface ITextEditorprotected void performRevert()
Subclasses may extend.
protected void handleElementContentReplaced()
Clients may extended this method.
public void setAction(String actionID,
IAction action)
ITextEditor
setAction in interface ITextEditoractionID - the action idaction - the action, or null to clear itITextEditor.getAction(String)
public void setActionActivationCode(String actionID,
char activationCharacter,
int activationKeyCode,
int activationStateMask)
ITextEditorKeyEvent. If the activation code is triggered
and the associated action is enabled, the action is performed
and the triggering KeyEvent is considered consumed.
If the action is disabled, the KeyEvent is passed
on unmodified. Thus, action activation codes and action accelerators
differ in their model of event consumption. The key code parameter
can be -1 to indicate a wild card. The state mask
parameter can be SWT.DEFAULT to indicate a wild card.
setActionActivationCode in interface ITextEditoractionID - the action idactivationCharacter - the activation code characteractivationKeyCode - the activation code key code or -1 for wild cardactivationStateMask - the activation code state mask or SWT.DEFAULT for wild cardpublic void removeActionActivationCode(String actionID)
ITextEditor
removeActionActivationCode in interface ITextEditoractionID - the action idpublic IAction getAction(String actionID)
ITextEditor
getAction in interface ITextEditoractionID - the action id
null if noneITextEditor.setAction(String, IAction)
public void markAsSelectionDependentAction(String actionId,
boolean mark)
actionId - the action idmark - true if the action is selection dependent
public void markAsContentDependentAction(String actionId,
boolean mark)
actionId - the action idmark - true if the action is content dependent
public void markAsPropertyDependentAction(String actionId,
boolean mark)
actionId - the action idmark - true if the action is property dependent
public void markAsStateDependentAction(String actionId,
boolean mark)
actionId - the action idmark - true if the action is state dependentprotected void updateSelectionDependentActions()
protected void updateContentDependentActions()
protected void updatePropertyDependentActions()
protected void updateStateDependentActions()
protected void createNavigationActions()
org.eclipse.swt.custom.ST. Overwrites and
extends the list of these actions afterwards.
Subclasses may extend.
protected void createUndoRedoActions()
Subclasses may override or extend.
protected IOperationApprover getUndoRedoOperationApprover(IUndoContext undoContext)
IOperationApprover appropriate for approving the undo and
redo of operations that have the specified undo context.
Subclasses may override.
undoContext - the IUndoContext of operations that should be examined
by the operation approver
IOperationApprover appropriate for approving undo
and redo operations inside this editor, or null if no
approval is neededprotected void createActions()
Subclasses may extend.
protected final void addAction(IMenuManager menu,
String actionId)
menu - the menu to add the action toactionId - the id of the action to be added
protected final void addAction(IMenuManager menu,
String group,
String actionId)
menu - the menu to add the action togroup - the group in the menuactionId - the id of the action to add
protected final void addGroup(IMenuManager menu,
String existingGroup,
String newGroup)
menu - the menu to add the new group toexistingGroup - the group after which to insert the new groupnewGroup - the new groupprotected void rulerContextMenuAboutToShow(IMenuManager menu)
Subclasses may extend to add other actions.
menu - the menuprotected void editorContextMenuAboutToShow(IMenuManager menu)
Subclasses may extend to add other actions.
menu - the menuprotected IStatusLineManager getStatusLineManager()
public Object getAdapter(Class required)
WorkbenchPartnull if
no such object can be found.
Subclasses may override this method (however, if they do so, they
should invoke the method on their superclass to ensure that the
Platform's adapter manager is consulted).
getAdapter in interface IAdaptablegetAdapter in class WorkbenchPartrequired - the adapter class to look up
null if this object does not
have an adapter for the given classpublic void setFocus()
IWorkbenchPart
Clients should not call this method (the workbench calls this method at
appropriate times). To have the workbench activate a part, use
IWorkbenchPage.activate(IWorkbenchPart) instead.
setFocus in interface IWorkbenchPartsetFocus in class WorkbenchPartpublic boolean showsHighlightRangeOnly()
ITextEditor
showsHighlightRangeOnly in interface ITextEditortrue if only the highlighted range is shown, and
false if this editor shows the entire text of the documentITextEditor.showHighlightRangeOnly(boolean)public void showHighlightRangeOnly(boolean showHighlightRangeOnly)
ITextEditor
showHighlightRangeOnly in interface ITextEditorshowHighlightRangeOnly - true if only the highlighted
range is shown, and false if this editor shows the entire
text of the documentITextEditor.showsHighlightRangeOnly()
public void setHighlightRange(int offset,
int length,
boolean moveCursor)
ITextEditor
setHighlightRange in interface ITextEditoroffset - the offset of the highlighted rangelength - the length of the highlighted rangemoveCursor - true if the cursor should be moved to the start of the
highlighted range, and false to leave the cursor unaffected - has no
effect if the range to highlight is already the highlighted oneITextEditor.getHighlightRange()public IRegion getHighlightRange()
ITextEditor
getHighlightRange in interface ITextEditorITextEditor.setHighlightRange(int, int, boolean)public void resetHighlightRange()
ITextEditor
resetHighlightRange in interface ITextEditor
protected void adjustHighlightRange(int offset,
int length)
Subclasses may re-implement this method.
offset - the offset of the range which at least should be highlightedlength - the length of the range which at least should be highlighted
public void selectAndReveal(int start,
int length)
ITextEditor
selectAndReveal in interface ITextEditorstart - the offset of the selectionlength - the length of the selection
protected void selectAndReveal(int selectionStart,
int selectionLength,
int revealStart,
int revealLength)
selectionStart - the offset of the selectionselectionLength - the length of the selectionrevealStart - the offset of the revealed rangerevealLength - the length of the revealed rangepublic INavigationLocation createEmptyNavigationLocation()
INavigationLocationProviderrestoreState
will be sent to the location to restore its state.
createEmptyNavigationLocation in interface INavigationLocationProviderpublic INavigationLocation createNavigationLocation()
INavigationLocationProvider
createNavigationLocation in interface INavigationLocationProviderprotected void markInNavigationHistory()
protected void editorSaved()
protected void firePropertyChange(int property)
WorkbenchPart
firePropertyChange in class WorkbenchPartproperty - the id of the property that changed
public void setStatusField(IStatusField field,
String category)
ITextEditorExtension
setStatusField in interface ITextEditorExtensionfield - the status field to be usedcategory - the status information categoryITextEditorActionConstantsprotected IStatusField getStatusField(String category)
category - the status category
protected boolean isInInsertMode()
true if in insert mode, false for overwrite modepublic ITextEditorExtension3.InsertMode getInsertMode()
ITextEditorExtension3
getInsertMode in interface ITextEditorExtension3public void setInsertMode(ITextEditorExtension3.InsertMode newMode)
ITextEditorExtension3
setInsertMode in interface ITextEditorExtension3newMode - the new insert modeprotected List getLegalInsertModes()
protected void configureInsertMode(ITextEditorExtension3.InsertMode mode,
boolean legal)
mode - the insert mode to be configuredlegal - true if the given mode is legal, false otherwiseprotected void enableOverwriteMode(boolean enable)
enable - true to enable new overwrite mode,
false to disableprotected void handleInsertModeChanged()
protected void handleCursorPositionChanged()
protected void updateStatusField(String category)
category - the categoryprotected void updateStatusFields()
protected String getCursorPosition()
public boolean isEditorInputReadOnly()
ITextEditorExtensionisEditable as it talks about the
editor input, i.e. the domain element, and not about the editor
document.
isEditorInputReadOnly in interface ITextEditorExtensiontrue if the editor input is read-onlypublic boolean isEditorInputModifiable()
ITextEditorExtension2ITextEditorExtension.isEditorInputReadOnly as read-only elements may be modifiable and
writable elements may not be modifiable. If the given element is not connected to this document
provider, the result is undefined. Document providers are allowed to use a cache to answer this
question, i.e. there can be a difference between the "real" state of the element and the return
value.
isEditorInputModifiable in interface ITextEditorExtension2true if the editor input is modifiablepublic void addRulerContextMenuListener(IMenuListener listener)
ITextEditorExtension
addRulerContextMenuListener in interface ITextEditorExtensionlistener - the listenerpublic void removeRulerContextMenuListener(IMenuListener listener)
ITextEditorExtension
removeRulerContextMenuListener in interface ITextEditorExtensionlistener - the listener
protected boolean canHandleMove(IEditorInput originalElement,
IEditorInput movedElement)
true. Subclasses may reimplement.
originalElement - the original elementmovedElement - the moved element
protected static final int widgetOffset2ModelOffset(ISourceViewer viewer,
int widgetOffset)
-1 if there is no such offset.
viewer - the source viewerwidgetOffset - the widget offset
-1
protected static final int modelOffset2WidgetOffset(ISourceViewer viewer,
int modelOffset)
-1 if there is no such offset.
viewer - the source viewermodelOffset - the model offset
-1protected static final IRegion getCoverage(ISourceViewer viewer)
viewer - the viewer go return the coverage for
protected static final boolean isVisible(ISourceViewer viewer,
int offset,
int length)
viewer - the source vieweroffset - the offset of the regionlength - the length of the region
true if visiblepublic void showChangeInformation(boolean show)
ITextEditorExtension3
showChangeInformation in interface ITextEditorExtension3show - true if quick diff information should be shown, false otherwisepublic boolean isChangeInformationShowing()
ITextEditorExtension3
isChangeInformationShowing in interface ITextEditorExtension3true if quick diff info is displayed, false otherwiseprotected void setStatusLineErrorMessage(String message)
message - message to be setprotected void setStatusLineMessage(String message)
message - message to be setpublic Annotation gotoAnnotation(boolean forward)
gotoAnnotation in interface ITextEditorExtension4forward - true if search direction is forward, false if backward
null if noneisNavigationTarget(Annotation),
findAnnotation(int, int, boolean, Position)
protected Annotation findAnnotation(int offset,
int length,
boolean forward,
Position annotationPosition)
offset - the region offsetlength - the region lengthforward - true for forwards, false for backwardannotationPosition - the position of the found annotation
protected boolean isNavigationTarget(Annotation annotation)
Per default every annotation is a target.
annotation - the annotation
true if this is a target, false otherwise
public void showRevisionInformation(RevisionInformation info,
String quickDiffProviderId)
ITextEditorExtension4
showRevisionInformation in interface ITextEditorExtension4info - the revision information to displayquickDiffProviderId - the quick diff provider that matches the source of the revision
informationpublic void restoreState(IMemento memento)
IPersistableEditor
restoreState in interface IPersistableEditormemento - the saved state for this editor. May be null.public void saveState(IMemento memento)
IPersistable
saveState in interface IPersistablememento - the storage area for object's stateprotected boolean containsSavedState(IMemento memento)
Subclasses may extend or override this method.
memento - the saved state of this editor
true if the given memento contains saved stateprotected void doRestoreState(IMemento memento)
Subclasses may extend or override this method.
memento - the saved state of this editorpublic Saveable[] getSaveables()
ISaveablesSourceISaveablesLifecycleListener.handleLifecycleEvent(SaveablesLifecycleEvent).
Additions of saveables to the list of saveables of this part are
announced using an event of type
SaveablesLifecycleEvent.POST_OPEN. Removals are announced in a
two-stage process, first using an event of type
SaveablesLifecycleEvent.PRE_CLOSE followed by an event of type
SaveablesLifecycleEvent.POST_CLOSE. Since firing the
PRE_CLOSE event may trigger prompts to save dirty
saveables, the cancellation status of the event must be checked by the
part after the notification. When removing only non-dirty saveables,
POST_CLOSE notification is sufficient.
The listener is obtained from the part site by calling
partSite.getService(ISaveablesLifecycleListener.class).
The part must not notify from its initialization methods (e.g. init
or createPartControl), or from its dispose method. Parts that
implement IReusableEditor must notify when their input is changed
through IReusableEditor.setInput(IEditorInput).
getSaveables in interface ISaveablesSourceISaveablesLifecycleListenerpublic Saveable[] getActiveSaveables()
ISaveablesSourceCertain workbench actions, such as Save, target only the active saveables in the active part. For example, the active saveables could be determined based on the current selection in the part.
getActiveSaveables in interface ISaveablesSourceprotected void installTabsToSpacesConverter()
Subclasses may extend or override this method.
protected void uninstallTabsToSpacesConverter()
Subclasses may extend or override this method.
protected boolean isTabsToSpacesConversionEnabled()
Subclasses may override this method.
true if tabs should be converted to spacesprotected final void updateIndentPrefixes()
protected boolean isBlockSelectionModeSupported()
By default block selection mode is supported. Subclasses may override this method to disable it.
true if block selection mode is supported, false otherwisepublic final boolean isBlockSelectionModeEnabled()
ITextEditorExtension5true if the receiver is in block (aka column) selection mode,
false otherwise.
isBlockSelectionModeEnabled in interface ITextEditorExtension5ITextEditorExtension5.isBlockSelectionModeEnabled()public void setBlockSelectionMode(boolean enable)
ITextEditorExtension5state. Nothing happens
if the receiver already is in the requested state.
setBlockSelectionMode in interface ITextEditorExtension5enable - the new block selection stateITextEditorExtension5.setBlockSelectionMode(boolean)
|
Eclipse Platform Release 3.7 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.