How do I get different togglestates of a command between views [message #893562] |
Wed, 04 July 2012 14:52 |
Alexander Haag Messages: 119 Registered: July 2009 |
Senior Member |
|
|
Hi there,
I have an RCP application (using indigo) with multiple navigation views (some of them also multi-instance). Those views all need to have a common command, lets call it 'alphasort'.
This command should be a toggle command and should appear in the toolbars & menus of all the views. Most of the time there are at least two views visible (parallel to each other for Drag&Drop).
The command has a default handler doing the same on every view (setting special sorter). What I want to have is that there is a toggle-state for this command for every view, not a single togglestate for the command.
Right now i have a single togglestate so that toggling in one view will toggle the command in the other views too. I read this behaviour as designed behaviour (see 'https://bugs.eclipse.org/bugs/show_bug.cgi?id=221980#c5').
I defined the command using the article of Prakash ('http://blog.eclipse-tips.com/2009/03/commands-part-6-toggle-radio-menu.html'), see plugin.xml-snippet below.
There was a similar question like mine asked by 'Jay in August 25, 2011 5:57 AM', any replies on that?
Questions:
- Is there a way to get a togglestate for each view?
- Would it help to create view-dependend handler (using activeWhen-definition) and let the handler manage the togglestate or do i have to define the command multiple times (one for each view)?
- I did not see any way to add the toggle-state to the handler-definition in plugin.xml (this was my first idea getting what i want).
snippet of plugin.xml
<command
defaultHandler="<myPackages>.CreatorToggleCommandAbstractHandler"
id="EditorialManagement.Actions.AlphaSortCommand"
name="AlphaSort">
<state
class="org.eclipse.jface.commands.ToggleState"
id="org.eclipse.ui.commands.toggleState">
</state>
</command>
If you need any more information, please ask!
Thanks for any help
Alex
[Updated on: Wed, 04 July 2012 15:27] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01947 seconds