diff --git a/java/execution/impl/src/com/intellij/execution/JavaTestConfigurationBase.java b/java/execution/impl/src/com/intellij/execution/JavaTestConfigurationBase.java index 1a833b42daff..1933c0d06d4e 100644 --- a/java/execution/impl/src/com/intellij/execution/JavaTestConfigurationBase.java +++ b/java/execution/impl/src/com/intellij/execution/JavaTestConfigurationBase.java @@ -33,8 +33,8 @@ import org.jetbrains.annotations.Nullable; import java.util.List; public abstract class JavaTestConfigurationBase extends ModuleBasedConfiguration - implements CommonJavaRunConfigurationParameters, ConfigurationWithClasspathShortener, RefactoringListenerProvider, SMRunnerConsolePropertiesProvider { - private ShortenClasspath myShortenClasspath = null; + implements CommonJavaRunConfigurationParameters, ConfigurationWithCommandLineShortener, RefactoringListenerProvider, SMRunnerConsolePropertiesProvider { + private ShortenCommandLine myShortenCommandLine = null; public JavaTestConfigurationBase(String name, @NotNull JavaRunConfigurationModule configurationModule, @@ -66,24 +66,24 @@ public abstract class JavaTestConfigurationBase extends ModuleBasedConfiguration @Nullable @Override - public ShortenClasspath getShortenClasspath() { - return myShortenClasspath; + public ShortenCommandLine getShortenCommandLine() { + return myShortenCommandLine; } @Override - public void setShortenClasspath(ShortenClasspath shortenClasspath) { - myShortenClasspath = shortenClasspath; + public void setShortenCommandLine(ShortenCommandLine shortenCommandLine) { + myShortenCommandLine = shortenCommandLine; } @Override public void readExternal(Element element) throws InvalidDataException { super.readExternal(element); - setShortenClasspath(ShortenClasspath.readShortenClasspathMethod(element)); + setShortenCommandLine(ShortenCommandLine.readShortenClasspathMethod(element)); } @Override public void writeExternal(Element element) throws WriteExternalException { super.writeExternal(element); - ShortenClasspath.writeShortenClasspathMethod(element, myShortenClasspath); + ShortenCommandLine.writeShortenClasspathMethod(element, myShortenCommandLine); } } diff --git a/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java b/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java index 3c0538d462d3..ebeb4b2eef6e 100644 --- a/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java +++ b/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java @@ -74,7 +74,7 @@ import java.util.Map; public abstract class JavaTestFrameworkRunnableState & CommonJavaRunConfigurationParameters - & ConfigurationWithClasspathShortener + & ConfigurationWithCommandLineShortener & SMRunnerConsolePropertiesProvider> extends JavaCommandLineState implements RemoteConnectionCreator { private static final Logger LOG = Logger.getInstance(JavaTestFrameworkRunnableState.class); protected ServerSocket myServerSocket; @@ -196,7 +196,7 @@ public abstract class JavaTestFrameworkRunnableState myMainClass; private LabeledComponent myModule; - private LabeledComponent myShortenClasspathModeCombo; + private LabeledComponent myShortenClasspathModeCombo; private JPanel myWholePanel; private final ConfigurationModuleSelector myModuleSelector; @@ -67,7 +67,7 @@ public class ApplicationConfigurable extends SettingsEditor - implements CommonJavaRunConfigurationParameters, ConfigurationWithClasspathShortener, SingleClassConfiguration, RefactoringListenerProvider { + implements CommonJavaRunConfigurationParameters, ConfigurationWithCommandLineShortener, SingleClassConfiguration, RefactoringListenerProvider { public String MAIN_CLASS_NAME; public String VM_PARAMETERS; @@ -61,7 +61,7 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration myEnvs = new LinkedHashMap<>(); @@ -245,7 +245,7 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration extends BaseJavaApplicationCommandLineState { @@ -284,7 +284,7 @@ public class ApplicationConfiguration extends ModuleBasedConfiguration { +public class ShortenCommandLineModeCombo extends ComboBox { private final Project myProject; - public ShortenClasspathModeCombo(Project project, JrePathEditor pathEditor) { + public ShortenCommandLineModeCombo(Project project, JrePathEditor pathEditor) { myProject = project; initModel(null, pathEditor); - setRenderer(new ColoredListCellRenderer() { + setRenderer(new ColoredListCellRenderer() { @Override - protected void customizeCellRenderer(@NotNull JList list, - ShortenClasspath value, + protected void customizeCellRenderer(@NotNull JList list, + ShortenCommandLine value, int index, boolean selected, boolean hasFocus) { if (value == null) { - ShortenClasspath defaultMode = ShortenClasspath.getDefaultMethod(myProject, getJdkRoot(pathEditor)); + ShortenCommandLine defaultMode = ShortenCommandLine.getDefaultMethod(myProject, getJdkRoot(pathEditor)); append("user-local default: " + defaultMode.getPresentableName()).append(" - " + defaultMode.getDescription(), SimpleTextAttributes.GRAYED_ATTRIBUTES); } else { @@ -37,16 +37,16 @@ public class ShortenClasspathModeCombo extends ComboBox { }); pathEditor.addActionListener(e -> { Object item = getSelectedItem(); - initModel((ShortenClasspath)item, pathEditor); + initModel((ShortenCommandLine)item, pathEditor); }); } - private void initModel(ShortenClasspath preselection, JrePathEditor pathEditor) { + private void initModel(ShortenCommandLine preselection, JrePathEditor pathEditor) { removeAllItems(); String jdkRoot = getJdkRoot(pathEditor); addItem(null); - for (ShortenClasspath mode : ShortenClasspath.values()) { + for (ShortenCommandLine mode : ShortenCommandLine.values()) { if (mode.isApplicable(jdkRoot)) { addItem(mode); } @@ -57,17 +57,16 @@ public class ShortenClasspathModeCombo extends ComboBox { @Nullable private static String getJdkRoot(JrePathEditor pathEditor) { - String rootPath = null; String jrePathOrName = pathEditor.getJrePathOrName(); if (jrePathOrName != null) { Sdk configuredJdk = ProjectJdkTable.getInstance().findJdk(jrePathOrName); if (configuredJdk != null) { - rootPath = configuredJdk.getHomePath(); + return configuredJdk.getHomePath(); } else { - rootPath = jrePathOrName; + return jrePathOrName; } } - return rootPath; + return null; } } diff --git a/platform/lang-api/src/com/intellij/execution/ShortenClasspath.java b/platform/lang-api/src/com/intellij/execution/ShortenCommandLine.java similarity index 85% rename from platform/lang-api/src/com/intellij/execution/ShortenClasspath.java rename to platform/lang-api/src/com/intellij/execution/ShortenCommandLine.java index 3a923fcc612f..ee8c259ac72c 100644 --- a/platform/lang-api/src/com/intellij/execution/ShortenClasspath.java +++ b/platform/lang-api/src/com/intellij/execution/ShortenCommandLine.java @@ -23,7 +23,7 @@ import org.jetbrains.annotations.NotNull; * * 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 { +public enum ShortenCommandLine { NONE("none", "java [options] classname [args]"), MANIFEST("JAR manifest", "java -cp classpath.jar classname [args]"), CLASSPATH_FILE("classpath file", "java WrapperClass classpathFile [args]"), @@ -37,7 +37,7 @@ public enum ShortenClasspath { private final String myPresentableName; private final String myDescription; - ShortenClasspath(String presentableName, String description) { + ShortenCommandLine(String presentableName, String description) { myPresentableName = presentableName; myDescription = description; } @@ -54,14 +54,14 @@ public enum ShortenClasspath { return myPresentableName; } - public static ShortenClasspath getDefaultMethod(Project project, String rootPath) { + public static ShortenCommandLine getDefaultMethod(Project project, String rootPath) { if (!JdkUtil.useDynamicClasspath(project)) return NONE; if (rootPath != null && JdkUtil.isModularRuntime(rootPath)) return ARGS_FILE; if (JdkUtil.useClasspathJar()) return MANIFEST; return CLASSPATH_FILE; } - public static ShortenClasspath readShortenClasspathMethod(@NotNull Element element) { + public static ShortenCommandLine readShortenClasspathMethod(@NotNull Element element) { Element mode = element.getChild("shortenClasspath"); if (mode != null) { return valueOf(mode.getAttributeValue("name")); @@ -69,9 +69,9 @@ public enum ShortenClasspath { return null; } - public static void writeShortenClasspathMethod(@NotNull Element element, ShortenClasspath shortenClasspath) { - if (shortenClasspath != null) { - element.addContent(new Element("shortenClasspath").setAttribute("name", shortenClasspath.name())); + public static void writeShortenClasspathMethod(@NotNull Element element, ShortenCommandLine shortenCommandLine) { + if (shortenCommandLine != null) { + element.addContent(new Element("shortenClasspath").setAttribute("name", shortenCommandLine.name())); } } } diff --git a/platform/lang-api/src/com/intellij/execution/configurations/SimpleJavaParameters.java b/platform/lang-api/src/com/intellij/execution/configurations/SimpleJavaParameters.java index 0ba5cf35c911..90b06f672b78 100644 --- a/platform/lang-api/src/com/intellij/execution/configurations/SimpleJavaParameters.java +++ b/platform/lang-api/src/com/intellij/execution/configurations/SimpleJavaParameters.java @@ -17,7 +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.ShortenCommandLine; import com.intellij.execution.process.OSProcessHandler; import com.intellij.execution.process.ProcessTerminatedListener; import com.intellij.openapi.diagnostic.Logger; @@ -150,14 +150,14 @@ public class SimpleJavaParameters extends SimpleProgramParameters { myUseClasspathJar = useClasspathJar && JdkUtil.useClasspathJar(); } - public void setShortenClasspath(@Nullable ShortenClasspath mode, Project project) { + public void setShortenCommandLine(@Nullable ShortenCommandLine mode, Project project) { if (mode == null) { Sdk jdk = getJdk(); - mode = ShortenClasspath.getDefaultMethod(project, jdk != null ? jdk.getHomePath() : null); + mode = ShortenCommandLine.getDefaultMethod(project, jdk != null ? jdk.getHomePath() : null); } - myUseDynamicClasspath = mode != ShortenClasspath.NONE; - myUseClasspathJar = mode == ShortenClasspath.MANIFEST; - setArgFile(mode == ShortenClasspath.ARGS_FILE); + myUseDynamicClasspath = mode != ShortenCommandLine.NONE; + myUseClasspathJar = mode == ShortenCommandLine.MANIFEST; + setArgFile(mode == ShortenCommandLine.ARGS_FILE); } public String getJarPath() { diff --git a/platform/lang-impl/src/com/intellij/execution/ConfigurationWithClasspathShortener.java b/platform/lang-impl/src/com/intellij/execution/ConfigurationWithCommandLineShortener.java similarity index 77% rename from platform/lang-impl/src/com/intellij/execution/ConfigurationWithClasspathShortener.java rename to platform/lang-impl/src/com/intellij/execution/ConfigurationWithCommandLineShortener.java index 1188a70b614e..9055106d22f5 100644 --- a/platform/lang-impl/src/com/intellij/execution/ConfigurationWithClasspathShortener.java +++ b/platform/lang-impl/src/com/intellij/execution/ConfigurationWithCommandLineShortener.java @@ -4,17 +4,17 @@ package com.intellij.execution; import com.intellij.openapi.project.Project; import org.jetbrains.annotations.Nullable; -public interface ConfigurationWithClasspathShortener { +public interface ConfigurationWithCommandLineShortener { /** * @return null if option was not selected explicitly, legacy user-local options to be used */ @Nullable - ShortenClasspath getShortenClasspath(); + ShortenCommandLine getShortenCommandLine(); /** * Called from UI, when user explicitly selects method to be used to shorten the command line or from the deserialization */ - void setShortenClasspath(ShortenClasspath mode); + void setShortenCommandLine(ShortenCommandLine mode); Project getProject(); } diff --git a/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java b/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java index 2cef052cd272..7396a435421c 100644 --- a/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java +++ b/platform/lang-impl/src/com/intellij/execution/ProgramRunnerUtil.java @@ -117,7 +117,7 @@ public class ProgramRunnerUtil { } String windowId = ExecutionManager.getInstance(project).getContentManager().getToolWindowIdByEnvironment(environment); RunConfiguration configuration = runnerAndConfigurationSettings != null ? runnerAndConfigurationSettings.getConfiguration() : null; - if (configuration instanceof ConfigurationWithClasspathShortener && ExecutionUtil.isProcessNotCreated(e)) { + if (configuration instanceof ConfigurationWithCommandLineShortener && ExecutionUtil.isProcessNotCreated(e)) { handelProcessNotStartedError(runnerAndConfigurationSettings, e, name, windowId); } else { @@ -134,14 +134,14 @@ public class ProgramRunnerUtil { String windowId) { String description = e.getMessage(); HyperlinkListener listener = null; - ConfigurationWithClasspathShortener configuration = (ConfigurationWithClasspathShortener)runnerAndConfigurationSettings.getConfiguration(); + ConfigurationWithCommandLineShortener configuration = (ConfigurationWithCommandLineShortener)runnerAndConfigurationSettings.getConfiguration(); Project project = configuration.getProject(); - if (configuration.getShortenClasspath() == null) { + if (configuration.getShortenCommandLine() == null) { ConfigurationFactory factory = runnerAndConfigurationSettings.getFactory(); RunnerAndConfigurationSettings configurationTemplate = RunManager.getInstance(project) .getConfigurationTemplate(factory); description = "Command line is too long. Shorten command line for " + name + ""; - if (((ConfigurationWithClasspathShortener)configurationTemplate.getConfiguration()).getShortenClasspath() == null) { + if (((ConfigurationWithCommandLineShortener)configurationTemplate.getConfiguration()).getShortenCommandLine() == null) { description += " or also for " + factory.getName() + " default configuration"; } description += "."; @@ -152,8 +152,8 @@ public class ProgramRunnerUtil { SingleConfigurableEditor dialog = RunDialog.editShortenClasspathSetting(isDefaultConfigurationChosen ? configurationTemplate : runnerAndConfigurationSettings, "Edit" + (isDefaultConfigurationChosen ? " Default" : "") + " Configuration"); if (dialog.showAndGet() && isDefaultConfigurationChosen) { - ((ConfigurationWithClasspathShortener)runnerAndConfigurationSettings.getConfiguration()) - .setShortenClasspath(((ConfigurationWithClasspathShortener)configurationTemplate.getConfiguration()).getShortenClasspath()); + ((ConfigurationWithCommandLineShortener)runnerAndConfigurationSettings.getConfiguration()) + .setShortenCommandLine(((ConfigurationWithCommandLineShortener)configurationTemplate.getConfiguration()).getShortenCommandLine()); } } }; diff --git a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java index 132969475d28..03c9c53a86ae 100644 --- a/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java +++ b/plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitConfigurable.java @@ -19,7 +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.ShortenCommandLine; import com.intellij.execution.configuration.BrowseModuleValueActionListener; import com.intellij.execution.junit.JUnitConfiguration; import com.intellij.execution.junit.JUnitConfigurationType; @@ -104,7 +104,7 @@ public class JUnitConfigurable extends SettingsEdi private JRadioButton myModuleWDScope; private TextFieldWithBrowseButton myPatternTextField; private JrePathEditor myJrePathEditor; - private LabeledComponent myShortenClasspathModeCombo; + private LabeledComponent myShortenClasspathModeCombo; private JComboBox myForkCb; private JBLabel myTestLabel; private JComboBox myTypeChooser; @@ -279,7 +279,7 @@ public class JUnitConfigurable extends SettingsEdi model.addElement(changeList.getName()); } - myShortenClasspathModeCombo.setComponent(new ShortenClasspathModeCombo(myProject, myJrePathEditor)); + myShortenClasspathModeCombo.setComponent(new ShortenCommandLineModeCombo(myProject, myJrePathEditor)); } private static void addRadioButtonsListeners(final JRadioButton[] radioButtons, ChangeListener listener) { @@ -317,7 +317,7 @@ public class JUnitConfigurable extends SettingsEdi myCommonJavaParameters.applyTo(configuration); configuration.setForkMode((String)myForkCb.getSelectedItem()); - configuration.setShortenClasspath((ShortenClasspath)myShortenClasspathModeCombo.getComponent().getSelectedItem()); + configuration.setShortenCommandLine((ShortenCommandLine)myShortenClasspathModeCombo.getComponent().getSelectedItem()); } public void resetEditorFrom(@NotNull final JUnitConfiguration configuration) { @@ -343,7 +343,7 @@ public class JUnitConfigurable extends SettingsEdi myJrePathEditor .setPathOrName(configuration.getAlternativeJrePath(), configuration.isAlternativeJrePathEnabled()); myForkCb.setSelectedItem(configuration.getForkMode()); - myShortenClasspathModeCombo.getComponent().setSelectedItem(configuration.getShortenClasspath()); + myShortenClasspathModeCombo.getComponent().setSelectedItem(configuration.getShortenCommandLine()); } private void changePanel () { diff --git a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationEditor.java b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationEditor.java index a716ede4c522..bf888824e9cb 100644 --- a/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationEditor.java +++ b/plugins/testng/src/com/theoryinpractice/testng/configuration/TestNGConfigurationEditor.java @@ -20,7 +20,7 @@ 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.ShortenCommandLine; import com.intellij.execution.configuration.BrowseModuleValueActionListener; import com.intellij.execution.testframework.TestSearchScope; import com.intellij.execution.ui.*; @@ -101,7 +101,7 @@ public class TestNGConfigurationEditor extends Se private LabeledComponent myPattern; private JPanel myPropertiesPanel; private JPanel myListenersPanel; - private LabeledComponent myShortenCommandLineCombo; + private LabeledComponent myShortenCommandLineCombo; TextFieldWithBrowseButton myPatternTextField; private final CommonJavaParametersPanel commonJavaParameters = new CommonJavaParametersPanel(); private final ArrayList> propertiesList = new ArrayList<>(); @@ -203,7 +203,7 @@ public class TestNGConfigurationEditor extends Se commonJavaParameters.setProgramParametersLabel(ExecutionBundle.message("junit.configuration.test.runner.parameters.label")); - myShortenCommandLineCombo.setComponent(new ShortenClasspathModeCombo(project, alternateJDK)); + myShortenCommandLineCombo.setComponent(new ShortenCommandLineModeCombo(project, alternateJDK)); setAnchor(outputDirectory.getLabel()); alternateJDK.setAnchor(moduleClasspath.getLabel()); commonJavaParameters.setAnchor(moduleClasspath.getLabel()); @@ -304,7 +304,7 @@ public class TestNGConfigurationEditor extends Se listenerModel.setListenerList(data.TEST_LISTENERS); myUseDefaultReportersCheckBox.setSelected(data.USE_DEFAULT_REPORTERS); - myShortenCommandLineCombo.getComponent().setSelectedItem(config.getShortenClasspath()); + myShortenCommandLineCombo.getComponent().setSelectedItem(config.getShortenCommandLine()); } @Override @@ -338,7 +338,7 @@ public class TestNGConfigurationEditor extends Se data.TEST_LISTENERS.addAll(listenerModel.getListenerList()); data.USE_DEFAULT_REPORTERS = myUseDefaultReportersCheckBox.isSelected(); - config.setShortenClasspath((ShortenClasspath)myShortenCommandLineCombo.getComponent().getSelectedItem()); + config.setShortenCommandLine((ShortenCommandLine)myShortenCommandLineCombo.getComponent().getSelectedItem()); } public ConfigurationModuleSelector getModuleSelector() {