com.ibm.lab.soln.contributions
Class ActivateEditorPulldownDelegate
java.lang.Object
|
+--com.ibm.lab.soln.contributions.ActivateEditorPulldownDelegate
- All Implemented Interfaces:
- org.eclipse.ui.IActionDelegate, org.eclipse.ui.IWorkbenchWindowActionDelegate, org.eclipse.ui.IWorkbenchWindowPulldownDelegate
- public class ActivateEditorPulldownDelegate
- extends java.lang.Object
- implements org.eclipse.ui.IWorkbenchWindowPulldownDelegate
A contribution to a toolbar pull-down menu is defined whose
contents are based on the open workbench editors.
- See Also:
IWorkbenchWindowActionDelegate
Method Summary |
void |
dispose()
|
org.eclipse.swt.widgets.Menu |
getMenu(org.eclipse.swt.widgets.Control parent)
This method does all the work by dynamically creating a Menu and
populating it with a set of MenuItem objects, each of which holds a
reference to an open editor. |
void |
init(org.eclipse.ui.IWorkbenchWindow window)
|
void |
run(org.eclipse.jface.action.IAction action)
Unlike most actions, the run method for this class does nothing. |
void |
selectionChanged(org.eclipse.jface.action.IAction action,
org.eclipse.jface.viewers.ISelection selection)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ActivateEditorPulldownDelegate
public ActivateEditorPulldownDelegate()
dispose
public void dispose()
- Specified by:
dispose
in interface org.eclipse.ui.IWorkbenchWindowActionDelegate
- See Also:
IWorkbenchWindowActionDelegate.dispose()
getMenu
public org.eclipse.swt.widgets.Menu getMenu(org.eclipse.swt.widgets.Control parent)
- This method does all the work by dynamically creating a Menu and
populating it with a set of MenuItem objects, each of which holds a
reference to an open editor. A selection listener is created for each
menu item. When a MenuItem object is selected, its corresponding
editor is brought to the top and made the active editor. Observe that
that this method traverses all the open workbench pages, where a page
maps to a Perspective. On each page, any references to open
editors as IEditorReference objects are added to the menu.
Note that in Eclipse 2.0, there is no longer more than one instance
of an editor on the same object so it is not necessary to traverse
all the workbench pages. The first loop could be eliminated
and replaced with the method IWorkbenchWindow.getActivePage to find
all the editor references.
- Specified by:
getMenu
in interface org.eclipse.ui.IWorkbenchWindowPulldownDelegate
- See Also:
IWorkbenchWindowPulldownDelegate.getMenu(Control)
init
public void init(org.eclipse.ui.IWorkbenchWindow window)
- Specified by:
init
in interface org.eclipse.ui.IWorkbenchWindowActionDelegate
- See Also:
IWorkbenchWindowActionDelegate.init(org.eclipse.ui.IWorkbenchWindow)
run
public void run(org.eclipse.jface.action.IAction action)
- Unlike most actions, the run method for this class does nothing. It
is replaced by the code in the selection listener of the getMenu method.
- Specified by:
run
in interface org.eclipse.ui.IActionDelegate
- See Also:
IActionDelegate.run(org.eclipse.jface.action.IAction)
,
getMenu(org.eclipse.swt.widgets.Control)
selectionChanged
public void selectionChanged(org.eclipse.jface.action.IAction action,
org.eclipse.jface.viewers.ISelection selection)
- Specified by:
selectionChanged
in interface org.eclipse.ui.IActionDelegate
- See Also:
IActionDelegate.selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)