Community
Participate
Working Groups
Build Identifier: M20120208-0800 Some background: We have an existing editor associated to the file names BUILD and BUILD.test. We are currently re-writing this editor. Until this new editor has all the features of the existing/old one, we are allowing our users to use both, for testing purposes. The problem is that when they install the new one, "BUILD" is not mapped to the new editor, even though the new editor is associated to the file names BUILD and BUILD.test. BTW, the new editor is successfully mapped to BUILD.test (but not to BUILD). Problem: After doing some debugging, we found out that the method readResources(Map, Reader) in org.eclipse.ui.internal.registry.EditorRegistry assumes that the file extension is never empty: FileEditorMapping mapping = getMappingFor(name + "." + extension); //$NON-NLS-1$ I'm submitting a patch that does the following, instead: String key = name; if (extension != null && extension.length() > 0) { key = key + "." + extension; //$NON-NLS-1$ } FileEditorMapping mapping = getMappingFor(key); This bug is present in 3.7.2, 3.8 and Juno. The same patch can be be applied to all the Eclipse versions. Reproducible: Always Steps to Reproduce: 1. Have an editor associated to a file name without extension (e.g. "BUILD") 2. Create a new plug-in that has an editor associated to the same extension 3. When the new editor is installed, it is not associated to the file name it is supposed to.
Created attachment 213721 [details] Suggested fix.
I know we don't handle content types with no file extension gracefully, but a quick can through the code seems to indicate that having no extension/"" is handled. John, I'm inclined to apply the patch ... do have have any reservations? PW
Looks quite reasonable to me.
Alex, first off thanks for taking the time to track down the issue... What version did you make the 'patch' with ? I've found what I think is the right place to put the code but in the current source it's at line 776, not line 763 as indicated by the patch. I'm just trying to make sure I'm looking in the right place...
Hi Eric, I created the patch using Eclipse 3.7.2. I thought that when applying the patch Git will figure out the place based on surrounding code, instead of line numbers. I also successfully applied the patch to 3.8. Please let me know if version-specific patches is a better approach. Many thanks, -Alex (In reply to comment #4) > Alex, first off thanks for taking the time to track down the issue... > > What version did you make the 'patch' with ? I've found what I think is the > right place to put the code but in the current source it's at line 776, not > line 763 as indicated by the patch. > > I'm just trying to make sure I'm looking in the right place...
Released: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=6a3c2870c4b77571115360602140a34d61cef2bf Thanx Alex. PW
It was my pleasure! Thanks so much for fixing it :) Cheers, -Alex (In reply to comment #6) > Released: > http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=6a3c2870c4b77571115360602140a34d61cef2bf > > Thanx Alex. > > PW
by inspection in I20120430-1800 PW