当前位置: 首页>>代码示例>>Java>>正文


Java ProgramRunner类代码示例

本文整理汇总了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);
    }
}
 
开发者ID:testmycode,项目名称:tmc-intellij,代码行数:23,代码来源:ProjectExecutor.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DeployToServerState.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ExternalSystemBeforeRunTaskProvider.java

示例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));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:ExternalSystemUtil.java

示例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));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RunnerAndConfigurationSettingsImpl.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:RunnerAndConfigurationSettingsImpl.java

示例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();
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:RunnerAndConfigurationSettingsImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ConfigurationSettingsEditor.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:RunConfigurationBeforeRunProvider.java

示例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);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MavenRunConfigurationType.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AntRunProfileState.java

示例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
}
 
开发者ID:eli1982,项目名称:intellij-perl-plugin,代码行数:26,代码来源:PerlRunProfileState.java

示例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);
    }
}
 
开发者ID:shlxue,项目名称:MvnRunner,代码行数:22,代码来源:MvnRunConfigurationType.java

示例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);
}
 
开发者ID:getgauge,项目名称:Intellij-Plugin,代码行数:21,代码来源:GaugeCommandLineState.java

示例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);
}
 
开发者ID:bsblabs,项目名称:intellij-xmlbeans-plugin,代码行数:22,代码来源:XmlBeansCompiler.java


注:本文中的com.intellij.execution.runners.ProgramRunner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。