org.eclipse.emf.workspace.examples.extlibrary.presentation
Class EXTLibraryActionBarContributor
java.lang.Object
org.eclipse.ui.part.EditorActionBarContributor
org.eclipse.ui.part.MultiPageEditorActionBarContributor
org.eclipse.emf.edit.ui.action.EditingDomainActionBarContributor
org.eclipse.emf.workspace.examples.extlibrary.presentation.EXTLibraryActionBarContributor
-
All Implemented Interfaces:
-
IMenuListener,
ISelectionChangedListener,
IEditorActionBarContributor,
IPropertyListener
-
public class EXTLibraryActionBarContributor
- extends
EditingDomainActionBarContributor
- implements
ISelectionChangedListener
This is the action bar contributor for the EXTLibrary model editor.
It is customized from its EMF-generated form to provide alternative implementations
of the undo and redo menu actions (delegating to the operation history) and
additional example actions such as initiation of long-running background reader
jobs.
In the code, customizations from the EMF-generated implementation are
marked by //.CUSTOM: comments.
|
Fields inherited from class org.eclipse.emf.edit.ui.action.
EditingDomainActionBarContributor
|
activeEditor,
ADDITIONS_LAST_STYLE,
controlAction,
copyAction,
cutAction,
deleteAction,
loadResourceAction,
pasteAction,
redoAction,
style,
undoAction,
validateAction
|
|
Method Summary
|
void
|
activate
()
Extends the inherited method to notify the long-running read task
action that I am the currently active editor. |
protected void
|
addGlobalActions
(
IMenuManager menuManager)
Extends the EMF-generated
addGlobalActionsGen(org.eclipse.jface.action.IMenuManager) method
to add the long-running read job action. |
protected void
|
addGlobalActionsGen
(
IMenuManager menuManager)
This inserts global actions before the "additions-end" separator |
void
|
contributeToMenu
(
IMenuManager menuManager)
This adds to the menu bar a menu and some separators for editor additions,
as well as the sub-menus for object creation items |
void
|
contributeToToolBar
(
IToolBarManager toolBarManager)
This adds Separators for editor additions to the tool bar |
void
|
deactivate
()
Extends the inherited method to notify the long-running read task
action that there is no longer an active editor. |
protected void
|
depopulateManager
(
IContributionManager manager,
Collection<? extends
IAction> actions)
This removes from the specified manager all
ActionContributionItems
based on the
IActions contained in the actions collection |
protected
Collection<
IAction>
|
generateCreateChildActions
(
Collection<?> descriptors,
ISelection selection)
This generates a
CreateChildAction for each object in descriptors,
and returns the collection of these actions |
protected
Collection<
IAction>
|
generateCreateSiblingActions
(
Collection<?> descriptors,
ISelection selection)
This generates a
CreateSiblingAction for each object in descriptors,
and returns the collection of these actions |
void
|
init
(
IActionBars actionBars)
Extends the inherited method to replace the action handlers for undo
and redo with our operation-history-aware implementations. |
void
|
menuAboutToShow
(
IMenuManager menuManager)
This populates the pop-up menu before it appears |
protected void
|
populateManager
(
IContributionManager manager,
Collection<? extends
IAction> actions,
String contributionID)
This populates the specified manager with
ActionContributionItems
based on the
IActions contained in the actions collection,
by inserting them before the specified contribution item contributionID. |
protected boolean
|
removeAllReferencesOnDelete
()
This ensures that a delete action will clean up all references to deleted objects |
void
|
selectionChanged
(
SelectionChangedEvent event)
This implements
ISelectionChangedListener,
handling
SelectionChangedEvents by querying for the children and siblings
that can be added to the selected object and updating the menus accordingly |
void
|
setActiveEditor
(
IEditorPart part)
When the active editor changes, this remembers the change and registers with it as a selection provider |
|
Methods inherited from class java.lang.
Object
|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
|
activeEditorPart
protected
IEditorPart activeEditorPart
- This keeps track of the active editor.
selectionProvider
protected
ISelectionProvider selectionProvider
- This keeps track of the current selection provider.
showPropertiesViewAction
protected
IAction showPropertiesViewAction
- This action opens the Properties view.
refreshViewerAction
protected
IAction refreshViewerAction
- This action refreshes the viewer of the current editor if the editor
implements
IViewerProvider.
longRunningReadAction
protected
LongRunningReadAction longRunningReadAction
- Action demonstrating interaction of the editor with long-running
read-only transactions on other threads.
createChildActions
protected
Collection<
IAction> createChildActions
- This will contain one
CreateChildAction corresponding to each descriptor
generated for the current selection by the item provider.
createChildMenuManager
protected
IMenuManager createChildMenuManager
- This is the menu manager into which menu contribution items should be added for CreateChild actions.
createSiblingActions
protected
Collection<
IAction> createSiblingActions
- This will contain one
CreateSiblingAction corresponding to each descriptor
generated for the current selection by the item provider.
createSiblingMenuManager
protected
IMenuManager createSiblingMenuManager
- This is the menu manager into which menu contribution items should be added for CreateSibling actions.
EXTLibraryActionBarContributor
public EXTLibraryActionBarContributor()
- This creates an instance of the contributor.
init
public void init(
IActionBars actionBars)
- Extends the inherited method to replace the action handlers for undo
and redo with our operation-history-aware implementations.
-
-
Overrides:
-
init
in class
EditingDomainActionBarContributor
-
contributeToToolBar
public void contributeToToolBar(
IToolBarManager toolBarManager)
- This adds Separators for editor additions to the tool bar.
-
-
Overrides:
-
contributeToToolBar
in class
EditingDomainActionBarContributor
-
contributeToMenu
public void contributeToMenu(
IMenuManager menuManager)
- This adds to the menu bar a menu and some separators for editor additions,
as well as the sub-menus for object creation items.
-
-
Overrides:
-
contributeToMenu
in class
EditingDomainActionBarContributor
-
setActiveEditor
public void setActiveEditor(
IEditorPart part)
- When the active editor changes, this remembers the change and registers with it as a selection provider.
-
-
Specified by:
-
setActiveEditor
in interface
IEditorActionBarContributor
-
Overrides:
-
setActiveEditor
in class
EditingDomainActionBarContributor
-
activate
public void activate()
- Extends the inherited method to notify the long-running read task
action that I am the currently active editor.
-
-
Overrides:
-
activate
in class
EditingDomainActionBarContributor
-
deactivate
public void deactivate()
- Extends the inherited method to notify the long-running read task
action that there is no longer an active editor.
-
-
Overrides:
-
deactivate
in class
EditingDomainActionBarContributor
-
selectionChanged
public void selectionChanged(
SelectionChangedEvent event)
- This implements
ISelectionChangedListener,
handling
SelectionChangedEvents by querying for the children and siblings
that can be added to the selected object and updating the menus accordingly.
-
-
Specified by:
-
selectionChanged
in interface
ISelectionChangedListener
-
generateCreateChildActions
protected
Collection<
IAction> generateCreateChildActions(
Collection<?> descriptors,
ISelection selection)
- This generates a
CreateChildAction for each object in descriptors,
and returns the collection of these actions.
-
-
generateCreateSiblingActions
protected
Collection<
IAction> generateCreateSiblingActions(
Collection<?> descriptors,
ISelection selection)
- This generates a
CreateSiblingAction for each object in descriptors,
and returns the collection of these actions.
-
-
populateManager
protected void populateManager(
IContributionManager manager,
Collection<? extends
IAction> actions,
String contributionID)
- This populates the specified
manager with
ActionContributionItems
based on the
IActions contained in the actions collection,
by inserting them before the specified contribution item contributionID.
If contributionID is null, they are simply added.
-
-
depopulateManager
protected void depopulateManager(
IContributionManager manager,
Collection<? extends
IAction> actions)
- This removes from the specified
manager all
ActionContributionItems
based on the
IActions contained in the actions collection.
-
-
menuAboutToShow
public void menuAboutToShow(
IMenuManager menuManager)
- This populates the pop-up menu before it appears.
-
-
Specified by:
-
menuAboutToShow
in interface
IMenuListener
-
Overrides:
-
menuAboutToShow
in class
EditingDomainActionBarContributor
-
addGlobalActionsGen
protected void addGlobalActionsGen(
IMenuManager menuManager)
- This inserts global actions before the "additions-end" separator.
Extended by the
addGlobalActions(org.eclipse.jface.action.IMenuManager) method to add the action
that invokes the example job demonstrating long-running read-only
transactions.
-
-
addGlobalActions
protected void addGlobalActions(
IMenuManager menuManager)
- Extends the EMF-generated
addGlobalActionsGen(org.eclipse.jface.action.IMenuManager) method
to add the long-running read job action.
-
-
Overrides:
-
addGlobalActions
in class
EditingDomainActionBarContributor
-
removeAllReferencesOnDelete
protected boolean removeAllReferencesOnDelete()
- This ensures that a delete action will clean up all references to deleted objects.
-
-
Overrides:
-
removeAllReferencesOnDelete
in class
EditingDomainActionBarContributor
-