Using SelectionService in Commands [message #673479] |
Mon, 23 May 2011 14:45  |
Eclipse User |
|
|
|
Hey,
I'm almost positive that what the title says is not the way the selection service is intended to be used, but here is the problem that i have.
I had a view that had a list of elements, and that list was a SelectionProvider.
Two other views were registered as a SelectionListener so when an element in the list got selected, the views got notified.
Now I want to get rid of the view and put everything into a ListDialog thingy. I used the menus extension to add a command to the main toolbar, and that command now opens the dialog that let's you select the element you wish.
But I can't use the selectionProvider mechanism from commands right ? how else would i tackle this problem?
Thanks
Sebastian
|
|
|
|
Re: Using SelectionService in Commands [message #673695 is a reply to message #673479] |
Tue, 24 May 2011 09:46  |
Eclipse User |
|
|
|
Right, you can't use the ISelectionService, as the participants 1) are parts and 2) only supply their values when they are active (and your dialog will go away).
I would have your dialog find your 2 view parts. When you instantiate your dialog, you can pass in an IWorkbenchWindow. Then when you need to notify your parts (or when you open your dialog) you can get the views:
IViewReference ref = window.getActivePage().findViewReference(VIEW_ID1);
IWorkbenchPart part = ref.getPart(false); // can return null
if (part instanceof MyView1) {
((MyView1)part).setSelection(myObj);
}
PW
|
|
|
Powered by
FUDForum. Page generated in 0.04201 seconds