Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 78898 - [Contributions] [EditorMgmt] SubActionBarstivate()/deactivate() and updateActionBars() not working ac
Summary: [Contributions] [EditorMgmt] SubActionBarstivate()/deactivate() and updateAct...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P2 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-17 17:21 EST by Elias Torres CLA
Modified: 2021-12-28 03:37 EST (History)
8 users (show)

See Also:


Attachments
A testcase plugin demonstrating my SubActionBars problem. (10.67 KB, application/zip)
2004-11-17 17:22 EST, Elias Torres CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Elias Torres CLA 2004-11-17 17:21:06 EST
I'm trying to contribute items in a MultiPageEditor on a per nested-Editor
basis. The method I'm following is to create a separate SubActionBar for each
nested-editor and activate/deactivate as setActivePage/setActiveEditor is being
called on my MultiPageEditorActionContributor.

I believe everything is being called, but activate/deactivate seem to cause no
effect on the actual ToolBar actions, even after calling updateActionBars().
Comment 1 Elias Torres CLA 2004-11-17 17:22:59 EST
Created attachment 15952 [details]
A testcase plugin demonstrating my SubActionBars problem.

Most of the demo code is in MultiPageEditorContributor. I've added two new
SubActionBars and two new Actions that I'm trying to hide depending on the
active nested-editor.
Comment 2 Nick Edgar CLA 2005-05-12 11:54:58 EDT
Punting to RC1.  
Comment 3 Michael Van Meekeren CLA 2005-06-14 15:24:21 EDT
NE to investigate for RC3
Comment 4 Nick Edgar CLA 2005-06-15 16:04:39 EDT
There is major breakage here:

- The editor's ToolbarManager gets dirtied when one of the SubToolBarManager's
visibility changes, but this does not get propagated to the containing
CoolBarManager.  Should use a subclass of ToolbarManager whose markDirty()
method propagates to the CoolBarManager.
E.g. have getToolBarManager() call:
	/**
	 * Creates the tool bar manager for the editor.
	 * This propagates any dirtying up to the parent cool bar manager.
	 */
	private ToolBarManager createToolBarManager(final ICoolBarManager coolBarManager) {
		return new ToolBarManager(coolBarManager.getStyle()) {
			public void markDirty() {
				super.markDirty();
				coolBarManager.markDirty();
			}
		};
	}


- If this is fixed, then the corresponding ToolBarContributionItem gets told to
update(), but this is a no-op.  It should call update(true) which does an
update() on the ToolBarManager.
e.g. add:
    /* (non-Javadoc)
     * @see org.eclipse.jface.action.IContributionItem#update()
     */
    public void update() {
    	update(null);
    }

- If this is fixed, then the initial state is still wrong.  The items on the
SubToolBarManagers have visible==true, even though they had visible==false when
first added.  Their visibility state gets whacked in
EditorActionBars.setVisible.  EditorActionBars should not reach into the state
of the SubToolBarManager or its items.  Should use the
IContributionManagerOverrides mechanism to override the enablement state instead
(as is done for menus).  Still need to force an update when the visibility is
changed.

- Also: could optimize SubContributionManager.setVisible to only do work if the
state changes.  That is, add:
    	if (this.visible == visible) {
    		return;
    	}
Can only do this once the whacking above is fixed.
The invariant to be maintained is: the SubContributionManager's visibility is
the same as for all the SubContributionItem wrappers for its items.

Changes in this area are notoriously fragile.  Deferring to 3.2 as it's too
risky for 3.1.
Comment 5 Nick Edgar CLA 2005-06-15 16:05:49 EDT
s/update(true)/update(null)
Comment 6 Nick Edgar CLA 2005-06-15 16:12:26 EDT
The workaround is to add all actions and make them always visible, but update
their enablement state accordingly when the active nested editor changes.
Comment 7 Nick Edgar CLA 2006-02-10 15:33:35 EST
Doug, this is a pretty serious issue.  Can you look at it for 3.2?
Comment 8 Michael Van Meekeren CLA 2006-04-21 13:18:45 EDT
Moving Dougs bugs
Comment 9 Tod Creasey CLA 2006-05-01 11:20:57 EDT
Deferring
Comment 10 Mike Wilson CLA 2008-04-12 11:35:59 EDT
This bug is marked P2/major with a target milestone of 3.3. Did anything get done?


Comment 11 Kim Horne CLA 2008-04-14 11:07:42 EDT
No, this slipped through the cracks.  I'm not entirely sure why it landed in my bucket at all - my experience with these components has been restricted to scary stories told 'round the campfire by a flashlite-lit Paul. 

Paul, I've confirmed this is still an issue but am hesitant to play Jenga in this area.  How would you like to handle this?
Comment 12 Mike Wilson CLA 2008-04-14 12:54:48 EDT
Assume you meant to give this to Paul?
Comment 13 Remy Suen CLA 2008-07-17 23:20:29 EDT
Is this related to bug 71923?
Comment 14 Paul Webster CLA 2008-07-21 09:28:06 EDT
(In reply to comment #13)
> Is this related to bug 71923?


No, this is coolbar related, and it looks like bug 71923 is a workbench window with a toolbar.

PW

Comment 15 Paul Webster CLA 2009-03-02 11:39:26 EST
Updated as per http://wiki.eclipse.org/Platform_UI/Bug_Triage
PW
Comment 16 Jurgen Vinju CLA 2009-10-08 13:47:04 EDT
I seem to have the same issue. I'm extending IMP's UniversalEditor, using a PartListener to call activate and deactivate of a SubActionBar. Same behavior as reported. I've tried to 'manually' set the visibility of the embedded contribution items, that helps a bit, but not satisfactory since sometimes they don't reappear (when the focus moves to a different part of the perspective).
Comment 17 Eclipse Webmaster CLA 2019-09-06 16:07:05 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 18 Eclipse Genie CLA 2021-12-28 03:37:34 EST
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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.

--
The automated Eclipse Genie.