Bug 67022 - [MPE] PME: Label reverts to "Plug-in Manifest Editor" after changing plug-in ID
Summary: [MPE] PME: Label reverts to "Plug-in Manifest Editor" after changing plug-in ID
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: 3.0 RC4   Edit
Assignee: Dejan Glozic CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 67802 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-06-14 12:35 EDT by Dan Kehn CLA
Modified: 2004-06-22 02:38 EDT (History)
6 users (show)

See Also:


Attachments
Before (55.31 KB, image/pjpeg)
2004-06-14 12:36 EDT, Dan Kehn CLA
no flags Details
Mid-way (36.50 KB, image/pjpeg)
2004-06-14 12:36 EDT, Dan Kehn CLA
no flags Details
After (36.66 KB, image/pjpeg)
2004-06-14 12:37 EDT, Dan Kehn CLA
no flags Details
Manifest editor title patch (723 bytes, patch)
2004-06-21 17:50 EDT, Dejan Glozic CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Kehn CLA 2004-06-14 12:35:46 EDT
Build RC

To reproduce:

1. Create plug-in project, "hello.world" (empty is fine)
2. PME opens, label is correct, "hello.world"
3. Change plug-in id, save.
4. Reopen plugin.xml.  Label is now "Plug-in Manifest Editor"

See attached screenshots.
Comment 1 Dan Kehn CLA 2004-06-14 12:36:19 EDT
Created attachment 12046 [details]
Before
Comment 2 Dan Kehn CLA 2004-06-14 12:36:43 EDT
Created attachment 12047 [details]
Mid-way
Comment 3 Dan Kehn CLA 2004-06-14 12:37:00 EDT
Created attachment 12048 [details]
After
Comment 4 Dan Kehn CLA 2004-06-14 12:37:29 EDT
Build RC2, fresh unzip.
Comment 5 Wassim Melhem CLA 2004-06-14 14:31:36 EDT
I see this behavior too.
When opening a plugin.xml for an external plug-in from the Plugins view, I 
randomly either get the id of the plugin (good) or "Plugin Manifest Editor" 
(not good).

When opening a feature.xml, I get "Feature Manifest Editor" as the editor tab 
title.
Comment 6 Wassim Melhem CLA 2004-06-17 14:02:02 EDT
This seems like a Platform/UI issue.
Adding Stefan for comment.

When opening a plugin manifest editor, ManifestEditor.getTitle() gets called 
several times.  The first couple of times, PDE has not initialized a model 
yet, so we return the generic string "Plugin Manifest Editor".  However when 
getTitle() gets called the third time and onwards, we return the id of the 
plugin, but the original generic title does not get overwritten.
Comment 7 Wassim Melhem CLA 2004-06-17 14:49:20 EDT
Moving to Platform/UI
Comment 8 Nick Edgar CLA 2004-06-18 12:13:34 EDT
Moving to Stefan to address post-3.0.
Comment 9 Dejan Glozic CLA 2004-06-18 12:19:05 EDT
Nick, we beg to differ. This is a serious issue for PDE because you don't want 
to have several manifest editors opened with the same label on the tab 
(Manifest Editor). This used to work before, then it stopped, then it got 
fixed, and now it comes and goes depending on the scenario. Therefore, this is 
a regression and should not go into 3.0.
Comment 10 Michael Van Meekeren CLA 2004-06-18 18:49:50 EDT
Is there any way that the editor could return the right thing sooner, or return 
null or something when it does not know the correct title?

What I am saying is have you tried any workarounds?
Comment 11 Dejan Glozic CLA 2004-06-18 19:01:32 EDT
We are open to workarounds but we need to be told about them :-). If returning 
null will do the trick, we can easily do it when our model is still null.
Comment 12 Wassim Melhem CLA 2004-06-19 00:19:02 EDT
*** Bug 67802 has been marked as a duplicate of this bug. ***
Comment 13 Stefan Xenos CLA 2004-06-21 11:43:50 EDT
The manifest editor is not firing a PROP_TITLE property change event when the
result of getTitle() changes (see the JavaDoc for IWorkbenchPart.getTitle()).

This is a tricky thing to get right, which is why the setTitle(...) (and more
recently, setPartName(...)) methods were provided. The exact timing of the first
call to getTitle() is not part of the contract between IWorkbenchPart and the
workbench.

The easiest way to fix this is to call setPartName(...) (or setTitle(...) if
using the old APIs) when the label needs to change rather than overloading
getTitle(...). If this is impossible, then the implementation of getTitle(...)
should be updated to conform to the spec.
Comment 14 Stefan Xenos CLA 2004-06-21 11:48:08 EDT
Moving to PDE. These changes need to be done in PDEFormEditor.

Comment 15 Stefan Xenos CLA 2004-06-21 11:58:57 EDT
Note: PDEFormEditor has a handy updateTitle() method that fires off the missing
property change. If you want to fix this the quick-and-dirty way, you can insert
a call to updateTitle() after the model is first initialized. 

Comment 16 Dejan Glozic CLA 2004-06-21 12:27:07 EDT
This definitely cannot ship like this - making it an RC4 candidate. 
Comment 17 Dejan Glozic CLA 2004-06-21 17:50:17 EDT
The fix is fairly straightforward. If we call 'updateTitle()' 
inside 'createPages()', we will ensure that the title has been recomputed 
after the model is created, ensuring that the value is computed when the model 
is not null:

	protected void createPages() {
		clipboard = new Clipboard(getContainer().getDisplay());
		MenuManager manager = new MenuManager();
		IMenuListener listener = new IMenuListener() {
			public void menuAboutToShow(IMenuManager manager) {
				contextMenuAboutToShow(manager);
			}
		};
		manager.setRemoveAllWhenShown(true);
		manager.addMenuListener(listener);
		contextMenu = manager.createContextMenu(getContainer());
		getContainer().setMenu(contextMenu);
		createInputContexts(inputContextManager);
		super.createPages();
		inputContextManager.addInputContextListener(this);
		String pageToShow = computeInitialPageId();
		if (pageToShow != null)
			setActivePage(pageToShow);
		updateTitle(); <-- The fix
	}

Attached is a patch for this tix.
Comment 18 Dejan Glozic CLA 2004-06-21 17:50:54 EDT
Created attachment 12618 [details]
Manifest editor title patch
Comment 19 Wassim Melhem CLA 2004-06-21 18:21:34 EDT
Patch works great.
+1
Comment 20 Cherie Wong CLA 2004-06-21 18:42:25 EDT
Verified!

+1
Comment 21 Wassim Melhem CLA 2004-06-21 23:49:50 EDT
Konrad, we are soliciting another vote for this defect to be addressed in RC4.
Comment 22 Konrad Kolosowski CLA 2004-06-22 00:10:21 EDT
I agree, that this problem should be fixed.  Patch looks very safe.
+1
Comment 23 Wassim Melhem CLA 2004-06-22 02:38:44 EDT
Patch applied.  Marking as fixed.