diff options
Diffstat (limited to 'platform/lang-impl/src/com/intellij/profile/codeInspection/ui')
5 files changed, 19 insertions, 32 deletions
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java index c69a3e5566a2..602de3c8dba5 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/ScopesOrderDialog.java @@ -64,7 +64,7 @@ public class ScopesOrderDialog extends DialogWrapper { ListUtil.moveSelectedItemsUp(myOptionsList); } }).disableRemoveAction().disableAddAction().createPanel(); - final JLabel descr = new JLabel("<html><p>If file appears in two or more scopes, it will be" + + final JLabel descr = new JLabel("<html><p>If file appears in two or more scopes, it will be " + "inspected with settings of the topmost scope in list above.</p><p/>" + "<p>Scope order is set globally for all inspections in the profile.</p></html>"); descr.setPreferredSize(new Dimension(300, 100)); diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java index 2da5c80a758b..81d0bf651688 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java @@ -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); diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java index 92cb62f0f800..5607816ad13c 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/inspectionsTree/InspectionsConfigTreeTable.java @@ -64,8 +64,8 @@ public class InspectionsConfigTreeTable extends TreeTable { final TableColumn isEnabledColumn = getColumnModel().getColumn(IS_ENABLED_COLUMN); isEnabledColumn.setMaxWidth(20); - isEnabledColumn.setCellRenderer(new ThreeStateCheckBoxRenderer(false)); - isEnabledColumn.setCellEditor(new ThreeStateCheckBoxRenderer(true)); + isEnabledColumn.setCellRenderer(new ThreeStateCheckBoxRenderer()); + isEnabledColumn.setCellEditor(new ThreeStateCheckBoxRenderer()); addMouseMotionListener(new MouseAdapter() { @Override diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java index 3b2c36bf7d34..385b764af027 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ScopesAndSeveritiesTable.java @@ -20,11 +20,9 @@ import com.intellij.codeInsight.daemon.HighlightDisplayKey; import com.intellij.codeInspection.ex.Descriptor; import com.intellij.codeInspection.ex.InspectionProfileImpl; import com.intellij.codeInspection.ex.ScopeToolState; -import com.intellij.icons.AllIcons; import com.intellij.ide.DataManager; import com.intellij.lang.annotation.HighlightSeverity; import com.intellij.openapi.actionSystem.DataContext; -import com.intellij.openapi.actionSystem.PlatformDataKeys; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.popup.JBPopupFactory; @@ -36,12 +34,12 @@ import com.intellij.profile.codeInspection.ui.inspectionsTree.InspectionConfigTr import com.intellij.psi.search.scope.packageSet.NamedScope; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.table.JBTable; -import com.intellij.ui.treeStructure.treetable.TreeTable; import com.intellij.util.ArrayUtil; import com.intellij.util.Function; import com.intellij.util.SmartList; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.EditableModel; +import com.intellij.util.ui.EmptyIcon; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -63,7 +61,7 @@ public class ScopesAndSeveritiesTable extends JBTable { public static final HighlightSeverity MIXED_FAKE_SEVERITY = new HighlightSeverity("Mixed", -1); @SuppressWarnings("UnusedDeclaration") - public static final HighlightDisplayLevel MIXED_FAKE_LEVEL = new HighlightDisplayLevel(MIXED_FAKE_SEVERITY, AllIcons.Actions.Help); + public static final HighlightDisplayLevel MIXED_FAKE_LEVEL = new HighlightDisplayLevel(MIXED_FAKE_SEVERITY, EmptyIcon.create(12)); private final static int SCOPE_ENABLED_COLUMN = 0; private final static int SCOPE_NAME_COLUMN = 1; @@ -76,8 +74,8 @@ public class ScopesAndSeveritiesTable extends JBTable { final TableColumn scopeEnabledColumn = columnModel.getColumn(SCOPE_ENABLED_COLUMN); scopeEnabledColumn.setMaxWidth(30); - scopeEnabledColumn.setCellRenderer(new ThreeStateCheckBoxRenderer(false)); - scopeEnabledColumn.setCellEditor(new ThreeStateCheckBoxRenderer(true)); + scopeEnabledColumn.setCellRenderer(new ThreeStateCheckBoxRenderer()); + scopeEnabledColumn.setCellEditor(new ThreeStateCheckBoxRenderer()); final TableColumn severityColumn = columnModel.getColumn(SEVERITY_COLUMN); severityColumn.setCellRenderer(SeverityRenderer.create(tableSettings.getInspectionProfile())); @@ -113,12 +111,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()); @@ -130,7 +126,6 @@ public class ScopesAndSeveritiesTable extends JBTable { } myInspectionProfile = inspectionProfile; - myTreeTable = treeTable; myProject = project; } @@ -150,10 +145,6 @@ public class ScopesAndSeveritiesTable extends JBTable { return myInspectionProfile; } - public TreeTable getTreeTable() { - return myTreeTable; - } - public Project getProject() { return myProject; } @@ -186,8 +177,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; @@ -202,8 +191,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(); } @@ -263,7 +250,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: @@ -275,13 +262,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 @@ -361,7 +352,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) { @@ -417,7 +408,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); diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ThreeStateCheckBoxRenderer.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ThreeStateCheckBoxRenderer.java index 455e2a60cd19..9e2a4ead10f1 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ThreeStateCheckBoxRenderer.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/ThreeStateCheckBoxRenderer.java @@ -27,6 +27,7 @@ import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import java.awt.*; import java.awt.event.*; +import java.util.ArrayList; import java.util.EventObject; import java.util.List; @@ -37,7 +38,7 @@ public class ThreeStateCheckBoxRenderer extends ThreeStateCheckBox implements Ta private final List<CellEditorListener> myListeners = new SmartList<CellEditorListener>(); - public ThreeStateCheckBoxRenderer(final boolean isEditor) { + public ThreeStateCheckBoxRenderer() { setThirdStateEnabled(false); setHorizontalAlignment(CENTER); setVerticalAlignment(CENTER); @@ -95,7 +96,7 @@ public class ThreeStateCheckBoxRenderer extends ThreeStateCheckBox implements Ta @Override public boolean stopCellEditing() { final ChangeEvent e = new ChangeEvent(this); - for (final CellEditorListener listener : myListeners) { + for (final CellEditorListener listener : new ArrayList<CellEditorListener>(myListeners)) { listener.editingStopped(e); } return true; @@ -104,7 +105,7 @@ public class ThreeStateCheckBoxRenderer extends ThreeStateCheckBox implements Ta @Override public void cancelCellEditing() { final ChangeEvent e = new ChangeEvent(this); - for (final CellEditorListener listener : myListeners) { + for (final CellEditorListener listener : new ArrayList<CellEditorListener>(myListeners)) { listener.editingCanceled(e); } } |