Community
Participate
Working Groups
Created attachment 181276 [details] patch relative to the IMP runtime project Somewhere there is a call to getLocation to convert an IFile to an IPath, but this requires the file to be a file on the file system. This is not always the case, for example when viewing source code that is embedded in a jar, or from a linked resource in a bundle. I've attached a small patch that changes a call to getLocation to getFullPath before the IPath is given to findLanguage (all it needs is the file extension actually!) This fixes the bug. The patch is relative to the root of the run-time project.
I've applied the patch. I used the bug system to make everybody aware of this small change since I usually don't commit in imp.runtime. The fix is really trivial and should have no impact at all by looking at the code (all that is needed is access to the file extension)
Thanks! The patch does look reasonable. At the same time, this is in an absolutely critical and core bit of functionality of IMP, so it pays to be careful. We'll have to test this out over the next few days, particularly as some IMP-based IDEs now actually care about storing source files in jars. FWIW, admittedly IMP has historically not done the right thing with respect to handling various types of IEditorInputs. I've been working to clean this up a bit lately, e.g. to handle source files inside jar files (see commits of about a month ago or so). I know we have a ways to go, though. In particular, I doubt that IMP would handle remote files properly at this point, but it should. BTW, are you aware of EditorInputUtils? It's a locus for helper methods for accessing/manipulating IEditorInputs of various sorts. There's probably still a bunch of code lying around in various parts of the runtime that's special casing things that EditorInputUtils handles better/more completely. Be on the lookout. :-) Also, especially given that you don't normally commit to imp.runtime, it would be even better to post a note to the newsgroup, so that people who don't track bugs get a heads-up.