Class EditorOpener

java.lang.Object
org.eclipse.handly.ui.EditorOpener
Direct Known Subclasses:
SearchEditorOpener

public class EditorOpener extends Object
A helper class for opening a model element in an editor.
  • Constructor Details

    • EditorOpener

      public EditorOpener(org.eclipse.ui.IWorkbenchPage page, EditorUtility editorUtility)
      Constructs an editor opener with the given workbench page and the given editor utility.
      Parameters:
      page - the workbench page to open the editor in (not null)
      editorUtility - the editor utility for this opener (not null)
  • Method Details

    • getWorkbenchPage

      public final org.eclipse.ui.IWorkbenchPage getWorkbenchPage()
      Returns the workbench page to open the editor in.
      Returns:
      the workbench page to open the editor in (never null)
    • getEditorUtility

      public final EditorUtility getEditorUtility()
      Returns the editor utility for this opener.
      Returns:
      the editor utility for this opener (never null)
    • open

      public org.eclipse.ui.IEditorPart open(Object element, boolean activate, boolean reveal) throws org.eclipse.ui.PartInitException
      Opens the given element in an appropriate editor.

      Default implementation attempts to find a matching open editor or, failing that, opens a new editor on the corresponding editor input; it then reveals the element in the editor, if requested. If editors should be reused, tries to reuse an existing editor rather than open a new one.

      Parameters:
      element - the element to open (not null)
      activate - whether to activate the editor
      reveal - whether to reveal the element in the editor
      Returns:
      an open editor, or null if an external editor was opened
      Throws:
      org.eclipse.ui.PartInitException - if the editor could not be created or initialized
    • shouldReuseEditor

      protected boolean shouldReuseEditor()
      Returns whether editors should be reused.

      Default implementation returns false.

      Returns:
      true if editors should be reused, and false otherwise
      See Also: