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

public class TextEditor extends AbstractDecoratedTextEditor
The standard/default text editor.

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.

  • Field Details

    • fEncodingSupport

      protected DefaultEncodingSupport fEncodingSupport
      The encoding support for the editor.
      Since:
      2.0
  • Constructor Details

  • 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 call 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.
      Overrides:
      initializeEditor in class AbstractDecoratedTextEditor
    • dispose

      public void dispose()
      Description copied from class: AbstractTextEditor
      The 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.

      Specified by:
      dispose in interface IWorkbenchPart
      Overrides:
      dispose in class AbstractDecoratedTextEditor
    • 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
      The AbstractTextEditor implementation of this IEditorPart method returns false. Subclasses may override.
      Specified by:
      isSaveAsAllowed in interface ISaveablePart
      Overrides:
      isSaveAsAllowed in class AbstractTextEditor
      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 class AbstractDecoratedTextEditor
    • getStatusHeader

      protected String getStatusHeader(IStatus status)
      Description copied from class: StatusTextEditor
      Returns a header for the given status
      Overrides:
      getStatusHeader in class StatusTextEditor
      Parameters:
      status - the status whose message is returned
      Returns:
      a header for the given status
    • getStatusBanner

      protected String getStatusBanner(IStatus status)
      Description copied from class: StatusTextEditor
      Returns a banner for the given status.
      Overrides:
      getStatusBanner in class StatusTextEditor
      Parameters:
      status - the status whose message is returned
      Returns:
      a banner for the given status
    • getStatusMessage

      protected String getStatusMessage(IStatus status)
      Description copied from class: StatusTextEditor
      Returns a message for the given status.
      Overrides:
      getStatusMessage in class StatusTextEditor
      Parameters:
      status - the status whose message is returned
      Returns:
      a message for the given status
    • doSetInput

      protected void doSetInput(IEditorInput input) throws CoreException
      Description copied from class: AbstractTextEditor
      Called directly from 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.

      Overrides:
      doSetInput in class AbstractDecoratedTextEditor
      Parameters:
      input - the input to be set
      Throws:
      CoreException - if input cannot be connected to the document provider
    • getAdapter

      public <T> T getAdapter(Class<T> adapter)
      Description copied from class: WorkbenchPart
      Returns an object which is an instance of the given class associated with this object. Returns null 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 interface IAdaptable
      Overrides:
      getAdapter in class AbstractDecoratedTextEditor
      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 class AbstractTextEditor
    • handlePreferenceStoreChanged

      protected void handlePreferenceStoreChanged(PropertyChangeEvent event)
      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 class AbstractDecoratedTextEditor
      Parameters:
      event - the property change event
    • editorContextMenuAboutToShow

      protected void editorContextMenuAboutToShow(IMenuManager menu)
      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 class AbstractDecoratedTextEditor
      Parameters:
      menu - the menu