本文整理汇总了Java中com.intellij.execution.configurations.SimpleJavaParameters类的典型用法代码示例。如果您正苦于以下问题:Java SimpleJavaParameters类的具体用法?Java SimpleJavaParameters怎么用?Java SimpleJavaParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleJavaParameters类属于com.intellij.execution.configurations包,在下文中一共展示了SimpleJavaParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configureConfiguration
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
public static void configureConfiguration(SimpleJavaParameters parameters, CommonJavaRunConfigurationParameters configuration) {
ProgramParametersUtil.configureConfiguration(parameters, configuration);
Project project = configuration.getProject();
Module module = ProgramParametersUtil.getModule(configuration);
String alternativeJrePath = configuration.getAlternativeJrePath();
if (alternativeJrePath != null) {
configuration.setAlternativeJrePath(ProgramParametersUtil.expandPath(alternativeJrePath, null, project));
}
String vmParameters = configuration.getVMParameters();
if (vmParameters != null) {
vmParameters = ProgramParametersUtil.expandPath(vmParameters, module, project);
for (Map.Entry<String, String> each : parameters.getEnv().entrySet()) {
vmParameters = StringUtil.replace(vmParameters, "$" + each.getKey() + "$", each.getValue(), false); //replace env usages
}
}
parameters.getVMParametersList().addParametersString(vmParameters);
}
示例2: runJython
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
public static ProcessOutput runJython(String workDir, String pythonPath, String... args) throws ExecutionException {
final SimpleJavaSdkType sdkType = new SimpleJavaSdkType();
final Sdk ideaJdk = sdkType.createJdk("tmp", SystemProperties.getJavaHome());
SimpleJavaParameters parameters = new SimpleJavaParameters();
parameters.setJdk(ideaJdk);
parameters.setMainClass("org.python.util.jython");
File jythonJar = new File(PythonHelpersLocator.getPythonCommunityPath(), "lib/jython.jar");
parameters.getClassPath().add(jythonJar.getPath());
parameters.getProgramParametersList().add("-Dpython.path=" + pythonPath + File.pathSeparator + workDir);
parameters.getProgramParametersList().addAll(args);
parameters.setWorkingDirectory(workDir);
final GeneralCommandLine commandLine = JdkUtil.setupJVMCommandLine(sdkType.getVMExecutablePath(ideaJdk), parameters, false);
final CapturingProcessHandler processHandler = new CapturingProcessHandler(commandLine.createProcess());
return processHandler.runProcess();
}
示例3: enhanceRemoteProcessing
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
@Override
public void enhanceRemoteProcessing(@NotNull SimpleJavaParameters parameters) throws ExecutionException {
final Set<String> additionalEntries = ContainerUtilRt.newHashSet();
for (GradleProjectResolverExtension extension : RESOLVER_EXTENSIONS.getValue()) {
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(extension.getClass()));
for (Class aClass : extension.getExtraProjectModelClasses()) {
ContainerUtilRt.addIfNotNull(additionalEntries, PathUtil.getJarPathForClass(aClass));
}
extension.enhanceRemoteProcessing(parameters);
}
final PathsList classPath = parameters.getClassPath();
for (String entry : additionalEntries) {
classPath.add(entry);
}
parameters.getVMParametersList().addProperty(
ExternalSystemConstants.EXTERNAL_SYSTEM_ID_KEY, GradleConstants.SYSTEM_ID.getId());
}
示例4: appendCoverageArgument
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
public void appendCoverageArgument(RunConfigurationBase configuration, final SimpleJavaParameters javaParameters) {
final CoverageRunner runner = getCoverageRunner();
try {
if (runner != null && runner instanceof JavaCoverageRunner) {
final String path = getCoverageFilePath();
assert path != null; // cannot be null here if runner != null
String sourceMapPath = null;
if (myCoverageProvider.isSourceMapNeeded(configuration)) {
sourceMapPath = getSourceMapPath(path);
}
((JavaCoverageRunner)runner).appendCoverageArgument(new File(path).getCanonicalPath(),
getPatterns(),
javaParameters,
isTrackPerTestCoverage() && !isSampling(),
isSampling(),
sourceMapPath);
}
}
catch (IOException e) {
LOG.info(e);
}
}
示例5: configureConfiguration
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
public static void configureConfiguration(SimpleJavaParameters parameters, CommonJavaRunConfigurationParameters configuration) {
ProgramParametersUtil.configureConfiguration(parameters, configuration);
Project project = configuration.getProject();
Module module = ProgramParametersUtil.getModule(configuration);
String vmParameters = configuration.getVMParameters();
if (vmParameters != null) {
vmParameters = ProgramParametersUtil.expandPath(vmParameters, module, project);
if (parameters.getEnv() != null) {
for (Map.Entry<String, String> each : parameters.getEnv().entrySet()) {
vmParameters = StringUtil.replace(vmParameters, "$" + each.getKey() + "$", each.getValue(), false); //replace env usages
}
}
}
parameters.getVMParametersList().addParametersString(vmParameters);
}
示例6: configureConfiguration
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
private void configureConfiguration(SimpleJavaParameters parameters, XQueryRunConfiguration configuration) {
ProgramParametersUtil.configureConfiguration(parameters, configuration);
Project project = configuration.getProject();
Module module = getModule(configuration);
;
String alternativeJrePath = configuration.getAlternativeJrePath();
if (alternativeJrePath != null) {
configuration.setAlternativeJrePath(expandPath(alternativeJrePath, null, project));
}
String vmParameters = configuration.getVMParameters();
if (vmParameters != null) {
vmParameters = expandPath(vmParameters, module, project);
for (Map.Entry<String, String> each : parameters.getEnv().entrySet()) {
vmParameters = StringUtil.replace(vmParameters, "$" + each.getKey() + "$", each.getValue(), false);
}
}
parameters.getVMParametersList().addParametersString(vmParameters);
}
示例7: appendParamsEncodingClasspath
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的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());
}
}
示例8: enhanceRemoteProcessing
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
@Override
public void enhanceRemoteProcessing(@NotNull SimpleJavaParameters parameters) {
List<String> classPath = Lists.newArrayList();
// Android module jars
addIfNotNull(getJarPathForClass(getClass()), classPath);
// Android sdklib jar
addIfNotNull(getJarPathForClass(FullRevision.class), classPath);
// Android common jar
addIfNotNull(getJarPathForClass(AndroidGradleSettings.class), classPath);
// Android gradle model jar
addIfNotNull(getJarPathForClass(AndroidProject.class), classPath);
parameters.getClassPath().addAll(classPath);
}
示例9: appendCoverageArgument
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
@Override
public void appendCoverageArgument(String sessionDataFilePath,
@Nullable String[] patterns,
SimpleJavaParameters parameters,
boolean collectLineInfo,
boolean isSampling) {
appendCoverageArgument(sessionDataFilePath, patterns, parameters, collectLineInfo, isSampling, null);
}
示例10: appendCoverageArgument
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
public void appendCoverageArgument(final String sessionDataFilePath, final String[] patterns, final SimpleJavaParameters javaParameters,
final boolean collectLineInfo, final boolean isSampling) {
StringBuffer argument = new StringBuffer("-javaagent:");
final String agentPath = PathUtil.getJarPathForClass(org.jacoco.agent.rt.RT.class);
final String parentPath = handleSpacesInPath(agentPath);
argument.append(parentPath).append(File.separator).append(new File(agentPath).getName());
argument.append("=");
argument.append("destfile=").append(sessionDataFilePath);
argument.append(",append=false");
javaParameters.getVMParametersList().add(argument.toString());
}
示例11: appendParamsEncodingClasspath
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的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());
}
}
示例12: configureModule
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
private void configureModule(final RunConfigurationModule runConfigurationModule,
final SimpleJavaParameters parameters,
@Nullable String jreHome) throws CantRunException {
Module module = runConfigurationModule.getModule();
if (module == null) {
throw CantRunException.noModuleConfigured(runConfigurationModule.getModuleName());
}
configureByModule(parameters, module, createModuleJdk(module, jreHome));
}
示例13: configureByModule
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
private void configureByModule(SimpleJavaParameters parameters, final Module module, final Sdk jdk) throws CantRunException {
if (jdk == null) {
throw CantRunException.noJdkConfigured();
}
parameters.setJdk(jdk);
setDefaultCharset(parameters, module.getProject());
configureEnumerator(OrderEnumerator.orderEntries(module).runtimeOnly().recursively(), jdk).collectPaths(parameters.getClassPath());
}
示例14: prepareRunnerParameters
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的package包/类
private SimpleJavaParameters prepareRunnerParameters() throws CantRunException {
final SimpleJavaParameters parameters = new SimpleJavaParameters();
parameters.setMainClass(configuration.getRunClass());
boolean isDebugging = getEnvironment().getExecutor().getId().equals(DefaultDebugExecutor.EXECUTOR_ID);
parameters.getProgramParametersList().prepend(getSerializedConfig(configuration, isDebugging, port).getAbsolutePath());
parameters.getClassPath().addFirst(new XQueryRunnerClasspathEntryGenerator().generateRunnerClasspathEntries(configuration));
return parameters;
}
示例15: setupJVMCommandLine
import com.intellij.execution.configurations.SimpleJavaParameters; //导入依赖的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;
}