use of org.eclipse.core.commands.State in project gfm_viewer by satyagraha.
the class ViewerSupportDefault method isLinked.
@Override
public boolean isLinked() {
LOGGER.fine("");
Command command = commandService.getCommand(GFM_VIEWER_PLUGIN_LINKED);
State state = command.getState(RegistryToggleState.STATE_ID);
return (Boolean) state.getValue();
}
use of org.eclipse.core.commands.State in project translationstudio8 by heartsome.
the class CommandsPropertyTester method test.
public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
if (receiver instanceof IServiceLocator && args.length == 1 && args[0] instanceof String) {
final IServiceLocator locator = (IServiceLocator) receiver;
if (TOGGLE_PROPERTY_NAME.equals(property)) {
final String commandId = args[0].toString();
final ICommandService commandService = (ICommandService) locator.getService(ICommandService.class);
final Command command = commandService.getCommand(commandId);
final State state = command.getState(RegistryToggleState.STATE_ID);
if (state != null) {
return state.getValue().equals(expectedValue);
}
}
}
return false;
}
use of org.eclipse.core.commands.State in project gfm_viewer by satyagraha.
the class ViewerSupportDefault method isOnline.
@Override
public boolean isOnline() {
LOGGER.fine("");
Command command = commandService.getCommand(GFM_VIEWER_PLUGIN_ONLINE);
State state = command.getState(RegistryToggleState.STATE_ID);
return (Boolean) state.getValue();
}
use of org.eclipse.core.commands.State in project yamcs-studio by yamcs.
the class SwitchProcessorHandler method updateElement.
/*
* Workaround to allow checking radio items in a dynamic contribution
*
* https://bugs.eclipse.org/bugs/show_bug.cgi?id=398647
*/
@Override
public void updateElement(UIElement element, @SuppressWarnings("rawtypes") Map parameters) {
ICommandService service = (ICommandService) element.getServiceLocator().getService(ICommandService.class);
String state = (String) parameters.get(RadioState.PARAMETER_ID);
Command command = service.getCommand(SwitchProcessorCompoundContributionItem.SWITCH_PROCESSOR_COMMAND);
State commandState = command.getState(RadioState.STATE_ID);
if (commandState.getValue().equals(state)) {
element.setChecked(true);
}
}
use of org.eclipse.core.commands.State 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());
}
Aggregations