當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。