Hi there, I've just joined this community because I'm stuck with my gef editor. I'm following this tutorial ( ), adapting it to my different model. Everything is ok but if I launche the editor i got NullPointerException in ApplicationWorkbenchAdvisor class in postStartup method.
This is the code of the method:
@Override
public void postStartup() {
try {
IWorkbench bench = PlatformUI.getWorkbench();
IWorkbenchWindow bw = bench.getActiveWorkbenchWindow();
// Here bw is null so the exception is thrown in next line
IWorkbenchPage page = bw.getActivePage;
page.openEditor(new MyEditorInput("PlutoEditor"), MyGraphicalEditor.ID, false);
} catch (Exception e) {
e.printStackTrace();
}
}
On the web I found a partial solution that launch this code on a new thread, I suppose:
@Override
public void postStartup() {
PlatformUI.getWorkbench().getDisplay.asyncExec(new Runnable() {
public void run() {
// Same code above opening the editor
// .....
}
});
}
In this way I can get launching the editor and use it, but the outline is not showing. Then I discovered that I could add after "page.openEditor(.....)" line a new istruction to show the outline and property sheet view. I tried it but eveytime I launch the app the layout is random generated, and launching it more times create more empty views in the RCP app.
If needed I can put more code, just tell me
Thank you