|
Re: Hiding MenuContriubtions for a given Command [message #327527 is a reply to message #327473] |
Wed, 23 April 2008 14:58 |
|
There are a couple of ways to do it ... if the system admin of your RCP
app can configure which roles link to which commands, then you would
probably have to use your property tester.
The best way to do it is to create a couple of
org.eclipse.core.expressions.definitions and reuse them in your menu
contribution visibleWhen clauses.
There is an outstanding feature (maybe 3.5?) for menu overrides, the
ability (especially for a product or RCP app) to override a menu item or
tool items visibility (and potentially other things like image, text,
enabled state, etc). Not implemented, and not well spec'ed out.
In 3.4 there is decent API to register your own source provider
(org.eclipse.ui.services), and also decent API to simply requests a
specific property tester-property be re-evaluated (IEvaluationService)
(if your property tester doesn't need a specific source).
In 3.3, it's a lot more "hackery", and not enough API.
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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
|
|
|
Re: Hiding MenuContriubtions for a given Command [message #327530 is a reply to message #327527] |
Wed, 23 April 2008 15:52 |
Stuart Pond Messages: 27 Registered: July 2009 |
Junior Member |
|
|
Yes, we are using Eclipse 3.3. and yes the system admin can configure the
roles to link to which commands.
I have created a command_suppression custom source and this works, but boy
is my menu contribution xml kind of ugly. Is there any way to clean this
up? Can Definitions take variables like command id
Every single command's MenuContribution has something like this:
<visibleWhen>
<with variable="command_suppression">
<not>
<iterate operator="or">
<equals
value="org.eclipse.ui.file.print">
</equals>
</iterate>
</not>
</with>
</visibleWhen>
Is there a way to clean this up. Is there a way to say currentCommandId?
Also, is there away I could add the visibleWhen clause programatically to
all commandContributions?
"Paul Webster" <pwebster@ca.ibm.com> wrote in message
news:funifo$akc$1@build.eclipse.org...
> There are a couple of ways to do it ... if the system admin of your RCP
> app can configure which roles link to which commands, then you would
> probably have to use your property tester.
>
> The best way to do it is to create a couple of
> org.eclipse.core.expressions.definitions and reuse them in your menu
> contribution visibleWhen clauses.
>
> There is an outstanding feature (maybe 3.5?) for menu overrides, the
> ability (especially for a product or RCP app) to override a menu item or
> tool items visibility (and potentially other things like image, text,
> enabled state, etc). Not implemented, and not well spec'ed out.
>
> In 3.4 there is decent API to register your own source provider
> (org.eclipse.ui.services), and also decent API to simply requests a
> specific property tester-property be re-evaluated (IEvaluationService) (if
> your property tester doesn't need a specific source).
>
> In 3.3, it's a lot more "hackery", and not enough API.
>
> 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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
|
|
|
Powered by
FUDForum. Page generated in 0.03656 seconds