mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not write default ALTERNATIVE_JRE_PATH/ALTERNATIVE_JRE_PATH
This commit is contained in:
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.execution.util;
|
||||
|
||||
import com.intellij.execution.CantRunException;
|
||||
@@ -32,6 +18,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.DefaultJDOMExternalizer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiClass;
|
||||
@@ -41,6 +28,7 @@ import org.intellij.lang.annotations.MagicConstant;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -190,4 +178,20 @@ public class JavaParametersUtil {
|
||||
throw new RuntimeConfigurationWarning(ExecutionBundle.message("jre.path.is.not.valid.jre.home.error.message", jrePath));
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@NotNull
|
||||
public static DefaultJDOMExternalizer.JDOMFilter getFilter(@NotNull CommonJavaRunConfigurationParameters parameters) {
|
||||
return new DefaultJDOMExternalizer.JDOMFilter() {
|
||||
@Override
|
||||
public boolean isAccept(@NotNull Field field) {
|
||||
String name = field.getName();
|
||||
if ((name.equals("ALTERNATIVE_JRE_PATH_ENABLED") && !parameters.isAlternativeJrePathEnabled()) ||
|
||||
(name.equals("ALTERNATIVE_JRE_PATH") && StringUtil.isEmpty(parameters.getAlternativeJrePath()))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import com.intellij.execution.runners.ExecutionEnvironment;
|
||||
import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
|
||||
import com.intellij.execution.testframework.TestSearchScope;
|
||||
import com.intellij.execution.testframework.sm.runner.SMTRunnerConsoleProperties;
|
||||
import com.intellij.execution.util.JavaParametersUtil;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
@@ -441,7 +442,7 @@ public class JUnitConfiguration extends JavaTestConfigurationBase {
|
||||
public void writeExternal(@NotNull final Element element) throws WriteExternalException {
|
||||
super.writeExternal(element);
|
||||
JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
DefaultJDOMExternalizer.writeExternal(this, element, JavaParametersUtil.getFilter(this));
|
||||
final Data persistentData = getPersistentData();
|
||||
DefaultJDOMExternalizer.writeExternal(persistentData, element, new DifferenceFilter<>(persistentData, new Data()));
|
||||
|
||||
@@ -463,13 +464,16 @@ public class JUnitConfiguration extends JavaTestConfigurationBase {
|
||||
element.addContent(categoryNameElement);
|
||||
}
|
||||
|
||||
final Element patternsElement = new Element(PATTERNS_EL_NAME);
|
||||
for (String o : persistentData.getPatterns()) {
|
||||
final Element patternElement = new Element(PATTERN_EL_NAME);
|
||||
patternElement.setAttribute(TEST_CLASS_ATT_NAME, o);
|
||||
patternsElement.addContent(patternElement);
|
||||
if (!persistentData.getPatterns().isEmpty()) {
|
||||
final Element patternsElement = new Element(PATTERNS_EL_NAME);
|
||||
for (String o : persistentData.getPatterns()) {
|
||||
final Element patternElement = new Element(PATTERN_EL_NAME);
|
||||
patternElement.setAttribute(TEST_CLASS_ATT_NAME, o);
|
||||
patternsElement.addContent(patternElement);
|
||||
}
|
||||
element.addContent(patternsElement);
|
||||
}
|
||||
element.addContent(patternsElement);
|
||||
|
||||
final String forkMode = getForkMode();
|
||||
if (!forkMode.equals("none")) {
|
||||
final Element forkModeElement = new Element("fork_mode");
|
||||
|
||||
+1
-1
@@ -342,7 +342,7 @@ public class TestNGConfiguration extends JavaTestConfigurationBase {
|
||||
public void writeExternal(@NotNull Element element) throws WriteExternalException {
|
||||
super.writeExternal(element);
|
||||
JavaRunConfigurationExtensionManager.getInstance().writeExternal(this, element);
|
||||
DefaultJDOMExternalizer.writeExternal(this, element);
|
||||
DefaultJDOMExternalizer.writeExternal(this, element, JavaParametersUtil.getFilter(this));
|
||||
DefaultJDOMExternalizer.writeExternal(getPersistantData(), element, new DifferenceFilter<>(getPersistantData(), new TestData()));
|
||||
EnvironmentVariablesComponent.writeExternal(element, getPersistantData().getEnvs());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user