Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » ActiveEditorId Expression
ActiveEditorId Expression [message #331920] Mon, 29 September 2008 14:03 Go to next message
Richard Craddock is currently offline Richard CraddockFriend
Messages: 31
Registered: July 2009
Member
Hi,

I am trying to use expressions to enable/disable (ie set visible/not
visible) menu entries when certain conditions are met. Basically we have a
"profile" which is a bit like a set of preferences and allows users to
turn off certain behaviours.

I have created my own PropertyTester, but I am having a bit of trouble.

The configuration for the propertyTester requires a "type" which I have
set to ...IResource. This works fine when the current selection is an item
in the explorer - although I never use the actual resource.

When the user opens an editor however the propertyTester no longer works.
In fact everything then gets "false" and all of the menu/toolbar items
using this propertyTester disappear!

How can I set up a propertyTester to be used irrespective of the current
selection/ active Editor ?

(At least I think that's the right question !!!!)

Thanks,

Richard
Re: ActiveEditorId Expression [message #332011 is a reply to message #331920] Wed, 01 October 2008 13:45 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Richard Craddock wrote:
> Hi,
>
> I am trying to use expressions to enable/disable (ie set visible/not
> visible) menu entries when certain conditions are met. Basically we have
> a "profile" which is a bit like a set of preferences and allows users to
> turn off certain behaviours.
>
> I have created my own PropertyTester, but I am having a bit of trouble.

Well, the type you pick depends on what menus you wish your contribution
to appear in. Where do you want them? Do you really care about the
current selection, or you expect them to appear in every popup
(controlled by the profile)?

If the second is true, 2 potential solutions are 1) tie your PT to
java.lang.Object, although I don't really recommend this or 2) tie your
PT to org.eclipse.ui.IWorkbenchPart and use it like:

<visibleWhen>
<with variable="activePart">
<test ...whatever.../>
</with>
</visibleWhen>
[/xml]

Later,
PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Previous Topic:Default configuration for dev environment
Next Topic:What's the difference between IEditorSite and IEditorPart
Goto Forum:
  


Current Time: Thu Jul 04 19:18:03 GMT 2024

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

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

Back to the top