Package org.eclipse.ui.texteditor
Class StatusTextEditor
- java.lang.Object
-
- org.eclipse.core.commands.common.EventManager
-
- org.eclipse.ui.part.WorkbenchPart
-
- org.eclipse.ui.part.EditorPart
-
- org.eclipse.ui.texteditor.AbstractTextEditor
-
- org.eclipse.ui.texteditor.StatusTextEditor
-
- All Implemented Interfaces:
IAdaptable,IExecutableExtension,IEditorPart,INavigationLocationProvider,IPersistable,IPersistableEditor,IReusableEditor,ISaveablePart,ISaveablesSource,IWorkbenchPart,IWorkbenchPart2,IWorkbenchPart3,IWorkbenchPartOrientation,ITextEditor,ITextEditorExtension,ITextEditorExtension2,ITextEditorExtension3,ITextEditorExtension4,ITextEditorExtension5,ITextEditorExtension6
- Direct Known Subclasses:
AbstractDecoratedTextEditor
public class StatusTextEditor extends AbstractTextEditor
Capable of handling input elements that have an associated status with them.- Since:
- 2.0
-
-
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
-
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
Constructors Constructor Description StatusTextEditor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreatePartControl(Composite parent)TheAbstractTextEditorimplementation of thisIWorkbenchPartmethod creates the vertical ruler and source viewer.protected ControlcreateStatusControl(Composite parent, IStatus status)Creates the status control for the given status.voiddoRevertToSaved()TheAbstractTextEditorimplementation of thisITextEditormethod 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 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 voidhandleEditorInputChanged()Handles an external change of the editor's input element.protected voidhandleElementContentReplaced()Performs any additional action necessary to perform after the input document's content has been replaced.protected booleanisErrorStatus(IStatus status)Returns whether the given status indicates an error.protected voidsanityCheckState(IEditorInput input)Checks the state of the given editor input.voidsetFocus()Asks this part to take focus within the workbench.voidupdatePartControl(IEditorInput input)Checks if the status of the given input is OK.protected voidupdateStatusField(String category)Updates the status fields for the given category.booleanvalidateEditorInputState()Validates the state of the given editor input.-
Methods inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
addAction, addAction, addGroup, addRulerContextMenuListener, adjustHighlightRange, affectsTextPresentation, canHandleMove, close, configureInsertMode, containsSavedState, createActions, createColumnSupport, createContextMenuListener, createEmptyNavigationLocation, createNavigationActions, createNavigationLocation, createSourceViewer, createUndoRedoActions, createVerticalRuler, dispose, disposeDocumentProvider, doGetSelection, doRestoreState, doSave, doSaveAs, doSetSelection, editorContextMenuAboutToShow, editorSaved, enableOverwriteMode, enableSanityChecking, enableStateValidation, findAnnotation, firePropertyChange, getAction, getActiveSaveables, getAdapter, getContextMenuListener, getCoverage, getCursorListener, getCursorPosition, getDocumentProvider, getEditorContextMenuId, getFontPropertyPreferenceKey, getHelpContextId, getHighlightRange, getInitialWordWrapStatus, getInsertMode, getLegalInsertModes, getPreferenceStore, getProgressMonitor, getRangeIndicator, getRulerContextMenuId, getRulerMouseListener, getSaveables, getSelectionChangedListener, getSelectionProvider, getSourceViewer, getSourceViewerConfiguration, getStatusField, getStatusLineManager, getUndoRedoOperationApprover, getVerticalRuler, gotoAnnotation, handleCursorPositionChanged, handleExceptionOnSave, handleInsertModeChanged, handlePreferenceStoreChanged, init, initializeDragAndDrop, initializeViewerColors, installCodeMiningProviders, installTabsToSpacesConverter, installTextDragAndDrop, internalInit, isBlockSelectionModeEnabled, isBlockSelectionModeSupported, isChangeInformationShowing, isDirty, isEditable, isEditorInputIncludedInContextMenu, isEditorInputModifiable, isEditorInputReadOnly, isInInsertMode, isNavigationTarget, isSaveAsAllowed, isSpacesAsTabsDeletionEnabled, isTabsToSpacesConversionEnabled, isVisible, isWordWrapEnabled, isWordWrapSupported, markAsContentDependentAction, markAsPropertyDependentAction, markAsSelectionDependentAction, markAsStateDependentAction, markInNavigationHistory, modelOffset2WidgetOffset, openSaveErrorDialog, performRevert, performSave, performSaveAs, rememberSelection, removeActionActivationCode, removeRulerContextMenuListener, resetHighlightRange, restoreSelection, restoreState, rulerContextMenuAboutToShow, safelySanityCheckState, saveState, selectAndReveal, selectAndReveal, setAction, setActionActivationCode, setBlockSelectionMode, setCompatibilityMode, setDocumentProvider, setDocumentProvider, setEditorContextMenuId, setHelpContextId, setHighlightRange, setInput, setInputWithNotify, setInsertMode, setKeyBindingScopes, setPreferenceStore, setRangeIndicator, setRulerContextMenuId, setSourceViewerConfiguration, setStatusField, setStatusLineErrorMessage, setStatusLineMessage, setWordWrap, showChangeInformation, showHighlightRangeOnly, showRevisionInformation, showsHighlightRangeOnly, uninstallTabsToSpacesConverter, uninstallTextDragAndDrop, updateContentDependentActions, updateContributedRulerColumns, updateIndentPrefixes, updatePropertyDependentActions, 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
-
-
-
-
Method Detail
-
createPartControl
public void createPartControl(Composite parent)
Description copied from class:AbstractTextEditorTheAbstractTextEditorimplementation of thisIWorkbenchPartmethod creates the vertical ruler and source viewer.Subclasses may extend this method. Besides extending this method, the behavior of
createPartControlmay be customized by calling, extending or replacing the following methods:
Subclasses may supply customized implementations for some members using the following methods beforecreatePartControlis invoked:- setSourceViewerConfiguration to supply a custom source viewer configuration,
- setRangeIndicator to provide a range indicator,
- setHelpContextId to provide a help context id,
- setEditorContextMenuId to set a custom context menu id,
- setRulerContextMenuId to set a custom ruler context menu id.
Subclasses may replace the following methods called from withincreatePartControl:- createVerticalRuler to supply a custom vertical ruler,
- createSourceViewer to supply a custom source viewer,
- getSelectionProvider to supply a custom selection provider.
Subclasses may extend the following methods called from withincreatePartControl:- initializeViewerColors to customize the viewer color scheme (may also be replaced),
- initializeDragAndDrop to customize drag and drop (may also be replaced),
- createNavigationActions to add navigation actions,
- createActions to add text editor actions.
- Specified by:
createPartControlin interfaceIWorkbenchPart- Overrides:
createPartControlin classAbstractTextEditor- Parameters:
parent- the parent composite
-
updatePartControl
public void updatePartControl(IEditorInput input)
Checks if the status of the given input is OK. If not the status control is shown rather than the default control.- Parameters:
input- the input whose status is checked
-
setFocus
public void setFocus()
Description copied from interface:IWorkbenchPartAsks this part to take focus within the workbench. Parts must assign focus to one of the controls contained in the part's parent composite.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.- Specified by:
setFocusin interfaceIWorkbenchPart- Overrides:
setFocusin classAbstractTextEditor
-
validateEditorInputState
public boolean validateEditorInputState()
Description copied from interface:ITextEditorExtension2Validates the state of the given editor input. The predominate intent of this method is to take any action probably necessary to ensure that the input can persistently be changed.- Specified by:
validateEditorInputStatein interfaceITextEditorExtension2- Overrides:
validateEditorInputStatein classAbstractTextEditor- Returns:
trueif the input was validated,falseotherwise
-
isErrorStatus
protected boolean isErrorStatus(IStatus status)
Returns whether the given status indicates an error. Subclasses may override.- Parameters:
status- the status to be checked- Returns:
trueif the status indicates an error,falseotherwise\- Since:
- 3.0
-
createStatusControl
protected Control createStatusControl(Composite parent, IStatus status)
Creates the status control for the given status. May be overridden by subclasses.- Parameters:
parent- the parent controlstatus- the status- Returns:
- the new status control
-
getStatusHeader
protected String getStatusHeader(IStatus status)
Returns a header for the given status- Parameters:
status- the status whose message is returned- Returns:
- a header for the given status
-
getStatusBanner
protected String getStatusBanner(IStatus status)
Returns a banner for the given status.- Parameters:
status- the status whose message is returned- Returns:
- a banner for the given status
-
getStatusMessage
protected String getStatusMessage(IStatus status)
Returns a message for the given status.- Parameters:
status- the status whose message is returned- Returns:
- a message for the given status
-
updateStatusField
protected void updateStatusField(String category)
Description copied from class:AbstractTextEditorUpdates the status fields for the given category.- Overrides:
updateStatusFieldin classAbstractTextEditor- Parameters:
category- the category
-
doSetInput
protected void doSetInput(IEditorInput input) throws CoreException
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 classAbstractTextEditor- Parameters:
input- the input to be set- Throws:
CoreException- if input cannot be connected to the document provider
-
doRevertToSaved
public void doRevertToSaved()
Description copied from class:AbstractTextEditorTheAbstractTextEditorimplementation of thisITextEditormethod may be extended by subclasses.- Specified by:
doRevertToSavedin interfaceITextEditor- Overrides:
doRevertToSavedin classAbstractTextEditor
-
sanityCheckState
protected void sanityCheckState(IEditorInput input)
Description copied from class:AbstractTextEditorChecks the state of the given editor input.- Overrides:
sanityCheckStatein classAbstractTextEditor- Parameters:
input- the editor input whose state is to be checked
-
handleEditorInputChanged
protected void handleEditorInputChanged()
Description copied from class:AbstractTextEditorHandles an external change of the editor's input element. Subclasses may extend.- Overrides:
handleEditorInputChangedin classAbstractTextEditor
-
handleElementContentReplaced
protected void handleElementContentReplaced()
Description copied from class:AbstractTextEditorPerforms any additional action necessary to perform after the input document's content has been replaced.Clients may extended this method.
- Overrides:
handleElementContentReplacedin classAbstractTextEditor
-
-