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.TextEditorSavableNested classes/interfaces inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3
ITextEditorExtension3.InsertMode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DefaultEncodingSupportThe encoding support for the editor.Fields inherited from class org.eclipse.ui.texteditor.AbstractDecoratedTextEditor
DEFAULT_OVERVIEW_RULER_CONTEXT_MENU_ID, fAnnotationAccess, fIsUpdatingMarkerViews, fLineNumberRulerColumn, fOverviewRuler, fSourceViewerDecorationSupportFields 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_WIDTHFields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUTFields inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3
INSERT, SMART_INSERTFields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidCreates this editor's standard actions and connects them with the global workbench actions.voiddispose()TheAbstractTextEditorimplementation of thisIWorkbenchPartmethod may be extended by subclasses.protected voiddoSetInput(IEditorInput input) Called directly fromsetInputand from within a workspace runnable frominit, this method does the actual setting of the editor input.protected voidSets up this editor's context menu before it is made visible.<T> TgetAdapter(Class<T> adapter) Returns an object which is an instance of the given class associated with this object.protected StringgetStatusBanner(IStatus status) Returns a banner for the given status.protected StringgetStatusHeader(IStatus status) Returns a header for the given statusprotected StringgetStatusMessage(IStatus status) Returns a message for the given status.protected voidHandles a property change event describing a change of the editor's preference store and updates the preference related editor properties.protected voidInitializes this editor.protected voidInstalls the encoding support on the given text editor.booleanTheAbstractTextEditorimplementation of thisIEditorPartmethod returnsfalse.protected voidUpdates 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, validateEditorInputStateMethods inherited from class org.eclipse.ui.texteditor.StatusTextEditor
doRevertToSaved, handleElementContentReplaced, sanityCheckState, setFocus, updatePartControl, updateStatusFieldMethods 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, widgetOffset2ModelOffsetMethods inherited from class org.eclipse.ui.part.EditorPart
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setPartNameMethods 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, showBusyMethods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObjectMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.ui.IEditorPart
getEditorInput, getEditorSiteMethods inherited from interface org.eclipse.ui.ISaveablePart
isSaveOnCloseNeededMethods 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.- See Also:
-
-
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:
initializeEditorin classAbstractDecoratedTextEditor
-
dispose
public void dispose()Description copied from class:AbstractTextEditorTheAbstractTextEditorimplementation of thisIWorkbenchPartmethod may be extended by subclasses. Subclasses must callsuper.dispose().Note that many methods may return
nullafter the editor is disposed.- Specified by:
disposein interfaceIWorkbenchPart- Overrides:
disposein 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:AbstractTextEditorTheAbstractTextEditorimplementation of thisIEditorPartmethod returnsfalse. Subclasses may override.- Specified by:
isSaveAsAllowedin interfaceISaveablePart- Overrides:
isSaveAsAllowedin classAbstractTextEditor- Returns:
false
-
createActions
protected void createActions()Description copied from class:AbstractTextEditorCreates this editor's standard actions and connects them with the global workbench actions.Subclasses may extend.
- Overrides:
createActionsin classAbstractDecoratedTextEditor
-
getStatusHeader
Description copied from class:StatusTextEditorReturns a header for the given status- Overrides:
getStatusHeaderin classStatusTextEditor- Parameters:
status- the status whose message is returned- Returns:
- a header for the given status
-
getStatusBanner
Description copied from class:StatusTextEditorReturns a banner for the given status.- Overrides:
getStatusBannerin classStatusTextEditor- Parameters:
status- the status whose message is returned- Returns:
- a banner for the given status
-
getStatusMessage
Description copied from class:StatusTextEditorReturns a message for the given status.- Overrides:
getStatusMessagein classStatusTextEditor- Parameters:
status- the status whose message is returned- Returns:
- a message for the given status
-
doSetInput
Description copied from class:AbstractTextEditorCalled directly fromsetInputand from within a workspace runnable frominit, this method does the actual setting of the editor input. Closes the editor ifinputisnull. Disconnects from any previous editor input and its document provider and connects to the new one.Subclasses may extend.
- Overrides:
doSetInputin classAbstractDecoratedTextEditor- Parameters:
input- the input to be set- Throws:
CoreException- if input cannot be connected to the document provider
-
getAdapter
Description copied from class:WorkbenchPartReturns an object which is an instance of the given class associated with this object. Returnsnullif 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:
getAdapterin interfaceIAdaptable- Overrides:
getAdapterin classAbstractDecoratedTextEditor- Type Parameters:
T- the class type- Parameters:
adapter- the adapter class to look up- Returns:
- a object of the given class, or
nullif this object does not have an adapter for the given class
-
updatePropertyDependentActions
protected void updatePropertyDependentActions()Description copied from class:AbstractTextEditorUpdates all property dependent actions.- Overrides:
updatePropertyDependentActionsin classAbstractTextEditor
-
handlePreferenceStoreChanged
Description copied from class:AbstractTextEditorHandles a property change event describing a change of the editor's preference store and updates the preference related editor properties.Subclasses may extend.
- Overrides:
handlePreferenceStoreChangedin classAbstractDecoratedTextEditor- Parameters:
event- the property change event
-
editorContextMenuAboutToShow
Description copied from class:AbstractTextEditorSets up this editor's context menu before it is made visible.Subclasses may extend to add other actions.
- Overrides:
editorContextMenuAboutToShowin classAbstractDecoratedTextEditor- Parameters:
menu- the menu
-