Hi,

I want to start eclipse in a custom perspective, but when I try to do that
in the startup method, it throws a null pointer exception at the point I
try to access the Display thread.

code used to invoke the perspective :

final IWorkbenchWindow workbenchWindow =
PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IPerspectiveDescriptor activePerspective =
workbenchWindow.getActivePage().getPerspective();// null pointer here
if (activePerspective == null ||
!activePerspective.getId().equals(PERSPECTIVE_ID)) {
Display.getCurrent().asyncExec(new Runnable() {// if I remove the get
active page since it is not mandatory, I get null pointer here.
public void run() {
// switch perspective
try {
workbenchWindow.getWorkbench().showPerspective(PERSPECTIVE_ID,
workbenchWindow);
} catch (WorkbenchException e) {
log.error("Can not switch to perspective: " + PERSPECTIVE_ID, e);
}
}
});
}


Can someone help me to open eclipse in my custom perspective? I tried using
this in an early startup as well as in the activator class, both gave same
results.


Regards
Awanthika Senarath
Senior Software Engineer, WSO2 Inc.
Mobile: +94717681791
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to