Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 146951 - [EditorMgmt] Files shown with wrong icons in the navigator
Summary: [EditorMgmt] Files shown with wrong icons in the navigator
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P2 major with 1 vote (vote)
Target Milestone: 3.4 M6   Edit
Assignee: Boris Bokowski CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 110961 139756 157910 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-06-13 19:56 EDT by Valentin Baciu CLA
Modified: 2008-04-16 10:34 EDT (History)
16 users (show)

See Also:


Attachments
patch (14.81 KB, patch)
2008-03-23 00:04 EDT, Boris Bokowski CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Valentin Baciu CLA 2006-06-13 19:56:32 EDT
This behaviour is a side effect of the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=107121.

In order to improve performance when using large workspaces, the platform uses a "guessing" algorithm for icons. This algorithm uses the "general is better" policy for choosing between content types in a hierarchy. Thus it picks the icon of the editor associated with the more generic content type instead of the more specific one. See for example https://bugs.eclipse.org/bugs/show_bug.cgi?id=139756

A potential solution is proposed here https://bugs.eclipse.org/bugs/show_bug.cgi?id=107121#c12 but it appears it did not get implemented yet.
Comment 1 Valentin Baciu CLA 2006-06-13 20:00:11 EDT
*** Bug 139756 has been marked as a duplicate of this bug. ***
Comment 2 Tod Creasey CLA 2006-06-14 09:07:53 EDT

*** This bug has been marked as a duplicate of 8232 ***
Comment 3 Valentin Baciu CLA 2006-06-14 09:49:17 EDT
Tod, I don't really see how this bug is a duplicate of 8232. Can you please provide more details? 
Comment 4 Tod Creasey CLA 2006-06-14 10:07:21 EDT
Actually you are right Valentin - I thought this was the same as the external icon issue
Comment 5 Craig Salter CLA 2006-06-27 17:58:04 EDT
I think this is a fairly serious problem.  The way things are today we have no way of displaying the proper icons for various artifacts such as XML Schema and WSDL files (we get the vanilla XML icon if we like it or not).

Any thoughts on how this could be fixed?  

If there's some issue with content type checking then perhaps our editor could also specify a file extension in the plugin.xml and the proper icon would get used at least for files that matched the extension?
Comment 6 Craig Salter CLA 2006-07-17 14:43:03 EDT
Any update on this issue?  We feel this is a major issue that needs addressing for 3.2.1.
Comment 7 Kim Horne CLA 2006-08-16 12:56:38 EDT
I don't believe this can be properly addressed in a point release.   As I outlined in the comment referenced, this is a very major change that will likely require new API or massive refactoring at the very least.  I don't believe there is any solution or workaround that I can suggest for 3.2.1.
Comment 8 Craig Salter CLA 2006-08-16 13:07:00 EDT
That's really bad news.  Kim can you provide a summary to explain how we ever got ourselves into this predicament where something as fundamental as displaying an icon for a file doesn't work properly?  Is this a case of the platform and adopters moving onto a 'content type' approach too quickly (before the infrastucture is ready)?
Comment 9 Kim Horne CLA 2006-08-16 13:18:40 EDT
Well, it was working "correctly" for a time.  When we are passed a file to obtain an icon for we would check the content type of the file and do lookup based on that.  This is great... provided you implement an efficient content type checker and you dont have thousands of files to determine icons for.  It was pointed out to us that large directories were taking FOREVER to render because of the content type lookups.  We had a blocker PR from an IBM team that said we needed to get this fixed for a release and it happened so late in the cycle that the only solution was not to resolve the icon and fall back on the default.  We were between a rock and a hard place and we felt the solution that didn't look like a deadlock was the appropriate one.  It's too big a problem for a point release and for almost the entirety of 3.2 I was on another project - there was no one to fix it.  It's unfortunate - by our estimation the content type support was ready for primetime right up until the speed defect was brought to our attention by which time it was too late to back out of it.
Comment 10 Lawrence Mandel CLA 2006-08-16 15:31:32 EDT
I second Craig's comment that it's really bad news that this can't be fixed in 3.2.1. From a user perspective this is a regression from 3.1 that may affect their productivity. (Those nice icons are there to help differentiate resources, right?)
Comment 11 Tod Creasey CLA 2006-08-23 12:33:06 EDT
Given the potential risk to performance this will be deferred until 3.3.
Comment 12 Kim Horne CLA 2006-09-20 10:14:28 EDT
*** Bug 157910 has been marked as a duplicate of this bug. ***
Comment 13 Craig Salter CLA 2007-04-02 12:57:33 EDT
Any update or ETA?  This is a very visible problem that impacts the usability and look and feel of adopter products.  Is there something fundamentally  broken with respect to our support for content type?  Do we need to rethink this mechanism.  

IMHO the akward integration with the file association preferences and content types(and associated usability issues) along with this icon association issue leaves me wondering if the concept of  content type is more trouble than it's worth.  Any thoughts on the usefulness/effectiveness of this bit of machinery?
Comment 14 Kim Horne CLA 2007-04-03 09:41:10 EDT
There was no time for this in 3.3.  :(  Given the scope and underlying reasons regarding the difficulty in implementing this change I would hesitate to commit to this in the 3.X stream.  Editor management is, however, a prime candidate for improvements in the 4.0 stream.  
Comment 15 Boris Bokowski CLA 2007-06-29 10:43:59 EDT
Marking for investigation in 3.4. I cannot promise anything at this point other than that I will look at this soon.
Comment 16 Valentin Baciu CLA 2007-06-29 12:15:31 EDT
In bug 194935 I described a scenario that appears related. In there I explore the potential cause and a solution that may apply to both bugs.
Comment 17 Kim Sullivan CLA 2007-07-29 14:15:27 EDT
I filed bug 198208 how the current implementation of the XMLRootElementContentDescriber is broken (when using that class, the content type is not determined by the contents of the file if a filename or file extension is specified). I think that the final resolution of that bug depends on the correct working of icons in editors.
Comment 18 Kim Sullivan CLA 2007-07-29 14:17:49 EDT
 (In reply to comment #17)
> I think that the final resolution of that bug depends
> on the correct working of icons in editors.

Ooops, it's the other way around of course. Correct working of icons in the navigator depends on correct resolution of content types.
Comment 19 Keith Chong CLA 2007-09-17 19:30:51 EDT
*** Bug 110961 has been marked as a duplicate of this bug. ***
Comment 20 Boris Bokowski CLA 2007-09-18 00:42:36 EDT
If we could not get all views to display the most specific icons, which ones were most important to get right?  Is it just the Project Explorer?

The reason for this question is because I would like to avoid having to compute the correct icons for all files under a certain parent (there might be hundreds or potentially thousands).  Using 1600x1200, my vertically-oriented navigator shows 60 items, which would be a nice upper bound for how many content type lookups we cause.  To find out which items are currently visible, the underlying tree would have to be SWT.VIRTUAL or it would have to make use of owner draw. The latter seems easier to implement.  For example, JDT's package explorer already uses owner draw as of 3.4.
Comment 21 Boris Bokowski CLA 2008-03-23 00:04:20 EDT
Created attachment 93205 [details]
patch

This patch uses the decorators mechanism for computing a more accurate icon in the background. If possible, I would like to get feedback as soon as possible how this works for use cases that failed before (i.e. hundreds of html or xml files in one folder).
Comment 22 Boris Bokowski CLA 2008-03-23 00:06:08 EDT
To apply the patch, you need org.eclipse.jface, org.eclipse.ui, org.eclipse.ui.ide, and org.eclipse.ui.workbench in your workspace.
Comment 23 Boris Bokowski CLA 2008-03-23 13:40:30 EDT
After sleeping it over, I released this change to HEAD. I believe it is at least part of the solution of getting accurate file icons. If this patch causes performance problems, we still have a number of possible optimizations that can be applied.

I am still interested in feedback, in particular with regards to performance.
Comment 24 Kim Horne CLA 2008-03-23 16:32:44 EDT
Looks good to me. 

If we dont already have this optimization in place, it might be good for decorators in general, but do we delay decorating non-visible icons?
Comment 25 Boris Bokowski CLA 2008-03-23 21:33:33 EDT
(In reply to comment #24)
> If we dont already have this optimization in place, it might be good for
> decorators in general, but do we delay decorating non-visible icons?

As far as I can tell, we don't do anything like this yet. The most accurate solution for delaying would be to use the owner draw events (or SWT.VIRTUAL).
Comment 26 Tod Creasey CLA 2008-03-24 08:13:28 EDT
In a way we do - we only decorate what you ask for. If you don'task for non visible icons we won't decorate them.
Comment 27 Valentin Baciu CLA 2008-03-26 15:25:13 EDT
Boris, thank you for fixing this.

I have done some limited testing using an older WTP driver  (with a pre P2-ed platform, http://build.eclipse.org/webtools/committers/wtp-R3.0-I/20080324171756/I-I20080324171756-20080324171756/) and pulling in the code from HEAD into my workspace. At a superficial look, the fix appears to be working correctly from a functional point of view.

To test, I created the sample WTP project Editing and Validating XML files and inspected the WSDL and XSD resources and verified that the actual WSDL and XSD icons are used instead of the generic XML icon. I have also used the zip with 2500 HTML files attached to bug 107121. I renamed all the files from *.htmltestonly to *.html and placed them into a folder. And lastly I used a project with lots of XSD files.

Overall, on my dual core notebook, performance was pretty good for the project with lots of XSD files and decent for the one with lots of HTML files. I take it that the HTML content type descriptor is a bit slower. It seems to read in quite a bit of the file's content to infer the file's encoding. I also used the "show system jobs" feature of  the progress view and confirmed that the content type decorator job was running. Sometimes the job seemed to take quite some time and wait more toward the end. I would think the best way to improve performance would be to speed up the processing that takes place in the content type descriptors but only profiling will tell exactly where the time is being spent.

As you suggested, periodic updates to show the computed icons for the visible resources (typically under 100 depending on the resolution) would improve the perceived responsiveness.

We hope to do more testing once the P2 dust settles and we can use a more recent WTP driver. I have also sent a note to wtp-dev to make the committers and adopters aware of the change. Perhaps a similar note is in order for some of the platform dev or cross-project devs lists?
Comment 28 Jason Brennan CLA 2008-03-28 13:55:23 EDT
Verified in I20080327-2251
Comment 29 Boris Bokowski CLA 2008-04-16 10:34:16 EDT
Just FYI - we are currently discussing how important it is to update file icons when the file contents change. See bug 223976 if you want to participate in that discussion.