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


Java ParametersList.hasParameter方法代码示例

本文整理汇总了Java中com.intellij.execution.configurations.ParametersList.hasParameter方法的典型用法代码示例。如果您正苦于以下问题:Java ParametersList.hasParameter方法的具体用法?Java ParametersList.hasParameter怎么用?Java ParametersList.hasParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.execution.configurations.ParametersList的用法示例。


在下文中一共展示了ParametersList.hasParameter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateJavaParameters

import com.intellij.execution.configurations.ParametersList; //导入方法依赖的package包/类
@Override
public <T extends RunConfigurationBase> void updateJavaParameters(
    final T configuration, final JavaParameters params, final RunnerSettings runnerSettings
) throws ExecutionException {
    if (runnerSettings != null || !isApplicableFor(configuration)) {
        return;
    }
    final Project project = configuration.getProject();
    final ParametersList vmParameters = params.getVMParametersList();

    if (!vmParameters.hasParameter("-ea")) {
        vmParameters.add("-ea");
    }
    if (vmParameters.getParameters().stream().noneMatch(param -> param.startsWith("-Dplatformhome="))) {
        final VirtualFile platformRootDirectory = findPlatformRootDirectory(project);

        if (platformRootDirectory != null) {
            vmParameters.add("-Dplatformhome=" + platformRootDirectory.getPath());
        }
    }
    if (!params.getEnv().containsKey(HYBRIS_DATA_DIR_ENV)) {
        final HybrisProjectSettings settings = HybrisProjectSettingsComponent.getInstance(project).getState();

        final String hybrisDataDirPath = FileUtil.toCanonicalPath(
            project.getBasePath() + '/' + settings.getHybrisDirectory() + '/' + HybrisConstants.HYBRIS_DATA_DIRECTORY);

        if (hybrisDataDirPath != null) {
            params.addEnv(HYBRIS_DATA_DIR_ENV, hybrisDataDirPath);
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:32,代码来源:HybrisJUnitExtension.java

示例2: appendParamsEncodingClasspath

import com.intellij.execution.configurations.ParametersList; //导入方法依赖的package包/类
private static void appendParamsEncodingClasspath(SimpleJavaParameters javaParameters,
                                                  GeneralCommandLine commandLine,
                                                  ParametersList parametersList) {
  commandLine.addParameters(parametersList.getList());
  appendEncoding(javaParameters, commandLine, parametersList);
  if (!parametersList.hasParameter("-classpath") && !parametersList.hasParameter("-cp") && !javaParameters.getClassPath().getPathList().isEmpty()){
    commandLine.addParameter("-classpath");
    commandLine.addParameter(javaParameters.getClassPath().getPathsString());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JdkUtil.java

示例3: appendParamsEncodingClasspath

import com.intellij.execution.configurations.ParametersList; //导入方法依赖的package包/类
private static void appendParamsEncodingClasspath(SimpleJavaParameters javaParameters,
                                                  GeneralCommandLine commandLine,
                                                  ParametersList parametersList) {
  commandLine.addParameters(parametersList.getList());
  appendEncoding(javaParameters, commandLine, parametersList);
  if (!parametersList.hasParameter("-classpath") && !parametersList.hasParameter("-cp")){
    commandLine.addParameter("-classpath");
    commandLine.addParameter(javaParameters.getClassPath().getPathsString());
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:JdkUtil.java

示例4: setupJVMCommandLine

import com.intellij.execution.configurations.ParametersList; //导入方法依赖的package包/类
public static GeneralCommandLine setupJVMCommandLine(final String exePath,
                                                     final SimpleJavaParameters javaParameters,
                                                     final boolean forceDynamicClasspath) {
  final GeneralCommandLine commandLine = new GeneralCommandLine(exePath);

  final ParametersList vmParametersList = javaParameters.getVMParametersList();
  commandLine.withEnvironment(javaParameters.getEnv());
  commandLine.withParentEnvironmentType(javaParameters.isPassParentEnvs() ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);

  final Class commandLineWrapper;
  if ((commandLineWrapper = getCommandLineWrapperClass()) != null) {
    if (forceDynamicClasspath && !vmParametersList.hasParameter("-classpath") && !vmParametersList.hasParameter("-cp")) {
      if (isClassPathJarEnabled(javaParameters, PathUtil.getJarPathForClass(ClassPath.class))) {
        appendJarClasspathParams(javaParameters, commandLine, vmParametersList, commandLineWrapper);
      }
      else {
        appendOldCommandLineWrapper(javaParameters, commandLine, vmParametersList, commandLineWrapper);
      }
    }
    else {
      appendParamsEncodingClasspath(javaParameters, commandLine, vmParametersList);
    }
  }
  else {
    appendParamsEncodingClasspath(javaParameters, commandLine, vmParametersList);
  }

  final String mainClass = javaParameters.getMainClass();
  final String jarPath = javaParameters.getJarPath();
  if (mainClass != null) {
    commandLine.addParameter(mainClass);
  }
  else if (jarPath != null) {
    commandLine.addParameter("-jar");
    commandLine.addParameter(jarPath);
  }

  commandLine.addParameters(javaParameters.getProgramParametersList().getList());

  commandLine.withWorkDirectory(javaParameters.getWorkingDirectory());

  return commandLine;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:JdkUtil.java

示例5: appendJarClasspathParams

import com.intellij.execution.configurations.ParametersList; //导入方法依赖的package包/类
private static void appendJarClasspathParams(SimpleJavaParameters javaParameters,
                                             GeneralCommandLine commandLine,
                                             ParametersList vmParametersList, Class commandLineWrapper) {
  try {
    final Manifest manifest = new Manifest();
    manifest.getMainAttributes().putValue("Created-By",
                                          ApplicationNamesInfo.getInstance().getFullProductName());
    final boolean writeDynamicVMOptions = javaParameters.isDynamicVMOptions() && useDynamicVMOptions();
    if (writeDynamicVMOptions) {
      List<String> dParams = new ArrayList<String>();
      for (String param : vmParametersList.getList()) {
        if (param.startsWith("-D")) {
          dParams.add(param);
        }
      }

      manifest.getMainAttributes().putValue("VM-Options", ParametersListUtil.join(dParams));
      final ArrayList<String> restParams = new ArrayList<String>(vmParametersList.getList());
      restParams.removeAll(dParams);
      commandLine.addParameters(restParams);
    }
    else {
      commandLine.addParameters(vmParametersList.getList());
    }
    final boolean notEscape = vmParametersList.hasParameter(PROPERTY_DO_NOT_ESCAPE_CLASSPATH_URL);
    final List<String> classPathList = javaParameters.getClassPath().getPathList();
    final String jarFile = CommandLineWrapperUtil.createClasspathJarFile(manifest, classPathList, notEscape).getAbsolutePath();
    commandLine.addParameter("-classpath");
    if (writeDynamicVMOptions) {
      commandLine.addParameter(PathUtil.getJarPathForClass(commandLineWrapper) + File.pathSeparator + jarFile);
      appendEncoding(javaParameters, commandLine, vmParametersList);
      commandLine.addParameter(commandLineWrapper.getName());
      commandLine.addParameter(jarFile);
    }
    else {
      commandLine.addParameters(jarFile);
      appendEncoding(javaParameters, commandLine, vmParametersList);
    }
  }
  catch (IOException e) {
    LOG.error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:JdkUtil.java

示例6: explicitClassPath

import com.intellij.execution.configurations.ParametersList; //导入方法依赖的package包/类
private static boolean explicitClassPath(ParametersList vmParameters)
{
	return vmParameters.hasParameter("-cp") || vmParameters.hasParameter("-classpath") || vmParameters.hasParameter("--class-path");
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:5,代码来源:OwnJdkUtil.java

示例7: explicitModulePath

import com.intellij.execution.configurations.ParametersList; //导入方法依赖的package包/类
private static boolean explicitModulePath(ParametersList vmParameters)
{
	return vmParameters.hasParameter("-p") || vmParameters.hasParameter("--module-path");
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:5,代码来源:OwnJdkUtil.java

示例8: setClasspathJarParams

import com.intellij.execution.configurations.ParametersList; //导入方法依赖的package包/类
private static void setClasspathJarParams(GeneralCommandLine commandLine,
		OwnSimpleJavaParameters javaParameters,
		ParametersList vmParameters,
		Class commandLineWrapper,
		boolean dynamicVMOptions,
		boolean dynamicParameters) throws CantRunException
{
	try
	{
		Manifest manifest = new Manifest();
		manifest.getMainAttributes().putValue("Created-By", ApplicationNamesInfo.getInstance().getFullProductName());

		String manifestText = "";
		if(dynamicVMOptions)
		{
			List<String> properties = new ArrayList<>();
			for(String param : vmParameters.getList())
			{
				if(isUserDefinedProperty(param))
				{
					properties.add(param);
				}
				else
				{
					commandLine.addParameter(param);
				}
			}
			manifest.getMainAttributes().putValue("VM-Options", ParametersListUtil.join(properties));
			manifestText += "VM-Options: " + ParametersListUtil.join(properties) + "\n";
		}
		else
		{
			commandLine.addParameters(vmParameters.getList());
		}

		appendEncoding(javaParameters, commandLine, vmParameters);

		if(dynamicParameters)
		{
			manifest.getMainAttributes().putValue("Program-Parameters", ParametersListUtil.join(javaParameters.getProgramParametersList().getList()));
			manifestText += "Program-Parameters: " + ParametersListUtil.join(javaParameters.getProgramParametersList().getList()) + "\n";
		}

		boolean notEscape = vmParameters.hasParameter(PROPERTY_DO_NOT_ESCAPE_CLASSPATH_URL);
		PathsList path = javaParameters.getClassPath();
		File classpathJarFile = CommandLineWrapperUtil.createClasspathJarFile(manifest, path.getPathList(), notEscape);

		String jarFilePath = classpathJarFile.getAbsolutePath();
		commandLine.addParameter("-classpath");
		if(dynamicVMOptions || dynamicParameters)
		{
			commandLine.addParameter(PathUtil.getJarPathForClass(commandLineWrapper) + File.pathSeparator + jarFilePath);
			commandLine.addParameter(commandLineWrapper.getName());
		}
		commandLine.addParameter(jarFilePath);

		commandLine.putUserData(COMMAND_LINE_CONTENT, ContainerUtil.stringMap(jarFilePath, manifestText + "Class-Path: " + path.getPathsString()));

		OSProcessHandler.deleteFileOnTermination(commandLine, classpathJarFile);
	}
	catch(IOException e)
	{
		throwUnableToCreateTempFile(e);
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:66,代码来源:OwnJdkUtil.java


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