本文整理汇总了Java中com.intellij.execution.ExecutionModes类的典型用法代码示例。如果您正苦于以下问题:Java ExecutionModes类的具体用法?Java ExecutionModes怎么用?Java ExecutionModes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ExecutionModes类属于com.intellij.execution包,在下文中一共展示了ExecutionModes类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: makeSquirrelCompiler
import com.intellij.execution.ExecutionModes; //导入依赖的package包/类
public static void makeSquirrelCompiler(String sdkPath) {
try {
if (retrieveSquirrelVersion(sdkPath) == null) {
throw new ExecutionException("Failed to make squirrel compiler, no sources present at the path.");
}
String make = getMakeExecutable();
if (make == null) {
throw new ExecutionException("Failed to found make executable.");
}
GeneralCommandLine cmd = new GeneralCommandLine();
cmd.setExePath(make);
cmd.withWorkDirectory(sdkPath);
cmd.getParametersList().addParametersString("-C " + sdkPath);
KillableColoredProcessHandler handler = new KillableColoredProcessHandler(cmd);
handler.setShouldDestroyProcessRecursively(true);
ProcessTerminatedListener.attach(handler);
handler.startNotify();
Project project = ProjectManager.getInstance().getDefaultProject();
ExecutionHelper.executeExternalProcess(project, handler, new ExecutionModes.ModalProgressMode("Making a squirrel compiler..."), cmd);
}
catch (ExecutionException e) {
SquirrelSdkService.LOG.debug(e.getMessage());
}
}
示例2: queryRakeRoutes
import com.intellij.execution.ExecutionModes; //导入依赖的package包/类
/**
* Internally used method that runs rake task and gets its output. This
* method should be called from backgroundable task.
*
* @param module Rails module for which rake task should be run.
* @return Output of 'rake routes'.
*/
@Nullable
public static ProcessOutput queryRakeRoutes(Module module,
String routesTaskName, String railsEnv) {
// Get root path of Rails application from module.
RailsApp app = RailsApp.fromModule(module);
if ((app == null) || (app.getRailsApplicationRoot() == null))
return null;
String moduleContentRoot = app.getRailsApplicationRoot().getPresentableUrl();
ModuleRootManager mManager = ModuleRootManager.getInstance(module);
Sdk sdk = mManager.getSdk();
if (sdk == null) {
Notifications.Bus.notify(new Notification("Railways",
"Railways Error",
"Cannot update route list for '" + module.getName() +
"' module, because its SDK is not set",
NotificationType.ERROR)
, module.getProject());
return null;
}
try {
railsEnv = (railsEnv == null) ? "" : "RAILS_ENV=" + railsEnv;
// Will work on IntelliJ platform since 2017.3
return RubyGemExecutionContext.create(sdk, "rake")
.withModule(module)
.withWorkingDirPath(moduleContentRoot)
.withExecutionMode(new ExecutionModes.SameThreadMode())
.withArguments(routesTaskName, "--trace", railsEnv)
.executeScript();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}