[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Launch Command at startup

In addition to previous post:

i created my perspective listener as follows:
private IPerspectiveListener perspectiveListener = new PerspectiveAdapter() {
@Override
public void perspectiveActivated(IWorkbenchPage page,
IPerspectiveDescriptor perspective) {
if (ApplicationConstants.ID_PERSPECTIVE_DEMO
.equals(perspective.getId())) {
// open navigation view
IHandlerService handlerService = (IHandlerService) window
.getService(IHandlerService.class);
try {
handlerService.executeCommand(
my_command_id, null);
} catch (Exception e) {
ApplicationUtil.handleException(e);
}
}
}
};


in the execute-method of the defaulthandler of the command i have following line of code

IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);

the first time the perspectiveActivated gets called i get an execution exception "No activeWorkbenchWindow found while executing my_command_id". the second call to perspectiveActivated no exception is thrown and code is executed as expected