Wed 20 Jun 2007
Eclipse 3.3 Plug-in Development Gotcha: What happened to JavaFileEditorInput?
Posted by Ryan under Programming
No Comments
If you develop a plug-in for Eclipse, you know that each release cycle you have to deal with new incompatibilities between your plug-in and the new version of Eclipse. There is always a plug-in migration guide to help you, and typically they do a pretty nice job. Every cycle though, there is usually some compatibility issues which arise that I have trouble finding any concrete information about, and eventually end up scouring random Internet threads and API docs for hours. Hopefully this post helps to eliminate one such problem for other developers.
If your plug-in deals with non-workspace files (opening files which are NOT part of the current workspace), take note that the representation within Eclipse for these resources has changed as of version 3.3. What were instances of
1 | JavaFileEditorInput |
are now represented as
1 | FileStoreEditorInput |
, which uses
1 | IFileStore |
in order to retrieve information about the resource.
So if as before, you have a non-workspace file as an instance of
1 | IEditorInput |
(
1 | _ei |
), you can do something like the following in order to retrieve properties about the resource:
if (_ei instanceof FileStoreEditorInput){
FileStoreEditorInput _input = (FileStoreEditorInput)_ei;
URI _uri = _input.getURI();
Path _p = new Path(_uri.getPath());
IFileStore _ifs = EFS.getLocalFileSystem().getStore(_p);
}
1 | JavaFileEditorInput |
is now a thing of the past. Enjoy!