|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--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 arguments 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 arguments 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
.
TextEditor
Field Summary | |
protected static org.eclipse.ui.texteditor.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 Value: AbstractTextEditor.Color.Background |
static String |
PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT
Key used to look up background color system default preference Value: AbstractTextEditor.Color.Background.SystemDefault |
static String |
PREFERENCE_COLOR_FIND_SCOPE
Key used to look up find scope background color preference Value: AbstractTextEditor.Color.FindScope |
static String |
PREFERENCE_COLOR_FOREGROUND
Key used to look up foreground color preference Value: AbstractTextEditor.Color.Foreground |
static String |
PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT
Key used to look up foreground color system default preference Value: AbstractTextEditor.Color.Foreground.SystemDefault |
static String |
PREFERENCE_FONT
Key used to look up font preference |
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 |
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 wether 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 |
createActions()
Creates this editor's standard actions and connects them with the global workbench actions. |
protected void |
createNavigationActions()
Creates this editor's standard navigation actions. |
void |
createPartControl(Composite parent)
The AbstractTextEditor implementation of this
IWorkbenchPart method creates the vertical ruler and
source viewer. |
protected WorkspaceModifyOperation |
createSaveOperation(boolean overwrite)
Creates a workspace modify operation which saves the content of the editor to the editor's input element. |
protected ISourceViewer |
createSourceViewer(Composite parent,
IVerticalRuler ruler,
int styles)
Creates the source viewer to be used by this editor. |
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. |
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 oerformSaveAs . |
protected void |
doSetInput(IEditorInput input)
Internal setInput method. |
protected void |
editorContextMenuAboutToShow(IMenuManager menu)
Sets up this editor's context menu before it is made visible. |
protected void |
enableSanityChecking(boolean enable)
Enables/Disabled sanity checking. |
protected void |
firePropertyChange(int property)
Fires a property changed event. |
IAction |
getAction(String actionID)
Returns the action installed under the given action id. |
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 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 |
getHelpContextId()
Returns the editor's help context id. |
IRegion |
getHighlightRange()
Returns the highlighted range of this text editor. |
protected IPreferenceStore |
getPreferenceStore()
Returns this editor's preference store. |
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. |
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. |
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 IVerticalRuler |
getVerticalRuler()
Returns the editor's vertical ruler. |
void |
gotoMarker(IMarker marker)
If the editor can be saved all marker ranges have been changed according to the text manipulations. |
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 |
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. |
boolean |
isDirty()
Returns whether the contents of this editor have changed since the last save operation. |
boolean |
isEditable()
Returns whether the text in this text editor can be changed by the user. |
boolean |
isEditorInputReadOnly()
Returns whether the editor's input is read-only. |
protected boolean |
isInInsertMode()
Returns whether this editor is in overwrite or insert mode. |
boolean |
isSaveAsAllowed()
The AbstractTextEditor implementation of this
IEditorPart method returns false . |
boolean |
isSaveOnCloseNeeded()
Returns whether the contents of this editor should be saved when the editor is closed. |
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 |
performSaveAs(IProgressMonitor progressMonitor)
Performs a save as and reports the result state back to the given progress monitor. |
protected void |
performSaveOperation(WorkspaceModifyOperation operation,
IProgressMonitor progressMonitor)
Performs the given save operation and handles errors appropriatly. |
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 . |
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 |
selectAndReveal(int start,
int length)
Selects and reveals the specified range 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 |
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 start,
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 |
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. |
void |
showHighlightRangeOnly(boolean showHighlightRangeOnly)
Configures this text editor to show only the highlighted range of the text. |
boolean |
showsHighlightRangeOnly()
Returns whether this text editor is configured to show only the highlighted range of the text. |
protected void |
updateContentDependentActions()
Updates all content dependent actions. |
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 etc. |
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. |
protected void |
validateState(IEditorInput input)
Validates the state of the given editor input. |
Methods inherited from class org.eclipse.ui.part.EditorPart |
getEditorInput, getEditorSite, getTitleToolTip |
Methods inherited from class org.eclipse.ui.part.WorkbenchPart |
addPropertyListener, getConfigurationElement, getDefaultImage, getSite, getTitle, getTitleImage, removePropertyListener, setInitializationData, setSite, setTitle, setTitleImage, setTitleToolTip |
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 |
Field Detail |
public static final String PREFERENCE_FONT
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_FIND_SCOPE
AbstractTextEditor.Color.FindScope
public static final String DEFAULT_EDITOR_CONTEXT_MENU_ID
public static final String DEFAULT_RULER_CONTEXT_MENU_ID
protected static final int VERTICAL_RULER_WIDTH
protected static final org.eclipse.ui.texteditor.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 ITextEditor
protected final Annotation getRangeIndicator()
protected final SourceViewerConfiguration getSourceViewerConfiguration()
protected final ISourceViewer getSourceViewer()
protected final IVerticalRuler getVerticalRuler()
protected final String getEditorContextMenuId()
protected final String getRulerContextMenuId()
protected final String getHelpContextId()
protected final IPreferenceStore getPreferenceStore()
protected void setDocumentProvider(IDocumentProvider provider)
provider
- the document providerprotected void setSourceViewerConfiguration(SourceViewerConfiguration configuration)
SourceViewerConfiguration
.
configuration
- the source viewer configuration objectprotected void setRangeIndicator(Annotation rangeIndicator)
DefaultRangeIndicator
.
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 setPreferenceStore(IPreferenceStore store)
store
- the new preference storepublic boolean isEditable()
ITextEditor
isEditable
in interface ITextEditor
true
if it can be edited, and false
if it is read-onlypublic ISelectionProvider getSelectionProvider()
ITextEditor
getSelectionProvider
in interface ITextEditor
protected 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 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 final IMenuListener getContextMenuListener()
protected final MouseListener getRulerMouseListener()
protected final ISelectionChangedListener getSelectionChangedListener()
protected final org.eclipse.ui.texteditor.AbstractTextEditor.ICursorListener getCursorListener()
handleCursorPositionChanged()
.
public void init(IEditorSite site, IEditorInput input) throws PartInitException
IEditorPart
This method is automatically called shortly after part construction; 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 IEditorPart
init
in class EditorPart
site
- the editor siteinput
- the editor input
PartInitException
- if this editor was not initialized successfullyprotected IVerticalRuler createVerticalRuler()
protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles)
parent
- the parent controlruler
- the vertical rulerstyles
- style bits
public void createPartControl(Composite parent)
AbstractTextEditor
implementation of this
IWorkbenchPart
method creates the vertical ruler and
source viewer. Subclasses may extend.
createPartControl
in interface IWorkbenchPart
createPartControl
in class WorkbenchPart
parent
- the parent controlprotected void doSetInput(IEditorInput input) throws CoreException
setInput
method.
input
- the input to be set
CoreException
- if input cannot be connected to the document providerpublic final void setInput(IEditorInput input)
EditorPart
setInput
in interface IReusableEditor
setInput
in class EditorPart
EditorPart#setInput
public void close(boolean save)
ITextEditor
close
in interface ITextEditor
save
- 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()
.
dispose
in interface IWorkbenchPart
dispose
in class WorkbenchPart
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 void handlePreferenceStoreChanged(PropertyChangeEvent event)
event
- the property change eventprotected void handleEditorInputChanged()
public void doSaveAs()
AbstractTextEditor
implementation of this
IEditorPart
method calls oerformSaveAs
.
Subclasses may reimplement.
doSaveAs
in interface IEditorPart
doSaveAs
in class EditorPart
protected void performSaveAs(IProgressMonitor progressMonitor)
progressMonitor
- the progress monitor for communicating result state or null
public void doSave(IProgressMonitor progressMonitor)
AbstractTextEditor
implementation of this
IEditorPart
method may be extended by subclasses.
doSave
in interface IEditorPart
doSave
in class EditorPart
progressMonitor
- the progress monitorprotected void enableSanityChecking(boolean enable)
enable
- true
if santity 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 validateState(IEditorInput input)
input
- the input to be validatedprotected void updateState(IEditorInput input)
input
- the input to be validatedprotected WorkspaceModifyOperation createSaveOperation(boolean overwrite)
overwrite
indicates whether
the editor input element may be overwritten if necessary. Clients may
reimplement this method.
overwrite
- indicates whether or not overwrititng is allowed
protected void performSaveOperation(WorkspaceModifyOperation operation, IProgressMonitor progressMonitor)
operation
- the operation to be performedprogressMonitor
- the monitor in which to run the operationprotected void handleExceptionOnSave(CoreException exception, IProgressMonitor progressMonitor)
exception
- the exception to handleprogressMonitor
- the progress monitorpublic boolean isSaveAsAllowed()
AbstractTextEditor
implementation of this
IEditorPart
method returns false
. Subclasses
may override.
isSaveAsAllowed
in interface IEditorPart
isSaveAsAllowed
in class EditorPart
true
if "save as" is supported, and false
if "save as" is not supportedpublic boolean isSaveOnCloseNeeded()
IEditorPart
isSaveOnCloseNeeded
in interface IEditorPart
isSaveOnCloseNeeded
in class EditorPart
true
if the contents of the editor should be saved on
close, and false
if the contents are expendablepublic boolean isDirty()
IEditorPart
PROP_DIRTY
.
isDirty
in interface IEditorPart
isDirty
in class EditorPart
true
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 ITextEditor
public void setAction(String actionID, IAction action)
ITextEditor
setAction
in interface ITextEditor
action
- the action, or null
to clear itITextEditor.getAction(java.lang.String)
public void setActionActivationCode(String actionID, char activationCharacter, int activationKeyCode, int activationStateMask)
ITextEditor
KeyEvent
. 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.
setActionActivationCode
in interface ITextEditor
actionID
- the action idpublic void removeActionActivationCode(String actionID)
ITextEditor
removeActionActivationCode
in interface ITextEditor
actionID
- the action idpublic IAction getAction(String actionID)
ITextEditor
getAction
in interface ITextEditor
actionID
- the action id
null
if noneITextEditor.setAction(java.lang.String, org.eclipse.jface.action.IAction)
public void markAsSelectionDependentAction(String actionId, boolean mark)
actionId
- the action idmark
- true
if the action is selection dependentpublic void markAsContentDependentAction(String actionId, boolean mark)
actionId
- the action idmark
- true
if the action is content dependentpublic void markAsPropertyDependentAction(String actionId, boolean mark)
actionId
- the action idmark
- true
if the action is property dependentpublic 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()
Subclasses may extend.
protected 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 addedprotected 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 addprotected 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 menupublic Object getAdapter(Class required)
IAdaptable
null
if
no such object can be found.
getAdapter
in interface IAdaptable
getAdapter
in class WorkbenchPart
required
- 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).
setFocus
in interface IWorkbenchPart
setFocus
in class WorkbenchPart
public void gotoMarker(IMarker marker)
gotoMarker
in interface IEditorPart
gotoMarker
in class EditorPart
marker
- the marker to go toEditorPart.gotoMarker(org.eclipse.core.resources.IMarker)
public boolean showsHighlightRangeOnly()
ITextEditor
showsHighlightRangeOnly
in interface ITextEditor
true
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 ITextEditor
showHighlightRangeOnly
- 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 start, int length, boolean moveCursor)
ITextEditor
setHighlightRange
in interface ITextEditor
start
- 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 unaffectedITextEditor.getHighlightRange()
public IRegion getHighlightRange()
ITextEditor
getHighlightRange
in interface ITextEditor
ITextEditor.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 highlightedpublic void selectAndReveal(int start, int length)
ITextEditor
selectAndReveal
in interface ITextEditor
start
- the offset of the selectionlength
- the length of the selectionprotected void firePropertyChange(int property)
WorkbenchPart
firePropertyChange
in class WorkbenchPart
property
- the id of the property that changedpublic void setStatusField(IStatusField field, String category)
ITextEditorExtension
setStatusField
in interface ITextEditorExtension
field
- the status field to be usedcategory
- the status information categoryITextEditorActionConstants
protected IStatusField getStatusField(String category)
category
- the status category
protected boolean isInInsertMode()
true
if in insert mode, false
for overwrite modeprotected void handleCursorPositionChanged()
protected void handleInsertModeChanged()
protected void updateStatusField(String category)
category
- protected void updateStatusFields()
protected String getCursorPosition()
public boolean isEditorInputReadOnly()
ITextEditorExtension
isEditable
as it talks about the
editor input, i.e. the domain element, and not about the editor
document.
isEditorInputReadOnly
in interface ITextEditorExtension
true
if the editor input is read-onlypublic void addRulerContextMenuListener(IMenuListener listener)
ITextEditorExtension
addRulerContextMenuListener
in interface ITextEditorExtension
listener
- the listenerpublic void removeRulerContextMenuListener(IMenuListener listener)
ITextEditorExtension
removeRulerContextMenuListener
in interface ITextEditorExtension
listener
- the listenerprotected boolean canHandleMove(IEditorInput originalElement, IEditorInput movedElement)
true
. Subclasses may reimplement.
originalElement
- the original elementmovedElement
- the moved element
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |