Reputation: 221
I am programming an Eclipse RCP application. I have a View on the left and an editor on the right. The view is a menu. With a click on a button in the menu, the editor should open AND the view should change. The editor opens after the click but the view does not change.
Do I have to close the menu-view and open a new one? If yes, how?
If i write page.showView(ID_of_my_view_class.ID) before page.openEditor(..) it opens a new tab next to the displayed console with the logs.
current code:
public Object execute(ExecutionEvent event) throws ExecutionException {
this.log.info(this.getClass().getSimpleName() + " called");
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
IWorkbenchPage page = window.getActivePage();
KuenstlerEditorInput input = new KuenstlerEditorInput(new Kuenstler());
try {
page.openEditor(input, KuenstlerEditor.ID);
} catch (PartInitException e) {
MessageDialog.openError(window.getShell(), "Error",
"Editor f¸r K¸nstler konnte nicht geˆffnet werden: "
+ e.getMessage());
this.log.error(e);
}
return null;
}
When I start the program, it looks like this: https://i.sstatic.net/1faPT.png When I do the page.showView(the_ID.ID) command, it looks like this: https://i.sstatic.net/tsoP9.png
The view should appear on the left, instead of the menu with all the buttons.
Upvotes: 0
Views: 1878
Reputation: 51
Create or get an Object of your Project and then do this: (Works only with the Navigator-view) project.refreshLocal(IResource.DEPTH_INFINITE, null);
Upvotes: 0
Reputation: 19443
Use the org.eclipse.ui.perspectives
extension point to create a perspective, and then provide an implementation of IPerspectiveFactory
which will allow you to define the location of the named views that you create.
Upvotes: 1