mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
inspections ui: in scopes table used getScopeName() instead getScope().getName() + unused fields deleted
This commit is contained in:
+1
-5
@@ -16,7 +16,6 @@
|
||||
|
||||
package com.intellij.profile.codeInspection.ui;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.codeHighlighting.HighlightDisplayLevel;
|
||||
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
|
||||
@@ -62,7 +61,6 @@ import com.intellij.profile.codeInspection.ui.table.ScopesAndSeveritiesTable;
|
||||
import com.intellij.psi.search.scope.packageSet.NamedScope;
|
||||
import com.intellij.ui.*;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
import com.intellij.ui.treeStructure.Tree;
|
||||
import com.intellij.util.Alarm;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.config.StorageAccessors;
|
||||
@@ -85,8 +83,6 @@ import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreeNode;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.awt.*;
|
||||
import java.awt.event.InputEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.*;
|
||||
@@ -811,7 +807,7 @@ public class SingleInspectionProfilePanel extends JPanel {
|
||||
}
|
||||
}
|
||||
final JTable scopesAndScopesAndSeveritiesTable =
|
||||
new ScopesAndSeveritiesTable(new ScopesAndSeveritiesTable.TableSettings(nodes, mySelectedProfile, myTreeTable, project) {
|
||||
new ScopesAndSeveritiesTable(new ScopesAndSeveritiesTable.TableSettings(nodes, mySelectedProfile, project) {
|
||||
@Override
|
||||
protected void onScopeChosen(@NotNull final ScopeToolState state) {
|
||||
setConfigPanel(configPanelAnchor, state);
|
||||
|
||||
+7
-15
@@ -114,12 +114,10 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
private final List<String> myKeyNames;
|
||||
private final List<HighlightDisplayKey> myKeys;
|
||||
private final InspectionProfileImpl myInspectionProfile;
|
||||
private final TreeTable myTreeTable;
|
||||
private final Project myProject;
|
||||
|
||||
protected TableSettings(final List<InspectionConfigTreeNode> nodes,
|
||||
final InspectionProfileImpl inspectionProfile,
|
||||
final TreeTable treeTable,
|
||||
final Project project) {
|
||||
myNodes = nodes;
|
||||
myKeys = new ArrayList<HighlightDisplayKey>(myNodes.size());
|
||||
@@ -131,7 +129,6 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
}
|
||||
|
||||
myInspectionProfile = inspectionProfile;
|
||||
myTreeTable = treeTable;
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@@ -151,10 +148,6 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
return myInspectionProfile;
|
||||
}
|
||||
|
||||
public TreeTable getTreeTable() {
|
||||
return myTreeTable;
|
||||
}
|
||||
|
||||
public Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
@@ -187,8 +180,6 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
private static class MyTableModel extends AbstractTableModel implements EditableModel {
|
||||
private final InspectionProfileImpl myInspectionProfile;
|
||||
private final List<String> myKeyNames;
|
||||
private final List<InspectionConfigTreeNode> myNodes;
|
||||
private final TreeTable myTreeTable;
|
||||
private final Project myProject;
|
||||
private final TableSettings myTableSettings;
|
||||
private final List<HighlightDisplayKey> myKeys;
|
||||
@@ -203,8 +194,6 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
myInspectionProfile = tableSettings.getInspectionProfile();
|
||||
myKeys = tableSettings.getKeys();
|
||||
myKeyNames = tableSettings.getKeyNames();
|
||||
myNodes = tableSettings.getNodes();
|
||||
myTreeTable = tableSettings.getTreeTable();
|
||||
myScopeComparator = new ScopeOrderComparator(myInspectionProfile);
|
||||
refreshAggregatedScopes();
|
||||
}
|
||||
@@ -264,7 +253,7 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
case SCOPE_ENABLED_COLUMN:
|
||||
return isEnabled(rowIndex);
|
||||
case SCOPE_NAME_COLUMN:
|
||||
return rowIndex == lastRowIndex() ? "Everywhere else" : getScope(rowIndex).getName();
|
||||
return rowIndex == lastRowIndex() ? "Everywhere else" : getScopeName(rowIndex);
|
||||
case SEVERITY_COLUMN:
|
||||
return getSeverityState(rowIndex);
|
||||
default:
|
||||
@@ -276,13 +265,17 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
return getScopeToolState(rowIndex).getExistedStates().get(0).getScope(myProject);
|
||||
}
|
||||
|
||||
private String getScopeName(final int rowIndex) {
|
||||
return getScopeToolState(rowIndex).getExistedStates().get(0).getScopeName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private SeverityState getSeverityState(final int rowIndex) {
|
||||
final ExistedScopesStatesAndNonExistNames existedScopesStatesAndNonExistNames = getScopeToolState(rowIndex);
|
||||
if (!existedScopesStatesAndNonExistNames.getNonExistNames().isEmpty()) {
|
||||
return new SeverityState(MIXED_FAKE_SEVERITY, false);
|
||||
}
|
||||
return new SeverityState(ScopesAndSeveritiesTable.getSeverity(existedScopesStatesAndNonExistNames.getExistedStates()), true);
|
||||
return new SeverityState(getSeverity(existedScopesStatesAndNonExistNames.getExistedStates()), true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -362,7 +355,7 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
LOG.error("no display level found for name " + severityState.getSeverity().getName());
|
||||
return;
|
||||
}
|
||||
final String scopeName = rowIndex == lastRowIndex() ? null : getScope(rowIndex).getName();
|
||||
final String scopeName = rowIndex == lastRowIndex() ? null : getScopeName(rowIndex);
|
||||
myInspectionProfile.setErrorLevel(myKeys, level, scopeName, myProject);
|
||||
}
|
||||
else if (columnIndex == SCOPE_ENABLED_COLUMN) {
|
||||
@@ -418,7 +411,6 @@ public class ScopesAndSeveritiesTable extends JBTable {
|
||||
}
|
||||
};
|
||||
DataContext dataContext = DataManager.getInstance().getDataContext(myTable);
|
||||
final JComponent component = (JComponent)PlatformDataKeys.CONTEXT_COMPONENT.getData(dataContext);
|
||||
final ListPopup popup = JBPopupFactory.getInstance()
|
||||
.createActionGroupPopup(ScopesChooser.TITLE, scopesChooser.createPopupActionGroup(myTable), dataContext,
|
||||
JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false);
|
||||
|
||||
Reference in New Issue
Block a user