Package org.eclipse.handly.ui
Class EditorOpener
java.lang.Object
org.eclipse.handly.ui.EditorOpener
- Direct Known Subclasses:
SearchEditorOpener
A helper class for opening a model element in an editor.
-
Constructor Summary
ConstructorDescriptionEditorOpener
(org.eclipse.ui.IWorkbenchPage page, EditorUtility editorUtility) Constructs an editor opener with the given workbench page and the given editor utility. -
Method Summary
Modifier and TypeMethodDescriptionfinal EditorUtility
Returns the editor utility for this opener.final org.eclipse.ui.IWorkbenchPage
Returns the workbench page to open the editor in.org.eclipse.ui.IEditorPart
Opens the given element in an appropriate editor.protected boolean
Returns whether editors should be reused.
-
Constructor Details
-
EditorOpener
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 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
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 thecorresponding
editor input; it thenreveals
the 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
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, andfalse
otherwise- See Also:
-