本文整理汇总了Java中com.intellij.execution.configurations.JavaParameters.getVMParametersList方法的典型用法代码示例。如果您正苦于以下问题:Java JavaParameters.getVMParametersList方法的具体用法?Java JavaParameters.getVMParametersList怎么用?Java JavaParameters.getVMParametersList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.execution.configurations.JavaParameters
的用法示例。
在下文中一共展示了JavaParameters.getVMParametersList方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCommandLineProxy
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
public ProcessProxy createCommandLineProxy(final JavaCommandLine javaCmdLine) throws ExecutionException {
ProcessProxyImpl proxy = null;
final JavaParameters javaParameters = javaCmdLine.getJavaParameters();
String mainClass = javaParameters.getMainClass();
if (ProcessProxyImpl.useLauncher() && mainClass != null) {
try {
proxy = new ProcessProxyImpl();
JavaSdkUtil.addRtJar(javaParameters.getClassPath());
final ParametersList vmParametersList = javaParameters.getVMParametersList();
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_PORT_NUMBER, String.valueOf(proxy.getPortNumber()));
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_BINPATH, PathManager.getBinPath());
javaParameters.getProgramParametersList().prepend(mainClass);
javaParameters.setMainClass(ProcessProxyImpl.LAUNCH_MAIN_CLASS);
}
catch (ProcessProxyImpl.NoMoreSocketsException e) {
proxy = null;
}
}
return proxy;
}
示例2: createCommandLineProxy
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
public ProcessProxy createCommandLineProxy(final JavaCommandLine javaCmdLine) throws ExecutionException {
ProcessProxyImpl proxy = null;
if (ProcessProxyImpl.useLauncher()) {
try {
proxy = new ProcessProxyImpl();
final JavaParameters javaParameters = javaCmdLine.getJavaParameters();
JavaSdkUtil.addRtJar(javaParameters.getClassPath());
final ParametersList vmParametersList = javaParameters.getVMParametersList();
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_PORT_NUMBER, String.valueOf(proxy.getPortNumber()));
vmParametersList.defineProperty(ProcessProxyImpl.PROPERTY_BINPATH, PathManager.getBinPath());
javaParameters.getProgramParametersList().prepend(javaParameters.getMainClass());
javaParameters.setMainClass(ProcessProxyImpl.LAUNCH_MAIN_CLASS);
}
catch (ProcessProxyImpl.NoMoreSocketsException e) {
proxy = null;
}
}
return proxy;
}
示例3: updateJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的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
示例4: addRequiredVmParams
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
public static void addRequiredVmParams(JavaParameters params, Sdk ideaJdk) {
String canonicalSandbox = IdeaJdkHelper.getSandboxHome(ideaJdk);
ParametersList vm = params.getVMParametersList();
@NonNls String libPath = ideaJdk.getHomePath() + File.separator + "lib";
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
vm.defineProperty("idea.config.path", canonicalSandbox + File.separator + "config");
vm.defineProperty("idea.system.path", canonicalSandbox + File.separator + "system");
vm.defineProperty("idea.plugins.path", canonicalSandbox + File.separator + "plugins");
vm.defineProperty("idea.classpath.index.enabled", "false");
if (SystemInfo.isMac) {
vm.defineProperty("idea.smooth.progress", "false");
vm.defineProperty("apple.laf.useScreenMenuBar", "true");
}
if (SystemInfo.isXWindow) {
if (!vm.hasProperty("sun.awt.disablegrab")) {
vm.defineProperty(
"sun.awt.disablegrab", "true"); // See http://devnet.jetbrains.net/docs/DOC-1142
}
}
params.setWorkingDirectory(ideaJdk.getHomePath() + File.separator + "bin" + File.separator);
params.setJdk(ideaJdk);
addIntellijLibraries(params, ideaJdk);
params.setMainClass("com.intellij.idea.Main");
}
示例5: patchJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
public void patchJavaParameters(@Nullable Module module, JavaParameters javaParameters) {
Sdk jdk = javaParameters.getJdk();
jdk = IdeaJdk.findIdeaJdk(jdk);
if (jdk == null) return;
@NonNls String libPath = jdk.getHomePath() + File.separator + "lib";
final ParametersList vm = javaParameters.getVMParametersList();
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
if (!vm.hasProperty("idea.load.plugins.id") && module != null && PluginModuleType.isOfType(module)) {
final String id = DescriptorUtil.getPluginId(module);
if (id != null) {
vm.defineProperty("idea.load.plugins.id", id);
}
}
final String sandboxHome = getSandboxPath(jdk);
if (sandboxHome != null) {
if (!vm.hasProperty("idea.home.path")) {
vm.defineProperty("idea.home.path", sandboxHome + File.separator + "test");
}
if (!vm.hasProperty("idea.plugins.path")) {
vm.defineProperty("idea.plugins.path", sandboxHome + File.separator + "plugins");
}
}
javaParameters.getClassPath().addFirst(libPath + File.separator + "idea.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "resources.jar");
javaParameters.getClassPath().addFirst(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk));
}
示例6: startUploadingProcess
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
private void startUploadingProcess() {
final Process process;
final GeneralCommandLine commandLine;
try {
JavaParameters parameters = new JavaParameters();
parameters.configureByModule(myAppEngineFacet.getModule(), JavaParameters.JDK_ONLY);
parameters.setMainClass("com.google.appengine.tools.admin.AppCfg");
parameters.getClassPath().add(mySdk.getToolsApiJarFile().getAbsolutePath());
final List<KeyValue<String,String>> list = HttpConfigurable.getJvmPropertiesList(false, null);
if (! list.isEmpty()) {
final ParametersList parametersList = parameters.getVMParametersList();
for (KeyValue<String, String> value : list) {
parametersList.defineProperty(value.getKey(), value.getValue());
}
}
final ParametersList programParameters = parameters.getProgramParametersList();
if (myAuthData.isOAuth2()) {
programParameters.add("--oauth2");
}
else {
programParameters.add("--email=" + myAuthData.getEmail());
programParameters.add("--passin");
programParameters.add("--no_cookies");
}
programParameters.add("update");
programParameters.add(FileUtil.toSystemDependentName(myArtifact.getOutputPath()));
commandLine = CommandLineBuilder.createFromJavaParameters(parameters);
process = commandLine.createProcess();
}
catch (ExecutionException e) {
myCallback.errorOccurred("Cannot start uploading: " + e.getMessage());
return;
}
final ProcessHandler processHandler = new OSProcessHandler(process, commandLine.getCommandLineString());
processHandler.addProcessListener(new MyProcessListener(processHandler, null, myLoggingHandler));
myLoggingHandler.attachToProcess(processHandler);
processHandler.startNotify();
}
示例7: patchJavaParameters
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
public void patchJavaParameters(@Nullable final Module module, JavaParameters javaParameters) {
if (module != null && PsiUtil.isIdeaProject(module.getProject()) &&
!javaParameters.getVMParametersList().hasParameter(JAVA_SYSTEM_CLASS_LOADER_PROPERTY)) {
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(module.getProject());
final String qualifiedName = UrlClassLoader.class.getName();
final PsiClass urlLoaderClass = ApplicationManager.getApplication().runReadAction(new Computable<PsiClass>() {
@Override
public PsiClass compute() {
return psiFacade.findClass(qualifiedName, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(module));
}
});
if (urlLoaderClass != null) {
javaParameters.getVMParametersList().add("-D" + JAVA_SYSTEM_CLASS_LOADER_PROPERTY + "=" + UrlClassLoader.class.getName());
}
}
Sdk jdk = javaParameters.getJdk();
jdk = IdeaJdk.findIdeaJdk(jdk);
if (jdk == null) return;
@NonNls String libPath = jdk.getHomePath() + File.separator + "lib";
final ParametersList vm = javaParameters.getVMParametersList();
vm.add("-Xbootclasspath/a:" + libPath + File.separator + "boot.jar");
if (!vm.hasProperty("idea.load.plugins.id") && module != null && PluginModuleType.isOfType(module)) {
final String id = DescriptorUtil.getPluginId(module);
if (id != null) {
vm.defineProperty("idea.load.plugins.id", id);
}
}
final File sandboxHome = getSandboxPath(jdk);
if (sandboxHome != null) {
if (!vm.hasProperty("idea.home.path")) {
File homeDir = new File(sandboxHome, "test");
FileUtil.createDirectory(homeDir);
vm.defineProperty("idea.home.path", homeDir.getAbsolutePath());
}
if (!vm.hasProperty("idea.plugins.path")) {
vm.defineProperty("idea.plugins.path", new File(sandboxHome, "plugins").getAbsolutePath());
}
}
javaParameters.getClassPath().addFirst(libPath + File.separator + "idea.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "resources.jar");
javaParameters.getClassPath().addFirst(((JavaSdkType)jdk.getSdkType()).getToolsPath(jdk));
}
示例8: getState
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
/**
* Plugin jar has been previously created via blaze build. This method: - copies jar to sandbox
* environment - cracks open jar and finds plugin.xml (with ID, etc., needed for JVM args) - sets
* up the SDK, etc. (use project SDK?) - sets up the JVM, and returns a JavaCommandLineState
*/
@Nullable
@Override
public RunProfileState getState(Executor executor, ExecutionEnvironment env)
throws ExecutionException {
final Sdk ideaJdk = pluginSdk;
if (!IdeaJdkHelper.isIdeaJdk(ideaJdk)) {
throw new ExecutionException("Choose an IntelliJ Platform Plugin SDK");
}
String sandboxHome = IdeaJdkHelper.getSandboxHome(ideaJdk);
if (sandboxHome == null) {
throw new ExecutionException("No sandbox specified for IntelliJ Platform Plugin SDK");
}
try {
sandboxHome = new File(sandboxHome).getCanonicalPath();
} catch (IOException e) {
throw new ExecutionException("No sandbox specified for IntelliJ Platform Plugin SDK");
}
String buildNumber = IdeaJdkHelper.getBuildNumber(ideaJdk);
final BlazeIntellijPluginDeployer deployer =
new BlazeIntellijPluginDeployer(sandboxHome, buildNumber, getTarget());
env.putUserData(BlazeIntellijPluginDeployer.USER_DATA_KEY, deployer);
// copy license from running instance of idea
IdeaJdkHelper.copyIDEALicense(sandboxHome);
return new JavaCommandLineState(env) {
@Override
protected JavaParameters createJavaParameters() throws ExecutionException {
List<String> pluginIds = deployer.deployNonBlocking();
final JavaParameters params = new JavaParameters();
ParametersList vm = params.getVMParametersList();
fillParameterList(vm, vmParameters);
fillParameterList(params.getProgramParametersList(), programParameters);
IntellijWithPluginClasspathHelper.addRequiredVmParams(params, ideaJdk);
vm.defineProperty(
JetBrainsProtocolHandler.REQUIRED_PLUGINS_KEY, Joiner.on(',').join(pluginIds));
if (!vm.hasProperty(PlatformUtils.PLATFORM_PREFIX_KEY) && buildNumber != null) {
String prefix = IdeaJdkHelper.getPlatformPrefix(buildNumber);
if (prefix != null) {
vm.defineProperty(PlatformUtils.PLATFORM_PREFIX_KEY, prefix);
}
}
return params;
}
@Override
protected OSProcessHandler startProcess() throws ExecutionException {
deployer.blockUntilDeployComplete();
final OSProcessHandler handler = super.startProcess();
handler.addProcessListener(
new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
deployer.deleteDeployment();
}
});
return handler;
}
};
}
示例9: startUploadingProcess
import com.intellij.execution.configurations.JavaParameters; //导入方法依赖的package包/类
private void startUploadingProcess() {
final Process process;
final GeneralCommandLine commandLine;
try {
JavaParameters parameters = new JavaParameters();
parameters.configureByModule(myAppEngineFacet.getModule(), JavaParameters.JDK_ONLY);
parameters.setMainClass("com.google.appengine.tools.admin.AppCfg");
parameters.getClassPath().add(mySdk.getToolsApiJarFile().getAbsolutePath());
final List<KeyValue<String,String>> list = HttpConfigurable.getJvmPropertiesList(false, null);
if (! list.isEmpty()) {
final ParametersList parametersList = parameters.getVMParametersList();
for (KeyValue<String, String> value : list) {
parametersList.defineProperty(value.getKey(), value.getValue());
}
}
final ParametersList programParameters = parameters.getProgramParametersList();
programParameters.add("--email=" + myEmail);
programParameters.add("update");
programParameters.add(FileUtil.toSystemDependentName(myArtifact.getOutputPath()));
commandLine = CommandLineBuilder.createFromJavaParameters(parameters);
process = commandLine.createProcess();
}
catch (ExecutionException e) {
Messages.showErrorDialog(myProject, "Cannot start uploading: " + e.getMessage(), CommonBundle.getErrorTitle());
return;
}
final Executor executor = DefaultRunExecutor.getRunExecutorInstance();
final ConsoleView console = TextConsoleBuilderFactory.getInstance().createBuilder(myProject).getConsole();
final RunnerLayoutUi ui = RunnerLayoutUi.Factory.getInstance(myProject).create("Upload", "Upload Application", "Upload Application", myProject);
final DefaultActionGroup group = new DefaultActionGroup();
ui.getOptions().setLeftToolbar(group, ActionPlaces.UNKNOWN);
ui.addContent(ui.createContent("upload", console.getComponent(), "Upload Application", null, console.getPreferredFocusableComponent()));
final ProcessHandler processHandler = new OSProcessHandler(process, commandLine.getCommandLineString());
processHandler.addProcessListener(new MyProcessListener(processHandler, console));
console.attachToProcess(processHandler);
final RunContentDescriptor contentDescriptor = new RunContentDescriptor(console, processHandler, ui.getComponent(), "Upload Application");
group.add(ActionManager.getInstance().getAction(IdeActions.ACTION_STOP_PROGRAM));
group.add(new CloseAction(executor, contentDescriptor, myProject));
ExecutionManager.getInstance(myProject).getContentManager().showRunContent(executor, contentDescriptor);
processHandler.startNotify();
}