diff --git a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java index 2b1f8d0633d8..1097996744ff 100644 --- a/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/deadCode/UnusedDeclarationInspection.java @@ -126,8 +126,18 @@ public class UnusedDeclarationInspection extends UnusedDeclarationInspectionBase }); gc.gridy++; - gc.weighty = 1; add(myNonJavaCheckbox, gc); + + final JButton configureClassPatternsButton = EntryPointsManagerImpl.createConfigureClassPatternsButton(); + gc.fill = GridBagConstraints.NONE; + gc.gridy++; + add(configureClassPatternsButton, gc); + + JButton configureAnnotations = EntryPointsManagerImpl.createConfigureAnnotationsButton(); + gc.gridy++; + gc.weighty = 1; + + add(configureAnnotations, gc); } } diff --git a/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsConfigurable.java b/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsConfigurable.java deleted file mode 100644 index 65ad3a9c7357..000000000000 --- a/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsConfigurable.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2000-2016 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.codeInspection.ex; - -import com.intellij.codeInspection.util.SpecialAnnotationsUtil; -import com.intellij.openapi.options.ConfigurationException; -import com.intellij.openapi.options.SearchableConfigurable; -import com.intellij.openapi.project.Project; -import com.intellij.util.ui.JBUI; -import org.jetbrains.annotations.Nls; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -public class EntryPointsConfigurable implements SearchableConfigurable { - private final List myAnnotations; - private final List myModifiedPatterns; - private final EntryPointsManagerBase myEntryPointsManager; - - public EntryPointsConfigurable(Project project) { - final EntryPointsManagerBase entryPointsManager = (EntryPointsManagerBase)EntryPointsManager.getInstance(project); - myAnnotations = new ArrayList<>(entryPointsManager.ADDITIONAL_ANNOTATIONS); - myModifiedPatterns = new ArrayList<>(entryPointsManager.getPatterns()); - myEntryPointsManager = entryPointsManager; - } - - @NotNull - @Override - public String getId() { - return "EntryPoints"; - } - - @Nullable - @Override - public JComponent createComponent() { - final JPanel wholePanel = new JPanel(new GridBagLayout()); - final GridBagConstraints gc = - new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0.5, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0); - wholePanel.add(SpecialAnnotationsUtil.createSpecialAnnotationsListControl(myAnnotations, "Mark as entry point if annotated by", true), gc); - wholePanel.add(new ClassPatternsPanel(myModifiedPatterns), gc); - return wholePanel; - } - - @Override - public void apply() throws ConfigurationException { - myEntryPointsManager.ADDITIONAL_ANNOTATIONS.clear(); - myEntryPointsManager.ADDITIONAL_ANNOTATIONS.addAll(myAnnotations); - - myEntryPointsManager.getPatterns().clear(); - myEntryPointsManager.getPatterns().addAll(myModifiedPatterns); - } - - @Override - public void reset() { - myAnnotations.clear(); - myAnnotations.addAll(myEntryPointsManager.ADDITIONAL_ANNOTATIONS); - - myModifiedPatterns.clear(); - myModifiedPatterns.addAll(myEntryPointsManager.getPatterns()); - } - - @Override - public boolean isModified() { - return !myAnnotations.equals(myEntryPointsManager.ADDITIONAL_ANNOTATIONS) || - !myModifiedPatterns.equals(myEntryPointsManager.getPatterns()); - } - - @Nls - @Override - public String getDisplayName() { - return "Project Entry Points"; - } - - @Nullable - @Override - public String getHelpTopic() { - return getId(); - } -} diff --git a/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java b/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java index 8f4d56e9512d..88c877e20f33 100644 --- a/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java +++ b/java/java-impl/src/com/intellij/codeInspection/ex/EntryPointsManagerImpl.java @@ -32,6 +32,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectUtil; import com.intellij.openapi.ui.DialogWrapper; import org.jdom.Element; +import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.awt.event.ActionEvent; @@ -48,7 +49,7 @@ public class EntryPointsManagerImpl extends EntryPointsManagerBase implements Pe @Override public void configureAnnotations() { final List list = new ArrayList<>(ADDITIONAL_ANNOTATIONS); - final JPanel listPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(list, "Do not check if annotated by", true); + final JPanel listPanel = SpecialAnnotationsUtil.createSpecialAnnotationsListControl(list, "Mark as entry point if annotated by", true); new DialogWrapper(myProject) { { init(); @@ -85,4 +86,37 @@ public class EntryPointsManagerImpl extends EntryPointsManagerBase implements Pe }); return configureAnnotations; } + + public static JButton createConfigureClassPatternsButton() { + final JButton configureAnnotations = new JButton("Configure class patterns..."); + configureAnnotations.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + final EntryPointsManagerBase entryPointsManagerBase = getInstance(ProjectUtil.guessCurrentProject(configureAnnotations)); + final ArrayList list = new ArrayList<>(entryPointsManagerBase.getPatterns()); + new DialogWrapper(entryPointsManagerBase.myProject) { + + { + init(); + setTitle("Configure Class Patterns"); + } + + @Nullable + @Override + protected JComponent createCenterPanel() { + return new ClassPatternsPanel(list); + } + + @Override + protected void doOKAction() { + final List patterns = entryPointsManagerBase.getPatterns(); + patterns.clear(); + patterns.addAll(list); + super.doOKAction(); + } + }.show(); + } + }); + return configureAnnotations; + } } \ No newline at end of file diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml index c377e0b1aac9..76d68f5c2067 100644 --- a/resources/src/META-INF/IdeaPlugin.xml +++ b/resources/src/META-INF/IdeaPlugin.xml @@ -547,9 +547,6 @@ - - diff --git a/resources/src/idea/RichPlatformPlugin.xml b/resources/src/idea/RichPlatformPlugin.xml index b5bc9821a0f5..da0f45e4e70e 100644 --- a/resources/src/idea/RichPlatformPlugin.xml +++ b/resources/src/idea/RichPlatformPlugin.xml @@ -226,7 +226,7 @@ - +