本文整理汇总了Java中com.intellij.execution.runners.ProgramRunner类的典型用法代码示例。如果您正苦于以下问题:Java ProgramRunner类的具体用法?Java ProgramRunner怎么用?Java ProgramRunner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProgramRunner类属于com.intellij.execution.runners包,在下文中一共展示了ProgramRunner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: executeConfiguration
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
public void executeConfiguration(Project project, ModuleBasedConfiguration appCon) {
if (noProjectsAreOpen()) {
logger.warn("No open projects found, can't execute the project.");
return;
}
logger.info("Starting to build execution environment.");
RunManager runManager = RunManager.getInstance(project);
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
RunnerAndConfigurationSettingsImpl selectedConfiguration =
getApplicationRunnerAndConfigurationSettings(runManager, appCon);
ProgramRunner runner = getRunner(executor, selectedConfiguration);
logger.info("Creating ExecutionEnvironment.");
ExecutionEnvironment environment =
new ExecutionEnvironment(
new DefaultRunExecutor(), runner, selectedConfiguration, project);
try {
logger.info("Executing project.");
runner.execute(environment);
} catch (ExecutionException e1) {
JavaExecutionUtil.showExecutionErrorMessage(e1, "Error", project);
}
}
示例2: execute
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
final ServerConnection connection = ServerConnectionManager.getInstance().getOrCreateConnection(myServer);
final Project project = myEnvironment.getProject();
RemoteServersView.getInstance(project).showServerConnection(connection);
final DebugConnector<?,?> debugConnector;
if (DefaultDebugExecutor.getDebugExecutorInstance().equals(executor)) {
debugConnector = myServer.getType().createDebugConnector();
}
else {
debugConnector = null;
}
connection.deploy(new DeploymentTaskImpl(mySource, myConfiguration, project, debugConnector, myEnvironment),
new ParameterizedRunnable<String>() {
@Override
public void run(String s) {
RemoteServersView.getInstance(project).showDeployment(connection, s);
}
});
return null;
}
示例3: canExecuteTask
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
@Override
public boolean canExecuteTask(RunConfiguration configuration, ExternalSystemBeforeRunTask beforeRunTask) {
final ExternalSystemTaskExecutionSettings executionSettings = beforeRunTask.getTaskExecutionSettings();
final List<ExternalTaskPojo> tasks = ContainerUtilRt.newArrayList();
for (String taskName : executionSettings.getTaskNames()) {
tasks.add(new ExternalTaskPojo(taskName, executionSettings.getExternalProjectPath(), null));
}
if (tasks.isEmpty()) return true;
final Pair<ProgramRunner, ExecutionEnvironment> pair =
ExternalSystemUtil.createRunner(executionSettings, DefaultRunExecutor.EXECUTOR_ID, myProject, mySystemId);
if (pair == null) return false;
final ProgramRunner runner = pair.first;
final ExecutionEnvironment environment = pair.second;
return runner.canRun(DefaultRunExecutor.EXECUTOR_ID, environment.getRunProfile());
}
示例4: createRunner
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
@Nullable
public static Pair<ProgramRunner, ExecutionEnvironment> createRunner(@NotNull ExternalSystemTaskExecutionSettings taskSettings,
@NotNull String executorId,
@NotNull Project project,
@NotNull ProjectSystemId externalSystemId) {
Executor executor = ExecutorRegistry.getInstance().getExecutorById(executorId);
if (executor == null) return null;
String runnerId = getRunnerId(executorId);
if (runnerId == null) return null;
ProgramRunner runner = RunnerRegistry.getInstance().findRunnerById(runnerId);
if (runner == null) return null;
RunnerAndConfigurationSettings settings = createExternalSystemRunnerAndConfigurationSettings(taskSettings, project, externalSystemId);
if (settings == null) return null;
return Pair.create(runner, new ExecutionEnvironment(executor, runner, settings, project));
}
示例5: loadState
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
public void loadState(@NotNull Element element) throws InvalidDataException {
settings.clear();
if (unloadedSettings != null) {
unloadedSettings.clear();
}
loadedIds.clear();
for (Iterator<Element> iterator = element.getChildren(childTagName).iterator(); iterator.hasNext(); ) {
Element state = iterator.next();
ProgramRunner runner = findRunner(state.getAttributeValue(RUNNER_ID));
if (runner == null) {
iterator.remove();
}
add(state, runner, runner == null ? null : createSettings(runner));
}
}
示例6: add
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
private void add(@NotNull Element state, @Nullable ProgramRunner runner, @Nullable T data) throws InvalidDataException {
if (runner == null) {
if (unloadedSettings == null) {
unloadedSettings = new SmartList<Element>();
}
unloadedSettings.add(state);
return;
}
if (data != null) {
((JDOMExternalizable)data).readExternal(state);
}
settings.put(runner, data);
loadedIds.add(runner.getRunnerId());
}
示例7: checkSettings
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
@Override
public void checkSettings(@Nullable Executor executor) throws RuntimeConfigurationException {
myConfiguration.checkConfiguration();
if (myConfiguration instanceof RunConfigurationBase) {
final RunConfigurationBase runConfigurationBase = (RunConfigurationBase) myConfiguration;
Set<ProgramRunner> runners = new THashSet<ProgramRunner>();
runners.addAll(myRunnerSettings.settings.keySet());
runners.addAll(myConfigurationPerRunnerSettings.settings.keySet());
for (ProgramRunner runner : runners) {
if (executor == null || runner.canRun(executor.getId(), myConfiguration)) {
runConfigurationBase.checkRunnerSettings(runner, myRunnerSettings.settings.get(runner), myConfigurationPerRunnerSettings.settings.get(runner));
}
}
if (executor != null) {
runConfigurationBase.checkSettingsBeforeRun();
}
}
}
示例8: wrapEditor
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
private <T> SettingsEditor<RunnerAndConfigurationSettings> wrapEditor(SettingsEditor<T> editor,
Convertor<RunnerAndConfigurationSettings, T> convertor,
ProgramRunner runner) {
SettingsEditor<RunnerAndConfigurationSettings> wrappedEditor
= new SettingsEditorWrapper<RunnerAndConfigurationSettings, T>(editor, convertor);
List<SettingsEditor> unwrappedEditors = myRunner2UnwrappedEditors.get(runner);
if (unwrappedEditors == null) {
unwrappedEditors = new ArrayList<SettingsEditor>();
myRunner2UnwrappedEditors.put(runner, unwrappedEditors);
}
unwrappedEditors.add(editor);
myRunnerEditors.add(wrappedEditor);
Disposer.register(this, wrappedEditor);
return wrappedEditor;
}
示例9: getAvailableConfigurations
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
@NotNull
private static List<RunnerAndConfigurationSettings> getAvailableConfigurations(@NotNull RunConfiguration runConfiguration) {
Project project = runConfiguration.getProject();
if (project == null || !project.isInitialized()) {
return Collections.emptyList();
}
List<RunnerAndConfigurationSettings> configurations = new ArrayList<RunnerAndConfigurationSettings>(RunManagerImpl.getInstanceImpl(project).getSortedConfigurations());
String executorId = DefaultRunExecutor.getRunExecutorInstance().getId();
for (Iterator<RunnerAndConfigurationSettings> iterator = configurations.iterator(); iterator.hasNext();) {
RunnerAndConfigurationSettings settings = iterator.next();
ProgramRunner runner = ProgramRunnerUtil.getRunner(executorId, settings);
if (runner == null || settings.getConfiguration() == runConfiguration) {
iterator.remove();
}
}
return configurations;
}
示例10: runConfiguration
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
public static void runConfiguration(Project project,
@NotNull MavenRunnerParameters params,
@Nullable MavenGeneralSettings settings,
@Nullable MavenRunnerSettings runnerSettings,
@Nullable ProgramRunner.Callback callback) {
RunnerAndConfigurationSettings configSettings = createRunnerAndConfigurationSettings(settings,
runnerSettings,
params,
project);
ProgramRunner runner = DefaultJavaProgramRunner.getInstance();
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
try {
runner.execute(new ExecutionEnvironment(executor, runner, configSettings, project), callback);
}
catch (ExecutionException e) {
MavenUtil.showError(project, "Failed to execute Maven goal", e);
}
}
示例11: execute
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
@Nullable
@Override
public ExecutionResult execute(Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
RunProfile profile = myEnvironment.getRunProfile();
if (profile instanceof AntRunConfiguration) {
AntRunConfiguration antRunConfiguration = (AntRunConfiguration)profile;
AntBuildTarget target = antRunConfiguration.getTarget();
if (target == null) return null;
ProcessHandler processHandler = ExecutionHandler
.executeRunConfiguration(antRunConfiguration, myEnvironment.getDataContext(), new ArrayList<BuildFileProperty>(),
new AntBuildListener() {
@Override
public void buildFinished(int state, int errorCount) {
}
});
if (processHandler == null) return null;
return new DefaultExecutionResult(null, processHandler);
}
return null;
}
示例12: execute
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
@Nullable
@Override
public ExecutionResult execute(Executor executor, ProgramRunner programRunner) throws ExecutionException {
try {
String cmd = PerlCli.getPerlPath(project);
String[] params = {cmd ,"-e","'print 1;'"};
Process p = Runtime.getRuntime().exec(params);
BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line;
String sdkVersion = "UNKNOWN";
while ((line = input.readLine()) != null) {
Utils.print(sdkVersion = line);
}
input.close();
int result = p.waitFor();
if (result != 0) {
throw new Exception("Failed to get perl version - make sure PERL_HOME directs to the right folder");
}
} catch (Exception e) {
e.printStackTrace();
}
return null;//TODO:: Implement ExecutionResult
}
示例13: runConfiguration
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
public static void runConfiguration(Project project,
@NotNull MavenRunnerParameters params,
@Nullable MavenGeneralSettings settings,
@Nullable MavenRunnerSettings runnerSettings,
@Nullable ProgramRunner.Callback callback) {
RunnerAndConfigurationSettings configSettings = createRunnerAndConfigurationSettings(settings,
runnerSettings,
params,
project);
ProgramRunner runner = DefaultJavaProgramRunner.getInstance();
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
ExecutionEnvironment env = new ExecutionEnvironment(executor, runner, configSettings, project);
try {
runner.execute(env, callback);
}
catch (ExecutionException e) {
MavenUtil.showError(project, "Failed to execute Maven goal", e);
}
}
示例14: execute
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
@NotNull
@Override
public ExecutionResult execute(@NotNull Executor executor, @NotNull ProgramRunner runner) throws ExecutionException {
if (GaugeVersion.isGreaterOrEqual(GaugeRunConfiguration.TEST_RUNNER_SUPPORT_VERSION, false)
&& GaugeSettingsService.getSettings().useIntelliJTestRunner()) {
ProcessHandler handler = startProcess();
GaugeConsoleProperties properties = new GaugeConsoleProperties(config, "Gauge", executor, handler);
ConsoleView console = SMTestRunnerConnectionUtil.createAndAttachConsole("Gauge", handler, properties);
DefaultExecutionResult result = new DefaultExecutionResult(console, handler, createActions(console, handler));
if (ActionManager.getInstance().getAction("RerunFailedTests") != null) {
AbstractRerunFailedTestsAction action = properties.createRerunFailedTestsAction(console);
if (action != null) {
action.setModelProvider(((SMTRunnerConsoleView) console)::getResultsViewer);
result.setRestartActions(action);
}
}
return result;
}
return super.execute(executor, runner);
}
示例15: runCompiler
import com.intellij.execution.runners.ProgramRunner; //导入依赖的package包/类
private void runCompiler() {
ApplicationManager.getApplication().invokeAndWait(new Runnable() {
@Override
public void run() {
try {
runner.execute(environment, new ProgramRunner.Callback() {
@Override
public void processStarted(RunContentDescriptor descriptor) {
ProcessHandler processHandler = descriptor.getProcessHandler();
if (processHandler != null) {
processHandler.addProcessListener(listener);
}
}
});
}
catch (ExecutionException e) {
throw new IllegalStateException("Could not compile XMLBeans sources.", e);
}
}
}, ModalityState.NON_MODAL);
}