Merge remote-tracking branch 'origin/master' into develar/is
authorVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Wed, 22 Jun 2016 12:40:12 +0000 (14:40 +0200)
committerVladimir Krivosheev <vladimir.krivosheev@jetbrains.com>
Wed, 22 Jun 2016 12:40:12 +0000 (14:40 +0200)
# Conflicts:
# java/java-tests/testSrc/com/intellij/codeInspection/OfflineInspectionResultViewTest.java
# platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java
# platform/lang-impl/src/com/intellij/codeInspection/actions/CodeCleanupAction.java
# platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java

23 files changed:
1  2 
java/java-analysis-impl/src/com/intellij/codeInspection/visibility/AccessCanBeTightenedInspection.java
java/java-tests/testSrc/com/intellij/codeInsight/daemon/impl/DaemonRespondToChangesTest.java
java/java-tests/testSrc/com/intellij/codeInspection/OfflineInspectionResultViewTest.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfo.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/HighlightInfoType.java
platform/analysis-impl/src/com/intellij/codeInsight/daemon/impl/SeverityRegistrar.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/InspectionProfileWrapper.java
platform/analysis-impl/src/com/intellij/codeInspection/ex/ToolsImpl.java
platform/lang-impl/src/com/intellij/application/options/colors/ColorAndFontOptions.java
platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/LocalInspectionsPass.java
platform/lang-impl/src/com/intellij/codeInspection/actions/CodeCleanupAction.java
platform/lang-impl/src/com/intellij/codeInspection/actions/CodeInspectionAction.java
platform/lang-impl/src/com/intellij/codeInspection/ex/GlobalInspectionContextImpl.java
platform/lang-impl/src/com/intellij/codeInspection/ui/DefaultInspectionToolPresentation.java
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
platform/lang-impl/src/com/intellij/profile/codeInspection/ui/SingleInspectionProfilePanel.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileDocumentManagerImpl.java
platform/platform-resources/src/META-INF/LangExtensionPoints.xml
platform/platform-resources/src/META-INF/PlatformExtensions.xml
platform/testFramework/src/com/intellij/testFramework/LightPlatformTestCase.java
platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java
plugins/InspectionGadgets/testsrc/com/intellij/codeInspection/visibility/AccessCanBeTightenedInspectionTest.java
python/src/com/jetbrains/python/inspections/PyPackageRequirementsInspection.java

index e36aad45d4f0a120e6d06632253756d0aba915bb,436f3f6552ad4ee5b9e85418e135432cc9f781c9..1403c8bb3468d1d2d62a18a56f4a45f0c33b1912
@@@ -40,9 -39,11 +39,12 @@@ import com.intellij.openapi.util.io.Fil
  import com.intellij.psi.PsiElement;
  import com.intellij.testFramework.PlatformTestUtil;
  import com.intellij.testFramework.TestSourceBasedTestCase;
+ import com.intellij.util.containers.ContainerUtil;
  import com.intellij.util.ui.tree.TreeUtil;
+ import com.siyeh.ig.bugs.EqualsWithItselfInspection;
+ import gnu.trove.THashMap;
  import org.jetbrains.annotations.NotNull;
 +import org.jetbrains.annotations.Nullable;
  
  import java.io.File;
  import java.io.IOException;
@@@ -67,11 -69,10 +70,10 @@@ public class OfflineInspectionResultVie
        HighlightDisplayKey.register(DefUseInspectionBase.SHORT_NAME);
      }
  
-     myToolWrapper = new LocalInspectionToolWrapper(new DefUseInspection());
-     myView = ViewOfflineResultsAction.showOfflineView(getProject(), parse(), new InspectionProfileImpl("test") {
+     final InspectionProfileImpl profile = new InspectionProfileImpl("test") {
        @Override
 -      public boolean isToolEnabled(final HighlightDisplayKey key, PsiElement element) {
 -        return Comparing.strEqual(key.toString(), DefUseInspectionBase.SHORT_NAME);
 +      public boolean isToolEnabled(@Nullable final HighlightDisplayKey key, PsiElement element) {
 +        return key != null && Comparing.strEqual(key.toString(), DefUseInspectionBase.SHORT_NAME);
        }
  
        @Override
index 3693eff3d089440920c69d25478a0758006e3468,a81aba306715467c72fcde789cbe8a662fc146ba..9a5d61d6693f9153b67d96e257d7a54dd7b31f44
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
 -
  package com.intellij.codeInspection.ex;
  
+ import com.intellij.codeHighlighting.HighlightDisplayLevel;
  import com.intellij.codeInsight.daemon.HighlightDisplayKey;
  import com.intellij.codeInspection.InspectionProfile;
  import com.intellij.codeInspection.InspectionProfileEntry;
index 9da874ae4e101eced24570928849d0d00ffdbef5,5d802127efa488b9f7ed665357c9229d3b829e53..f8a6ad6a1fe8f28a62255800379778f5f817fcb8
@@@ -21,11 -22,10 +21,10 @@@ import com.intellij.codeInspection.Insp
  import com.intellij.codeInspection.ex.GlobalInspectionContextBase;
  import com.intellij.codeInspection.ex.InspectionToolWrapper;
  import com.intellij.openapi.project.Project;
 -import com.intellij.profile.codeInspection.InspectionProfileManager;
  import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
 +import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl;
  import com.intellij.profile.codeInspection.ui.header.InspectionToolsConfigurable;
- import javax.swing.*;
+ import com.intellij.profile.codeInspection.ui.header.ProfilesComboBox;
  
  public class CodeCleanupAction extends CodeInspectionAction {
  
index 9bf2aa673e11ab0dc6de687c832f1184a8a24c8d,f0e3798e8166f1ffd74ac7cef1c8c39ace7d59ad..e8d99538df4d40ed744f47409f11353300ca42d9
@@@ -30,12 -29,11 +29,12 @@@ import com.intellij.openapi.fileEditor.
  import com.intellij.openapi.options.ex.SingleConfigurableEditor;
  import com.intellij.openapi.project.Project;
  import com.intellij.profile.Profile;
- import com.intellij.profile.ProfileManager;
  import com.intellij.profile.codeInspection.InspectionProfileManager;
  import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
 +import com.intellij.profile.codeInspection.ProjectInspectionProfileManagerImpl;
  import com.intellij.profile.codeInspection.ui.ErrorsConfigurable;
  import com.intellij.profile.codeInspection.ui.header.InspectionToolsConfigurable;
+ import com.intellij.profile.codeInspection.ui.header.ProfilesComboBox;
  import com.intellij.ui.ComboboxWithBrowseButton;
  import com.intellij.ui.ListCellRendererWrapper;
  import org.jetbrains.annotations.NonNls;
@@@ -103,19 -101,9 +102,9 @@@ public class CodeInspectionAction exten
    protected JComponent getAdditionalActionSettings(@NotNull final Project project, final BaseAnalysisActionDialog dialog) {
      final AdditionalPanel panel = new AdditionalPanel();
      final InspectionManagerEx manager = (InspectionManagerEx)InspectionManager.getInstance(project);
-     final JComboBox profiles = panel.myBrowseProfilesCombo.getComboBox();
-     profiles.setRenderer(new ListCellRendererWrapper() {
-       @Override
-       public void customize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
-         if (value instanceof Profile) {
-           Profile profile = (Profile)value;
-           setText(profile.getName());
-           setIcon(profile.isProjectLevel() ? AllIcons.General.ProjectSettings : AllIcons.General.Settings);
-         }
-       }
-     });
+     final ProfilesComboBox profiles = (ProfilesComboBox)panel.myBrowseProfilesCombo.getComboBox();
      final InspectionProfileManager profileManager = InspectionProfileManager.getInstance();
 -    final InspectionProjectProfileManager projectProfileManager = InspectionProjectProfileManager.getInstance(project);
 +    final ProjectInspectionProfileManagerImpl projectProfileManager = ProjectInspectionProfileManagerImpl.getInstanceImpl(project);
      reloadProfiles(profiles, profileManager, projectProfileManager, manager);
      panel.myBrowseProfilesCombo.addActionListener(new ActionListener() {
        @Override
                                InspectionProjectProfileManager inspectionProjectProfileManager,
                                InspectionManagerEx inspectionManager) {
      final InspectionProfile selectedProfile = getGlobalInspectionContext(inspectionManager.getProject()).getCurrentProfile();
-     final DefaultComboBoxModel model = (DefaultComboBoxModel)profiles.getModel();
-     model.removeAllElements();
-     fillModel(inspectionProfileManager, model);
-     fillModel(inspectionProjectProfileManager, model);
-     profiles.setSelectedItem(selectedProfile);
-   }
-   private static void fillModel(final ProfileManager inspectionProfileManager, final DefaultComboBoxModel model) {
-     Collection<Profile> profiles = new TreeSet<Profile>(inspectionProfileManager.getProfiles());
-     for (Profile profile : profiles) {
-       model.addElement(profile);
-     }
+     List<Profile> profiles = new ArrayList<>();
+     profiles.addAll(inspectionProfileManager.getProfiles());
+     profiles.addAll(inspectionProjectProfileManager.getProfiles());
+     profilesCombo.reset(profiles);
+     profilesCombo.selectProfile((InspectionProfileImpl)selectedProfile);
    }
  
 -
    private static class AdditionalPanel {
      public ComboboxWithBrowseButton myBrowseProfilesCombo;
      public JPanel myAdditionalPanel;