alternative jre: accept jdk path as valid jre; save system independent paths to enable path macros (sharing inside JDK team; common layout)

This commit is contained in:
Anna Kozlova
2015-10-08 20:35:21 +02:00
parent 4d3f29cbda
commit 77e38903b1
2 changed files with 9 additions and 6 deletions
@@ -239,13 +239,13 @@ public class JrePathEditor extends JPanel implements PanelWithAnchor {
@Override
public void render(SimpleColoredComponent component, boolean selected) {
component.append(getPresentableText());
component.append(FileUtil.toSystemDependentName(getPresentableText()));
component.setIcon(AllIcons.Nodes.Folder);
}
@Override
public String getPresentableText() {
return FileUtil.toSystemDependentName(myPath);
return myPath;
}
@Override
@@ -32,6 +32,7 @@ import com.intellij.openapi.projectRoots.ProjectJdkTable;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.ex.PathUtilEx;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass;
@@ -56,6 +57,11 @@ public class JavaParametersUtil {
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);
@@ -156,10 +162,7 @@ public class JavaParametersUtil {
return configuredJdk;
}
if (JdkUtil.checkForJdk(jreHome)) {
throw new CantRunException(ExecutionBundle.message("jre.path.is.jdk.error.message"));
}
if (!JdkUtil.checkForJre(jreHome)) {
if (!JdkUtil.checkForJre(jreHome) && !JdkUtil.checkForJdk(jreHome)) {
throw new CantRunException(ExecutionBundle.message("jre.path.is.not.valid.jre.home.error.message", jreHome));
}