private void createCommand(MCommand cmdModel) { IParameter[] parms = null; String id = cmdModel.getElementId(); String name = localize(cmdModel.getCommandName(), cmdModel); String desc = localize(cmdModel.getDescription(), cmdModel); List<MCommandParameter> modelParms = cmdModel.getParameters(); if (modelParms != null && !modelParms.isEmpty()) { ArrayList<Parameter> parmList = new ArrayList<>(); for (MCommandParameter cmdParm : modelParms) { ParameterType parameterType = null; if (cmdParm.getTypeId() != null && cmdParm.getTypeId().length() > 0) { parameterType = commandManager.getParameterType(cmdParm.getTypeId()); } parmList.add(new Parameter(cmdParm.getElementId(), cmdParm.getName(), null, parameterType, cmdParm.isOptional())); } parms = parmList.toArray(new Parameter[parmList.size()]); } Category cat = undefinedCategory; if (cmdModel.getCategory() != null) { cat = commandService.getCategory(cmdModel.getCategory().getElementId()); } commandService.defineCommand(id, name, desc, cat, parms, cmdModel.getPersistedState().get("HelpContextId")); //$NON-NLS-1$ }
if (!cmdName.equals(mCommand.getCommandName())) { mCommand.setCommandName(cmdName); String cmdDesc = cmd.getDescription();
public static MMenuItem createItem(MApplication application, CommandContributionItem cci) { MCommand command = getMCommand(application, cci); if (command != null) { CommandContributionItemParameter data = cci.getData(); MHandledMenuItem menuItem = MenuFactoryImpl.eINSTANCE.createHandledMenuItem(); menuItem.setCommand(command); menuItem.setContributorURI(command.getContributorURI()); if (data.label != null) { menuItem.setLabel(data.label); } else { menuItem.setLabel(command.getCommandName()); } if (data.mnemonic != null) { menuItem.setMnemonics(data.mnemonic); } if (data.icon != null) { menuItem.setIconURI(getIconURI(data.icon, application.getContext())); } else { menuItem.setIconURI(getIconURI(command.getElementId(), application.getContext(), ICommandImageService.TYPE_DEFAULT)); } String itemId = cci.getId(); menuItem.setElementId(itemId == null ? command.getElementId() : itemId); return menuItem; } return null; }
MHandledMenuItem menuItem = MenuFactoryImpl.eINSTANCE.createHandledMenuItem(); menuItem.setCommand(command); menuItem.setLabel(command.getCommandName()); menuItem.setIconURI(getIconURI(action.getImageDescriptor(), application.getContext())); menuItem.setLabel(action.getText()); } else { menuItem.setLabel(command.getCommandName());
ICommandImageService.TYPE_DEFAULT); if (iconURI == null) { toolItem.setLabel(command.getCommandName()); } else { toolItem.setIconURI(iconURI);
toolItem.setLabel(command.getCommandName()); } else { toolItem.setIconURI(iconURI);