Enabling menu item - newbie question [message #459974] |
Sat, 09 December 2006 13:04  |
Eclipse User |
|
|
|
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 #460061 is a reply to message #460013] |
Tue, 12 December 2006 16:32  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03141 seconds