Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » [commands] Dynamic enablement observation
[commands] Dynamic enablement observation [message #487828] Thu, 24 September 2009 10:16 Go to next message
Eclipse UserFriend
I would like to ask, whether there exists already
more or less direct support for my use-case, before
I reinvent the wheel:

In one of the menus of my RCP main menu I would like
to add a menu contribution (I use org.eclipse.ui.menus
and the command framework and use the declarative way via
the extension points) which allows me to save a copy
of the log file. Similar to the Error Log View I would like
to perform some form of auto-enablement based on the
existence of the log file. Ideally the corresponding
ILogListener would register as soon as any menu contribution
that represents this command becomes (potentially) visible.

Does there exists anywhere a dedicated point in the live-cycle
of menu contributions or the command itself that allows
me to perform this registration (and if possible deregistration)?

I would like to prevent a programmatic registration as part
of my *Advisors classes of my branding plugin, because this
should be done by a plug-in without access to the branding
plug-in.

Thanks in advance,

Daniel Krügler
Re: [commands] Dynamic enablement observation [message #487908 is a reply to message #487828] Thu, 24 September 2009 14:34 Go to previous message
Eclipse UserFriend
In the declarative lifecycle, there aren't many programmatic points of injection.

The closest you can come for enablement is probably:

<handler ...
<enabledWhen>
<test forcePluginActivation="true" property="com.example.isLogAvailable"/>
</enabledWhen>
</handler>

Then your property tester should add a listener if it's not there already and return the appropriate true/false.

In theory the first time something needs to ask that command if it is enabled, the property tester will get called.

PW
Previous Topic:UI Forms Title Area Toolbar & Commands
Next Topic:view action enablement without selection provider
Goto Forum:
  


Current Time: Thu Jul 03 20:56:52 EDT 2025

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

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

Back to the top