Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Enabling menu item - newbie question
Enabling menu item - newbie question [message #459974] Sat, 09 December 2006 13:04 Go to next message
Eclipse UserFriend
Originally posted by: guefeld.spammerslammer.com

Hello NG

Having a RCP application I want to create a submenu item, which should be
only enabled, when no editor window inside the workbench is open.
Do I need a listener,
Is there somewhere a description howto make it? I could not find an example

Thanks in advance for your suggestions.

G
Re: Enabling menu item - newbie question [message #459999 is a reply to message #459974] Sun, 10 December 2006 23:00 Go to previous messageGo to next message
Eclipse UserFriend
Hmm -- not sure I've understood the question, but maybe you could (in your action-delegate, or
whatever implements your menu-item) make use of:
<code>PlatformUI.getWorkbench().getWorkbenchWindows()</code >

HTH,
Paul
Re: Enabling menu item - newbie question [message #460013 is a reply to message #459999] Mon, 11 December 2006 11:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: guefeld.spammerslammer.com

How to explain...

Having a RCP application, my objective is to have a menu item in the
workbench menu, which is only enabled, when no kind of child window, editor,
view is opened, otherwise it should become disabled when any kind of editor
or view is opened. If the last editor or view is closed, the menu item
should be enabled again.
So where to manage this?

Thanks in advance for your suggestions.
G
Re: Enabling menu item - newbie question [message #460061 is a reply to message #460013] Tue, 12 December 2006 16:32 Go to previous message
Eclipse UserFriend
Well, I would manage the initial enablement by using the code I suggested (in the action-delegate's
constructor); then I would make the action-delegate also an IPartListener2 (sic) and on every
change, check the same code (actually, you say "window" but referring to editors and views suggests
you may want to check for number of views/editors open too, also accessible by iterating the
windows, then the WorkbenchPage's of each, etc.); I would connect the part-listener, in the
action-delegate's c'tor to the PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().
Since I have never actually done any of that, I am not so sure where all the gotchas would be.

(I think it is true that if the workbench is up and running, there is at least one window that has
at elast one page.)

HTH,
Paul
Previous Topic:[databinding] what's the status
Next Topic:any API to set description and/or title of the "new wizard"?
Goto Forum:
  


Current Time: Fri Mar 21 11:03:13 EDT 2025

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

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

Back to the top