Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Examples of expressions in enabledWhen/activeWhen elements
Examples of expressions in enabledWhen/activeWhen elements [message #305259] Tue, 27 June 2006 12:27 Go to next message
Eclipse UserFriend
Originally posted by: jai_shirole123.rediffmail.com

I'm trying to learn/practice the org.eclipse.ui.commands concept.
I've defined a handler for my command.
I want my handler to be active only when one of the specified workbench
parts is active. i.e.if Editor A or ViewPart B or ViewPart C is active.

This means, when I extend org.eclipse.ui.handlers extension point, I have
to form an OR expression for "activeWhen" element.

The help documentation mentions following:
"The workbench provides some variables that these expressions can rely on.
The variables supported are: the active contexts, the active editor, the
"active part" and the current selection. While not supported in this
initial design, it is easy to see how it would be possible to add other
variables or even allow plug-in developers to contribute other variables."

So, how do I have to formulate the expression for my requirement?
A sample from Help doc:
<extension
point="org.eclipse.ui.handlers">
<handler
commandId="commandId"
class="org.eclipse.Handler">
<enabledWhen>
<with variable="context">
<property
id="id"
value="debugging" />
</with>
</enabledWhen>
</handler>
</extension>

Thanks,
J@y
Re: Examples of expressions in enabledWhen/activeWhen elements [message #305262 is a reply to message #305259] Tue, 27 June 2006 13:05 Go to previous messageGo to next message
Eclipse UserFriend
The enabledWhen/activeWhen use an evaluation context (not the same as
the keybinding active context :-)

What release are you in?

In 3.2, the variables available are described in org.eclipse.ui.ISources.

I'd try:
<with variable="activePartId">
<equals value="com.example.MyEditor"/>
</with>

But I couldn't find a good description of the variables and types that
are provided by the workbench.

Later,
PW
Re: Examples of expressions in enabledWhen/activeWhen elements [message #305272 is a reply to message #305262] Wed, 28 June 2006 00:43 Go to previous message
Eclipse UserFriend
Originally posted by: jai_shirole123.rediffmail.com

Hi,
Yes, that solution worked.
I'm in Eclipse 3.2 release so this new stuff is supported there np.
Thanks much for the tip, appreciate it!

Regards,
J@y
Previous Topic:SWT Application on PocketPC Windows Mobile 2003
Next Topic:JFace Menumanager
Goto Forum:
  


Current Time: Sun May 11 07:26:14 EDT 2025

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

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

Back to the top