2

I would like to know if there is a pure Eclipse E4 way to open programmatically a java editor.

I am migrating my plug-in from Eclipse 3.x to Eclipse E4, and I need to transform the following Eclipse 3.x call into an Eclipse E4 call.

final IWorkbenchPage page = Activator.getActiveEditor().getSite().getPage();
IDE.openEditor(page, (IFile) myResource);

After search and analysis seem there is not an Eclipse E4 equivalent for this call. Is this possible?

0

2 Answers 2

2

This isn't possible in a pure e4 application.

The Java editor is a 3.x compatibility mode component and won't run in an e4 application. The editor depends on many org.eclipse.ui.xxx plugins and things like IFile none of which are available in a plain e4 RCP.

Sign up to request clarification or add additional context in comments.

Comments

1

If you still have the compatibility layer around (which I assume must be the case, as JDT requires it), you should be able to execute the org.eclipse.ui.navigate.openResource command with a filePath parameter pointing to your resource. Alas, this command doesn’t give you the guarantee that the Java editor opens – it may just open a plain text editor. But perhaps that’s good enough for you. At least, your code doesn’t touch org.eclipse.ui.* packages directly (safe for the command’s ID).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.