Bug 185245 - [Contributions] legacy actions no longer work for multipage editors
Summary: [Contributions] legacy actions no longer work for multipage editors
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-05-02 18:11 EDT by Amy Wu CLA
Modified: 2007-06-06 08:19 EDT (History)
1 user (show)

See Also:


Attachments
org.eclipse.ui.workbench.patch (1.55 KB, patch)
2007-05-02 18:14 EDT, Amy Wu CLA
no flags Details | Diff
Update the dispose listener (1.47 KB, patch)
2007-05-03 08:51 EDT, Paul Webster CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Amy Wu CLA 2007-05-02 18:11:36 EDT
Around Eclipse 3.3 M6 our editor actions stopped working for multipage editors.

I believe the problem is in org.eclipse.ui.actions.ContributedAction.  It is expecting locator to be an instance of PartSite when it does not necessarily have to be.  It looks like locator can just be an instance of IWorkbenchPartSite.  (EditorPartSite is an instance of PartSite, but MultiPageEditorSite is not)

**The constructor should be changed from:
if (locator instanceof PartSite) {
	updateSiteAssociations((PartSite) locator, commandId, actionId,
			element);
}
**to:
if (locator instanceof IWorkbenchPartSite) {
	updateSiteAssociations((IWorkbenchPartSite) locator, commandId, 
	actionId, element);
}

**And
private void updateSiteAssociations(PartSite site, String commandId,
			String actionId, IConfigurationElement element) {
**should be changed to 
private void updateSiteAssociations(IWorkbenchPartSite site, String commandId,
			String actionId, IConfigurationElement element) {
Comment 1 Amy Wu CLA 2007-05-02 18:14:19 EDT
Created attachment 65701 [details]
org.eclipse.ui.workbench.patch

Here is a patch (based on latest code from head) with the fix.
Comment 2 Paul Webster CLA 2007-05-02 21:06:53 EDT
Released to HEAD for I20070503-0010
PW
Comment 3 Paul Webster CLA 2007-05-03 07:44:10 EDT
Now the "part" listener is incorrect
PW
Comment 4 Paul Webster CLA 2007-05-03 08:51:05 EDT
Created attachment 65754 [details]
Update the dispose listener

If we're a "version" of MultiPageEditorSite, listener for the real editor close, not the inner editor.

PW
Comment 5 Paul Webster CLA 2007-05-03 08:52:56 EDT
Fixed in HEAD
PW
Comment 6 Paul Webster CLA 2007-05-03 18:39:58 EDT
Amy, could you please verify this using I20070503-1400?

It works for me.

PW
Comment 7 Amy Wu CLA 2007-05-03 19:05:39 EDT
I just tried it and it looks like if i invoke an action, the action then becomes disabled until i switch focus to another part and then come back.
Comment 8 Paul Webster CLA 2007-05-03 19:15:52 EDT
I probably won't be able to fix that for M7, it'll have to be RC1 (2 weeks).  Could you please open another bug?

Also, what would be an easily replicatable test case I could try here?  The MultiPageEditorPart example has actions like Add task and add bookmark, and they seem to work.  Is there something simple I could add to that example that would show the disabled behaviour?  (IIRC, it has a text editor and 2 "pages")

Thanx,
PW
Comment 9 Amy Wu CLA 2007-05-03 20:21:16 EDT
Thanks for fixing this bug so quickly.  I've opened bug 185475 to track the new issue.  I'll try to come up with some sort of example you can use.  I noted this in bug 185475, but I think the issue is with what is the active editor/part.
Comment 10 Amy Wu CLA 2007-05-08 13:03:49 EDT
verified using Eclipse 3.3 I20070508-0800.  Thanks!