Class TextEditor
- All Implemented Interfaces:
IAdaptable
,IExecutableExtension
,IEditorPart
,INavigationLocationProvider
,IPersistable
,IPersistableEditor
,IReusableEditor
,ISaveablePart
,ISaveablesSource
,IWorkbenchPart
,IWorkbenchPart2
,IWorkbenchPart3
,IWorkbenchPartOrientation
,ITextEditor
,ITextEditorExtension
,ITextEditorExtension2
,ITextEditorExtension3
,ITextEditorExtension4
,ITextEditorExtension5
,ITextEditorExtension6
This editor has id "org.eclipse.ui.DefaultTextEditor
".
The editor's context menu has id #TextEditorContext
. The editor's ruler context menu
has id #TextRulerContext
.
The workbench will automatically instantiate this class when the default editor is needed for a workbench window.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
AbstractTextEditor.AbstractSelectionChangedListener, AbstractTextEditor.ColumnSupport, AbstractTextEditor.IdMapEntry, AbstractTextEditor.LineEndAction, AbstractTextEditor.LineStartAction, AbstractTextEditor.SelectionProvider, AbstractTextEditor.TextEditorSavable
Nested classes/interfaces inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3
ITextEditorExtension3.InsertMode
-
Field Summary
Modifier and TypeFieldDescriptionprotected DefaultEncodingSupport
The encoding support for the editor.Fields inherited from class org.eclipse.ui.texteditor.AbstractDecoratedTextEditor
DEFAULT_OVERVIEW_RULER_CONTEXT_MENU_ID, fAnnotationAccess, fIsUpdatingMarkerViews, fLineNumberRulerColumn, fOverviewRuler, fSourceViewerDecorationSupport
Fields inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
ACTION_MAP, COMMON_EDITOR_CONTEXT_MENU_ID, COMMON_RULER_CONTEXT_MENU_ID, DEFAULT_EDITOR_CONTEXT_MENU_ID, DEFAULT_RULER_CONTEXT_MENU_ID, fErrorLabel, PREFERENCE_COLOR_BACKGROUND, PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_FIND_SCOPE, PREFERENCE_COLOR_FOREGROUND, PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_SELECTION_BACKGROUND, PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_SELECTION_FOREGROUND, PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT, PREFERENCE_FONT, PREFERENCE_HOVER_ENRICH_MODE, PREFERENCE_HYPERLINK_KEY_MODIFIER, PREFERENCE_HYPERLINK_KEY_MODIFIER_MASK, PREFERENCE_HYPERLINKS_ENABLED, PREFERENCE_NAVIGATION_SMART_HOME_END, PREFERENCE_RULER_CONTRIBUTIONS, PREFERENCE_SHOW_CARET_OFFSET, PREFERENCE_SHOW_CARRIAGE_RETURN, PREFERENCE_SHOW_ENCLOSED_IDEOGRAPHIC_SPACES, PREFERENCE_SHOW_ENCLOSED_SPACES, PREFERENCE_SHOW_ENCLOSED_TABS, PREFERENCE_SHOW_LEADING_IDEOGRAPHIC_SPACES, PREFERENCE_SHOW_LEADING_SPACES, PREFERENCE_SHOW_LEADING_TABS, PREFERENCE_SHOW_LINE_FEED, PREFERENCE_SHOW_SELECTION_SIZE, PREFERENCE_SHOW_TRAILING_IDEOGRAPHIC_SPACES, PREFERENCE_SHOW_TRAILING_SPACES, PREFERENCE_SHOW_TRAILING_TABS, PREFERENCE_SHOW_WHITESPACE_CHARACTERS, PREFERENCE_TEXT_DRAG_AND_DROP_ENABLED, PREFERENCE_USE_CUSTOM_CARETS, PREFERENCE_WHITESPACE_CHARACTER_ALPHA_VALUE, PREFERENCE_WIDE_CARET, PREFERENCE_WORD_WRAP_ENABLED, TAG_SELECTION_HORIZONTAL_PIXEL, TAG_SELECTION_LENGTH, TAG_SELECTION_OFFSET, TAG_SELECTION_TOP_PIXEL, VERTICAL_RULER_WIDTH
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
Fields inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3
INSERT, SMART_INSERT
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Creates this editor's standard actions and connects them with the global workbench actions.void
dispose()
TheAbstractTextEditor
implementation of thisIWorkbenchPart
method may be extended by subclasses.protected void
doSetInput
(IEditorInput input) Called directly fromsetInput
and from within a workspace runnable frominit
, this method does the actual setting of the editor input.protected void
Sets up this editor's context menu before it is made visible.<T> T
getAdapter
(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.protected String
getStatusBanner
(IStatus status) Returns a banner for the given status.protected String
getStatusHeader
(IStatus status) Returns a header for the given statusprotected String
getStatusMessage
(IStatus status) Returns a message for the given status.protected void
Handles a property change event describing a change of the editor's preference store and updates the preference related editor properties.protected void
Initializes this editor.protected void
Installs the encoding support on the given text editor.boolean
TheAbstractTextEditor
implementation of thisIEditorPart
method returnsfalse
.protected void
Updates all property dependent actions.Methods inherited from class org.eclipse.ui.texteditor.AbstractDecoratedTextEditor
collectContextMenuPreferencePages, collectOverviewRulerMenuPreferencePages, collectRulerMenuPreferencePages, configureSourceViewerDecorationSupport, createAnnotationAccess, createAnnotationRulerColumn, createChangeHover, createChangeRulerColumn, createColumnSupport, createCompositeRuler, createContextMenuListener, createLineNumberRulerColumn, createOverviewRuler, createOverviewRulerContextMenu, createPartControl, createShowInTargetList, createSourceViewer, createStatusControl, createVerticalRuler, disposeDocumentProvider, getAnnotationAccess, getAnnotationPreferenceLookup, getAnnotationPreferences, getDocumentProvider, getOverviewRuler, getOverviewRulerContextMenuId, getSharedColors, getSourceViewerDecorationSupport, getUndoRedoOperationApprover, gotoAnnotation, gotoMarker, handleEditorInputChanged, hideOverviewRuler, initializeKeyBindingScopes, initializeLineNumberRulerColumn, isChangeInformationShowing, isEditable, isErrorStatus, isLineNumberRulerVisible, isNavigationTarget, isOverviewRulerVisible, isOverwriteModeEnabled, isPrefQuickDiffAlwaysOn, isSpacesAsTabsDeletionEnabled, isTabsToSpacesConversionEnabled, openSaveErrorDialog, overviewRulerContextMenuAboutToShow, performSaveAs, rulerContextMenuAboutToShow, setDocumentProvider, setOverviewRulerContextMenuId, showChangeInformation, showOverviewRuler, showRevisionInformation, updateMarkerViews, validateEditorInputState
Methods inherited from class org.eclipse.ui.texteditor.StatusTextEditor
doRevertToSaved, handleElementContentReplaced, sanityCheckState, setFocus, updatePartControl, updateStatusField
Methods inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
addAction, addAction, addGroup, addRulerContextMenuListener, adjustHighlightRange, affectsTextPresentation, canHandleMove, close, configureInsertMode, containsSavedState, createEmptyNavigationLocation, createNavigationActions, createNavigationLocation, createUndoRedoActions, doGetSelection, doRestoreState, doSave, doSaveAs, doSetSelection, editorSaved, enableOverwriteMode, enableSanityChecking, enableStateValidation, findAnnotation, firePropertyChange, getAction, getActiveSaveables, getContextMenuListener, getCoverage, getCursorListener, getCursorPosition, getEditorContextMenuId, getFontPropertyPreferenceKey, getHelpContextId, getHighlightRange, getInitialWordWrapStatus, getInsertMode, getLegalInsertModes, getPreferenceStore, getProgressMonitor, getRangeIndicator, getRulerContextMenuId, getRulerMouseListener, getSaveables, getSelectionChangedListener, getSelectionProvider, getSourceViewer, getSourceViewerConfiguration, getStatusField, getStatusLineManager, getVerticalRuler, handleCursorPositionChanged, handleExceptionOnSave, handleInsertModeChanged, init, initializeDragAndDrop, initializeViewerColors, installCodeMiningProviders, installTabsToSpacesConverter, installTextDragAndDrop, internalInit, isBlockSelectionModeEnabled, isBlockSelectionModeSupported, isDirty, isEditorInputIncludedInContextMenu, isEditorInputModifiable, isEditorInputReadOnly, isInInsertMode, isVisible, isWordWrapEnabled, isWordWrapSupported, markAsContentDependentAction, markAsPropertyDependentAction, markAsSelectionDependentAction, markAsStateDependentAction, markInNavigationHistory, modelOffset2WidgetOffset, performRevert, performSave, rememberSelection, removeActionActivationCode, removeRulerContextMenuListener, resetHighlightRange, restoreSelection, restoreState, safelySanityCheckState, saveState, selectAndReveal, selectAndReveal, setAction, setActionActivationCode, setBlockSelectionMode, setCompatibilityMode, setDocumentProvider, setEditorContextMenuId, setHelpContextId, setHighlightRange, setInput, setInputWithNotify, setInsertMode, setKeyBindingScopes, setPreferenceStore, setRangeIndicator, setRulerContextMenuId, setSourceViewerConfiguration, setStatusField, setStatusLineErrorMessage, setStatusLineMessage, setWordWrap, showHighlightRangeOnly, showsHighlightRangeOnly, uninstallTabsToSpacesConverter, uninstallTextDragAndDrop, updateContentDependentActions, updateContributedRulerColumns, updateIndentPrefixes, updateSelectionDependentActions, updateState, updateStateDependentActions, updateStatusFields, validateState, widgetOffset2ModelOffset
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.ISaveablePart
isSaveOnCloseNeeded
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
-
Field Details
-
fEncodingSupport
The encoding support for the editor.- Since:
- 2.0
-
-
Constructor Details
-
TextEditor
public TextEditor()Creates a new text editor.
-
-
Method Details
-
initializeEditor
protected void initializeEditor()Initializes this editor. Subclasses may re-implement. If sub-classes do not change the contract, this method should not be extended, i.e. do not callsuper.initializeEditor()
in order to avoid the temporary creation of objects that are immediately overwritten by subclasses. This method configures the editor but does not define aSourceViewerConfiguration
. When only interested in providing a custom source viewer configuration, subclasses may extend this method.- Overrides:
initializeEditor
in classAbstractDecoratedTextEditor
-
dispose
public void dispose()Description copied from class:AbstractTextEditor
TheAbstractTextEditor
implementation of thisIWorkbenchPart
method may be extended by subclasses. Subclasses must callsuper.dispose()
.Note that many methods may return
null
after the editor is disposed.- Specified by:
dispose
in interfaceIWorkbenchPart
- Overrides:
dispose
in classAbstractDecoratedTextEditor
-
installEncodingSupport
protected void installEncodingSupport()Installs the encoding support on the given text editor.Subclasses may override to install their own encoding support or to disable the default encoding support.
- Since:
- 2.1
-
isSaveAsAllowed
public boolean isSaveAsAllowed()Description copied from class:AbstractTextEditor
TheAbstractTextEditor
implementation of thisIEditorPart
method returnsfalse
. Subclasses may override.- Specified by:
isSaveAsAllowed
in interfaceISaveablePart
- Overrides:
isSaveAsAllowed
in classAbstractTextEditor
- Returns:
false
-
createActions
protected void createActions()Description copied from class:AbstractTextEditor
Creates this editor's standard actions and connects them with the global workbench actions.Subclasses may extend.
- Overrides:
createActions
in classAbstractDecoratedTextEditor
-
getStatusHeader
Description copied from class:StatusTextEditor
Returns a header for the given status- Overrides:
getStatusHeader
in classStatusTextEditor
- Parameters:
status
- the status whose message is returned- Returns:
- a header for the given status
-
getStatusBanner
Description copied from class:StatusTextEditor
Returns a banner for the given status.- Overrides:
getStatusBanner
in classStatusTextEditor
- Parameters:
status
- the status whose message is returned- Returns:
- a banner for the given status
-
getStatusMessage
Description copied from class:StatusTextEditor
Returns a message for the given status.- Overrides:
getStatusMessage
in classStatusTextEditor
- Parameters:
status
- the status whose message is returned- Returns:
- a message for the given status
-
doSetInput
Description copied from class:AbstractTextEditor
Called directly fromsetInput
and from within a workspace runnable frominit
, this method does the actual setting of the editor input. Closes the editor ifinput
isnull
. Disconnects from any previous editor input and its document provider and connects to the new one.Subclasses may extend.
- Overrides:
doSetInput
in classAbstractDecoratedTextEditor
- Parameters:
input
- the input to be set- Throws:
CoreException
- if input cannot be connected to the document provider
-
getAdapter
Description copied from class:WorkbenchPart
Returns an object which is an instance of the given class associated with this object. Returnsnull
if no such object can be found.Clients may implement this method but should generally call
Adapters.adapt(Object, Class, boolean)
rather than invoking it directly. 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).- Specified by:
getAdapter
in interfaceIAdaptable
- Overrides:
getAdapter
in classAbstractDecoratedTextEditor
- Type Parameters:
T
- the class type- Parameters:
adapter
- the adapter class to look up- Returns:
- a object of the given class, or
null
if this object does not have an adapter for the given class
-
updatePropertyDependentActions
protected void updatePropertyDependentActions()Description copied from class:AbstractTextEditor
Updates all property dependent actions.- Overrides:
updatePropertyDependentActions
in classAbstractTextEditor
-
handlePreferenceStoreChanged
Description copied from class:AbstractTextEditor
Handles a property change event describing a change of the editor's preference store and updates the preference related editor properties.Subclasses may extend.
- Overrides:
handlePreferenceStoreChanged
in classAbstractDecoratedTextEditor
- Parameters:
event
- the property change event
-
editorContextMenuAboutToShow
Description copied from class:AbstractTextEditor
Sets up this editor's context menu before it is made visible.Subclasses may extend to add other actions.
- Overrides:
editorContextMenuAboutToShow
in classAbstractDecoratedTextEditor
- Parameters:
menu
- the menu
-