本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
});
}
}
示例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);
}
}
示例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);
}
}