Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356116 - [EditorMgmt] IEditorRegistry.getDefaultEditor fails to find an editor even though one exists
Summary: [EditorMgmt] IEditorRegistry.getDefaultEditor fails to find an editor even th...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.8 M4   Edit
Assignee: Remy Suen CLA
QA Contact: Remy Suen CLA
URL:
Whiteboard:
Keywords:
: 349552 (view as bug list)
Depends on:
Blocks: 349552
  Show dependency tree
 
Reported: 2011-08-29 15:58 EDT by Ed Merks CLA
Modified: 2011-11-02 11:51 EDT (History)
3 users (show)

See Also:


Attachments
EditorRegistry patch v1 (984 bytes, patch)
2011-08-30 14:46 EDT, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Merks CLA 2011-08-29 15:58:20 EDT
The implement in EditorRegistry of getDefaultEditor guesses a content type and then tries to find the editor based on that one content type.  The problem is that if there is no editor registered for the guessed content type, null is returned even when there are other content types for which there are registered editors. This causes problems for EMF:

  https://bugs.eclipse.org/bugs/show_bug.cgi?id=349552

It would be much better (i.e., more correct with regard to the documented behavior) if the method implementation considered each possible content type and returned an editor descriptor if there is any content type with a registered editor.
Comment 1 Dani Megert CLA 2011-08-30 04:52:45 EDT
It should use IContentTypeMatcher.findContentTypesFor(String) and try all content types.
Comment 2 Remy Suen CLA 2011-08-30 14:46:15 EDT
Created attachment 202451 [details]
EditorRegistry patch v1

Ed, if I understand your request correctly, I think this is what you want?
Comment 3 Ed Merks CLA 2011-08-30 15:02:32 EDT
Yes, that would be much better!!
Comment 4 Remy Suen CLA 2011-08-30 15:04:54 EDT
(In reply to comment #3)
> Yes, that would be much better!!

Thanks. I'll try to get this.
Comment 5 Ed Merks CLA 2011-10-27 13:07:41 EDT
*** Bug 349552 has been marked as a duplicate of this bug. ***
Comment 6 Remy Suen CLA 2011-11-02 11:51:22 EDT
(In reply to comment #2)
> Created attachment 202451 [details]
> EditorRegistry patch v1

This first test introduced test failures. I rewrote the code to minimize introducing casualties and regressions. Thanks for the bug report, Ed!

I've released the fix to master and R3_development. I also screwed up in my commit so I had to do a second commit to fix the problem.

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=2d5698e57a0c5913b5c4292806d23fd1d5569e1f
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=a78e46c87f7145ecc3a8e61bd7cbab7a601db039

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R3_development&id=b6996e7115c163052c3ee14f3a35b6c5766baa38
http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?h=R3_development&id=e495d4c520e380d5c2626041cfd1f259f70565ba