use of org.eclipse.core.commands.ParameterValuesException in project eclipse.platform.ui by eclipse-platform.
the class HandlerTest method defineCommands.
private void defineCommands(IEclipseContext context) {
ECommandService cs = workbenchContext.get(ECommandService.class);
Category category = cs.defineCategory(TEST_CAT1, "CAT1", null);
cs.defineCommand(TEST_ID1, "ID1", null, category, null);
cs.defineCommand(TEST_ID2, "ID2", null, category, null);
cs.defineCommand(TEST_ID3, "ID3", null, category, new IParameter[] { new IParameter() {
@Override
public boolean isOptional() {
return true;
}
@Override
public IParameterValues getValues() throws ParameterValuesException {
return Collections::emptyMap;
}
@Override
public String getName() {
return ACTIVE_INFO_ID;
}
@Override
public String getId() {
return ACTIVE_INFO_ID;
}
} });
}
use of org.eclipse.core.commands.ParameterValuesException in project egradle by de-jcup.
the class LaunchGradleCommandHandler method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
try {
IParameter configparameter = event.getCommand().getParameter(PARAMETER_LAUNCHCONFIG);
IParameterValues values = configparameter.getValues();
if (values instanceof LaunchParameterValues) {
LaunchParameterValues launchParameterValues = (LaunchParameterValues) values;
taskAttributeOverride = launchParameterValues.getOverriddenTasks();
launch = launchParameterValues.getLaunch();
postJob = launchParameterValues.getPostJob();
} else {
IDEUtil.logWarning(getClass().getSimpleName() + ":parameter values without being a launch parameter value was used !??! :" + values);
}
} catch (NotDefinedException | ParameterValuesException e) {
throw new IllegalStateException("Cannot fetch command parameter!", e);
}
return super.execute(event);
}
Aggregations