mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-256792 New run configuration show red error for Main class comes from libraries (when enabling "Include non-project items")
GitOrigin-RevId: e2157ceba45e5e3fc4c461a19629329f71fead3f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7acaa814c1
commit
72632db3df
+10
-4
@@ -104,17 +104,23 @@ public class ApplicationConfigurable extends SettingsEditor<ApplicationConfigura
|
||||
|
||||
private void createUIComponents() {
|
||||
myMainClass = new LabeledComponent<>();
|
||||
myMainClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, (declaration, place) -> {
|
||||
JavaCodeFragment.VisibilityChecker visibilityChecker = getVisibilityChecker(myModuleSelector);
|
||||
myMainClass.setComponent(new EditorTextFieldWithBrowseButton(myProject, true, visibilityChecker));
|
||||
myShortenClasspathModeCombo = new LabeledComponent<>();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static JavaCodeFragment.VisibilityChecker getVisibilityChecker(ConfigurationModuleSelector selector) {
|
||||
return (declaration, place) -> {
|
||||
if (declaration instanceof PsiClass) {
|
||||
PsiClass aClass = (PsiClass)declaration;
|
||||
if (ConfigurationUtil.MAIN_CLASS.value(aClass) && PsiMethodUtil.findMainMethod(aClass) != null ||
|
||||
place.getParent() != null && myModuleSelector.findClass(((PsiClass)declaration).getQualifiedName()) != null) {
|
||||
place.getParent() != null && selector.findClass(((PsiClass)declaration).getQualifiedName()) != null) {
|
||||
return JavaCodeFragment.VisibilityChecker.Visibility.VISIBLE;
|
||||
}
|
||||
}
|
||||
return JavaCodeFragment.VisibilityChecker.Visibility.NOT_VISIBLE;
|
||||
}));
|
||||
myShortenClasspathModeCombo = new LabeledComponent<>();
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -41,8 +41,9 @@ public final class JavaApplicationSettingsEditor extends JavaSettingsEditorBase<
|
||||
|
||||
@NotNull
|
||||
private SettingsEditorFragment<ApplicationConfiguration, EditorTextField> createMainClass(ModuleClasspathCombo classpathCombo) {
|
||||
ConfigurationModuleSelector moduleSelector = new ConfigurationModuleSelector(getProject(), classpathCombo);
|
||||
EditorTextField mainClass = ClassEditorField.createClassField(getProject(), () -> classpathCombo.getSelectedModule(),
|
||||
JavaCodeFragment.VisibilityChecker.PROJECT_SCOPE_VISIBLE, null);
|
||||
ApplicationConfigurable.getVisibilityChecker(moduleSelector), null);
|
||||
mainClass.setBackground(UIUtil.getTextFieldBackground());
|
||||
mainClass.setShowPlaceholderWhenFocused(true);
|
||||
CommonParameterFragments.setMonospaced(mainClass);
|
||||
|
||||
Reference in New Issue
Block a user