Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 09:04 Go to next message
Marcel Bruch is currently offline Marcel BruchFriend
Messages: 286
Registered: July 2009
Senior Member

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 09:23]

Report message to a 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 12:44 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1599
Registered: July 2009
Senior Member
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: Mon May 21 15:21:14 GMT 2018

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

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

Back to the top