Bug 240135 - [ErrorHandling] ErrorDialog#createDialogArea does not respect Dialog#createDialogArea contract
Summary: [ErrorHandling] ErrorDialog#createDialogArea does not respect Dialog#createD...
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Kevin McGuire CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed, greatbug
Depends on:
Blocks:
 
Reported: 2008-07-09 06:00 EDT by Krzysztof Daniel CLA
Modified: 2008-09-01 09:13 EDT (History)
5 users (show)

See Also:


Attachments
An example (901.66 KB, image/bmp)
2008-07-09 06:00 EDT, Krzysztof Daniel CLA
no flags Details
Picasso Visualisation (1.06 MB, image/bmp)
2008-07-09 06:04 EDT, Krzysztof Daniel CLA
no flags Details
Fix (1.42 KB, patch)
2008-07-09 06:06 EDT, Krzysztof Daniel CLA
no flags Details | Diff
Same screenshots with applied patch (841.69 KB, image/bmp)
2008-07-09 06:09 EDT, Krzysztof Daniel CLA
no flags Details
Manual Tests (9.21 KB, application/x-zip-compressed)
2008-07-09 06:12 EDT, Krzysztof Daniel CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof Daniel CLA 2008-07-09 06:00:59 EDT
Created attachment 106930 [details]
An example

Build ID: I20080617-2000

Dialog#createDialogArea javadoc says:
* @return the dialog area control 

but ErrorDialog#createDialogArea overrides Dialog#createDialogArea, does not call super (what is acceptable) and creates some components that are out of the dialog area control.

The problem appears when someone extends ErrorDialog and places additional widgets (createMessageArea overriden) *and* support area is enabled.

Support Area increases the number of available columns in GridLayout, however it is created after message area. So increasing columns count causes all widget to be shifted. ChangeExceptionHandler#RefactorErrorDialog is a good example (see attachment 1 [details]).
Comment 1 Krzysztof Daniel CLA 2008-07-09 06:04:24 EDT
Created attachment 106931 [details]
Picasso Visualisation 

Note the blue rectangle just above the buttons - it is empty dialog area. Message components are placed somewhere else. Note also the shift of components.
Comment 2 Krzysztof Daniel CLA 2008-07-09 06:06:06 EDT
Created attachment 106932 [details]
Fix

Fix is easy - message components have to be placed on the dialog area composite. We can also decrease vertical span for support, as we have one row less now.
Comment 3 Krzysztof Daniel CLA 2008-07-09 06:09:15 EDT
Created attachment 106933 [details]
Same screenshots with applied patch

Now message components are correctly placed.
Comment 4 Krzysztof Daniel CLA 2008-07-09 06:12:33 EDT
Created attachment 106934 [details]
Manual Tests

To reproduce:
import project, optionally import picasso (http://wiki.eclipse.org/PDE/Incubator/Picasso)

enable support (in testing menu), open error dialog (in testing menu)

To open refactoring error dialog
0. enable support
1. Open Java File with WORD.
2. Try to rename it.
Comment 5 Eddie Galvez CLA 2008-07-09 15:43:37 EDT
Could this fix possibly help 220250 ?
Comment 6 Krzysztof Daniel CLA 2008-07-09 16:21:28 EDT
(In reply to comment #5)
> Could this fix possibly help 220250 ?

I do not think so... I am trying to work dialog better in certain conditions, and I do not intend to change its behavior.
Comment 7 Kevin McGuire CLA 2008-07-16 18:22:34 EDT
Good investigation.  I agree that the fix must have the characteristic that the message and support areas are each single sibling composites. That's the only way to control layout.

Another fix would be for IconAndMessageDialog.createMessageArea() to create and return its own (new) composite. This makes createMessageArea() and createSupportArea() similar (both create composites in parent from createDialogArea()).  

However we must then trust that someone isn't overriding createMessageArea() and not calling super.  Nothing in the Javadoc prevents that.  So ok I think your solution is better although it looks odd in ErrorDialog.createDialogArea() to have:

	createMessageArea(composite);
	createSupportArea(parent);

I'm ok with this patch as is but it needs a comment in createDialogArea() explaining why the args of those to creates are different.
Comment 8 Kevin McGuire CLA 2008-07-16 18:41:23 EDT
Thinking more, you're right that this observes the contract from Dialog better.
Patch released with an additional explanatory comment.

Thanks for the patch!
Comment 9 Kevin McGuire CLA 2008-07-16 18:53:12 EDT
Marking as "greatbug" because:

1) You reported it
2) Analyzed why it was happening
3) Provided proof of issue via picasso snaps
4) Provided patch to fix
5) Provided test case and further picasso snaps to show fixed

Wow!!!  Nice work!
Comment 10 Krzysztof Daniel CLA 2008-08-12 03:49:30 EDT
verified with following procedure:
0. add support area to error dialog
1. create java project with some class
2. open the class with ms word
3. try to rename the class

ErrorDialog appears, picasso shows that everything is OK.
Code is in repository.