IDEA-CR-15067 remove SeverityProvider appcode/171.497
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Thu, 27 Oct 2016 09:59:40 +0000 (11:59 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Thu, 27 Oct 2016 10:01:04 +0000 (12:01 +0200)
platform/analysis-impl/src/com/intellij/codeInsight/daemon/InspectionProfileConvertor.java
platform/analysis-impl/src/com/intellij/profile/codeInspection/InspectionProfileManager.java
platform/analysis-impl/src/com/intellij/profile/codeInspection/SeverityProvider.java [deleted file]
platform/lang-impl/src/com/intellij/codeInspection/ex/ApplicationInspectionProfileManager.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/filter/InspectionFilterAction.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/table/SeverityRenderer.java

index 63fadcb0afa5135a793df9d993cd4aa641994963..3c04d62c0a5a3fda7410f40a94343b4dd270b90a 100644 (file)
@@ -25,7 +25,6 @@ import com.intellij.openapi.diagnostic.Logger;
 import com.intellij.openapi.util.JDOMUtil;
 import com.intellij.openapi.util.io.FileUtil;
 import com.intellij.profile.codeInspection.InspectionProfileManager;
-import com.intellij.profile.codeInspection.SeverityProvider;
 import org.jdom.Element;
 import org.jdom.JDOMException;
 import org.jetbrains.annotations.NonNls;
@@ -56,9 +55,9 @@ public class InspectionProfileConvertor {
   @NonNls private static final String DEFAULT_XML = "Default.xml";
   @NonNls private static final String XML_EXTENSION = ".xml";
   @NonNls public static final String LEVEL_ATT = "level";
-  private final SeverityProvider myManager;
+  private final InspectionProfileManager myManager;
 
-  public InspectionProfileConvertor(@NotNull SeverityProvider manager) {
+  public InspectionProfileConvertor(@NotNull InspectionProfileManager manager) {
     myManager = manager;
     renameOldDefaultsProfile();
   }
index 1d63fc495c3afaf07303dff0ccfcfc62390af64c..d8eba51572cc45ded2759563caea866931bf5d74 100644 (file)
@@ -15,6 +15,7 @@
  */
 package com.intellij.profile.codeInspection;
 
+import com.intellij.codeInsight.daemon.impl.SeverityRegistrar;
 import com.intellij.codeInspection.InspectionProfile;
 import com.intellij.openapi.Disposable;
 import com.intellij.openapi.components.ServiceManager;
@@ -27,7 +28,7 @@ import org.jetbrains.annotations.Nullable;
 
 import java.util.Collection;
 
-public interface InspectionProfileManager extends SeverityProvider {
+public interface InspectionProfileManager {
   String INSPECTION_DIR = "inspection";
 
   @NotNull
@@ -69,4 +70,10 @@ public interface InspectionProfileManager extends SeverityProvider {
   }
 
   void addProfileChangeListener(@NotNull ProfileChangeAdapter listener, @NotNull Disposable parent);
+
+  @NotNull
+  SeverityRegistrar getSeverityRegistrar();
+
+  @NotNull
+  SeverityRegistrar getOwnSeverityRegistrar();
 }
\ No newline at end of file
diff --git a/platform/analysis-impl/src/com/intellij/profile/codeInspection/SeverityProvider.java b/platform/analysis-impl/src/com/intellij/profile/codeInspection/SeverityProvider.java
deleted file mode 100644 (file)
index 25397a6..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2000-2009 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: 31-Jul-2007
- */
-package com.intellij.profile.codeInspection;
-
-import com.intellij.codeInsight.daemon.impl.SeverityRegistrar;
-import org.jetbrains.annotations.NotNull;
-
-public interface SeverityProvider {
-  @NotNull
-  SeverityRegistrar getSeverityRegistrar();
-
-  @NotNull
-  SeverityRegistrar getOwnSeverityRegistrar();
-}
\ No newline at end of file
index 6bb512792629aa9bcee6a127b76a1bedbdb95272..15a470a8e598134c9e7f7f2fa25615610b237384 100644 (file)
@@ -41,7 +41,10 @@ import com.intellij.openapi.options.SchemeManagerFactory;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.project.ProjectManager;
 import com.intellij.openapi.ui.Messages;
-import com.intellij.profile.codeInspection.*;
+import com.intellij.profile.codeInspection.BaseInspectionProfileManager;
+import com.intellij.profile.codeInspection.InspectionProfileLoadUtil;
+import com.intellij.profile.codeInspection.InspectionProfileManager;
+import com.intellij.profile.codeInspection.InspectionProfileProcessor;
 import com.intellij.util.ObjectUtils;
 import com.intellij.util.messages.MessageBus;
 import com.intellij.util.ui.UIUtil;
@@ -67,9 +70,7 @@ import java.util.function.Function;
   },
   additionalExportFile = InspectionProfileManager.INSPECTION_DIR
 )
-public class ApplicationInspectionProfileManager extends BaseInspectionProfileManager implements InspectionProfileManager,
-                                                                                                 SeverityProvider,
-                                                                                                 PersistentStateComponent<Element> {
+public class ApplicationInspectionProfileManager extends BaseInspectionProfileManager implements InspectionProfileManager, PersistentStateComponent<Element> {
   private static final ExtensionPointName<BundledSchemeEP> BUNDLED_EP_NAME = ExtensionPointName.create("com.intellij.bundledInspectionProfile");
 
   private final InspectionToolRegistrar myRegistrar;
index 403f6d0896ea5bc562369e53b79ce4c935586961..1d816a6b1bbf2eff0c8cd20db06c345959eaa905 100644 (file)
@@ -30,7 +30,6 @@ import com.intellij.openapi.project.DumbAware;
 import com.intellij.openapi.project.DumbAwareAction;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.profile.codeInspection.SeverityProvider;
 import com.intellij.profile.codeInspection.ui.LevelChooserAction;
 import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
 import com.intellij.ui.FilterComponent;
@@ -57,7 +56,7 @@ public class InspectionFilterAction extends DefaultActionGroup implements Toggle
     super("Filter Inspections", true);
     myInspectionsFilter = inspectionsFilter;
     myFilterComponent = filterComponent;
-    mySeverityRegistrar = ((SeverityProvider)profile.getProfileManager()).getOwnSeverityRegistrar();
+    mySeverityRegistrar = profile.getProfileManager().getOwnSeverityRegistrar();
     getTemplatePresentation().setIcon(AllIcons.General.Filter);
     tune(profile, project);
   }
@@ -107,7 +106,7 @@ public class InspectionFilterAction extends DefaultActionGroup implements Toggle
       final DefaultActionGroup languageActionGroupParent =
         new DefaultActionGroup("Filter by Language", languages.size() >= MIN_LANGUAGE_COUNT_TO_WRAP);
       add(languageActionGroupParent);
-      Collections.sort(languages, (l1, l2) -> l1.getDisplayName().compareTo(l2.getDisplayName()));
+      Collections.sort(languages, Comparator.comparing(Language::getDisplayName));
       for (Language language : languages) {
         languageActionGroupParent.add(new LanguageFilterAction(language));
       }
index b8fea3dec0f6a73d659a06f4351764779c857699..36afb3d96d7f3265771e16706cd2f178fe88b29a 100644 (file)
@@ -20,7 +20,6 @@ import com.intellij.codeInspection.ex.InspectionProfileImpl;
 import com.intellij.lang.annotation.HighlightSeverity;
 import com.intellij.openapi.ui.ComboBoxTableRenderer;
 import com.intellij.openapi.ui.popup.LightweightWindowEvent;
-import com.intellij.profile.codeInspection.SeverityProvider;
 import com.intellij.profile.codeInspection.ui.LevelChooserAction;
 import com.intellij.profile.codeInspection.ui.SingleInspectionProfilePanel;
 import com.intellij.util.containers.ContainerUtil;
@@ -48,8 +47,8 @@ public class SeverityRenderer extends ComboBoxTableRenderer<SeverityState> {
   }
 
   public static SeverityRenderer create(final InspectionProfileImpl inspectionProfile, @Nullable final Runnable onClose) {
-    final List<HighlightSeverity> severities =
-      LevelChooserAction.getSeverities(((SeverityProvider)inspectionProfile.getProfileManager()).getOwnSeverityRegistrar());
+    final List<HighlightSeverity> severities;
+    severities = LevelChooserAction.getSeverities(inspectionProfile.getProfileManager().getOwnSeverityRegistrar());
     return new SeverityRenderer(ContainerUtil.map2Array(severities, new SeverityState[severities.size()], severity -> new SeverityState(severity, true, false)), onClose);
   }