Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 38290 - [Contributions] visible/enabled: Toggle style toolbar actions ignore state setting
Summary: [Contributions] visible/enabled: Toggle style toolbar actions ignore state se...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.1   Edit
Hardware: All All
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-30 20:30 EDT by mary CLA
Modified: 2007-06-20 13:16 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mary CLA 2003-05-30 20:30:01 EDT
When creating an action for the org.eclipse.ui.viewActions extension point, if 
the style="toggle" and a toolbarPath is specified (as opposed to a 
menubarPath), then the setting of state is ignored. It is always shown as 
false, and if you have the same action associated with both a menubar and 
toolbar, they are not kept in sync. My particular case is:

   <extension point="org.eclipse.ui.viewActions"> 
      <viewContribution 
         id="com.amzi.prolog.debugview.toolbar" 
         targetID="org.eclipse.debug.ui.DebugView">
         <action
            id="com.amzi.prolog.debugview.leashExit" 
            label="Leash Exit Port" 
            icon="icons/exit.gif"
            tooltip="Break at Exit ports"
            toolbarPath="emptyStepGroup"
            style="toggle"
            state="true"
            class="com.amzi.prolog.debug.ui.actions.LeashActionDelegate">
         </action> 
      </viewContribution> 
   </extension>
Comment 1 Debbie Wilson CLA 2003-06-02 14:49:56 EDT
Simon, This doesn't look like a duplicate of bug 37537 but I'm not completely 
sure.  Can you verify?
Comment 2 Douglas Pollock CLA 2004-02-19 22:36:40 EST
Does this bug still persist in one of the more recent 3.0 integration builds 
(e.g., I20040219)? 
Comment 3 Dani Megert CLA 2004-07-06 09:20:43 EDT
I think so, see bug 34747
Comment 4 Douglas Pollock CLA 2004-07-15 11:13:31 EDT
*** Bug 34747 has been marked as a duplicate of this bug. ***
Comment 5 Gail Jakubowski CLA 2005-08-11 12:22:27 EDT
(In reply to comment #0)
The same issue is seen when defining an action using the actionset extension 
point and creating a corresponding toolbar action using an 
ActionbarContributor. With this setup, the toolbar is updated when the menu 
item is selected, but the menu item is not checked when the toolbar action is 
activated:
    <extension point="org.eclipse.ui.editors">
        <editor id="com.webperformanceinc.plugin.myeditor.MyEditor"
            name="%editor.name"
            icon="icons/logo16.png"
            class="com.webperformanceinc.plugin.myeditor.MyEditor"
		
	contributorClass="com.webperformanceinc.plugin.myeditor.actions.MyEditor
ActionbarContributor"/>
    </extension>

    <extension point="org.eclipse.ui.actionSets">
       <actionSet id="com.webperformanceinc.plugin.myactionset"
            label="%actionset.label"
            visible="false">
		<action 
id="com.webperformanceinc.plugin.myeditor.actions.EditorAction"
		menubarPath="edit/additions"
		label="%EditorAction.label"
		tooltip="%EditorAction.tip"
		icon="icons/percent.png"
		disabledicon="icons/percent_disabled.png"
		style="toggle"
		state="false"  
class="com.webperformanceinc.plugin.myeditor.actions.EditorAction"/>
        </actionSet>
    </extension>

In MyEditorActionbarContributor:
	public void contributeToToolBar(IToolBarManager toolBarManager) {
		initializeActions();
		for (int i=0;i<actions.length;i++) {
			toolBarManager.add(actions[i]);
			actions[i].setEnabled(true);
		}
		toolBarManager.update(false);
	}
	protected void initializeActions() {
		actions[0] = new EditorAction();
        }

In EditorAction:
	public int getStyle() {
		return IAction.AS_CHECK_BOX;
	}
Comment 6 Michael Van Meekeren CLA 2006-04-21 13:56:45 EDT
Moving Dougs bugs
Comment 7 Paul Webster CLA 2007-04-05 19:02:32 EDT
Assigning to component owner
PW
Comment 8 Paul Webster CLA 2007-06-20 13:16:53 EDT
This item has been fixed/superceded by the menu contribution mechanism - bug 154130