diff options
Diffstat (limited to 'platform/lang-impl/src/com/intellij/profile')
5 files changed, 12 insertions, 108 deletions
diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/InspectionProfileManagerImpl.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/InspectionProfileManagerImpl.java index de8ee09198c1..08c9e9f0d518 100644 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/InspectionProfileManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/profile/codeInspection/InspectionProfileManagerImpl.java @@ -42,13 +42,17 @@ import com.intellij.openapi.options.*; import com.intellij.openapi.project.Project; import com.intellij.openapi.project.ProjectManager; import com.intellij.openapi.ui.Messages; -import com.intellij.openapi.util.*; +import com.intellij.openapi.util.Comparing; +import com.intellij.openapi.util.InvalidDataException; +import com.intellij.openapi.util.JDOMExternalizable; +import com.intellij.openapi.util.WriteExternalException; import com.intellij.profile.Profile; import com.intellij.util.ArrayUtil; import com.intellij.util.ui.UIUtil; import org.jdom.Document; import org.jdom.Element; import org.jdom.JDOMException; +import org.jdom.Parent; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.TestOnly; @@ -94,7 +98,7 @@ public class InspectionProfileManagerImpl extends InspectionProfileManager imple @Override - public Document writeScheme(@NotNull final InspectionProfileImpl scheme) throws WriteExternalException { + public Element writeScheme(@NotNull final InspectionProfileImpl scheme) throws WriteExternalException { return scheme.saveToDocument(); } diff --git a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooser.java b/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooser.java deleted file mode 100644 index 5bc792545c96..000000000000 --- a/platform/lang-impl/src/com/intellij/profile/codeInspection/ui/LevelChooser.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2000-2012 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. - */ - -/* - * User: anna - * Date: 19-Apr-2009 - */ -package com.intellij.profile.codeInspection.ui; - -import com.intellij.codeHighlighting.HighlightDisplayLevel; -import com.intellij.codeInsight.daemon.impl.HighlightInfoType; -import com.intellij.codeInsight.daemon.impl.SeverityRegistrar; -import com.intellij.codeInsight.daemon.impl.SeverityUtil; -import com.intellij.codeInspection.ex.SeverityEditorDialog; -import com.intellij.ui.ListCellRendererWrapper; -import com.intellij.lang.annotation.HighlightSeverity; -import com.intellij.ui.ComboboxWithBrowseButton; -import org.jetbrains.annotations.NotNull; - -import javax.swing.*; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.util.TreeSet; - -public class LevelChooser extends ComboboxWithBrowseButton { - public LevelChooser(final SeverityRegistrar severityRegistrar) { - final JComboBox comboBox = getComboBox(); - final DefaultComboBoxModel model = new DefaultComboBoxModel(); - comboBox.setModel(model); - fillModel(model, severityRegistrar); - getButton().setToolTipText("Edit severities (" + getButton().getToolTipText(null) + ")"); - - comboBox.setRenderer(new ListCellRendererWrapper<HighlightSeverity>() { - @Override - public void customize(final JList list, final HighlightSeverity value, final int index, final boolean selected, final boolean hasFocus) { - if (value != null) { - setText(SingleInspectionProfilePanel.renderSeverity(value)); - setIcon(HighlightDisplayLevel.find(value).getIcon()); - } - } - }); - - addActionListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - final SeverityEditorDialog dlg = - new SeverityEditorDialog(LevelChooser.this, (HighlightSeverity)getComboBox().getSelectedItem(), severityRegistrar); - dlg.show(); - if (dlg.isOK()) { - final Object item = getComboBox().getSelectedItem(); - fillModel(model, severityRegistrar); - final HighlightInfoType type = dlg.getSelectedType(); - if (type != null) { - getComboBox().setSelectedItem(type.getSeverity(null)); - } - else { - getComboBox().setSelectedItem(item); - } - } - } - }); - } - - private static void fillModel(DefaultComboBoxModel model, final SeverityRegistrar severityRegistrar) { - model.removeAllElements(); - final TreeSet<HighlightSeverity> severities = new TreeSet<HighlightSeverity>(severityRegistrar); - for (SeverityRegistrar.SeverityBasedTextAttributes type : SeverityUtil.getRegisteredHighlightingInfoTypes(severityRegistrar)) { - severities.add(type.getSeverity()); - } - severities.add(HighlightSeverity.ERROR); - severities.add(HighlightSeverity.WARNING); - severities.add(HighlightSeverity.WEAK_WARNING); - severities.add(HighlightSeverity.GENERIC_SERVER_ERROR_OR_WARNING); - for (HighlightSeverity severity : severities) { - model.addElement(severity); - } - } - - @NotNull - public HighlightDisplayLevel getLevel() { - HighlightSeverity severity = (HighlightSeverity)getComboBox().getSelectedItem(); - if (severity == null) return HighlightDisplayLevel.WARNING; - return HighlightDisplayLevel.find(severity); - } - - public void setLevel(HighlightDisplayLevel level) { - getComboBox().setSelectedItem(level.getSeverity()); - } -}
\ No newline at end of file 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 81d0bf651688..2320d059c146 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 @@ -1005,11 +1005,10 @@ public class SingleInspectionProfilePanel extends JPanel { northPanel.add(createTreeToolbarPanel().getComponent(), new GridBagConstraints(1, 0, 1, 1, 0.5, 1, GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); treePanel.add(northPanel, BorderLayout.NORTH); - myMainSplitter = new Splitter(false); + myMainSplitter = new Splitter(false, myProperties.getFloat(VERTICAL_DIVIDER_PROPORTION, 0.5f), 0.01f, 0.99f); myMainSplitter.setFirstComponent(treePanel); myMainSplitter.setSecondComponent(myRightSplitter); myMainSplitter.setHonorComponentsMinimumSize(false); - myMainSplitter.setProportion(myProperties.getFloat(VERTICAL_DIVIDER_PROPORTION, 0.5f)); final JPanel panel = new JPanel(new BorderLayout()); panel.add(myMainSplitter, BorderLayout.CENTER); 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 5607816ad13c..fe36408cf61a 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 @@ -220,7 +220,7 @@ public class InspectionsConfigTreeTable extends TreeTable { @Override public void setValueAt(final Object aValue, final Object node, final int column) { LOG.assertTrue(column == IS_ENABLED_COLUMN); - LOG.assertTrue(aValue != null); + LOG.assertTrue(aValue != null, "node = " + node); final boolean doEnable = (Boolean) aValue; for (final InspectionConfigTreeNode aNode : InspectionsAggregationUtil.getInspectionsNodes((InspectionConfigTreeNode) node)) { final String toolId = aNode.getKey().toString(); 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 385b764af027..58e35083a247 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 @@ -357,6 +357,9 @@ public class ScopesAndSeveritiesTable extends JBTable { } else if (columnIndex == SCOPE_ENABLED_COLUMN) { final NamedScope scope = getScope(rowIndex); + if (scope == null) { + return; + } if ((Boolean)value) { if (rowIndex == lastRowIndex()) { myInspectionProfile.enableToolsByDefault(myKeyNames, myProject); @@ -381,7 +384,7 @@ public class ScopesAndSeveritiesTable extends JBTable { @Override public void removeRow(final int idx) { if (idx != lastRowIndex()) { - myInspectionProfile.removeScopes(myKeyNames, getScope(idx), myProject); + myInspectionProfile.removeScopes(myKeyNames, getScopeName(idx), myProject); refreshAggregatedScopes(); myTableSettings.onScopeRemoved(getRowCount()); } |