Package com.intellij.execution.configurations

Examples of com.intellij.execution.configurations.JavaParameters


        JFlexSettings settings = JFlexSettings.getInstance();

        //Earlier code used jflex.bat or jflex.sh. These files are broken after IDEA went open-source and changed
        //its sdk distribution structure. It's better to call JFlex.Main directly, not using any dumb bat or sh files.
        JavaParameters javaParameters = new JavaParameters();
        javaParameters.setJdk(projectSdk);
        javaParameters.setMainClass(JFLEX_MAIN_CLASS);
        javaParameters.getClassPath().add(JFLEX_JAR_PATH);

        StringBuilder command = new StringBuilder(CommandLineBuilder.createFromJavaParameters(javaParameters).getCommandLineString());

        //That options stuff can be refactored using javaParameters.getProgramParametersList().add(anOption),
        //as it does auto-quoting if necessary.
View Full Code Here


        super(runner, configuration);
        this.runConfiguration = runConfiguration;
    }

    protected JavaParameters createJavaParameters() throws ExecutionException {
        JavaParameters parameters = new JavaParameters();
        parameters.setMainClass(Constants.JBEHAVE_RUNNER_CLASS);
        String behaviorClass = runConfiguration.getBehaviorClass();
        String behaviourMethod = runConfiguration.getBehaviourMethod();
        String behaviourLocator = behaviorClass;
        if (behaviourMethod.length() > 0) {
            behaviourLocator += ":" + behaviourMethod;
        }
        parameters.getProgramParametersList().addParametersString(behaviourLocator);
        parameters.configureByModule(runConfiguration.getModule(),
                JavaParameters.JDK_AND_CLASSES_AND_TESTS);
        parameters.setWorkingDirectory(runConfiguration.getWorkingDirectoryPath());
        return parameters;
    }
View Full Code Here

    }
    if (jdkForRun == null) {
      throw CantRunException.noJdkConfigured();
    }

    JavaParameters params = new JavaParameters();

    // working directory and JVM

    if (myRunConfiguration.isGenerateWorkingDir()) {
      myWorkingDir = new File(PathManager.getSystemPath(), "osmorc/run." + System.currentTimeMillis());
    }
    else {
      myWorkingDir = new File(myRunConfiguration.getWorkingDir());
    }
    if (!myWorkingDir.isDirectory() && !myWorkingDir.mkdirs()) {
      throw new CantRunException("Cannot create work directory '" + myWorkingDir.getPath() + "'");
    }
    params.setWorkingDirectory(myWorkingDir);

    // only add JDK classes to the classpath, the rest is to be provided by bundles
    params.configureByProject(myRunConfiguration.getProject(), JavaParameters.JDK_ONLY, jdkForRun);

    // class path

    Collection<SelectedBundle> systemBundles = myInstanceManager.getFrameworkBundles(myInstance, FrameworkBundleType.SYSTEM);
    if (systemBundles.isEmpty()) {
      throw new CantRunException("Libraries required to start the framework not found - please check the installation");
    }
    for (SelectedBundle bundle : systemBundles) {
      String path = bundle.getBundlePath();
      assert path != null : bundle;
      params.getClassPath().add(path);
    }

    if (GenericRunProperties.isStartConsole(myAdditionalProperties)) {
      Collection<SelectedBundle> shellBundles = myInstanceManager.getFrameworkBundles(myInstance, FrameworkBundleType.SHELL);
      if (shellBundles.isEmpty()) {
        throw new CantRunException("Console requested but no shell bundles can be found - please check the installation");
      }
      List<SelectedBundle> allBundles = ContainerUtil.newArrayList(shellBundles);
      allBundles.addAll(myBundles);
      myBundles = allBundles;
    }

    if (myRunConfiguration.isIncludeAllBundlesInClassPath()) {
      for (SelectedBundle bundle : myBundles) {
        String path = bundle.getBundlePath();
        if (path != null) {
          params.getClassPath().add(path);
        }
      }
    }

    // runner options

    params.setUseDynamicVMOptions(!myBundles.isEmpty());

    params.getVMParametersList().addAll(HttpConfigurable.convertArguments(HttpConfigurable.getJvmPropertiesList(false, null)));
    params.getVMParametersList().addParametersString(myRunConfiguration.getVmParameters());

    String additionalProgramParams = myRunConfiguration.getProgramParameters();
    if (!StringUtil.isEmptyOrSpaces(additionalProgramParams)) {
      params.getProgramParametersList().addParametersString(additionalProgramParams);
    }

    String bootDelegation = GenericRunProperties.getBootDelegation(myAdditionalProperties);
    if (!StringUtil.isEmptyOrSpaces(bootDelegation)) {
      params.getVMParametersList().addProperty("org.osgi.framework.bootdelegation", bootDelegation);
    }

    String systemPackages = GenericRunProperties.getSystemPackages(myAdditionalProperties);
    if (!StringUtil.isEmptyOrSpaces(systemPackages)) {
      params.getVMParametersList().addProperty("org.osgi.framework.system.packages.extra", systemPackages);
    }

    // framework-specific options

    setupParameters(params);
View Full Code Here

    protected AnAction createStopAction() {
        return ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM);
    }

    private GeneralCommandLine createCommandLine(Module module, String workingDir) throws CantRunException {
        final JavaParameters params = new JavaParameters();
        params.configureByModule(module, JavaParameters.JDK_AND_CLASSES_AND_TESTS);

        params.getClassPath().add(PathUtil.getJarPathForClass(Main.class));

        Set<VirtualFile> cpVFiles = new HashSet<VirtualFile>();
        ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
        OrderEntry[] entries = moduleRootManager.getOrderEntries();
        for (OrderEntry orderEntry : entries) {
            if (orderEntry instanceof ModuleSourceOrderEntry) {
                cpVFiles.addAll(Arrays.asList(orderEntry.getFiles(OrderRootType.SOURCES)));
            }
        }

        for (VirtualFile file : cpVFiles) {
            params.getClassPath().add(file.getPath());
        }

        params.setMainClass(REPL_MAIN_CLASS);
        params.setWorkingDirectory(new File(workingDir));

        final GeneralCommandLine line = CommandLineBuilder.createFromJavaParameters(params, project, true);

        assert params.getJdk() != null;

        Map<String, String> envParams = new HashMap<String, String>();
        envParams.putAll(System.getenv());
        line.setEnvParams(envParams);
        line.addParameter("--port=" + port);
View Full Code Here

    return new ClojureConsoleView(getProject(), getConsoleTitle(), getHistoryModel(), getConsoleExecuteActionHandler(),
        nReplHost, nReplPort);
  }

  private static ArrayList<String> createRuntimeArgs(Module module, String workingDir) throws CantRunException {
    final JavaParameters params = new JavaParameters();
    params.configureByModule(module, JavaParameters.JDK_AND_CLASSES_AND_TESTS);
    // To avoid NCDFE while starting REPL

    final boolean sdkConfigured = ClojureConfigUtil.isClojureConfigured(module);
    if (!sdkConfigured) {
      final String jarPath = ClojureConfigUtil.CLOJURE_SDK;
      assert jarPath != null;
      params.getClassPath().add(jarPath);
    }

    Set<VirtualFile> cpVFiles = new HashSet<VirtualFile>();
    ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
    OrderEntry[] entries = moduleRootManager.getOrderEntries();
    for (OrderEntry orderEntry : entries) {
      // Add module sources to classpath
      if (orderEntry instanceof ModuleSourceOrderEntry) {
        cpVFiles.addAll(Arrays.asList(orderEntry.getFiles(OrderRootType.SOURCES)));
      }
    }
    // Also add output folders
    final VirtualFile outputDirectory = CompilerPaths.getModuleOutputDirectory(module, false);
    if (outputDirectory != null) {
      cpVFiles.add(outputDirectory);
    }

    for (VirtualFile file : cpVFiles) {
      params.getClassPath().add(file.getPath());
    }

    params.setMainClass(getMainReplClass(module));
    params.setWorkingDirectory(new File(workingDir));

    final GeneralCommandLine line = CommandLineBuilder.createFromJavaParameters(params, PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext()), true);

    final Sdk sdk = params.getJdk();
    assert sdk != null;
    final SdkType type = (SdkType) sdk.getSdkType();
    final String executablePath = ((JavaSdkType) type).getVMExecutablePath(sdk);

    final ArrayList<String> cmd = new ArrayList<String>();
View Full Code Here

    }
    return facet.isRunNrepl();
  }

  private GeneralCommandLine createCommandLine(Module module, String workingDir) throws CantRunException {
    final JavaParameters params = new JavaParameters();
    params.configureByModule(module, JavaParameters.JDK_AND_CLASSES_AND_TESTS);
    params.getVMParametersList().addAll(getJvmClojureOptions(module));
    params.getProgramParametersList().addAll(getReplClojureOptions(module));
    // To avoid NCDFE while starting REPL

    final boolean sdkConfigured = ClojureConfigUtil.isClojureConfigured(module);
    if (!sdkConfigured) {
      final String jarPath = ClojureConfigUtil.CLOJURE_SDK;
      assert jarPath != null;
      params.getClassPath().add(jarPath);
    }

    if (isRunNrepl(module)) {
      final String jarPathForNRepl = PathUtil.getJarPathForClass(Connection.class);
      params.getClassPath().add(jarPathForNRepl);
    }

    Set<VirtualFile> cpVFiles = new HashSet<VirtualFile>();
    ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module);
    OrderEntry[] entries = moduleRootManager.getOrderEntries();
    for (OrderEntry orderEntry : entries) {
      // Add module sources to classpath
      if (orderEntry instanceof ModuleSourceOrderEntry) {
        cpVFiles.addAll(Arrays.asList(orderEntry.getFiles(OrderRootType.SOURCES)));
      }
    }

    for (VirtualFile file : cpVFiles) {
      params.getClassPath().add(file.getPath());
    }

    params.setMainClass(getMainReplClass(module));
    params.setWorkingDirectory(new File(workingDir));

    final GeneralCommandLine line = CommandLineBuilder.createFromJavaParameters(params, PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext()), true);

    final Sdk sdk = params.getJdk();
    assert sdk != null;
    final SdkType type = (SdkType) sdk.getSdkType();
    final String executablePath = ((JavaSdkType) type).getVMExecutablePath(sdk);

    //final ArrayList<String> cmd = new ArrayList<String>();
View Full Code Here

      throw new ConfigurationException("Can't create Clojure REPL process");
    } else {
      // Only a single command line per-project is supported. We may need more flexibility
      //  in the future (e.g., different Clojure paths with different args)

      final JavaParameters params = new JavaParameters();
      params.configureByModule(myModule, JavaParameters.JDK_AND_CLASSES_AND_TESTS);
      // To avoid NCDFE while starting REPL

      final boolean sdkConfigured = ClojureConfigUtil.isClojureConfigured(myModule);
      if (!sdkConfigured) {
        final String jarPath = ClojureConfigUtil.CLOJURE_SDK;
        assert jarPath != null;
        params.getClassPath().add(jarPath);
      }

      Set<VirtualFile> cpVFiles = new HashSet<VirtualFile>();
      ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(myModule);
      OrderEntry[] entries = moduleRootManager.getOrderEntries();
      for (OrderEntry orderEntry : entries) {
        // Add module sources to classpath
        if (orderEntry instanceof ModuleSourceOrderEntry) {
          cpVFiles.addAll(Arrays.asList(orderEntry.getFiles(OrderRootType.SOURCES)));
        }
      }

      for (VirtualFile file : cpVFiles) {
        params.getClassPath().add(file.getPath());
      }


      params.setMainClass(ClojureUtils.CLOJURE_MAIN);
      params.setWorkingDirectory(path);

      final GeneralCommandLine line = CommandLineBuilder.createFromJavaParameters(params, PlatformDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext()), true);

      final Sdk sdk = params.getJdk();
      assert sdk != null;
      final SdkType type = (SdkType) sdk.getSdkType();
      final String executablePath = ((JavaSdkType) type).getVMExecutablePath(sdk);

      final ArrayList<String> env = new ArrayList<String>();
View Full Code Here

TOP

Related Classes of com.intellij.execution.configurations.JavaParameters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.