public abstract class OpenAndLinkWithEditorHelper extends Object
Constructor and Description |
---|
OpenAndLinkWithEditorHelper(StructuredViewer viewer)
Creates a new helper for the given viewer.
|
Modifier and Type | Method and Description |
---|---|
protected abstract void |
activate(ISelection selection)
Tells to activate the editor that is open on the given selection.
|
void |
dispose()
Disposes this helper.
|
protected void |
linkToEditor(ISelection selection)
Tells to link the given selection to the editor that is open on the given
selection but does nothing if no matching editor can be found.
|
protected abstract void |
open(ISelection selection,
boolean activate)
Tells to open an editor for the given selection.
|
void |
setLinkWithEditor(boolean enabled)
Sets whether editor that corresponds to the viewer's selection should be brought to front.
|
public OpenAndLinkWithEditorHelper(StructuredViewer viewer)
viewer
- the viewerpublic void setLinkWithEditor(boolean enabled)
enabled
- true
to enable, false
to disablepublic void dispose()
Clients only need to call this method if their viewer has a longer life-cycle than this helper.
protected abstract void activate(ISelection selection)
Note: The implementation must not open a new editor.
selection
- the viewer's selectionprotected abstract void open(ISelection selection, boolean activate)
selection
- the viewer's selectionactivate
- true
if the editor should be activated, false
otherwiseprotected void linkToEditor(ISelection selection)
The common implementation brings that editor to front but more advanced implementations may also select the given selection inside the editor.
Note: The implementation must not open a new editor.
The default implementation does nothing i.e. does not implement linking.
selection
- the viewer's selection
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.