Thursday, June 8, 2017

Programmatically executing a command in eclipse

If you know the eclipse command and you want to execute that in the programmatical way, you need to use IHandlerService.

Below is the example to perform toggle full-screen command from eclipse.

IHandlerService handlerService =
 (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);

if (handlerService == null)
                 return null;

   handlerService.executeCommand("org.eclipse.ui.cocoa.fullscreenWindow", null);
catch (Exception ex)
//log exception


No comments:

Post a Comment