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


Java ExecutionModes类代码示例

本文整理汇总了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());
    }
}
 
开发者ID:shvetsgroup,项目名称:squirrel-lang-idea-plugin,代码行数:29,代码来源:SquirrelSdkUtil.java

示例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;
}
 
开发者ID:basgren,项目名称:railways,代码行数:46,代码来源:RailwaysUtils.java


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