private void addUmlResource(String umlResourcePath, boolean doBundling,
boolean doSync, String modelPath) throws CoreException {
ICommandService cmdService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
IHandlerService handlerService = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
// get the command
Command command = cmdService.getCommand(AddUmlResourceHandler.COMMAND_ID);
IParameter umlPathParm = null;
IParameter doBundlingParm = null;
IParameter targetModelFileParm = null;
try {
umlPathParm = command.getParameter(AddUmlResourceHandler.PARAM_UML_RESOURCE_PATH);
doBundlingParm = command.getParameter(AddUmlResourceHandler.PARAM_DO_BUNDLING);
targetModelFileParm = command.getParameter(AddUmlResourceHandler.PARAM_TARGET_MODEL_PATH);
} catch (NotDefinedException e) {
this.throwCoreException("Unable to execute command, invalid parameter :" + e.getMessage(), e);
}
// parametrize it
Parameterization parmUmlPath = new Parameterization(umlPathParm, umlResourcePath);
Parameterization parmDoBundling = new Parameterization(doBundlingParm, Boolean.toString(doBundling));
Parameterization parmTargetModelFile = new Parameterization(targetModelFileParm, modelPath);
ParameterizedCommand parmCommand = new ParameterizedCommand(command,
new Parameterization[] { parmUmlPath, parmDoBundling, parmTargetModelFile});
// exec the command
try {
handlerService.executeCommand(parmCommand, null);
} catch (Exception e) {
this.throwCoreException(e.getMessage(), e);
}
}