Home » Eclipse Projects » Eclipse Platform » Visibility of Menu Contributions - a suggestion
|
Re: Visibility of Menu Contributions - a suggestion [message #330700 is a reply to message #330565] |
Sun, 10 August 2008 05:59 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) ![Go to next message Go to next message](theme/Solstice/images/down.png) |
Shawn Spiars![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=sspiars%40abac.com) Messages: 16 Registered: July 2009 |
Junior Member |
|
|
Kai,
This is probably not the official eclipse way to do this, but here
is what I do. I am using the CommonNavigator and have a class that
extends the CommonActionProvider. I put my program logic that
determines which menu items to show/hide/disable/enable inside of the
fillContextMenu(IMenuManager menu) method.
Shawn
Phurnace Software
Kai Schlamp wrote:
> Hello.
> In my RCP application I have many custom properties (like
> isConnectedToDatabase, isServiceRunning) that affects the visibility of
> various menu and toolbar items.
> If I understand the Menu Contributions correctly, the way would be to
> use custom sources or property testers. I use the later one. So I have
> to write property tester(s) for my custom properties plus call the
> IEvaluationService in the original class of the properties to force
> reevalutation after a property was changed.
> I wonder now, if there is really no way to show/hide/disable/enable menu
> items or toolbar items fully programmatically (I don't see a way at the
> moment to do this, am I wrong?).
>
> I suggest to have following functions:
> IMenuService.setVisible(boolean visible, String menuId)
> ICommandService.setEnabled(boolean enabled, String commandId)
>
> This would allow to setup commands and menu contributions declaratively,
> but also allow to modify the visibility programmatically.
>
> What do you think?
>
> Best regards,
> Kai
|
|
|
Re: Visibility of Menu Contributions - a suggestion [message #330855 is a reply to message #330565] |
Thu, 14 August 2008 17:23 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
|
Kai Schlamp wrote:
> I wonder now, if there is really no way to show/hide/disable/enable menu
> items or toolbar items fully programmatically (I don't see a way at the
> moment to do this, am I wrong?).
No, there's no programmatic way to do this. It had to do with who owns
the actions (framework) and who owns the behaviour (client) and the
various lifecycles, and then on the command framework it has to do with
the separation of the command, handler, and UI element that was added in
response to some of the usecases the action framework couldn't handle.
Something I'm interested in solving is the fact that the UI element
(menu or tool item) is in a context (it's in a view, or the main
toolbar, or a form editor section, etc), but the command determines if
it is enabled or not, and the command has a hard time finding out that
UI context information.
There does have to be a separation between UI (view), model, and
controller, but it seems to me the enablement of a UI element should be
calculated in the context of that UI element.
This is not a simple problem to solve, though, so it'll probably take a
lot of time.
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
|
|
|
Goto Forum:
Current Time: Tue Jul 16 16:56:14 GMT 2024
Powered by FUDForum. Page generated in 0.03745 seconds
|