IDEA-256633 Option to run application with 'provided' scope dependencies is hard...
authorDmitry Avdeev <dmitry.avdeev@jetbrains.com>
Wed, 9 Dec 2020 11:55:27 +0000 (14:55 +0300)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Wed, 9 Dec 2020 12:08:08 +0000 (12:08 +0000)
GitOrigin-RevId: 1ff4b22cb83cdf1f75cb5c659fb8f3fb5c399315

java/execution/impl/src/com/intellij/execution/application/JavaApplicationSettingsEditor.java
java/execution/impl/src/com/intellij/execution/application/JavaSettingsEditorBase.java
plugins/junit/src/com/intellij/execution/junit2/configuration/JUnitSettingsEditor.java

index 2383cdea506c2f25486af93b08acbbe735ab0a9f..2a9c664b79844e277bd551378faf9fd2eb51a2d3 100644 (file)
@@ -23,6 +23,11 @@ public final class JavaApplicationSettingsEditor extends JavaSettingsEditorBase<
   protected void customizeFragments(List<SettingsEditorFragment<ApplicationConfiguration, ?>> fragments,
                                     ModuleClasspathCombo classpathCombo,
                                     CommonParameterFragments<ApplicationConfiguration> commonParameterFragments) {
+    fragments.add(SettingsEditorFragment.createTag("include.provided",
+                                                   ExecutionBundle.message("application.configuration.include.provided.scope"),
+                                                   ExecutionBundle.message("group.java.options"),
+                                     configuration -> configuration.getOptions().isIncludeProvidedScope(),
+                                     (configuration, value) -> configuration.getOptions().setIncludeProvidedScope(value)));
     fragments.add(commonParameterFragments.programArguments());
     fragments.add(new TargetPathFragment<>());
     fragments.add(commonParameterFragments.createRedirectFragment());
@@ -34,14 +39,6 @@ public final class JavaApplicationSettingsEditor extends JavaSettingsEditorBase<
     fragments.add(createShortenClasspath(classpathCombo, jrePath, true));
   }
 
-  @Override
-  @NotNull
-  protected SettingsEditorFragment<ApplicationConfiguration, ModuleClasspathCombo> createClasspathCombo() {
-    ModuleClasspathCombo.Item item = new ModuleClasspathCombo.Item(ExecutionBundle.message("application.configuration.include.provided.scope"));
-    return CommonJavaFragments.moduleClasspath(item, configuration -> configuration.getOptions().isIncludeProvidedScope(),
-                                               (configuration, value) -> configuration.getOptions().setIncludeProvidedScope(value));
-  }
-
   @NotNull
   private SettingsEditorFragment<ApplicationConfiguration, EditorTextField> createMainClass(ModuleClasspathCombo classpathCombo) {
     EditorTextField mainClass = ClassEditorField.createClassField(getProject(), () -> classpathCombo.getSelectedModule(),
index 85be85f4aac41290d774457a61f7e91c519e412c..c5dd536497917be3ed07118f7f08a34652ec1e35 100644 (file)
@@ -33,7 +33,7 @@ public abstract class JavaSettingsEditorBase<T extends JavaRunConfigurationBase>
     fragments.add(BeforeRunFragment.createBeforeRun(beforeRunComponent, CompileStepBeforeRun.ID));
     fragments.addAll(BeforeRunFragment.createGroup());
 
-    SettingsEditorFragment<T, ModuleClasspathCombo> moduleClasspath = createClasspathCombo();
+    SettingsEditorFragment<T, ModuleClasspathCombo> moduleClasspath = CommonJavaFragments.moduleClasspath(null, null, null);
     ModuleClasspathCombo classpathCombo = moduleClasspath.component();
     Computable<Boolean> hasModule = () -> classpathCombo.getSelectedModule() != null;
 
@@ -69,9 +69,6 @@ public abstract class JavaSettingsEditorBase<T extends JavaRunConfigurationBase>
     return fragments;
   }
 
-  @NotNull
-  protected abstract SettingsEditorFragment<T, ModuleClasspathCombo> createClasspathCombo();
-
   @NotNull
   protected SettingsEditorFragment<T, LabeledComponent<ShortenCommandLineModeCombo>> createShortenClasspath(ModuleClasspathCombo classpathCombo,
                                                                                                             SettingsEditorFragment<T, JrePathEditor> jrePath,
index bdcc2bcdf370c831df586fd214b9aa0be73bc196..d1a155a895528d4df2b213627196dd5d51107e37 100644 (file)
@@ -13,7 +13,6 @@ import com.intellij.psi.PsiJavaModule;
 import com.intellij.psi.search.FilenameIndex;
 import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.rt.execution.junit.RepeatCount;
-import org.jetbrains.annotations.NotNull;
 
 import javax.swing.*;
 import java.awt.*;
@@ -28,11 +27,6 @@ public class JUnitSettingsEditor extends JavaSettingsEditorBase<JUnitConfigurati
     super(runConfiguration);
   }
 
-  @Override
-  protected @NotNull SettingsEditorFragment<JUnitConfiguration, ModuleClasspathCombo> createClasspathCombo() {
-    return CommonJavaFragments.moduleClasspath(null, null, null);
-  }
-
   @Override
   protected void customizeFragments(List<SettingsEditorFragment<JUnitConfiguration, ?>> fragments,
                                     ModuleClasspathCombo classpathCombo,