public class TextEditor extends AbstractDecoratedTextEditor
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.
AbstractTextEditor.AbstractSelectionChangedListener, AbstractTextEditor.ColumnSupport, AbstractTextEditor.IdMapEntry, AbstractTextEditor.LineEndAction, AbstractTextEditor.LineStartAction, AbstractTextEditor.SelectionProvider, AbstractTextEditor.TextEditorSavable
ITextEditorExtension3.InsertMode
Modifier and Type | Field and Description |
---|---|
protected DefaultEncodingSupport |
fEncodingSupport
The encoding support for the editor.
|
DEFAULT_OVERVIEW_RULER_CONTEXT_MENU_ID, fAnnotationAccess, fIsUpdatingMarkerViews, fLineNumberRulerColumn, fOverviewRuler, fSourceViewerDecorationSupport
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_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_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, TAG_SELECTION_HORIZONTAL_PIXEL, TAG_SELECTION_LENGTH, TAG_SELECTION_OFFSET, TAG_SELECTION_TOP_PIXEL, VERTICAL_RULER_WIDTH
PROP_DIRTY, PROP_INPUT
PROP_TITLE
INSERT, SMART_INSERT
Constructor and Description |
---|
TextEditor()
Creates a new text editor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
createActions()
Creates this editor's standard actions and connects them with the global
workbench actions.
|
void |
dispose()
The
AbstractTextEditor implementation of this
IWorkbenchPart method may be extended by subclasses. |
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 |
editorContextMenuAboutToShow(IMenuManager menu)
Sets up this editor's context menu before it is made visible.
|
Object |
getAdapter(Class 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 status
|
protected String |
getStatusMessage(IStatus status)
Returns a message for the given status.
|
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.
|
protected void |
initializeEditor()
Initializes this editor.
|
protected void |
installEncodingSupport()
Installs the encoding support on the given text editor.
|
boolean |
isSaveAsAllowed()
The
AbstractTextEditor implementation of this
IEditorPart method returns false . |
protected void |
updatePropertyDependentActions()
Updates all property dependent actions.
|
collectContextMenuPreferencePages, collectOverviewRulerMenuPreferencePages, collectRulerMenuPreferencePages, configureSourceViewerDecorationSupport, createAnnotationAccess, createAnnotationRulerColumn, createChangeHover, createChangeRulerColumn, createColumnSupport, createCompositeRuler, createContextMenuListener, createLineNumberRulerColumn, createOverviewRuler, createOverviewRulerContextMenu, createPartControl, 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, isTabsToSpacesConversionEnabled, openSaveErrorDialog, overviewRulerContextMenuAboutToShow, performSaveAs, rulerContextMenuAboutToShow, setDocumentProvider, setOverviewRulerContextMenuId, showChangeInformation, showOverviewRuler, showRevisionInformation, updateMarkerViews, validateEditorInputState
doRevertToSaved, handleElementContentReplaced, sanityCheckState, setFocus, updatePartControl, updateStatusField
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, getInsertMode, getLegalInsertModes, getPreferenceStore, getProgressMonitor, getRangeIndicator, getRulerContextMenuId, getRulerMouseListener, getSaveables, getSelectionChangedListener, getSelectionProvider, getSourceViewer, getSourceViewerConfiguration, getStatusField, getStatusLineManager, getVerticalRuler, handleCursorPositionChanged, handleExceptionOnSave, handleInsertModeChanged, init, initializeDragAndDrop, initializeViewerColors, installTabsToSpacesConverter, installTextDragAndDrop, internalInit, isBlockSelectionModeEnabled, isBlockSelectionModeSupported, isDirty, isEditorInputIncludedInContextMenu, isEditorInputModifiable, isEditorInputReadOnly, isInInsertMode, isVisible, 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, showHighlightRangeOnly, showsHighlightRangeOnly, uninstallTabsToSpacesConverter, uninstallTextDragAndDrop, updateContentDependentActions, updateContributedRulerColumns, updateIndentPrefixes, updateSelectionDependentActions, updateState, updateStateDependentActions, updateStatusFields, validateState, widgetOffset2ModelOffset
checkSite, getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setContentDescription, setInitializationData, setPartName
addPartPropertyListener, addPropertyListener, firePartPropertyChanged, getConfigurationElement, getContentDescription, getDefaultImage, getOrientation, getPartName, getPartProperties, getPartProperty, getSite, getTitle, getTitleImage, removePartPropertyListener, removePropertyListener, setPartProperty, setSite, setTitle, setTitleImage, setTitleToolTip, showBusy
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEditorInput, getEditorSite
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
isSaveOnCloseNeeded
protected DefaultEncodingSupport fEncodingSupport
protected void initializeEditor()
super.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 a
SourceViewerConfiguration
. When only interested in
providing a custom source viewer configuration, subclasses may extend
this method.initializeEditor
in class AbstractDecoratedTextEditor
public void dispose()
AbstractTextEditor
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 IWorkbenchPart
dispose
in class AbstractDecoratedTextEditor
protected void installEncodingSupport()
Subclasses may override to install their own encoding support or to disable the default encoding support.
public boolean isSaveAsAllowed()
AbstractTextEditor
AbstractTextEditor
implementation of this
IEditorPart
method returns false
.
Subclasses may override.isSaveAsAllowed
in interface ISaveablePart
isSaveAsAllowed
in class AbstractTextEditor
false
protected void createActions()
AbstractTextEditor
Subclasses may extend.
createActions
in class AbstractDecoratedTextEditor
protected String getStatusHeader(IStatus status)
StatusTextEditor
getStatusHeader
in class StatusTextEditor
status
- the status whose message is returnedprotected String getStatusBanner(IStatus status)
StatusTextEditor
getStatusBanner
in class StatusTextEditor
status
- the status whose message is returnedprotected String getStatusMessage(IStatus status)
StatusTextEditor
getStatusMessage
in class StatusTextEditor
status
- the status whose message is returnedprotected void doSetInput(IEditorInput input) throws CoreException
AbstractTextEditor
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.
doSetInput
in class AbstractDecoratedTextEditor
input
- the input to be setCoreException
- if input cannot be connected to the document
providerpublic Object getAdapter(Class adapter)
WorkbenchPart
null
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 IAdaptable
getAdapter
in class AbstractDecoratedTextEditor
adapter
- the adapter class to look upnull
if this object does not
have an adapter for the given classprotected void updatePropertyDependentActions()
AbstractTextEditor
updatePropertyDependentActions
in class AbstractTextEditor
protected void handlePreferenceStoreChanged(PropertyChangeEvent event)
AbstractTextEditor
Subclasses may extend.
handlePreferenceStoreChanged
in class AbstractDecoratedTextEditor
event
- the property change eventprotected void editorContextMenuAboutToShow(IMenuManager menu)
AbstractTextEditor
Subclasses may extend to add other actions.
editorContextMenuAboutToShow
in class AbstractDecoratedTextEditor
menu
- the menu
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.