Changing a Viewpart from a Menu item [message #696971] |
Fri, 15 July 2011 04:27  |
Eclipse User |
|
|
|
Hello,
I have a menu Item that when selected should change a view part's widget layout.
For now I am using the selection provider-selection listener pattern in a way
that I don't like very much.
In a class I have a static member that stores a reference to the menu command's
handler object. When I construct the command object I store it there. The menu command implements the ISelectionProvider interface.
In the view, on the createPartControl method I set the selection provider to the
command object I stored previously and register the view as a selection listener.
Like this :
public void createPartControl(Composite parent) {
...
getSite().setSelectionProvider(Application.getLoadTxFileCmdObj());
getSite().getPage().addSelectionListener(this);
...
The problem is that the view part is doing the selection provider addition code.
I would prefer to do it on the menu command class. But there is no method that
is run at initialization after all objects are constructed.
Is there a standard way to make this communication happen between a menu command and a view ?
Thanks for your reply
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.24134 seconds