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


Java ExecutionUtil.handleExecutionError方法代码示例

本文整理汇总了Java中com.intellij.execution.runners.ExecutionUtil.handleExecutionError方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutionUtil.handleExecutionError方法的具体用法?Java ExecutionUtil.handleExecutionError怎么用?Java ExecutionUtil.handleExecutionError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.execution.runners.ExecutionUtil的用法示例。


在下文中一共展示了ExecutionUtil.handleExecutionError方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executeBeforeRunTask

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的package包/类
@Override
public boolean executeBeforeRunTask(ExecutionEnvironment env) {
  executableToDebug = null;
  if (!isDebugging(env)) {
    return true;
  }
  try {
    File executable = getExecutableToDebug();
    if (executable != null) {
      executableToDebug = executable;
      return true;
    }
  } catch (ExecutionException e) {
    ExecutionUtil.handleExecutionError(
        env.getProject(), env.getExecutor().getToolWindowId(), env.getRunProfile(), e);
  }
  return false;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:19,代码来源:BlazeCidrRunConfigurationRunner.java

示例2: executeBeforeRunTask

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的package包/类
@Override
public boolean executeBeforeRunTask(ExecutionEnvironment env) {
  if (!isDebugging(env)) {
    return true;
  }
  env.getCopyableUserData(EXECUTABLE_KEY).set(null);
  try {
    File executable = getExecutableToDebug(env);
    env.getCopyableUserData(EXECUTABLE_KEY).set(executable);
    if (executable != null) {
      return true;
    }
  } catch (ExecutionException e) {
    ExecutionUtil.handleExecutionError(
        env.getProject(), env.getExecutor().getToolWindowId(), env.getRunProfile(), e);
  }
  return false;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:19,代码来源:BlazePyRunConfigurationRunner.java

示例3: ensureRunnerConfigured

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的package包/类
@Override
public boolean ensureRunnerConfigured(@Nullable Module module, RunProfile profile, Executor executor, final Project project) throws ExecutionException {
  if (module == null) {
    throw new ExecutionException("Module is not specified");
  }

  if (LibrariesUtil.getGroovyHomePath(module) == null) {
    ExecutionUtil.handleExecutionError(project, executor.getToolWindowId(), profile, new ExecutionException("Groovy is not configured"));
    ModulesConfigurator.showDialog(module.getProject(), module.getName(), ClasspathEditor.NAME);
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DefaultGroovyScriptRunner.java

示例4: executeBeforeRunTask

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的package包/类
@Override
public boolean executeBeforeRunTask(ExecutionEnvironment env) {
  try {
    ClassFileManifestBuilder.buildManifest(env, null);
    return true;
  } catch (ExecutionException e) {
    ExecutionUtil.handleExecutionError(
        env.getProject(), env.getExecutor().getToolWindowId(), env.getRunProfile(), e);
    logger.info(e);
  }
  return false;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:13,代码来源:BlazeJavaRunConfigurationHandler.java

示例5: ensureRunnerConfigured

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的package包/类
@Override
public boolean ensureRunnerConfigured(@Nullable Module module, RunProfile profile, Executor executor, final Project project) throws ExecutionException {
  if (module == null) {
    throw new ExecutionException("Module is not specified");
  }

  if (LibrariesUtil.getGroovyHomePath(module) == null) {
    ExecutionUtil.handleExecutionError(project, executor.getToolWindowId(), profile, new ExecutionException("Groovy is not configured"));
    ModulesConfigurator.showDialog(module.getProject(), module.getName(), ClasspathEditor.NAME);
    return false;
  }


  return true;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:DefaultGroovyScriptRunner.java

示例6: startDebugSession

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的package包/类
public void startDebugSession(@Nonnull Project project) {
  XLocalAttachDebugger debugger = getSelectedDebugger();
  UsageTrigger.trigger(ConvertUsagesUtil.ensureProperKey("debugger.attach.local"));
  UsageTrigger.trigger(ConvertUsagesUtil.ensureProperKey("debugger.attach.local." + debugger.getDebuggerDisplayName()));

  try {
    debugger.attachDebugSession(project, myProcessInfo);
  }
  catch (ExecutionException e) {
    ExecutionUtil.handleExecutionError(project, ToolWindowId.DEBUG, myProcessInfo.getExecutableName(), e);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:13,代码来源:AttachToLocalProcessAction.java

示例7: executeConfiguration

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的package包/类
public static void executeConfiguration(@NotNull ExecutionEnvironment environment, boolean showSettings, boolean assignNewId) {
  if (ExecutorRegistry.getInstance().isStarting(environment)) {
    return;
  }

  RunnerAndConfigurationSettings runnerAndConfigurationSettings = environment.getRunnerAndConfigurationSettings();
  if (runnerAndConfigurationSettings != null) {
    if (!ExecutionTargetManager.canRun(environment)) {
      ExecutionUtil.handleExecutionError(environment, new ExecutionException(
        StringUtil.escapeXml("Cannot run '" + environment.getRunProfile().getName() + "' on '" + environment.getExecutionTarget().getDisplayName() + "'")));
      return;
    }

    if (!RunManagerImpl.canRunConfiguration(environment) || (showSettings && runnerAndConfigurationSettings.isEditBeforeRun())) {
      if (!RunDialog.editConfiguration(environment, "Edit configuration")) {
        return;
      }

      while (!RunManagerImpl.canRunConfiguration(environment)) {
        if (Messages.YES == Messages
          .showYesNoDialog(environment.getProject(), "Configuration is still incorrect. Do you want to edit it again?", "Change Configuration Settings",
                           "Edit", "Continue Anyway", Messages.getErrorIcon())) {
          if (!RunDialog.editConfiguration(environment, "Edit configuration")) {
            return;
          }
        }
        else {
          break;
        }
      }
    }

    ConfigurationType configurationType = runnerAndConfigurationSettings.getType();
    if (configurationType != null) {
      UsageTrigger.trigger("execute." + ConvertUsagesUtil.ensureProperKey(configurationType.getId()) + "." + environment.getExecutor().getId());
    }
  }

  try {
    if (assignNewId) {
      environment.assignNewExecutionId();
    }
    environment.getRunner().execute(environment);
  }
  catch (ExecutionException e) {
    String name = runnerAndConfigurationSettings != null ? runnerAndConfigurationSettings.getName() : null;
    if (name == null) {
      name = environment.getRunProfile().getName();
    }
    if (name == null && environment.getContentToReuse() != null) {
      name = environment.getContentToReuse().getDisplayName();
    }
    if (name == null) {
      name = "<Unknown>";
    }
    ExecutionUtil.handleExecutionError(environment.getProject(), environment.getExecutor().getToolWindowId(), name, e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:59,代码来源:ProgramRunnerUtil.java

示例8: startRunProfile

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的package包/类
@Override
public void startRunProfile(@NotNull final RunProfileStarter starter, @NotNull final RunProfileState state,
                            @NotNull final Project project, @NotNull final Executor executor, @NotNull final ExecutionEnvironment env) {
  final RunContentDescriptor reuseContent =
    ExecutionManager.getInstance(project).getContentManager().getReuseContent(env);
  if (reuseContent != null) {
    reuseContent.setExecutionId(env.getExecutionId());
  }
  final RunProfile profile = env.getRunProfile();

  project.getMessageBus().syncPublisher(EXECUTION_TOPIC).processStartScheduled(executor.getId(), env);

  Runnable startRunnable = new Runnable() {
    @Override
    public void run() {
      if (project.isDisposed()) return;
      boolean started = false;
      try {
        project.getMessageBus().syncPublisher(EXECUTION_TOPIC).processStarting(executor.getId(), env);

        final RunContentDescriptor descriptor = starter.execute(project, executor, state, reuseContent, env);

        if (descriptor != null) {
          final Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor> trinity =
            Trinity.create(descriptor, env.getRunnerAndConfigurationSettings(), executor);
          myRunningConfigurations.add(trinity);
          Disposer.register(descriptor, new Disposable() {
            @Override
            public void dispose() {
              myRunningConfigurations.remove(trinity);
            }
          });
          ExecutionManager.getInstance(project).getContentManager().showRunContent(executor, descriptor, reuseContent);
          final ProcessHandler processHandler = descriptor.getProcessHandler();
          if (processHandler != null) {
            processHandler.startNotify();
            project.getMessageBus().syncPublisher(EXECUTION_TOPIC).processStarted(executor.getId(), env, processHandler);
            started = true;
            processHandler.addProcessListener(new ProcessExecutionListener(project, profile, processHandler));
          }
        }
      }
      catch (ExecutionException e) {
        ExecutionUtil.handleExecutionError(project, executor.getToolWindowId(), profile, e);
        LOG.info(e);
      }
      finally {
        if (!started) {
          project.getMessageBus().syncPublisher(EXECUTION_TOPIC).processNotStarted(executor.getId(), env);
        }
      }
    }
  };

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    startRunnable.run();
  }
  else {
    compileAndRun(startRunnable, env, state, new Runnable() {
      @Override
      public void run() {
        if (!project.isDisposed()) {
          project.getMessageBus().syncPublisher(EXECUTION_TOPIC).processNotStarted(executor.getId(), env);
        }
      }
    });
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:69,代码来源:ExecutionManagerImpl.java

示例9: executeConfiguration

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的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);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:53,代码来源:ProgramRunnerUtil.java

示例10: executeConfiguration

import com.intellij.execution.runners.ExecutionUtil; //导入方法依赖的package包/类
public static void executeConfiguration(@Nonnull ExecutionEnvironment environment, boolean showSettings, boolean assignNewId) {
  if (ExecutorRegistry.getInstance().isStarting(environment)) {
    return;
  }

  RunnerAndConfigurationSettings runnerAndConfigurationSettings = environment.getRunnerAndConfigurationSettings();
  if (runnerAndConfigurationSettings != null) {
    if (!ExecutionTargetManager.canRun(environment)) {
      ExecutionUtil.handleExecutionError(environment, new ExecutionException(
              StringUtil.escapeXml("Cannot run '" + environment.getRunProfile().getName() + "' on '" + environment.getExecutionTarget().getDisplayName() + "'")));
      return;
    }

    if (!RunManagerImpl.canRunConfiguration(environment) || (showSettings && runnerAndConfigurationSettings.isEditBeforeRun())) {
      if (!RunDialog.editConfiguration(environment, "Edit configuration")) {
        return;
      }

      while (!RunManagerImpl.canRunConfiguration(environment)) {
        if (Messages.YES == Messages
                .showYesNoDialog(environment.getProject(), "Configuration is still incorrect. Do you want to edit it again?", "Change Configuration Settings",
                                 "Edit", "Continue Anyway", Messages.getErrorIcon())) {
          if (!RunDialog.editConfiguration(environment, "Edit configuration")) {
            return;
          }
        }
        else {
          break;
        }
      }
    }

    ConfigurationType configurationType = runnerAndConfigurationSettings.getType();
    if (configurationType != null) {
      UsageTrigger.trigger("execute." + ConvertUsagesUtil.ensureProperKey(configurationType.getId()) + "." + environment.getExecutor().getId());
    }
  }

  try {
    if (assignNewId) {
      environment.assignNewExecutionId();
    }
    environment.getRunner().execute(environment);
  }
  catch (ExecutionException e) {
    String name = runnerAndConfigurationSettings != null ? runnerAndConfigurationSettings.getName() : null;
    if (name == null) {
      name = environment.getRunProfile().getName();
    }
    if (name == null && environment.getContentToReuse() != null) {
      name = environment.getContentToReuse().getDisplayName();
    }
    if (name == null) {
      name = "<Unknown>";
    }
    ExecutionUtil.handleExecutionError(environment.getProject(), environment.getExecutor().getToolWindowId(), name, e);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:59,代码来源:ProgramRunnerUtil.java


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