Java Code Examples for org.eclipse.ui.services.IServiceLocator#getService()
The following examples show how to use
org.eclipse.ui.services.IServiceLocator#getService() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CommandsPropertyTester.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
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; }
Example 2
Source File: KeyController2.java From translationstudio8 with GNU General Public License v2.0 | 6 votes |
private static BindingManager loadModelBackend(IServiceLocator locator) { IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class); BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager()); final Scheme[] definedSchemes = bindingService.getDefinedSchemes(); try { Scheme modelActiveScheme = null; for (int i = 0; i < definedSchemes.length; i++) { final Scheme scheme = definedSchemes[i]; final Scheme copy = bindingManager.getScheme(scheme.getId()); copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId()); if (definedSchemes[i] == bindingService.getActiveScheme()) { modelActiveScheme = copy; } } bindingManager.setActiveScheme(modelActiveScheme); } catch (final NotDefinedException e) { StatusManager.getManager() .handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH, "Keys page found an undefined scheme", e)); //$NON-NLS-1$ } bindingManager.setLocale(bindingService.getLocale()); bindingManager.setPlatform(bindingService.getPlatform()); bindingManager.setBindings(bindingService.getBindings()); return bindingManager; }
Example 3
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
private static BindingManager loadModelBackend(IServiceLocator locator) { IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class); BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager()); final Scheme[] definedSchemes = bindingService.getDefinedSchemes(); try { Scheme modelActiveScheme = null; for (int i = 0; i < definedSchemes.length; i++) { final Scheme scheme = definedSchemes[i]; final Scheme copy = bindingManager.getScheme(scheme.getId()); copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId()); if (definedSchemes[i] == bindingService.getActiveScheme()) { modelActiveScheme = copy; } } bindingManager.setActiveScheme(modelActiveScheme); } catch (final NotDefinedException e) { StatusManager.getManager() .handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH, "Keys page found an undefined scheme", e)); //$NON-NLS-1$ } bindingManager.setLocale(bindingService.getLocale()); bindingManager.setPlatform(bindingService.getPlatform()); bindingManager.setBindings(bindingService.getBindings()); return bindingManager; }
Example 4
Source File: CommandsPropertyTester.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
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; }
Example 5
Source File: KeyController2.java From tmxeditor8 with GNU General Public License v2.0 | 6 votes |
private static BindingManager loadModelBackend(IServiceLocator locator) { IBindingService bindingService = (IBindingService) locator.getService(IBindingService.class); BindingManager bindingManager = new BindingManager(new ContextManager(), new CommandManager()); final Scheme[] definedSchemes = bindingService.getDefinedSchemes(); try { Scheme modelActiveScheme = null; for (int i = 0; i < definedSchemes.length; i++) { final Scheme scheme = definedSchemes[i]; final Scheme copy = bindingManager.getScheme(scheme.getId()); copy.define(scheme.getName(), scheme.getDescription(), scheme.getParentId()); if (definedSchemes[i] == bindingService.getActiveScheme()) { modelActiveScheme = copy; } } bindingManager.setActiveScheme(modelActiveScheme); } catch (final NotDefinedException e) { StatusManager.getManager() .handle(new Status(IStatus.WARNING, WorkbenchPlugin.PI_WORKBENCH, "Keys page found an undefined scheme", e)); //$NON-NLS-1$ } bindingManager.setLocale(bindingService.getLocale()); bindingManager.setPlatform(bindingService.getPlatform()); bindingManager.setBindings(bindingService.getBindings()); return bindingManager; }
Example 6
Source File: ThemeContribution.java From tm4e with Eclipse Public License 1.0 | 4 votes |
@Override public void initialize(IServiceLocator serviceLocator) { handlerService = serviceLocator.getService(IHandlerService.class); }