Package org.eclipse.handly.ui
Class EditorOpener
- java.lang.Object
-
- org.eclipse.handly.ui.EditorOpener
-
- Direct Known Subclasses:
SearchEditorOpener
public class EditorOpener extends java.lang.ObjectA helper class for opening a model element in an editor.
-
-
Constructor Summary
Constructors Constructor Description EditorOpener(org.eclipse.ui.IWorkbenchPage page, EditorUtility editorUtility)Constructs an editor opener with the given workbench page and the given editor utility.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EditorUtilitygetEditorUtility()Returns the editor utility for this opener.org.eclipse.ui.IWorkbenchPagegetWorkbenchPage()Returns the workbench page to open the editor in.org.eclipse.ui.IEditorPartopen(java.lang.Object element, boolean activate, boolean reveal)Opens the given element in an appropriate editor.protected booleanshouldReuseEditor()Returns whether editors should be reused.
-
-
-
Constructor Detail
-
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 (notnull)editorUtility- the editor utility for this opener (notnull)
-
-
Method Detail
-
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(java.lang.Object element, boolean activate, boolean reveal) throws org.eclipse.ui.PartInitExceptionOpens the given element in an appropriate editor.Default implementation attempts to
finda matching open editor or, failing that, opens a new editor on thecorrespondingeditor input; it thenrevealsthe element in the editor, if requested. If editors should bereused, tries to reuse an existing editor rather than open a new one.- Parameters:
element- the element to open (notnull)activate- whether to activate the editorreveal- whether to reveal the element in the editor- Returns:
- an open editor, or
nullif 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:
trueif editors should be reused, andfalseotherwise- See Also:
open(Object, boolean, boolean)
-
-