Here are the examples of the java api org.netbeans.modules.groovy.grails.api.GrailsPlatform.IDE_RUN_COMMAND taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
3 Examples
19
Source : GrailsCommandSupport.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public ExecutionDescriptor getRunDescriptor(boolean debug) {
return getDescriptor(GrailsPlatform.IDE_RUN_COMMAND, debug);
}
16
Source : GrailsCommandSupport.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
public ExecutionDescriptor getDescriptor(String command, InputProcessorFactory outFactory, final boolean debug) {
if (GrailsPlatform.IDE_RUN_COMMAND.equals(command)) {
ExecutionDescriptor descriptor = RUN_DESCRIPTOR;
InputProcessorFactory urlFactory = new InputProcessorFactory() {
public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {
LineProcessor lineProcessor = null;
if (debug) {
lineProcessor = LineProcessors.proxy(new ServerOutputProcessor(project, debug), new DebugOutputProcessor(project));
} else {
lineProcessor = new ServerOutputProcessor(project, debug);
}
return InputProcessors.proxy(defaultProcessor, InputProcessors.bridge(lineProcessor));
}
};
descriptor = descriptor.outProcessorFactory(createInputProcessorFactory(urlFactory, outFactory));
return descriptor;
}
InputProcessorFactory debugFactory = null;
if (debug) {
debugFactory = new InputProcessorFactory() {
public InputProcessor newInputProcessor(InputProcessor defaultProcessor) {
return InputProcessors.proxy(defaultProcessor, InputProcessors.bridge(new DebugOutputProcessor(project)));
}
};
}
if ("shell".equals(command)) {
// NOI18N
ExecutionDescriptor descriptor = RUN_DESCRIPTOR.postExecution(new RefreshProjectRunnable(project)).errProcessorFactory(ANSI_STRIPPING);
descriptor = descriptor.outProcessorFactory(createInputProcessorFactory(ANSI_STRIPPING, outFactory, debugFactory));
return descriptor;
} else {
ExecutionDescriptor descriptor = GRAILS_DESCRIPTOR.postExecution(new RefreshProjectRunnable(project)).errProcessorFactory(ANSI_STRIPPING);
descriptor = descriptor.outProcessorFactory(createInputProcessorFactory(ANSI_STRIPPING, outFactory, debugFactory));
return descriptor;
}
}
4
Source : GrailsCommandAction.java
with Apache License 2.0
from apache
with Apache License 2.0
from apache
@Override
public void performAction() {
final GrailsPlatform runtime = GrailsPlatform.getDefault();
if (!runtime.isConfigured()) {
ConfigurationSupport.showConfigurationWarning(runtime);
return;
}
final GrailsProject project = inferGrailsProject();
if (project == null) {
return;
}
GrailsCommandChooser.CommandDescriptor commandDescriptor = GrailsCommandChooser.select(project);
if (commandDescriptor == null) {
return;
}
ProjectInformation inf = ProjectUtils.getInformation(project);
// NOI18N
String displayName = inf.getDisplayName() + " (" + commandDescriptor.getGrailsCommand().getCommand() + ")";
final String[] params;
// FIXME all parameters in one String should we split it ?
if (commandDescriptor.getCommandParams() != null && !"".equals(commandDescriptor.getCommandParams().trim())) {
params = new String[] { commandDescriptor.getCommandParams() };
} else {
params = new String[] {};
}
Callable<Process> callable;
ExecutionDescriptor descriptor;
final boolean debug = commandDescriptor.isDebug();
if (GrailsPlatform.IDE_RUN_COMMAND.equals(commandDescriptor.getGrailsCommand().getCommand())) {
final GrailsServerState serverState = project.getLookup().lookup(GrailsServerState.clreplaced);
Process process = null;
if (serverState != null && serverState.isRunning()) {
if (!debug) /*|| debug == serverState.isDebug()*/
{
URL url = serverState.getRunningUrl();
if (url != null) {
GrailsCommandSupport.showURL(url, debug, project);
}
return;
} else {
process = serverState.getProcess();
if (process != null) {
process.destroy();
}
}
}
final Process oldProcess = process;
callable = new Callable<Process>() {
public Process call() throws Exception {
if (oldProcess != null) {
oldProcess.waitFor();
}
Callable<Process> inner = ExecutionSupport.getInstance().createRunApp(GrailsProjectConfig.forProject(project), debug, params);
Process process = inner.call();
final GrailsServerState serverState = project.getLookup().lookup(GrailsServerState.clreplaced);
if (serverState != null) {
serverState.setProcess(process);
serverState.setDebug(debug);
}
return process;
}
};
descriptor = project.getCommandSupport().getRunDescriptor(debug);
} else {
callable = ExecutionSupport.getInstance().createSimpleCommand(commandDescriptor.getGrailsCommand().getCommand(), debug, GrailsProjectConfig.forProject(project), params);
descriptor = project.getCommandSupport().getDescriptor(commandDescriptor.getGrailsCommand().getCommand(), debug);
}
ExecutionService service = ExecutionService.newService(callable, descriptor, displayName);
service.run();
}