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

Bug 173678

Summary: [StatusHandling] Workbench ILogDialog swallows dialog title if StatusManager is installed
Product: [Eclipse Project] Platform Reporter: Samantha Chan <chanskw>
Component: UIAssignee: Szymon Brandys <Szymon.Brandys>
Status: VERIFIED FIXED QA Contact:
Severity: major    
Priority: P3 CC: n.a.edgar, snorthov, steveshaw, susan, Tod_Creasey
Version: 3.3   
Target Milestone: 3.3 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on: 175174, 175257    
Bug Blocks:    
Attachments:
Description Flags
screen capture
none
Fix none

Description Samantha Chan CLA 2007-02-09 13:59:42 EST
I20070206-0010

The message dialog is opened as follows:

MessageDialog.openError(
shell,
"Title",
"Message" + "\n" + "Details");

When the dialog is displayed, the string "MessageDetails" is shown on the title bar.  

I will attach screen capture.
Comment 1 Samantha Chan CLA 2007-02-09 14:00:12 EST
Created attachment 58681 [details]
screen capture
Comment 2 Susan McCourt CLA 2007-02-13 16:50:10 EST
I can't reproduce this bug on 3.3 M5 (I20070209-1006).  When I run the snippet, I see the title "Title" up in the title bar.  This is the snippet I used...

package snippets;


import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class MessageDialogBug {
	
	public static void main(String[] args) {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setLayout(new FillLayout());

		MessageDialog.openError(
				shell,
				"Title",
				"Message" + "\n" + "Details");

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}

Comment 3 Samantha Chan CLA 2007-02-13 18:00:22 EST
I reproduced this as follows:
1.  Create a new plugin project.  From the wizard, the project will contribute a new popup menu.
2.  In the project created, open the NewAction class
3.  In the run method of the action, change #openInformation to #openError
4.  Launch a runtime workspace and create a new file
5.  Run the "New Action" from the sample plugin project.

You will see that the title of the message dialog is "New Action was executed"

Comment 4 Susan McCourt CLA 2007-02-13 19:04:57 EST
Thanks for the steps.  I've renamed the bug and marked the severity as "Major" since it is a regression of standard JFace behavior.

The problem is that MessageDialog has been changed in 3.3 to use a generic status handler.  MessageDialog.openError now passes the error dialog info to the installed ILogDialog.  The default JFace ILogDialog simply passes the dialog title, message, and so forth to a message dialog, retaining the old behavior.  

But the workbench sets up its own ILogDialog, which uses a status handler to display the error.  When it creates the status, it sets the status message to the message parameter, but does nothing with the title parameter.

See the ILogDialog defined in JFaceUtil.initializeJFace().
Reassigning to Szymon, as I believe he is working in this code.

Comment 5 Tod Creasey CLA 2007-02-20 08:07:52 EST
*** Bug 174491 has been marked as a duplicate of this bug. ***
Comment 6 Szymon Brandys CLA 2007-02-21 07:58:46 EST
Created attachment 59465 [details]
Fix
Comment 7 Tod Creasey CLA 2007-02-21 10:20:32 EST
A few things to mention 

StatusAdapter has an API change by adding a getTitle and setTitle method. Do we think this is all we want or do we want a setProperty/getProperty so that we have some room for other attributes later?

Did we need to rename StatusInfo to StatusAdapterInfo? More to the point why is this API in the dialog anyways? Why is the info useful? Isn't the StatusAdapter enough? No one refers getSelectedError() so I think we might want to consider removing it or making it package private.


Are we not using showErrorFor(Job job, String title, String msg) anymore? If so we need to mark it as deprecated an give people a week to roll with the changes.

Should addStatusAdapter(StatusAdapter statusAdapter) be publicÉ If so then we need to add this to an API request

There are a lot of commented out methods. If there is some cleanup to be done here please attach it to another bug so that we can focus on this issue.
Comment 8 Nick Edgar CLA 2007-02-21 16:58:04 EST
JFaceUtil also ignores the displayMask.  It doesn't look like the patch addresses this.
Comment 9 Nick Edgar CLA 2007-02-21 16:58:56 EST
It's also still ignoring the passed-in message.
Comment 10 Nick Edgar CLA 2007-02-21 18:44:13 EST
Back link for our bug db: #18468
Comment 11 Nick Edgar CLA 2007-02-21 18:44:36 EST
Sorry, please ignore last comment.
Comment 12 Szymon Brandys CLA 2007-02-26 09:35:56 EST
Mark as FIXED
Comment 13 Susan McCourt CLA 2007-03-28 17:56:52 EDT
*** Bug 179823 has been marked as a duplicate of this bug. ***