protected static String getText(Object obj) { if (obj instanceof Command) { Command com = (Command) obj; try { return com.getName(); } catch (NotDefinedException e) { return com.getId(); } } else if (obj instanceof Category) { Category cat = (Category) obj; try { return cat.getName(); } catch (NotDefinedException e) { return cat.getId(); } } return ""; //$NON-NLS-1$ }
/** * @param commandManager */ private void generateCategories(MApplication application, CommandManager commandManager) { for (Category cat : commandManager.getDefinedCategories()) { if (categories.containsKey(cat.getId())) { continue; } try { MCategory catModel = modelService.createModelElement(MCategory.class); catModel.setElementId(cat.getId()); catModel.setName(cat.getName()); catModel.setDescription(cat.getDescription()); application.getCategories().add(catModel); categories.put(catModel.getElementId(), catModel); } catch (NotDefinedException e) { // Since we asked for defined commands, this shouldn't be an // issue WorkbenchPlugin.log(e); } } }
String name = category.getName(); Collection categories = (Collection) categoriesByName .get(name);
try { commandName = command.getName(); categoryName = command.getCommand().getCategory().getName(); } catch (final org.eclipse.core.commands.common.NotDefinedException e) {
/** * @param bindingCommand */ private void setCommandInfo(ParameterizedCommand bindingCommand) { setId(bindingCommand.getId()); try { setName(bindingCommand.getName()); } catch (NotDefinedException e) { setName(NewKeysPreferenceMessages.Undefined_Command); } try { setDescription(bindingCommand.getCommand().getDescription()); } catch (NotDefinedException e) { setDescription(Util.ZERO_LENGTH_STRING); } try { setCategory(bindingCommand.getCommand().getCategory().getName()); } catch (NotDefinedException e) { setCategory(NewKeysPreferenceMessages.Unavailable_Category); } setConflict(Boolean.FALSE); }
String commandName = null; try { categoryName = command.getCommand().getCategory().getName(); commandName = command.getName(); } catch (final NotDefinedException e) {