Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to create global actions with dynamic label and enablent
How to create global actions with dynamic label and enablent [message #819754] Tue, 13 March 2012 05:35 Go to next message
Eclipse UserFriend
I would need to create global actions that can change state in the time, but don't depend on any editor or view. The actions can be in two states:
index.php/fa/7503/0/
or:
index.php/fa/7504/0/
When I define the action with class attribute:
          <action
                class="com.gooddata.clover.designer.actions.SignInAction"
                id="com.gooddata.clover.designer.action.SignIn"
                label="%authorization_sign_in"
                menubarPath="com.gooddata.clover.designer.Server/Server">
          </action>

the label and state can't be changed dynamicaly. But, when I mark the action as "retarget" I can add it to the editor or view only.
What is the proper way of handling such situation?
Re: How to create global actions with dynamic label and enablent [message #819786 is a reply to message #819754] Tue, 13 March 2012 06:23 Go to previous messageGo to next message
Eclipse UserFriend
AFAIK it's not possible to do with out-dated Actions. Actions are considered out-dated, checkout Commands Framework instead. In case of Command Frameworks it is achievable with

<extension point="org.eclipse.ui.menus">
    <menuContribution
          allPopups="false"
          locationURI="menu:com.virtage.plexflow.menu.file?after=additions">
          
          <command
             commandId="com.virtage.plexflow.ui.explorer.NewContainer"
             label="New folder...">
             
             <!-- visible when Explorer editor is focused -->
             <visibleWhen>
                <with variable="activePartId">
                      <equals
                            value="com.virtage.plexflow.ui.explorer.ExplorerEditor">
                      </equals>
                </with>
             </visibleWhen>
             
       </command>
    </menuContribution>
    ...
    


There's a lot of possible <visibleWhen> conditions that are made win use of so-called core expressions.
Re: How to create global actions with dynamic label and enablent [message #819888 is a reply to message #819786] Tue, 13 March 2012 08:54 Go to previous messageGo to next message
Eclipse UserFriend
Thank you for answer. This way I'm able to control enability of the menu item, but I'm not able to change the label Sad
Re: How to create global actions with dynamic label and enablent [message #819972 is a reply to message #819786] Tue, 13 March 2012 11:06 Go to previous messageGo to next message
Eclipse UserFriend
Is it possible to provide "visibleWhen" programatically? If it would be possible I could create more diffrent actions and show the one with label I need. But I have no idea how to implement visibleWhen, with the current state of my object.
Re: How to create global actions with dynamic label and enablent [message #820007 is a reply to message #819972] Tue, 13 March 2012 12:04 Go to previous messageGo to next message
Eclipse UserFriend
At last I've found that it is piece of cake: all I need is to add a dynamic element that implements IContributionItem to my menu. Then I can change the label as well as enablement.
Re: How to create global actions with dynamic label and enablent [message #820051 is a reply to message #820007] Tue, 13 March 2012 13:07 Go to previous message
Eclipse UserFriend
Hi

i am also looking for similar stuff can you explain or provide some code for that?

thanks in advance

cheers,
Previous Topic:RCP and Database
Next Topic:Open custom editor from cnf
Goto Forum:
  


Current Time: Fri Jul 04 17:32:15 EDT 2025

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

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

Back to the top