use of org.eclipse.core.commands.common.NotDefinedException in project translationstudio8 by heartsome.
the class KeyController2 method loadModelBackend.
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", //$NON-NLS-1$
e));
}
bindingManager.setLocale(bindingService.getLocale());
bindingManager.setPlatform(bindingService.getPlatform());
bindingManager.setBindings(bindingService.getBindings());
return bindingManager;
}
use of org.eclipse.core.commands.common.NotDefinedException in project azure-tools-for-java by Microsoft.
the class AzureAbstractHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final Map<String, String> properties = new HashMap<>();
try {
final Command cmd = event.getCommand();
String handlerName = this.getClass().getSimpleName();
final Collection<?> callingMenus = HandlerUtil.getActiveMenus(event);
boolean fromProjectMenu = callingMenus != null && callingMenus.contains("org.eclipse.ui.navigator.ProjectExplorer#PopupMenu");
properties.put("FromProjectMenu", String.valueOf(fromProjectMenu));
if (cmd != null) {
properties.put("CategoryId", cmd.getCategory().getId());
properties.put("Category", cmd.getCategory().getName());
properties.put("CommandId", cmd.getId());
properties.put("Text", cmd.getName());
if (null == handlerName || handlerName.isEmpty()) {
handlerName = cmd.getName();
}
}
AppInsightsClient.createByType(AppInsightsClient.EventType.Action, handlerName, null, properties);
} catch (NotDefinedException ignore) {
}
return onExecute(event);
}
Aggregations