use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class RunCommandAction method actionPerformed.
@Override
public void actionPerformed(ActionEvent event) {
if (event.getParameters() == null) {
Log.error(getClass(), localizationConstant.runCommandEmptyParamsMessage());
return;
}
String name = event.getParameters().get(NAME_PARAM_ID);
if (name == null) {
Log.error(getClass(), localizationConstant.runCommandEmptyNameMessage());
return;
}
final CommandImpl command = selectCommandAction.getCommandByName(name);
if (command != null) {
commandManager.executeCommand(command, appContext.getDevMachine().getDescriptor());
}
}
use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class CommandManagerImpl method create.
@Override
public Promise<CommandImpl> create(String type) {
final CommandType commandType = commandTypeRegistry.getCommandTypeById(type);
Map<String, String> attributes = new HashMap<String, String>();
attributes.put(PREVIEW_URL_ATTR, commandType.getPreviewUrlTemplate());
final CommandImpl command = new CommandImpl(getUniqueCommandName(type, null), commandType.getCommandLineTemplate(), type, attributes);
return add(command);
}
use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class CommandManagerImpl method create.
@Override
public Promise<CommandImpl> create(String desirableName, String commandLine, String type, Map<String, String> attributes) {
final CommandType commandType = commandTypeRegistry.getCommandTypeById(type);
Map<String, String> attr = (attributes != null) ? attributes : new HashMap<String, String>();
attr.put(PREVIEW_URL_ATTR, commandType.getPreviewUrlTemplate());
final CommandImpl command = new CommandImpl(getUniqueCommandName(type, desirableName), commandLine != null ? commandLine : commandType.getCommandLineTemplate(), type, attr);
return add(command);
}
use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class TestServiceClient method getOrCreateTestCompileCommand.
public Promise<CommandImpl> getOrCreateTestCompileCommand() {
List<CommandImpl> commands = commandManager.getCommands();
for (CommandImpl command : commands) {
if (command.getName() != null && command.getName().startsWith("test-compile") && "mvn".equals(command.getType())) {
return promiseProvider.resolve(command);
}
}
for (CommandImpl command : commands) {
if ("build".equals(command.getName()) && "mvn".equals(command.getType())) {
String commandLine = command.getCommandLine();
MatchResult result = mavenCleanBuildPattern.exec(commandLine);
if (result != null) {
String testCompileCommandLine = mavenCleanBuildPattern.replace(commandLine, "$1mvn test-compile $2");
return commandManager.create("test-compile", testCompileCommandLine, "mvn", new HashMap<String, String>());
}
}
}
return promiseProvider.resolve(null);
}
use of org.eclipse.che.ide.api.command.CommandImpl in project che by eclipse.
the class TestServiceClientTest method reuseExistingCompileCommand.
@Test
public void reuseExistingCompileCommand() {
CommandImpl existingCompileCommand = new CommandImpl("test-compile", "mvn test-compile -f ${current.project.path}", "mvn");
when(commandManager.getCommands()).thenReturn(asList(new CommandImpl("run", "mvn run -f ${current.project.path}", "mvn"), new CommandImpl("build", "mvn clean install -f ${current.project.path}", "mvn"), existingCompileCommand));
testServiceClient.getOrCreateTestCompileCommand();
verify(promiseProvider).resolve(existingCompileCommand);
}
Aggregations