inspection toolwindow: offline descriptors more priority for name while comparing...
authorDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Mon, 6 Jun 2016 11:19:14 +0000 (14:19 +0300)
committerDmitry Batkovich <dmitry.batkovich@jetbrains.com>
Mon, 6 Jun 2016 11:19:14 +0000 (14:19 +0300)
platform/lang-impl/src/com/intellij/codeInspection/offlineViewer/OfflineInspectionRVContentProvider.java
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsView.java
platform/lang-impl/src/com/intellij/codeInspection/ui/InspectionResultsViewComparator.java

index 228266412cd55b245b40c18b403b96135d74cfef..ec4b7952e8b5c975aa60b4dc3be05c7be173f60a 100644 (file)
@@ -113,10 +113,10 @@ public class OfflineInspectionRVContentProvider extends InspectionRVContentProvi
     InspectionToolWrapper toolWrapper = toolNode.getToolWrapper();
     final Map<String, Set<OfflineProblemDescriptor>> filteredContent = getFilteredContent(context, toolWrapper);
     if (filteredContent != null && !filteredContent.values().isEmpty()) {
-      parentNode.add(toolNode);
+      parentNode.insertByOrder(toolNode, false);
       buildTree(context, filteredContent, false, toolWrapper, OfflineProblemDescriptorContainer::new, showStructure,
                 (newChild) -> {
-                  toolNode.add(newChild);
+                  toolNode.insertByOrder(newChild, false);
                   return newChild;
                 });
     }
index 9163d04a2613316e651b1a43feb55468537ae3c0..d06d1dcc19358b9e95d19fa0722bbc06f541d068 100644 (file)
@@ -1032,7 +1032,7 @@ public class InspectionResultsView extends JPanel implements Disposable, Occuren
 
     @Override
     public void update(AnActionEvent e) {
-      e.getPresentation().setEnabled(myScope.isValid());
+      e.getPresentation().setEnabled(!(myProvider instanceof OfflineInspectionRVContentProvider) && myScope.isValid());
     }
 
     @Override
index 59e7bae6fb728c3bb25851b2702ef4970c0d0beb..9167d41f83208321e0e9a89f74202fecb7b153c3 100644 (file)
@@ -93,8 +93,11 @@ public class InspectionResultsViewComparator implements Comparator {
       final Object userObject2 = ((OfflineRefElementNode)node2).getOfflineDescriptor();
       final OfflineProblemDescriptor descriptor1 = (OfflineProblemDescriptor)userObject1;
       final OfflineProblemDescriptor descriptor2 = (OfflineProblemDescriptor)userObject2;
-      if (descriptor1.getLine() != descriptor2.getLine()) return descriptor1.getLine() - descriptor2.getLine();
-      return descriptor1.getFQName().compareToIgnoreCase(descriptor2.getFQName());
+      final int res = descriptor1.getFQName().compareToIgnoreCase(descriptor2.getFQName());
+      if (res != 0) {
+        return res;
+      }
+      return descriptor1.getLine() - descriptor2.getLine();
     }
 
     if (node1 instanceof RefElementNode && node2 instanceof RefElementNode){   //sort by filename and inside file by start offset