Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 34747

Summary: [Contributions] visible/enabled: Control initial enablement of action set actions
Product: [Eclipse Project] Platform Reporter: Lynne Kues <lynne_kues>
Component: TextAssignee: Paul Pazderski <paul-eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, paul-eclipse
Version: 2.1   
Target Milestone: 4.16 M3   
Hardware: All   
OS: All   
See Also: https://git.eclipse.org/r/161647
https://git.eclipse.org/c/platform/eclipse.platform.text.git/commit/?id=02a132ef576618cb7738c6efe0c2276de35b81b4
Whiteboard:

Description Lynne Kues CLA 2003-03-11 16:48:50 EST
RC2

Start with a new workspace.
Start Eclipse.
Notice that the Go To Last Edit Position toolitem is active.  Click on it and 
it tells you "the chosen operation is not enabled".  

Why is the toolitem even enabled?
Comment 1 Dani Megert CLA 2004-07-06 06:25:11 EDT
We contribute it like this:
      <actionSet
            label="%textEditorNavigationActionSet.label"
            visible="true"
            id="org.eclipse.ui.edit.text.actionSet.navigation">
         <action
               toolbarPath="org.eclipse.ui.workbench.navigate/history.group"
               id="org.eclipse.ui.edit.text.gotoLastEditPosition"
               hoverIcon="icons/full/ctool16/last_edit_pos.gif"
               class="org.eclipse.ui.internal.texteditor.GotoLastEditPositionAction"
               definitionId="org.eclipse.ui.edit.text.gotoLastEditPosition"
               disabledIcon="icons/full/dtool16/last_edit_pos.gif"
               icon="icons/full/etool16/last_edit_pos.gif"
               helpContextId="goto_last_edit_position_action_context"
               label="%goToLastEditPosition.label"
               menubarPath="navigate/"
               tooltip="%goToLastEditPosition.tooltip">

The class is not loaded at this point and hence it is enabled. We now tried to add 
               style="toggle"
               state="false"

but this also doesn't disable the button.
Comment 2 Dani Megert CLA 2004-07-06 09:23:37 EDT
Released addition:
               style="toggle"
               state="false"
to 3.1

Note: most likely now a dup of bug 38290

Comment 3 Douglas Pollock CLA 2004-07-15 11:13:30 EDT
I agree that this problem seems like a duplicate of Bug 38290. 

*** This bug has been marked as a duplicate of 38290 ***
Comment 4 Dani Megert CLA 2004-08-04 09:46:13 EDT
The change mentioned in comment 2 is wrong and has been reverted since it is a
push and not a toggle button. This means the "state" cannot be used.
Comment 5 Dani Megert CLA 2004-08-04 09:49:24 EDT
It should be possible to provide the initial enable/disable state.

Note: "style" is only defined for toggle and radio.

Please move back to Platform/Text to adapt the plugin.xml once this is possible.
Comment 6 Jörg von Frantzius CLA 2004-11-19 14:34:20 EST
This is a problem for RCP applications that want to start with a defined
enablement of actions, i.e. CoolBar-buttons. I can't see any way of disabling
certain actions right from the start of the application, and in the context of
RCP  I wouldn't call that an enhancement request but a normal bug.

There might be workarounds such as asking the extension registry for the
action's contribution, I don't know. Or fumbling with "<enablement>" and
"<selection>" in the plugin.xml, but that relates to selections in the workbench
which do not necessarily exist in an RCP application.
Comment 7 Michael Van Meekeren CLA 2006-04-21 13:56:45 EDT
Moving Dougs bugs
Comment 8 Paul Webster CLA 2007-04-05 19:02:07 EDT
Assigning to component owner
PW
Comment 9 Eclipse Webmaster CLA 2019-09-06 16:08:35 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.
Comment 10 Paul Pazderski CLA 2020-04-28 05:15:02 EDT
(In reply to Dani Megert from comment #5)
> It should be possible to provide the initial enable/disable state.
> 
> Note: "style" is only defined for toggle and radio.
> 
> Please move back to Platform/Text to adapt the plugin.xml once this is
> possible.

Possible since bug 552350.
Comment 11 Eclipse Genie CLA 2020-04-28 05:16:14 EDT
New Gerrit change created: https://git.eclipse.org/r/161647