Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » How to open a JavaEditor on an 'in-memory' source file?
How to open a JavaEditor on an 'in-memory' source file? [message #1627019] Sat, 21 February 2015 04:04 Go to next message
Eclipse UserFriend
Hi,

I've a sources jar file on disk that is not part of the JavaModel, i.e., not referenced in any JavaProject nor target platform etc.

However, I'd like to open zip entry (= the sources of a ITypeRoot) inside that jar with a minimum of Java syntax highlighting. I'd also like to intercept events like 'Open Declaration' but that's not a hard requirement yet.

Are there any pointers how to achieve that?

My first guess using a NullEditorInput (see below) requires me to return an ITypeRoot in NullEditorInput.getAdapter() which I don't know how to produce it easily.

The ILocationProvider interface requires a path which (I assume) only works with local files. I'd prefer to not unzip the entry to a local file before.

Thanks in Advance

String source = getRemoteSourceFile(searchResult);
IWorkbenchPage page = getViewSite().getPage();
IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(".java");
page.openEditor(new NullEditorInput(), desc.getId());

[Updated on: Sat, 21 February 2015 04:23] by Moderator

Re: How to open a JavaEditor on an 'in-memory' source file? [message #1699880 is a reply to message #1627019] Sun, 28 June 2015 08:44 Go to previous message
Eclipse UserFriend
I just stumbled on this unanswered question.
I don't have a ready answer, but before going into details let me ask: is it still relevant for you?
Previous Topic:Hovers are broken on Linux with GTK3
Next Topic:Java annotationіs analysis
Goto Forum:
  


Current Time: Thu Apr 17 12:04:06 EDT 2025

Powered by FUDForum. Page generated in 0.03009 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top