add vm options to plugin run configuration

This commit is contained in:
Anna Kozlova
2005-03-07 21:39:31 +03:00
parent c36c0b3611
commit fb1a277488
3 changed files with 25 additions and 9 deletions
@@ -21,7 +21,6 @@ public class JUnitDevKitPatcher extends JUnitPatcher{
String libPath = jdk.getHomePath() + File.separator + "lib";
javaParameters.getVMParametersList().add("-Xbootclasspath/p:" + libPath + File.separator + "boot.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "idea.jar");
javaParameters.getClassPath().addTail(libPath + File.separator + "idea_rt.jar");
javaParameters.getClassPath().addFirst(libPath + File.separator + "resources.jar");
}
}
@@ -59,6 +59,8 @@ public class PluginRunConfiguration extends RunConfigurationBase {
private Module myModule;
private String myModuleName;
public String VM_PARAMETERS;
public PluginRunConfiguration(final Project project, final ConfigurationFactory factory, final String name) {
super(project, factory, name);
}
@@ -102,6 +104,11 @@ public class PluginRunConfiguration extends RunConfigurationBase {
ParametersList vm = params.getVMParametersList();
final String[] userVMOptions = VM_PARAMETERS != null ? VM_PARAMETERS.split(" ") : null;
for (int i = 0; userVMOptions != null && i < userVMOptions.length; i++) {
vm.add(userVMOptions[i]);
}
String libPath = jdk.getHomePath() + File.separator + "lib";
vm.add("-Xbootclasspath/p:" + libPath + File.separator + "boot.jar");
@@ -171,6 +178,7 @@ public class PluginRunConfiguration extends RunConfigurationBase {
if (module != null) {
myModuleName = module.getAttributeValue("name");
}
DefaultJDOMExternalizer.readExternal(this, element);
}
public void writeExternal(Element element) throws WriteExternalException {
@@ -181,6 +189,7 @@ public class PluginRunConfiguration extends RunConfigurationBase {
}
}));
element.addContent(moduleElement);
DefaultJDOMExternalizer.writeExternal(this, element);
}
public Module getModule() {
@@ -31,14 +31,13 @@
*/
package org.jetbrains.idea.devkit.run;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.util.Computable;
import com.intellij.ui.RawCommandLineEditor;
import javax.swing.*;
import java.awt.*;
@@ -48,7 +47,7 @@ public class PluginRunConfigurationEditor extends SettingsEditor<PluginRunConfig
private DefaultComboBoxModel myModulesModel = new DefaultComboBoxModel();
private JComboBox myModules = new JComboBox(myModulesModel);
private JLabel myModuleLabel = new JLabel("Choose classpath and jdk from module:");
private LabeledComponent<RawCommandLineEditor> myVMParameters = new LabeledComponent<RawCommandLineEditor>();
private PluginRunConfiguration myPRC;
@@ -59,6 +58,7 @@ public class PluginRunConfigurationEditor extends SettingsEditor<PluginRunConfig
public void resetEditorFrom(PluginRunConfiguration prc) {
myModules.setSelectedItem(prc.getModule());
getVMParameters().setText(prc.VM_PARAMETERS);
}
@@ -67,6 +67,7 @@ public class PluginRunConfigurationEditor extends SettingsEditor<PluginRunConfig
throw new ConfigurationException("No module selected.");
}
prc.setModule(((Module)myModules.getSelectedItem()));
prc.VM_PARAMETERS = getVMParameters().getText();
}
public JComponent createEditor() {
@@ -89,12 +90,19 @@ public class PluginRunConfigurationEditor extends SettingsEditor<PluginRunConfig
JPanel wholePanel = new JPanel(new GridBagLayout());
wholePanel.add(myModuleLabel, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST,
GridBagConstraints.NONE, new Insets(5, 0, 5, 0), 0, 0));
wholePanel.add(myModules, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST,
wholePanel.add(myModules, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.NORTHWEST,
GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
myVMParameters.setText("&VM Parameters");
myVMParameters.setComponent(new RawCommandLineEditor());
myVMParameters.getComponent().setDialodCaption(myVMParameters.getRawText());
wholePanel.add(myVMParameters, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST,
GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 0), 0, 0));
return wholePanel;
}
public RawCommandLineEditor getVMParameters() {
return myVMParameters.getComponent();
}
public void disposeEditor() {
}