Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » IWorkbenchPage.isPartVisible() doesn't return true for a visible part
IWorkbenchPage.isPartVisible() doesn't return true for a visible part [message #464738] Wed, 14 March 2007 18:36 Go to next message
Deepak Hathwar is currently offline Deepak HathwarFriend
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
Re: IWorkbenchPage.isPartVisible() doesn't return true for a visible part [message #465235 is a reply to message #464738] Mon, 26 March 2007 15:19 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Deepak Hathwar wrote:
>
> Is there anything, I need to do to make the page return true for a view
> that was opened after closing it?

when the view is re-opened, are you updating the view field?

PW


Previous Topic:Relationship between Action and ActionDelegate
Next Topic:Using env var for default workspace in eclipse.ini
Goto Forum:
  


Current Time: Sat Sep 14 10:34:22 GMT 2024

Powered by FUDForum. Page generated in 0.03479 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top