use of org.eclipse.ui.commands.ICommandService in project yamcs-studio by yamcs.
the class RCPUtils method runCommand.
public static void runCommand(String commandId) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
ICommandService commandService = (ICommandService) window.getService(ICommandService.class);
IEvaluationService evaluationService = (IEvaluationService) window.getService(IEvaluationService.class);
try {
Command cmd = commandService.getCommand(commandId);
cmd.executeWithChecks(new ExecutionEvent(cmd, new HashMap<String, String>(), null, evaluationService.getCurrentState()));
} catch (Exception exception) {
log.log(Level.SEVERE, "Could not execute command " + commandId, exception);
}
}
use of org.eclipse.ui.commands.ICommandService in project yamcs-studio by yamcs.
the class EventLog method updateState.
private void updateState() {
ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command command = service.getCommand(EventLog.CMD_SCROLL_LOCK);
State state = command.getState(EventLog.STATE_SCROLL_LOCK);
enableScrollLock((Boolean) state.getValue());
}
use of org.eclipse.ui.commands.ICommandService in project yamcs-studio by yamcs.
the class ScrollLockHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchPart part = HandlerUtil.getActivePartChecked(event);
EventLogView view = (EventLogView) part;
ICommandService service = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command command = service.getCommand(EventLog.CMD_SCROLL_LOCK);
boolean oldState = HandlerUtil.toggleCommandState(command);
view.getEventLog().enableScrollLock(!oldState);
return null;
}
Aggregations