I’m writing an Eclipse plugin that allows easier resource editing for Android. When user clicks on any XML resource file inside the project, an editor opens that allows editing all the resources in the project at once.
I’d like to add a capability to open the same file in a separate, default Android resource editor. I know the id of that editor, but I don’t have access to its class.
Calling IDE.openEditor does nothing, because an editor is already opened for that file, even though I specify the id of another, Android editor.
How to force Eclipse to open another editor for the same input?
On the other hand, is it possible to embed another editor in a MultiPageEditorPart if I have access only to its id, not its class?
The
IDE.openEditormethods call at the end the correspondingIWorkbenchPagemethods to open the editor.The method that could be useful in your case is
org.eclipse.ui.IWorkbenchPage.openEditor(IEditorInput, String, boolean, int)you need to call it and pass it
MATCH_ID | MATCH_INPUTso that it takes the editor id into account when trying to determine whether the existing editor should be reused or a new one should be created.