mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
option to choose shortening command line method (IDEA-154486; IDEA-165929)
This commit is contained in:
+13
@@ -37,4 +37,17 @@ public interface CommonJavaRunConfigurationParameters extends CommonProgramRunCo
|
||||
|
||||
@Nullable
|
||||
String getPackage();
|
||||
|
||||
/**
|
||||
* @return null if option was not selected explicitly, legacy user-local options to be used
|
||||
*/
|
||||
@Nullable
|
||||
default ShortenClasspath getShortenClasspath() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from UI, when user explicitly selects method to be used to shorten the command line or from the deserialization
|
||||
*/
|
||||
default void setShortenClasspath(ShortenClasspath mode) {}
|
||||
}
|
||||
|
||||
@@ -21,15 +21,21 @@ import com.intellij.execution.configurations.ModuleBasedConfiguration;
|
||||
import com.intellij.execution.configurations.RefactoringListenerProvider;
|
||||
import com.intellij.execution.testframework.TestSearchScope;
|
||||
import com.intellij.execution.testframework.sm.runner.SMRunnerConsolePropertiesProvider;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.psi.PsiClass;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiMethod;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public abstract class JavaTestConfigurationBase extends ModuleBasedConfiguration<JavaRunConfigurationModule>
|
||||
implements CommonJavaRunConfigurationParameters, RefactoringListenerProvider, SMRunnerConsolePropertiesProvider {
|
||||
private ShortenClasspath myShortenClasspath = null;
|
||||
|
||||
public JavaTestConfigurationBase(String name,
|
||||
@NotNull JavaRunConfigurationModule configurationModule,
|
||||
@NotNull ConfigurationFactory factory) {
|
||||
@@ -57,4 +63,27 @@ public abstract class JavaTestConfigurationBase extends ModuleBasedConfiguration
|
||||
}
|
||||
|
||||
public abstract TestSearchScope getTestSearchScope();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ShortenClasspath getShortenClasspath() {
|
||||
return myShortenClasspath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShortenClasspath(ShortenClasspath shortenClasspath) {
|
||||
myShortenClasspath = shortenClasspath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(Element element) throws InvalidDataException {
|
||||
super.readExternal(element);
|
||||
setShortenClasspath(ShortenClasspath.readShortenClasspathMethod(element));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(Element element) throws WriteExternalException {
|
||||
super.writeExternal(element);
|
||||
ShortenClasspath.writeShortenClasspathMethod(element, myShortenClasspath);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,10 +194,10 @@ public abstract class JavaTestFrameworkRunnableState<T extends
|
||||
@Override
|
||||
protected JavaParameters createJavaParameters() throws ExecutionException {
|
||||
final JavaParameters javaParameters = new JavaParameters();
|
||||
javaParameters.setUseClasspathJar(true);
|
||||
Project project = getConfiguration().getProject();
|
||||
javaParameters.setShortenClasspath(getConfiguration().getShortenClasspath(), project);
|
||||
final Module module = getConfiguration().getConfigurationModule().getModule();
|
||||
|
||||
Project project = getConfiguration().getProject();
|
||||
Sdk jdk = module == null ? ProjectRootManager.getInstance(project).getProjectSdk() : ModuleRootManager.getInstance(module).getSdk();
|
||||
javaParameters.setJdk(jdk);
|
||||
|
||||
|
||||
+11
-2
@@ -3,7 +3,7 @@
|
||||
<grid id="93687" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="8" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="53" y="36" width="708" height="319"/>
|
||||
<xy x="53" y="36" width="708" height="326"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -63,11 +63,20 @@
|
||||
</vspacer>
|
||||
<vspacer id="7cceb">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
|
||||
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="-1" height="10"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="c452d2" class="com.intellij.openapi.ui.LabeledComponent" binding="myShortenClasspathModeCombo" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<labelLocation value="West"/>
|
||||
<text resource-bundle="messages/ExecutionBundle" key="application.configuration.shorten.command.line.label"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
|
||||
+9
-1
@@ -18,6 +18,7 @@ package com.intellij.execution.application;
|
||||
import com.intellij.application.options.ModuleDescriptionsComboBox;
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
import com.intellij.execution.JavaExecutionUtil;
|
||||
import com.intellij.execution.ShortenClasspath;
|
||||
import com.intellij.execution.configurations.ConfigurationUtil;
|
||||
import com.intellij.execution.ui.*;
|
||||
import com.intellij.execution.util.JreVersionDetector;
|
||||
@@ -43,6 +44,7 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
|
||||
private CommonJavaParametersPanel myCommonProgramParameters;
|
||||
private LabeledComponent<EditorTextFieldWithBrowseButton> myMainClass;
|
||||
private LabeledComponent<ModuleDescriptionsComboBox> myModule;
|
||||
private LabeledComponent<ShortenClasspathModeCombo> myShortenClasspathModeCombo;
|
||||
private JPanel myWholePanel;
|
||||
|
||||
private final ConfigurationModuleSelector myModuleSelector;
|
||||
@@ -65,7 +67,8 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
|
||||
ClassBrowser.createApplicationClassBrowser(project, myModuleSelector).setField(getMainClassField());
|
||||
myVersionDetector = new JreVersionDetector();
|
||||
|
||||
myAnchor = UIUtil.mergeComponentsWithAnchor(myMainClass, myCommonProgramParameters, myJrePathEditor, myModule);
|
||||
myAnchor = UIUtil.mergeComponentsWithAnchor(myMainClass, myCommonProgramParameters, myJrePathEditor, myModule,
|
||||
myShortenClasspathModeCombo);
|
||||
}
|
||||
|
||||
public void applyEditorTo(@NotNull final ApplicationConfiguration configuration) throws ConfigurationException {
|
||||
@@ -77,6 +80,7 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
|
||||
configuration.ALTERNATIVE_JRE_PATH = myJrePathEditor.getJrePathOrName();
|
||||
configuration.ALTERNATIVE_JRE_PATH_ENABLED = myJrePathEditor.isAlternativeJreSelected();
|
||||
configuration.ENABLE_SWING_INSPECTOR = (myVersionDetector.isJre50Configured(configuration) || myVersionDetector.isModuleJre50Configured(configuration)) && myShowSwingInspectorCheckbox.isSelected();
|
||||
configuration.setShortenClasspath((ShortenClasspath)myShortenClasspathModeCombo.getComponent().getSelectedItem());
|
||||
|
||||
updateShowSwingInspector(configuration);
|
||||
}
|
||||
@@ -86,6 +90,7 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
|
||||
myModuleSelector.reset(configuration);
|
||||
getMainClassField().setText(configuration.MAIN_CLASS_NAME != null ? configuration.MAIN_CLASS_NAME.replaceAll("\\$", "\\.") : "");
|
||||
myJrePathEditor.setPathOrName(configuration.ALTERNATIVE_JRE_PATH, configuration.ALTERNATIVE_JRE_PATH_ENABLED);
|
||||
myShortenClasspathModeCombo.getComponent().setSelectedItem(configuration.getShortenClasspath());
|
||||
|
||||
updateShowSwingInspector(configuration);
|
||||
}
|
||||
@@ -130,6 +135,8 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
|
||||
return Visibility.NOT_VISIBLE;
|
||||
}
|
||||
}));
|
||||
myShortenClasspathModeCombo = new LabeledComponent<>();
|
||||
myShortenClasspathModeCombo.setComponent(new ShortenClasspathModeCombo(myProject));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -144,5 +151,6 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
|
||||
myCommonProgramParameters.setAnchor(anchor);
|
||||
myJrePathEditor.setAnchor(anchor);
|
||||
myModule.setAnchor(anchor);
|
||||
myShortenClasspathModeCombo.setAnchor(anchor);
|
||||
}
|
||||
}
|
||||
|
||||
+18
-1
@@ -61,6 +61,8 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
public String ALTERNATIVE_JRE_PATH;
|
||||
public boolean ENABLE_SWING_INSPECTOR;
|
||||
|
||||
private ShortenClasspath myShortenClasspath = null;
|
||||
|
||||
public String ENV_VARIABLES;
|
||||
private final Map<String,String> myEnvs = new LinkedHashMap<>();
|
||||
public boolean PASS_PARENT_ENVS = true;
|
||||
@@ -243,6 +245,7 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
DefaultJDOMExternalizer.readExternal(this, element);
|
||||
readModule(element);
|
||||
EnvironmentVariablesComponent.readExternal(element, getEnvs());
|
||||
setShortenClasspath(ShortenClasspath.readShortenClasspathMethod(element));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -257,6 +260,19 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
//if (!envs.isEmpty()) {
|
||||
EnvironmentVariablesComponent.writeExternal(element, envs);
|
||||
//}
|
||||
|
||||
ShortenClasspath.writeShortenClasspathMethod(element, myShortenClasspath);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ShortenClasspath getShortenClasspath() {
|
||||
return myShortenClasspath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setShortenClasspath(ShortenClasspath mode) {
|
||||
myShortenClasspath = mode;
|
||||
}
|
||||
|
||||
public static class JavaApplicationCommandLineState<T extends ApplicationConfiguration> extends BaseJavaApplicationCommandLineState<T> {
|
||||
@@ -267,7 +283,8 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration<JavaRunCo
|
||||
@Override
|
||||
protected JavaParameters createJavaParameters() throws ExecutionException {
|
||||
final JavaParameters params = new JavaParameters();
|
||||
params.setUseClasspathJar(true);
|
||||
T configuration = getConfiguration();
|
||||
params.setShortenClasspath(configuration.getShortenClasspath(), configuration.getProject());
|
||||
|
||||
final JavaRunConfigurationModule module = myConfiguration.getConfigurationModule();
|
||||
final String jreHome = myConfiguration.ALTERNATIVE_JRE_PATH_ENABLED ? myConfiguration.ALTERNATIVE_JRE_PATH : null;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright 2000-2017 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.ui;
|
||||
|
||||
import com.intellij.execution.ShortenClasspath;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.ui.ColoredListCellRenderer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class ShortenClasspathModeCombo extends ComboBox<ShortenClasspath> {
|
||||
private final Project myProject;
|
||||
|
||||
public ShortenClasspathModeCombo(Project project) {
|
||||
myProject = project;
|
||||
addItem(null);
|
||||
for (ShortenClasspath mode : ShortenClasspath.values()) {
|
||||
addItem(mode);
|
||||
}
|
||||
setRenderer(new ColoredListCellRenderer<ShortenClasspath>() {
|
||||
@Override
|
||||
protected void customizeCellRenderer(@NotNull JList<? extends ShortenClasspath> list,
|
||||
ShortenClasspath value,
|
||||
int index,
|
||||
boolean selected,
|
||||
boolean hasFocus) {
|
||||
if (value == null) {
|
||||
ShortenClasspath defaultMode = ShortenClasspath.getDefaultMethod(myProject);
|
||||
append("user-local default: " + defaultMode.getPresentableName()).append(" - " + defaultMode.getDescription(), SimpleTextAttributes.GRAYED_ATTRIBUTES);
|
||||
}
|
||||
else {
|
||||
append(value.getPresentableName()).append(" - " + value.getDescription(), SimpleTextAttributes.GRAYED_ATTRIBUTES);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
// 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.
|
||||
package com.intellij.execution;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.JdkUtil;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Command line has length limit depending on used OS. In order to allow java command lines of any length for any OS, a number of approaches are possible.
|
||||
*
|
||||
* Since 2017.3, it's possible to setup shortening command line method per run configuration, e.g. {@link com.intellij.execution.CommonJavaRunConfigurationParameters#getShortenClasspath}
|
||||
*/
|
||||
public enum ShortenClasspath {
|
||||
NONE("none", "java [options] classname [args]"),
|
||||
MANIFEST("JAR manifest", "java -cp classpath.jar classname [args]"),
|
||||
CLASSPATH_FILE("classpath file", "java WrapperClass classpathFile [args]");
|
||||
|
||||
private final String myPresentableName;
|
||||
private final String myDescription;
|
||||
|
||||
ShortenClasspath(String presentableName, String description) {
|
||||
myPresentableName = presentableName;
|
||||
myDescription = description;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
public String getPresentableName() {
|
||||
return myPresentableName;
|
||||
}
|
||||
|
||||
public static ShortenClasspath getDefaultMethod(Project project) {
|
||||
if (!JdkUtil.useDynamicClasspath(project)) return NONE;
|
||||
if (JdkUtil.useClasspathJar()) return MANIFEST;
|
||||
return CLASSPATH_FILE;
|
||||
}
|
||||
|
||||
public static ShortenClasspath readShortenClasspathMethod(@NotNull Element element) {
|
||||
Element mode = element.getChild("shortenClasspath");
|
||||
if (mode != null) {
|
||||
return valueOf(mode.getAttributeValue("name"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void writeShortenClasspathMethod(@NotNull Element element, ShortenClasspath shortenClasspath) {
|
||||
if (shortenClasspath != null) {
|
||||
element.addContent(new Element("shortenClasspath").setAttribute("name", shortenClasspath.name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
-2
@@ -17,6 +17,7 @@ package com.intellij.execution.configurations;
|
||||
|
||||
import com.intellij.execution.CantRunException;
|
||||
import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.ShortenClasspath;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.process.ProcessTerminatedListener;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -129,9 +130,18 @@ public class SimpleJavaParameters extends SimpleProgramParameters {
|
||||
return myUseClasspathJar;
|
||||
}
|
||||
|
||||
/** Allows to use a specially crafted .jar file instead of a custom class loader to pass classpath/properties/parameters. */
|
||||
/**
|
||||
* Allows to use a specially crafted .jar file instead of a custom class loader to pass classpath/properties/parameters.
|
||||
* Would have no effect if user explicitly disabled idea.dynamic.classpath.jar
|
||||
*/
|
||||
public void setUseClasspathJar(boolean useClasspathJar) {
|
||||
myUseClasspathJar = useClasspathJar;
|
||||
myUseClasspathJar = useClasspathJar && JdkUtil.useClasspathJar();
|
||||
}
|
||||
|
||||
public void setShortenClasspath(@Nullable ShortenClasspath mode, Project project) {
|
||||
if (mode == null) mode = ShortenClasspath.getDefaultMethod(project);
|
||||
myUseDynamicClasspath = mode != ShortenClasspath.NONE;
|
||||
myUseClasspathJar = mode == ShortenClasspath.MANIFEST;
|
||||
}
|
||||
|
||||
public String getJarPath() {
|
||||
|
||||
@@ -35,15 +35,12 @@ import com.intellij.openapi.vfs.encoding.EncodingManager;
|
||||
import com.intellij.util.PathUtil;
|
||||
import com.intellij.util.PathsList;
|
||||
import com.intellij.util.execution.ParametersListUtil;
|
||||
import com.intellij.util.lang.ClassPath;
|
||||
import com.intellij.util.lang.UrlClassLoader;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.IllegalCharsetNameException;
|
||||
import java.nio.charset.UnsupportedCharsetException;
|
||||
@@ -175,7 +172,7 @@ public class JdkUtil {
|
||||
dynamicMainClass = dynamicParameters;
|
||||
}
|
||||
else if (!explicitClassPath(vmParameters) && javaParameters.getJarPath() == null && (commandLineWrapper = getCommandLineWrapperClass()) != null) {
|
||||
if (canUseClasspathJar(javaParameters)) {
|
||||
if (javaParameters.isUseClasspathJar()) {
|
||||
setClasspathJarParams(commandLine, javaParameters, vmParameters, commandLineWrapper, dynamicVMOptions, dynamicParameters);
|
||||
}
|
||||
else {
|
||||
@@ -431,33 +428,6 @@ public class JdkUtil {
|
||||
throw new CantRunException("Failed to a create temporary file in " + FileUtilRt.getTempDirectory(), cause);
|
||||
}
|
||||
|
||||
private static boolean canUseClasspathJar(SimpleJavaParameters javaParameters) {
|
||||
String currentPath = PathUtil.getJarPathForClass(ClassPath.class);
|
||||
if (javaParameters.isUseClasspathJar() && useClasspathJar()) {
|
||||
try {
|
||||
final List<URL> urls = new ArrayList<>();
|
||||
for (String path : javaParameters.getClassPath().getPathList()) {
|
||||
if (!path.equals(currentPath)) {
|
||||
try {
|
||||
urls.add(new File(path).toURI().toURL());
|
||||
}
|
||||
catch (MalformedURLException ignore) {}
|
||||
}
|
||||
}
|
||||
final Class<?> aClass = Class.forName("com.intellij.util.lang.ClassPath", false, UrlClassLoader.build().urls(urls).get());
|
||||
try {
|
||||
aClass.getDeclaredMethod("initLoaders", URL.class, boolean.class, int.class);
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (Throwable ignore) {}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void appendParamsEncodingClasspath(SimpleJavaParameters javaParameters,
|
||||
GeneralCommandLine commandLine,
|
||||
ParametersList vmParameters) {
|
||||
|
||||
@@ -219,6 +219,7 @@ class.not.specified.error.message=Class not specified.
|
||||
failed.to.generate.wrapper.error.message=Failed to generate temporary html wrapper for applet class
|
||||
|
||||
application.configuration.use.classpath.and.jdk.of.module.label=Use classpath of m&odule:
|
||||
application.configuration.shorten.command.line.label=Shorten command line:
|
||||
application.configuration.main.class.label=Main &class:
|
||||
jre.path.is.not.valid.jre.home.error.message=''{0}'' is not a valid JRE home
|
||||
jre.path.is.jdk.error.message=Alternative JRE path needs to point to a JRE, not to a complete JDK installation
|
||||
|
||||
@@ -175,10 +175,6 @@ public class ClassPath {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used in com.intellij.openapi.projectRoots.JdkUtil#isClassPathJarEnabled(List, String)
|
||||
* as a condition that UrlClassLoader supports classpath jars. Please modify it accordingly.
|
||||
*/
|
||||
private void initLoaders(final URL url, boolean lastOne, int index) throws IOException {
|
||||
String path;
|
||||
|
||||
|
||||
+16
-6
@@ -3,7 +3,7 @@
|
||||
<grid id="ece1c" binding="myWholePanel" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="28" y="28" width="722" height="591"/>
|
||||
<xy x="28" y="28" width="722" height="610"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
@@ -43,7 +43,7 @@
|
||||
</hspacer>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="92997" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="92997" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="2" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -68,11 +68,15 @@
|
||||
<text resource-bundle="messages/ExecutionBundle" key="application.configuration.use.classpath.and.jdk.of.module.label"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="e5163" class="com.intellij.execution.ui.JrePathEditor" binding="myJrePathEditor">
|
||||
<component id="2fbb3" class="com.intellij.openapi.ui.LabeledComponent" binding="myShortenClasspathModeCombo" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="7" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<properties>
|
||||
<enabled value="true"/>
|
||||
<labelLocation value="West"/>
|
||||
<text resource-bundle="messages/ExecutionBundle" key="application.configuration.shorten.command.line.label"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="5d352">
|
||||
<constraints>
|
||||
@@ -83,9 +87,15 @@
|
||||
</vspacer>
|
||||
<vspacer id="3863d">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="e5163" class="com.intellij.execution.ui.JrePathEditor" binding="myJrePathEditor">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="ca987" layout-manager="GridLayoutManager" row-count="1" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
|
||||
+12
-2
@@ -19,6 +19,7 @@ package com.intellij.execution.junit2.configuration;
|
||||
import com.intellij.application.options.ModuleDescriptionsComboBox;
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
import com.intellij.execution.MethodBrowser;
|
||||
import com.intellij.execution.ShortenClasspath;
|
||||
import com.intellij.execution.configuration.BrowseModuleValueActionListener;
|
||||
import com.intellij.execution.junit.JUnitConfiguration;
|
||||
import com.intellij.execution.junit.JUnitConfigurationType;
|
||||
@@ -37,7 +38,9 @@ import com.intellij.openapi.fileTypes.PlainTextLanguage;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.*;
|
||||
import com.intellij.openapi.ui.ComponentWithBrowseButton;
|
||||
import com.intellij.openapi.ui.LabeledComponent;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.ui.ex.MessagesEx;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -49,8 +52,8 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.rt.execution.junit.RepeatCount;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.fields.ExpandableTextField;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.ui.components.fields.ExpandableTextField;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import gnu.trove.TIntArrayList;
|
||||
@@ -101,6 +104,7 @@ public class JUnitConfigurable<T extends JUnitConfiguration> extends SettingsEdi
|
||||
private JRadioButton myModuleWDScope;
|
||||
private TextFieldWithBrowseButton myPatternTextField;
|
||||
private JrePathEditor myJrePathEditor;
|
||||
private LabeledComponent<ShortenClasspathModeCombo> myShortenClasspathModeCombo;
|
||||
private JComboBox myForkCb;
|
||||
private JBLabel myTestLabel;
|
||||
private JComboBox myTypeChooser;
|
||||
@@ -264,6 +268,7 @@ public class JUnitConfigurable<T extends JUnitConfiguration> extends SettingsEdi
|
||||
setAnchor(mySearchForTestsLabel);
|
||||
myJrePathEditor.setAnchor(myModule.getLabel());
|
||||
myCommonJavaParameters.setAnchor(myModule.getLabel());
|
||||
myShortenClasspathModeCombo.setAnchor(myModule.getLabel());
|
||||
|
||||
final DefaultComboBoxModel<String> model = new DefaultComboBoxModel<>();
|
||||
myChangeListLabeledComponent.getComponent().setModel(model);
|
||||
@@ -310,6 +315,7 @@ public class JUnitConfigurable<T extends JUnitConfiguration> extends SettingsEdi
|
||||
|
||||
myCommonJavaParameters.applyTo(configuration);
|
||||
configuration.setForkMode((String)myForkCb.getSelectedItem());
|
||||
configuration.setShortenClasspath((ShortenClasspath)myShortenClasspathModeCombo.getComponent().getSelectedItem());
|
||||
}
|
||||
|
||||
public void resetEditorFrom(@NotNull final JUnitConfiguration configuration) {
|
||||
@@ -335,6 +341,7 @@ public class JUnitConfigurable<T extends JUnitConfiguration> extends SettingsEdi
|
||||
myJrePathEditor
|
||||
.setPathOrName(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled());
|
||||
myForkCb.setSelectedItem(configuration.getForkMode());
|
||||
myShortenClasspathModeCombo.getComponent().setSelectedItem(configuration.getShortenClasspath());
|
||||
}
|
||||
|
||||
private void changePanel () {
|
||||
@@ -516,6 +523,9 @@ public class JUnitConfigurable<T extends JUnitConfiguration> extends SettingsEdi
|
||||
JavaCodeFragment.VisibilityChecker.EVERYTHING_VISIBLE,
|
||||
PlainTextLanguage.INSTANCE.getAssociatedFileType());
|
||||
myMethod.setComponent(textFieldWithBrowseButton);
|
||||
|
||||
myShortenClasspathModeCombo = new LabeledComponent<>();
|
||||
myShortenClasspathModeCombo.setComponent(new ShortenClasspathModeCombo(myProject));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+14
-5
@@ -140,7 +140,7 @@
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="fab89" layout-manager="GridLayoutManager" row-count="5" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="fab89" layout-manager="GridLayoutManager" row-count="6" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<tabbedpane title="JDK Settings"/>
|
||||
@@ -158,11 +158,14 @@
|
||||
<text resource-bundle="messages/ExecutionBundle" key="application.configuration.use.classpath.and.jdk.of.module.label"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="baac2" class="com.intellij.execution.ui.JrePathEditor" binding="alternateJDK">
|
||||
<component id="86d21" class="com.intellij.openapi.ui.LabeledComponent" binding="myShortenCommandLineCombo" custom-create="true" default-binding="true">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<properties>
|
||||
<labelLocation value="West"/>
|
||||
<text resource-bundle="messages/ExecutionBundle" key="application.configuration.shorten.command.line.label"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="f5de" binding="commonParametersPanel" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
@@ -174,7 +177,7 @@
|
||||
</grid>
|
||||
<vspacer id="15fd">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<vspacer id="348fc">
|
||||
@@ -184,6 +187,12 @@
|
||||
</grid>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="baac2" class="com.intellij.execution.ui.JrePathEditor" binding="alternateJDK">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<grid id="bccab" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
|
||||
+15
-6
@@ -20,12 +20,10 @@ import com.intellij.application.options.ModulesComboBox;
|
||||
import com.intellij.execution.ExecutionBundle;
|
||||
import com.intellij.execution.JavaExecutionUtil;
|
||||
import com.intellij.execution.MethodBrowser;
|
||||
import com.intellij.execution.ShortenClasspath;
|
||||
import com.intellij.execution.configuration.BrowseModuleValueActionListener;
|
||||
import com.intellij.execution.testframework.TestSearchScope;
|
||||
import com.intellij.execution.ui.CommonJavaParametersPanel;
|
||||
import com.intellij.execution.ui.ConfigurationModuleSelector;
|
||||
import com.intellij.execution.ui.DefaultJreSelector;
|
||||
import com.intellij.execution.ui.JrePathEditor;
|
||||
import com.intellij.execution.ui.*;
|
||||
import com.intellij.ide.util.TreeClassChooser;
|
||||
import com.intellij.ide.util.TreeClassChooserFactory;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -36,16 +34,18 @@ import com.intellij.openapi.fileTypes.PlainTextLanguage;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.options.SettingsEditor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.*;
|
||||
import com.intellij.openapi.ui.ComponentWithBrowseButton;
|
||||
import com.intellij.openapi.ui.LabeledComponent;
|
||||
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.fields.ExpandableTextField;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.ui.components.JBList;
|
||||
import com.intellij.ui.components.fields.ExpandableTextField;
|
||||
import com.intellij.ui.table.TableView;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.theoryinpractice.testng.MessageInfoException;
|
||||
@@ -101,6 +101,7 @@ public class TestNGConfigurationEditor<T extends TestNGConfiguration> extends Se
|
||||
private LabeledComponent<JPanel> myPattern;
|
||||
private JPanel myPropertiesPanel;
|
||||
private JPanel myListenersPanel;
|
||||
private LabeledComponent<ShortenClasspathModeCombo> myShortenCommandLineCombo;
|
||||
TextFieldWithBrowseButton myPatternTextField;
|
||||
private final CommonJavaParametersPanel commonJavaParameters = new CommonJavaParametersPanel();
|
||||
private final ArrayList<Map.Entry<String, String>> propertiesList = new ArrayList<>();
|
||||
@@ -205,6 +206,7 @@ public class TestNGConfigurationEditor<T extends TestNGConfiguration> extends Se
|
||||
setAnchor(outputDirectory.getLabel());
|
||||
alternateJDK.setAnchor(moduleClasspath.getLabel());
|
||||
commonJavaParameters.setAnchor(moduleClasspath.getLabel());
|
||||
myShortenCommandLineCombo.setAnchor(moduleClasspath.getLabel());
|
||||
}
|
||||
|
||||
private void evaluateModuleClassPath() {
|
||||
@@ -301,6 +303,7 @@ public class TestNGConfigurationEditor<T extends TestNGConfiguration> extends Se
|
||||
|
||||
listenerModel.setListenerList(data.TEST_LISTENERS);
|
||||
myUseDefaultReportersCheckBox.setSelected(data.USE_DEFAULT_REPORTERS);
|
||||
myShortenCommandLineCombo.getComponent().setSelectedItem(config.getShortenClasspath());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -334,6 +337,7 @@ public class TestNGConfigurationEditor<T extends TestNGConfiguration> extends Se
|
||||
data.TEST_LISTENERS.addAll(listenerModel.getListenerList());
|
||||
|
||||
data.USE_DEFAULT_REPORTERS = myUseDefaultReportersCheckBox.isSelected();
|
||||
config.setShortenClasspath((ShortenClasspath)myShortenCommandLineCombo.getComponent().getSelectedItem());
|
||||
}
|
||||
|
||||
public ConfigurationModuleSelector getModuleSelector() {
|
||||
@@ -364,6 +368,11 @@ public class TestNGConfigurationEditor<T extends TestNGConfiguration> extends Se
|
||||
myTestLabel.setAnchor(anchor);
|
||||
}
|
||||
|
||||
private void createUIComponents() {
|
||||
myShortenCommandLineCombo = new LabeledComponent<>();
|
||||
myShortenCommandLineCombo.setComponent(new ShortenClasspathModeCombo(project));
|
||||
}
|
||||
|
||||
private static void registerListener(JRadioButton[] buttons, ChangeListener changelistener) {
|
||||
ButtonGroup buttongroup = new ButtonGroup();
|
||||
for (JRadioButton button : buttons) {
|
||||
|
||||
Reference in New Issue
Block a user