[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: how to call another command in handlerclass of a command

Neha wrote:
Hi,
I need to call another command in the handler class of a command. so that the handler of other command is executed within this handler. Is there a way to do so?
please let me know

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow activeWorkbenchWindow = HandlerUtil
.getActiveWorkbenchWindow(event);
if (activeWorkbenchWindow != null) {
IHandlerService handlerService = (IHandlerService)


                   activeWorkbenchWindow.getService(
                      IHandlerService.class);
                try {
                     handlerService.executeCommand(TheCommandId, null);
                } catch (...) {
                }
	}
        ...
	return null;
}

where TheCommandId is the commandId of the to be invoked command.

HTH & Greetings from Bremen,

Daniel Krügler