mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
unused declaration: move entry points configurable back to inspection
This commit is contained in:
+11
-1
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<String> myAnnotations;
|
||||
private final List<EntryPointsManagerBase.ClassPattern> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<String> 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<ClassPattern> 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<ClassPattern> patterns = entryPointsManagerBase.getPatterns();
|
||||
patterns.clear();
|
||||
patterns.addAll(list);
|
||||
super.doOKAction();
|
||||
}
|
||||
}.show();
|
||||
}
|
||||
});
|
||||
return configureAnnotations;
|
||||
}
|
||||
}
|
||||
@@ -547,9 +547,6 @@
|
||||
|
||||
<projectService serviceInterface="com.intellij.codeInspection.ex.EntryPointsManager"
|
||||
serviceImplementation="com.intellij.codeInspection.ex.EntryPointsManagerImpl"/>
|
||||
<projectConfigurable id="EntryPoints" displayName="Project Entry Points"
|
||||
parentId="Errors" instance = "com.intellij.codeInspection.ex.EntryPointsConfigurable"/>
|
||||
|
||||
|
||||
<projectService serviceInterface="com.intellij.codeInsight.NullableNotNullManager"
|
||||
serviceImplementation="com.intellij.codeInsight.NullableNotNullManagerImpl"/>
|
||||
|
||||
@@ -226,7 +226,7 @@
|
||||
|
||||
<!-- Errors -->
|
||||
<!-- Show full error options configurable only in full IDEA - platform supports only default IDE profile for now -->
|
||||
<projectConfigurable dynamic="true" groupId="editor" groupWeight="160" displayName="Inspections" id="Errors" instance="com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurable"/>
|
||||
<projectConfigurable groupId="editor" groupWeight="160" displayName="Inspections" id="Errors" instance="com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurable"/>
|
||||
|
||||
<!-- Compiler -->
|
||||
<projectConfigurable groupId="build" groupWeight="130" instance="com.intellij.compiler.options.CompilerConfigurable" id="project.propCompiler" order="after project"
|
||||
|
||||
Reference in New Issue
Block a user