Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: JetBrains/kotlin
base: f9515e1619
...
head fork: JetBrains/kotlin
compare: 91e150157a
  • 2 commits
  • 3 files changed
  • 4 commit comments
  • 2 contributors
Commits on May 19, 2012
@maxmanuylov maxmanuylov JetRunConfiguration should store its settings in the same format as J…
…ava's ApplicationConfiguration to be able to reuse code in JPS #KT-2041 Fixed
8793dee
Commits on May 21, 2012
@goodwinnk goodwinnk Merge pull request #57 from maxmanuylov/KT-2041
JetRunConfiguration should store its settings in the same format as Java...
91e1501
View
48 idea/src/org/jetbrains/jet/plugin/run/JetRunConfiguration.java
@@ -26,8 +26,7 @@
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.options.SettingsEditor;
-import com.intellij.openapi.util.InvalidDataException;
-import com.intellij.openapi.util.WriteExternalException;
+import com.intellij.openapi.util.*;
import com.intellij.util.xmlb.XmlSerializer;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
@@ -43,7 +42,10 @@
public class JetRunConfiguration extends ModuleBasedConfiguration<RunConfigurationModule>
implements CommonJavaRunConfigurationParameters {
- private JetRunConfigurationSettings settings = new JetRunConfigurationSettings();
+ public String MAIN_CLASS_NAME;
+ public String VM_PARAMETERS;
+ public String PROGRAM_PARAMETERS;
+ public String WORKING_DIRECTORY;
public boolean ALTERNATIVE_JRE_PATH_ENABLED;
public String ALTERNATIVE_JRE_PATH;
@@ -76,14 +78,20 @@ public void readExternal(final Element element) throws InvalidDataException {
super.readExternal(element);
JavaRunConfigurationExtensionManager.getInstance().readExternal(this, element);
+ DefaultJDOMExternalizer.readExternal(this, element);
+
readModule(element);
EnvironmentVariablesComponent.readExternal(element, getEnvs());
+ //TODO remove the following code (left for backward compatibility)
Element settingsElement = element.getChild(JetRunConfigurationSettings.class.getSimpleName());
if (settingsElement != null) {
- JetRunConfigurationSettings readSettings = XmlSerializer.deserialize(settingsElement, JetRunConfigurationSettings.class);
- if (readSettings != null) {
- settings = readSettings;
+ JetRunConfigurationSettings settings = XmlSerializer.deserialize(settingsElement, JetRunConfigurationSettings.class);
+ if (settings != null) {
+ MAIN_CLASS_NAME = settings.getMainClassName();
+ VM_PARAMETERS = settings.getVmParameters();
+ PROGRAM_PARAMETERS = settings.getProgramParameters();
+ WORKING_DIRECTORY = settings.getWorkingDirectory();
}
}
}
@@ -92,42 +100,41 @@ public void readExternal(final Element element) throws InvalidDataException {
public void writeExternal(final Element element) throws WriteExternalException {
super.writeExternal(element);
JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
+ DefaultJDOMExternalizer.writeExternal(this, element);
writeModule(element);
EnvironmentVariablesComponent.writeExternal(element, getEnvs());
PathMacroManager.getInstance(getProject()).collapsePathsRecursively(element);
-
- element.addContent(XmlSerializer.serialize(settings()));
}
@Override
public void setVMParameters(String value) {
- settings().setVmParameters(value);
+ VM_PARAMETERS = value;
}
@Override
public String getVMParameters() {
- return settings().getVmParameters();
+ return VM_PARAMETERS;
}
@Override
public void setProgramParameters(String value) {
- settings().setProgramParameters(value);
+ PROGRAM_PARAMETERS = value;
}
@Override
public String getProgramParameters() {
- return settings().getProgramParameters();
+ return PROGRAM_PARAMETERS;
}
@Override
public void setWorkingDirectory(String value) {
- settings().setWorkingDirectory(ExternalizablePath.urlValue(value));
+ WORKING_DIRECTORY = ExternalizablePath.urlValue(value);
}
@Override
public String getWorkingDirectory() {
- return ExternalizablePath.localPathValue(settings().getWorkingDirectory());
+ return ExternalizablePath.localPathValue(WORKING_DIRECTORY);
}
@Override
@@ -153,11 +160,11 @@ public boolean isPassParentEnvs() {
@Override
public String getRunClass() {
- return settings().getMainClassName();
+ return MAIN_CLASS_NAME;
}
public void setRunClass(String value) {
- settings().setMainClassName(value);
+ MAIN_CLASS_NAME = value;
}
@Override
@@ -185,11 +192,6 @@ public void setAlternativeJrePath(String path) {
ALTERNATIVE_JRE_PATH = path;
}
- @NotNull
- public JetRunConfigurationSettings settings() {
- return settings;
- }
-
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment executionEnvironment)
throws ExecutionException {
@@ -215,7 +217,7 @@ protected JavaParameters createJavaParameters() throws ExecutionException {
final int classPathType = JavaParametersUtil.getClasspathType(
module,
- myConfiguration.settings().getMainClassName(),
+ myConfiguration.getRunClass(),
false);
final String jreHome = myConfiguration.ALTERNATIVE_JRE_PATH_ENABLED ? myConfiguration.ALTERNATIVE_JRE_PATH
@@ -223,7 +225,7 @@ protected JavaParameters createJavaParameters() throws ExecutionException {
JavaParametersUtil.configureModule(module, params, classPathType, jreHome);
JavaParametersUtil.configureConfiguration(params, myConfiguration);
- params.setMainClass(myConfiguration.settings().getMainClassName());
+ params.setMainClass(myConfiguration.getRunClass());
return params;
}
View
2  idea/src/org/jetbrains/jet/plugin/run/JetRunConfigurationProducer.java
@@ -109,7 +109,7 @@ protected RunnerAndConfigurationSettings findExistingByElement(
for (RunnerAndConfigurationSettings existingConfiguration : existingConfigurations) {
if (existingConfiguration.getType() instanceof JetRunConfigurationType) {
JetRunConfiguration jetConfiguration = (JetRunConfiguration)existingConfiguration.getConfiguration();
- if (Comparing.equal(jetConfiguration.settings().getMainClassName(), startClassFQName.getFqName())) {
+ if (Comparing.equal(jetConfiguration.getRunClass(), startClassFQName.getFqName())) {
if (Comparing.equal(location.getModule(), jetConfiguration.getConfigurationModule().getModule())) {
return existingConfiguration;
}
View
4 idea/src/org/jetbrains/jet/plugin/run/JetRunConfigurationSettings.java
@@ -21,8 +21,12 @@
/**
* Should be serializable.
*
+ * @deprecated this class was left just for backward compatibility
* @author Nikolay Krasko
+ *
+ * TODO remove this class
*/
+@Deprecated
public class JetRunConfigurationSettings {
public static String DEFAULT_MAIN_CLASS_NAME = "";
public static String DEFAULT_VM_PARAMETERS = "";

Showing you all comments on commits in this comparison.

@abreslav
Owner

What are the compatibility implications of this? Who will suffer if we drop the obsolete class and how?

@maxmanuylov

If someone already has JetRunConfiguration in his/her project (stored in old format), we must be able to read its settings, otherwise user just loses them.

@abreslav
Owner

We can't keep the old clases around forever. Do you think there's a way to convert users' data or do something else about it?

@maxmanuylov

Yes, seems the classes "com.intellij.conversion.ProjectConverter" and "com.intellij.conversion.ConverterProvider" are exactly what we need here, so I'll use them to write a converter.

Something went wrong with that request. Please try again.