本文整理汇总了Java中com.intellij.execution.runners.ProgramRunner.execute方法的典型用法代码示例。如果您正苦于以下问题:Java ProgramRunner.execute方法的具体用法?Java ProgramRunner.execute怎么用?Java ProgramRunner.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.runners.ProgramRunner
的用法示例。
在下文中一共展示了ProgramRunner.execute方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: executeRun
import com.intellij.execution.runners.ProgramRunner; //导入方法依赖的package包/类
public static boolean executeRun(@NotNull final Project project, String contentName, Icon icon, DataContext dataContext, Filter[] filters) throws ExecutionException {
final JavaParameters cmdLine = JavaParameters.JAVA_PARAMETERS.getData(dataContext);
final DefaultRunProfile profile = new DefaultRunProfile(project, cmdLine, contentName, icon, filters);
final ProgramRunner runner = RunnerRegistry.getInstance().getRunner(DefaultRunExecutor.EXECUTOR_ID, profile);
if (runner != null) {
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
runner.execute(new ExecutionEnvironment(profile, executor, project, null));
return true;
}
return false;
}
示例6: runTask
import com.intellij.execution.runners.ProgramRunner; //导入方法依赖的package包/类
public static void runTask(@NotNull ExternalSystemTaskExecutionSettings taskSettings,
@NotNull String executorId,
@NotNull Project project,
@NotNull ProjectSystemId externalSystemId)
{
Executor executor = ExecutorRegistry.getInstance().getExecutorById(executorId);
if (executor == null) {
return;
}
String runnerId = getRunnerId(executorId);
if (runnerId == null) {
return;
}
ProgramRunner runner = RunnerRegistry.getInstance().findRunnerById(runnerId);
if (runner == null) {
return;
}
AbstractExternalSystemTaskConfigurationType configurationType = findConfigurationType(externalSystemId);
if (configurationType == null) {
return;
}
String name = AbstractExternalSystemTaskConfigurationType.generateName(project, taskSettings);
RunnerAndConfigurationSettings settings = RunManager.getInstance(project).createRunConfiguration(name, configurationType.getFactory());
ExternalSystemRunConfiguration runConfiguration = (ExternalSystemRunConfiguration)settings.getConfiguration();
runConfiguration.getSettings().setExternalProjectPath(taskSettings.getExternalProjectPath());
runConfiguration.getSettings().setTaskNames(taskSettings.getTaskNames());
ExecutionEnvironment env = new ExecutionEnvironment(executor, runner, settings, project);
try {
runner.execute(env, null);
}
catch (ExecutionException e) {
LOG.warn("Can't execute task " + taskSettings, e);
}
}
示例7: start
import com.intellij.execution.runners.ProgramRunner; //导入方法依赖的package包/类
private static void start(@NotNull Project project,
@Nullable ProgramRunner runner,
@Nullable RunProfile runProfile,
@Nullable RunnerSettings runnerSettings,
@Nullable ConfigurationPerRunnerSettings configurationPerRunnerSettings,
@Nullable RunnerAndConfigurationSettings configuration,
@NotNull Executor executor,
@NotNull ExecutionTarget target,
@Nullable RunContentDescriptor descriptor) {
Runnable restarter = descriptor != null ? descriptor.getRestarter() : null;
if (runner != null && runProfile != null) {
try {
runner.execute(new ExecutionEnvironment(runProfile,
executor,
target,
project,
runnerSettings,
configurationPerRunnerSettings,
descriptor,
configuration,
runner.getRunnerId()));
}
catch (RunCanceledByUserException ignore) {
}
catch (ExecutionException e1) {
Messages.showErrorDialog(project, e1.getMessage(), ExecutionBundle.message("restart.error.message.title"));
}
}
else if (configuration != null) {
ProgramRunnerUtil.executeConfiguration(project, configuration, executor, target, descriptor, true);
}
else if (restarter != null) {
restarter.run();
}
}
示例8: debugConfiguration
import com.intellij.execution.runners.ProgramRunner; //导入方法依赖的package包/类
public static void debugConfiguration(Project project, ProgramRunner.Callback callback,
RunnerAndConfigurationSettings configSettings, Executor executor) {
ProgramRunner runner = RunnerRegistry.getInstance().findRunnerById(DefaultDebugExecutor.EXECUTOR_ID);
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);
}
}
示例9: executeRun
import com.intellij.execution.runners.ProgramRunner; //导入方法依赖的package包/类
public static boolean executeRun(@NotNull final Project project, String contentName, Icon icon, DataContext dataContext, Filter[] filters) throws ExecutionException
{
final OwnJavaParameters cmdLine = dataContext.getData(OwnJavaParameters.JAVA_PARAMETERS);
final DefaultRunProfile profile = new DefaultRunProfile(project, cmdLine, contentName, icon, filters);
final ProgramRunner runner = RunnerRegistry.getInstance().getRunner(DefaultRunExecutor.EXECUTOR_ID, profile);
if(runner != null)
{
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
runner.execute(new ExecutionEnvironment(profile, executor, project, null));
return true;
}
return false;
}
示例10: executeConfiguration
import com.intellij.execution.runners.ProgramRunner; //导入方法依赖的package包/类
public static void executeConfiguration(@NotNull final Project project,
@NotNull final RunnerAndConfigurationSettings configuration,
@NotNull final Executor executor,
@NotNull final ExecutionTarget target,
@Nullable RunContentDescriptor contentToReuse,
final boolean showSettings) {
ProgramRunner runner = getRunner(executor.getId(), configuration);
if (runner == null) {
LOG.error("Runner MUST not be null! Cannot find runner for " + executor.getId() + " and " + configuration.getConfiguration().getFactory().getName());
return;
}
if (ExecutorRegistry.getInstance().isStarting(project, executor.getId(), runner.getRunnerId())){
return;
}
if (!ExecutionTargetManager.canRun(configuration, target)) {
ExecutionUtil.handleExecutionError(
project, executor.getToolWindowId(), configuration.getConfiguration(),
new ExecutionException(StringUtil.escapeXml("Cannot run '" + configuration.getName() + "' on '" + target.getDisplayName() + "'")));
return;
}
if (!RunManagerImpl.canRunConfiguration(configuration, executor) || (showSettings && configuration.isEditBeforeRun())) {
if (!RunDialog.editConfiguration(project, configuration, "Edit configuration", executor)) {
return;
}
while (!RunManagerImpl.canRunConfiguration(configuration, executor)) {
if (0 == Messages.showYesNoDialog(project, "Configuration is still incorrect. Do you want to edit it again?", "Change Configuration Settings",
"Edit", "Continue Anyway", Messages.getErrorIcon())) {
if (!RunDialog.editConfiguration(project, configuration, "Edit configuration", executor)) {
return;
}
} else {
break;
}
}
}
final ConfigurationType configurationType = configuration.getType();
if (configurationType != null) {
UsageTrigger.trigger("execute." + ConvertUsagesUtil.ensureProperKey(configurationType.getId()) + "." + executor.getId());
}
try {
runner.execute(new ExecutionEnvironmentBuilder(project, executor).setRunnerAndSettings(runner, configuration).setTarget(target)
.setContentToReuse(contentToReuse).assignNewId().build());
}
catch (ExecutionException e) {
ExecutionUtil.handleExecutionError(project, executor.getToolWindowId(), configuration.getConfiguration(), e);
}
}