hey there i am trying to capture user selections from the menu bar , for example if the user pressed File in the menu, my plug-in gonna print "File pressed". i figured out how to listen to view selections by IselectionService , but still has no clue how to do it with the main menu bars(or toolbars).
thanx for help
More details :
I gonna explain my problem a little bit more precisely :
I would like capture top-level menus actions and toolbar, the problem is I really don't know how to create and attach the listener.
Here is the ISelectionListener
of the plugin.
My purpose is to listen to the workbench top-level menu selections and toolbar.
Thanx for help
// the listener we register with the selection service
private ISelectionListener listener = new ISelectionListener() {
public void selectionChanged(IWorkbenchPart sourcepart, ISelection selection) {
// we ignore our own selections
if (sourcepart != SelectionView.this) {
showSelection(sourcepart, selection);
}
}
};
...
...
public void createPartControl(Composite parent) {
...
getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(listener);
P.S : Most what I found about menu listener were SWT stuff for some view or windows I had created, thats not what I meant, I need listener to the main top level menu and toolbars in eclipse workbench.