IWorkbenchPage.isPartVisible() doesn't return true for a visible part [message #464738] |
Wed, 14 March 2007 18:36 |
Deepak Hathwar Messages: 2 Registered: July 2009 |
Junior Member |
|
|
Hello:
I am trying to use a pulldown menu in my RCP applications toolbar. The
menu has two menu items. One to show a view and the other to hide the
view. In my IWorkbenchWindowPulldownDelegate's getMenu() method, I create
the menu and two menu items. The menu items are either enabled or disabled
depending on the state of the view. In order to determine if the view is
visible I have the following code in the getMenu() method...
<code>
public Menu getMenu(Control parent) {
boolean visible =
this.window.getActivePage().isPartVisible(this.view);
System.out.println(visible);
if (this.menu == null) {
this.menu = new Menu(parent);
this.hideMI = new MenuItem(this.menu, SWT.NULL);
hideMI.setText(this.menuLabels[0]);
hideMI.addSelectionListener(this.listener);
hideMI.setData(ManageViewsListener.VIEW_ID_KEY,
ADVERTISEMENT_VIEW_ID);
hideMI.setData(ManageViewsListener.HIDE_VIEW_KEY, "true");
this.showMI = new MenuItem(this.menu, SWT.NULL);
showMI.setText(this.menuLabels[1]);
showMI.addSelectionListener(this.listener);
showMI.setData(ManageViewsListener.VIEW_ID_KEY,
ADVERTISEMENT_VIEW_ID);
showMI.setData(ManageViewsListener.HIDE_VIEW_KEY, "false");
}
this.hideMI.setEnabled(visible);
this.showMI.setEnabled(!visible);
return this.menu;
}
</code>
Initially, when the perspective is opened, the hideMI is enabled as the
view is visible. Once, the view is closed and re-opened using
IWorkbenchPage.showView() method, the first line always returns false.
Is there anything, I need to do to make the page return true for a view
that was opened after closing it?
Thanks
Deepak
|
|
|
|
Powered by
FUDForum. Page generated in 0.03479 seconds