This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 289090 - [CommonNavigator] labels are missing
Summary: [CommonNavigator] labels are missing
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 blocker (vote)
Target Milestone: 3.5.1   Edit
Assignee: Francis Upton IV CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 296253
  Show dependency tree
 
Reported: 2009-09-10 11:42 EDT by Dimitar Giormov CLA
Modified: 2009-11-27 05:21 EST (History)
15 users (show)

See Also:
john.arthorne: pmc_approved+
mober.at+eclipse: pmc_approved+


Attachments
missing labels (41.45 KB, image/jpeg)
2009-09-10 11:42 EDT, Dimitar Giormov CLA
no flags Details
Proposed patch (876 bytes, patch)
2009-09-11 15:02 EDT, Francis Upton IV CLA
no flags Details | Diff
Patch as applied to HEAD (24.31 KB, patch)
2009-09-12 03:14 EDT, Francis Upton IV CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitar Giormov CLA 2009-09-10 11:42:45 EDT
Created attachment 146876 [details]
missing labels

see the screenshot
labels are missing in EAR and EJB project.
Comment 1 David Williams CLA 2009-09-10 13:03:42 EDT
Maybe others know if WTP changed in this area ... but, have you tried testing with base Eclipse 3.5? Instead of the near 3.5.1 version? Just in case it is their regression?
Comment 2 Carl Anderson CLA 2009-09-10 16:22:32 EDT
I just tested this scenario with eclipse-SDK-3.5.1RC2-win32.zip and eclipse-SDK-3.5.1RC3-win32.zip.  (All other files were identical.)  Only the setup with the RC3 version of the base showed this problem.

I am not sure if this was a change that we were supposed to react to, or if this is a regression from the base.  Either way, a change like this between RC2 and RC3 is not desireable.

David Williams did some investigation- the most likely candidate for the cause of this is bug 287103
Comment 3 Carl Anderson CLA 2009-09-10 18:04:02 EDT
Here is what I discovered investigating the Ear 5 labels - in bug 287103, they altered the way that the label provider is looked up.  Instead of going directly to the Ear 5 label provider, it goes through NavigatorContentServiceLabelProvider.getStyledText(), and gets a set of 3 possible label provider extensions- Web 25, Ear 5, and Working Sets.
(Note: only Ear 5 has a trigger for ModulesNode and BundledNode... but it wants to check all three now.)
It tries Web 25 first.  It gets our Web25LabelProvider, which has a org.eclipse.ui.model.WorkbenchLabelProvider to provide labels for Adaptable objects.  Since the Web25LabelProvider does not work for either the ModulesNode or BundledNode, it calls WorkbenchLabelProvider.getText(Object element), which returns "" for the text.
NavigatorContentServiceLabelProvider.findStyledText(), on line 183, simply checks:
if (text != null)
And, since "" is not equal to null, the text for many of our items is "".
Simply adding a check to see if text.length > 0 to that if statement should remedy our problem.
Comment 4 Francis Upton IV CLA 2009-09-10 18:41:20 EDT
(In reply to comment #3)
> returns "" for the text.
> NavigatorContentServiceLabelProvider.findStyledText(), on line 183, simply
> checks:
> if (text != null)
> And, since "" is not equal to null, the text for many of our items is "".
> Simply adding a check to see if text.length > 0 to that if statement should
> remedy our problem.
This is probably the right solution; I will prepare a patch and run our tests.
Comment 5 Boris Bokowski CLA 2009-09-10 23:19:48 EDT
Kim, is another 3.5.1 rebuild still possible at this point?
Comment 6 Kim Moir CLA 2009-09-11 08:45:34 EDT
The RC4 build isn't due to be released to galielo build until Sept 14 (Mon)
Comment 7 Kaloyan Raev CLA 2009-09-11 08:51:04 EDT
This should be OK for WTP. 
If possible, please point us an earlier nightly build of the platform that contains the fix, so we can retest before RC4 is declared.
Comment 8 Francis Upton IV CLA 2009-09-11 09:06:02 EDT
(In reply to comment #7)
> This should be OK for WTP. 
> If possible, please point us an earlier nightly build of the platform that
> contains the fix, so we can retest before RC4 is declared.
I can put the patch into tonight's HEAD, but I don't think that will do you any good (unless you want to test with HEAD).  I will have the patch done sometime today (California time), but I don't think there will be an M build before Monday.  Of course you can always just apply the patch and test.
Comment 9 Kaloyan Raev CLA 2009-09-11 09:19:38 EDT
OK, then let's have the patch attached to this bug.
Comment 10 Francis Upton IV CLA 2009-09-11 14:28:15 EDT
I can't figure out how to make this problem happen.  I am using the 3.5.0 eclipse-jee as my target platform and all of the labels are OK, but I can't figure out how to create Jar files under the deployment descriptors.

Can you provide exact steps for me to follow to make this happen?

The sooner the better as we need lots of approval to get this into a build tonight.
Comment 11 Francis Upton IV CLA 2009-09-11 14:33:51 EDT
Also, I can't find a regression in the NavigatorContentServiceLabelProvider.  When getText() is called on the client label provider, and it returns null, then it moves onto the next.  If it returns an empty string, it uses that.

By contrast the getStyledText() works differently as there is no way to return a null from getStyledText().  So if it returns an empty string it is bypassed.

The comment above in the bug report refers to line 183 in NCSLP which has nothing to do with getting the text (or styled text).

I think the change to have getText() skip empty labels is fine if it fixes this problem, but I don't fully understand what change caused the problem in the first place (vs. the 3.4 behaviour).
Comment 12 Francis Upton IV CLA 2009-09-11 14:47:15 EDT
Ok, I figured it out, creating EJB 3.0 project will show the problem.  Trying out the patch now.
Comment 13 Francis Upton IV CLA 2009-09-11 15:02:05 EDT
Created attachment 146987 [details]
Proposed patch

This has been tested with the navigator tests, WST and the problem described in this bug report.  Will test CDT in a few minutes.  DTP should also be tested (we need to ask them to do a good job).
Comment 14 Boris Bokowski CLA 2009-09-11 15:27:07 EDT
+1 from me for 3.5.1.

Not fixing looks really bad, and the fix is low risk. I don't think an empty text for a tree item is ever going to be the right answer (it's really hard to select the item if it doesn't have any text, for example).

In the worst case, we will get a label like "Error: no label provider for ..." instead of an empty label, but all examples Francis and I have looked at work well. We will continue testing this, and would appreciate another test pass from the DTP guys.

McQ, +1 for 3.5.1 - including a rebuild, hopefully today?
Comment 15 John Arthorne CLA 2009-09-11 15:45:48 EDT
I reviewed the fix with Boris. In the absence of a "real" PMC member and given the urgency of making a fix, I'm adding my "almost PMC" +1. The change is consistent with how we handle the result from IStyledLabelProvider, and I agree an empty string is never a good label in a tree. The regression for WTP is bad enough that a fix at this stage is warranted.
Comment 16 Boris Bokowski CLA 2009-09-11 15:48:56 EDT
Patch released to R3_5_maintenance. Map file is updated and rebuild has been requested. The build will hopefully happen later today.
Comment 17 Martin Oberhuber CLA 2009-09-11 18:14:31 EDT
I've been following recent work on the Common Navigator and was amazed by the diligence that I saw around unittests and trying extremely hard to get every possible case considered and verified.

The fix looks innocent, and most of all I trust Boris and John.

+1 from a "real" PMC member, just for the records :)
Comment 18 Francis Upton IV CLA 2009-09-11 18:21:25 EDT
(In reply to comment #17)
> I've been following recent work on the Common Navigator and was amazed by the
> diligence that I saw around unittests and trying extremely hard to get every
> possible case considered and verified.
Thanks Martin, we still need a test case for this one too, but we will have it soon.  It makes a big difference to hear that the work is appreciated.
Comment 19 Boris Bokowski CLA 2009-09-11 20:29:56 EDT
Dimitar, David, Carl - thanks for finding this issue just in time, and for the detailed analysis.

Francis - thanks for the extremely short turnaround time. Not sure if everyone on this bug knows it, but Francis is maintaining the Common Navigator on his own time, without funding from those who benefit from his work, in true open source spirit.

Happy birthday, Francis!
Comment 20 Francis Upton IV CLA 2009-09-12 01:55:01 EDT
Brian, can you and your folks test tonights M build (that has this fix) against DTP?  I don't anticipate problems, but we should have our bases covered.
Comment 21 Francis Upton IV CLA 2009-09-12 03:14:30 EDT
Created attachment 147036 [details]
Patch as applied to HEAD

This patch is a little more comprehensive than the one applied to 3.5.1 in that both instances where getText() is called and returns "" is handled correctly (by skipping the label provider).  

This patch also adds test cases that show the problem and have some additional tests to make sure returning null is also correctly handled.
Comment 22 Francis Upton IV CLA 2009-09-12 03:15:35 EDT
Released to HEAD (3.6M2)
Comment 23 Francis Upton IV CLA 2009-09-12 03:36:33 EDT
Verified in M20090911-1628
Comment 24 Francis Upton IV CLA 2009-09-12 03:52:57 EDT
Verified that Franck's new tests (bug 287261) work with this change.
Comment 25 Kaloyan Raev CLA 2009-09-14 08:00:38 EDT
I verified the fix submitted in the R3_5_maintenance branch. 

Francis, thank you for the efforts and quick resolution!
I wish you good luck and prosperity and I hope we haven't ruined your birthday party!
Comment 26 Kim Moir CLA 2009-09-14 08:36:30 EDT
Thanks for fixing this Francis! Happy belated Birthday!
Comment 27 Anthony Hunter CLA 2009-11-26 10:22:54 EST
Hi Team,

This changed has caused a significant regression in our GMF based editor.

We have GMF elements that are not yet named in the project explorer. The elements have a blank name and icon. Elements are created and subsequently the user can set a name. In some cases however, these elements are never given a name and "" always shows in the project explorer.

in the newer target, we now check for a zero length string and returns null:
String text= labelProvider.getText(anElement);
			if (text != null && text.length() > 0) {
				return new StyledString(text);
			}
		}  
		return null;
		
The getStyledText(...) method gets the null value and returns the error message that we see CommonNavigatorMessages.NavigatorContentServiceLabelProvider_Error_no_label_provider_for_0_
Comment 28 Dani Megert CLA 2009-11-26 10:30:03 EST
Anthony, please open a new bug report. This problem is considered fixed in 3.5.1 and if it caused another issue then we should track it in a separate bug. Thanks.
Comment 29 Anthony Hunter CLA 2009-11-26 10:51:46 EST
(In reply to comment #28)
> Anthony, please open a new bug report. This problem is considered fixed in
> 3.5.1 and if it caused another issue then we should track it in a separate bug.
> Thanks.

OK, Bug 296253 Submitted
	
Just to be clear, the problem is not fixed, having no label but an icon in project explorer is a valid use case.
Comment 30 Dani Megert CLA 2009-11-26 11:09:52 EST
>OK, Bug 296253 Submitted
Thanks, Anthony.

>Just to be clear, the problem is not fixed, having no label but an icon in
>project explorer is a valid use case.
I'm fully with you. I tried to explain that but it was not listened to my concerns (see bug 262883) and then I finally gave up.
Comment 31 Francis Upton IV CLA 2009-11-27 05:21:20 EST
Changing back to verified, as this fix was verified as working as intended.  (yes, it broke something else, but that's the subject of bug 296253)