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

Bug 94549

Summary: New Java class wizard "Interfaces" table displays junk
Product: [Eclipse Project] Platform Reporter: Jared Burns <jared_burns>
Component: SWTAssignee: Ian Pun <ipun>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: billy.biggs, cocoakevin, eclipse, ericwill, markus.kell.r, snorthov
Version: 4.7   
Target Milestone: 4.7 M2   
Hardware: PC   
OS: Linux-GTK   
See Also: https://git.eclipse.org/r/78969
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=93cbea04d4686273697e48e72ea5b7546547f7c0
https://bugs.eclipse.org/bugs/show_bug.cgi?id=542621
Whiteboard:
Attachments:
Description Flags
interfaces.png - a screenshot of the problem
none
Patch
none
new screenshot none

Description Jared Burns CLA 2005-05-10 18:09:07 EDT
Build 20050509
Linux-GTK

1. Bring up the new Java class wizard.
2. Add an interface.
3. The table element's text is drawn badly. (see screenshot)
Comment 1 Jared Burns CLA 2005-05-10 18:09:42 EDT
Created attachment 20915 [details]
interfaces.png - a screenshot of the problem
Comment 2 Martin Aeschlimann CLA 2005-05-11 03:22:22 EDT
Markus, can you have a look? Is this platform or us?
Comment 3 Markus Keller CLA 2005-05-17 08:24:12 EDT
Fixed in HEAD.
Comment 4 Markus Keller CLA 2005-05-25 14:04:17 EDT
Hmm, does not work in N20050525.
Comment 5 Markus Keller CLA 2005-05-25 14:46:25 EDT
Moving to SWT.

I can reproduce like this:
2.1 click the "Add" button
2.2 write an interface name
2.3 click "OK"

But I cannot reproduce it when I move the top dialog away after step 2.1, so
that the table becomes visible. Seems to be a problem with bounds calculation of
table items that are not drawn yet.
Comment 6 Steve Northover CLA 2005-05-25 20:33:04 EDT
Billy, can you reproduce this?
Comment 7 Billy Biggs CLA 2005-05-25 20:36:04 EDT
Reproducable using N20050523-0010.
Comment 8 Steve Northover CLA 2005-05-25 20:40:24 EDT
BB, want to have a go at fixing this?
Comment 9 Billy Biggs CLA 2005-05-25 20:49:56 EDT
When an interface is selected and the dialog closes, chooseSuperInterfaces() in
o.e.jdt.ui.wizards.NewTypeWizardPage is being called.  This calls
tableViewer.editElement(element, 0) which brings up a cell editor even though
the table doesn't have focus.  The cell editor is what you see above the Table.

I think there are two bugs here:

  1. Why is JDT activating the cell editor when I add an interface?
  2. The cell editor does not have the correct bounds.

I can look into fixing problem 2, unless there's something I'm missing.
Comment 10 Steve Northover CLA 2005-05-25 20:55:41 EDT
Does it happen on Windows?  We can look into it more tomorrow.
Comment 11 Markus Keller CLA 2005-05-26 04:26:40 EDT
Re comment 10:
No, works fine on Windows.

Re comment 9:
1. The cell editor is activated to allow users to add generic type parameters to
the newly added interface (e.g. Comparable<MyClass>)
2. Yes, that's the problem.

However, I think we could also ship without this fix, since there's an easy
workaround (deactivate the cell editor, then start again).
Comment 12 Billy Biggs CLA 2005-05-27 00:21:32 EDT
Created attachment 21866 [details]
Patch

It seems like there are two problems, both of which are races.	Sometimes I can
reproduce consistently, and then sometimes it goes away.  I see it with GTK+
2.6.4, which version is used in the screenshot?  The problems I see:

  1. Sometimes the item height only reflects the image height, and is too
     short for the text.  This is shown in the screenshot from comment #1.
     The attached patch works around the problem for me, but I am not sure
     yet why it is required.

  2. Sometimes the width returned for the image is 0, and so the cell editor
     obscures the icon.  This seems to be a problem with the function
     gtk_tree_view_column_cell_get_position(), but it is hard to debug since
     I cannot reliably reproduce this bug.
Comment 13 Nicholas Rajendram CLA 2007-04-23 14:17:26 EDT
Created attachment 64637 [details]
new screenshot

I tested this on GTK 2.8.10.
The tableitem is no longer drawn as incorrectly as before... but it still doesn't seem right? It looks as though the entire item should be highlighted, but instead the area around the text is covering the background color, leaving a border on the top and side edges of a selection. See screenshot (the middle item is selected).
Comment 14 Steve Northover CLA 2008-04-14 17:12:44 EDT
*** Bug 33283 has been marked as a duplicate of this bug. ***
Comment 15 Eric Williams CLA 2016-08-05 14:49:53 EDT
I can reproduce this issue on my machine. After adding an interface, the text editing area is wrong (as the screenshots in this bug display). After a few seconds, the text jumps back into its spot.

Assigning to Ian.
Comment 16 Eclipse Genie CLA 2016-08-12 11:22:58 EDT
New Gerrit change created: https://git.eclipse.org/r/78969
Comment 17 Ian Pun CLA 2016-08-12 11:30:16 EDT
Billy Biggs' patch fixes the issue in the interface. I don't see a huge problem with the highlighting, as technically the item is correctly highlighted, its just that the editing area widget covers over it. Closing as fixed.
Comment 19 Eric Williams CLA 2016-08-12 15:23:49 EDT
(In reply to Eclipse Genie from comment #18)
> Gerrit change https://git.eclipse.org/r/78969 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=93cbea04d4686273697e48e72ea5b7546547f7c0

Merged Billy's patch, seems to work fine. In master now.