VCS: highlight annotation actions update() optimization
authorirengrig <Irina.Chernushina@jetbrains.com>
Wed, 17 Mar 2010 10:33:52 +0000 (13:33 +0300)
committerirengrig <Irina.Chernushina@jetbrains.com>
Wed, 17 Mar 2010 10:33:52 +0000 (13:33 +0300)
platform/vcs-api/src/com/intellij/openapi/vcs/annotate/FileAnnotation.java
platform/vcs-impl/src/com/intellij/openapi/vcs/annotate/HighlightAnnotationsActions.java
plugins/cvs/cvs-plugin/src/com/intellij/cvsSupport2/annotate/CvsFileAnnotation.java
plugins/git4idea/src/git4idea/annotate/GitFileAnnotation.java
plugins/svn4idea/src/org/jetbrains/idea/svn/annotate/SvnFileAnnotation.java

index e9fb1106256a828b21de4da1c4638d15c618e52c..43c89072339188c01f0def04d07f9d580d607609 100644 (file)
@@ -96,6 +96,8 @@ public interface FileAnnotation {
   @Nullable
   List<VcsFileRevision> getRevisions();
 
+  boolean revisionsNotEmpty();
+
   @Nullable
   AnnotationSourceSwitcher getAnnotationSourceSwitcher();
 }
index cdf7d9f028275b563a80df0a5a847c717523b564..f717bde68e1b0f2ceb346b60962213c0d8642800 100644 (file)
@@ -117,8 +117,7 @@ public class HighlightAnnotationsActions {
       }
       e.getPresentation().setText(text);
       e.getPresentation().setDescription(description);
-      final List<VcsFileRevision> fileRevisionList = myFileAnnotation.getRevisions();
-      e.getPresentation().setEnabled(fileRevisionList != null && (! fileRevisionList.isEmpty()));
+      e.getPresentation().setEnabled(myFileAnnotation.revisionsNotEmpty());
     }
 
     public void actionPerformed(final AnActionEvent e) {
index 67aa788b88e7af150afcbefe9e2e265afddcce1a..209635c2a056de8451e9f60f7ddfbf6e2bab82fc 100644 (file)
@@ -164,6 +164,10 @@ public class CvsFileAnnotation implements FileAnnotation{
     return myRevisions;
   }
 
+  public boolean revisionsNotEmpty() {
+    return ! myRevisions.isEmpty();
+  }
+
   public AnnotationSourceSwitcher getAnnotationSourceSwitcher() {
     return null;
   }
index 9180787cf5d99077bb920366070db9d5ba6b52e7..eb34991f8c04c0419491d9cef17a698be52c4035 100644 (file)
@@ -243,6 +243,10 @@ public class GitFileAnnotation implements FileAnnotation {
     return result;
   }
 
+  public boolean revisionsNotEmpty() {
+    return ! myRevisionMap.isEmpty();
+  }
+
   public AnnotationSourceSwitcher getAnnotationSourceSwitcher() {
     return null;
   }
index d4d3b8a5b00cb4cefebd666a6bc2714d30c40ce7..b2b44774cd1507a1101bdf9a5f093bb1110d2b10 100644 (file)
@@ -248,6 +248,10 @@ public class SvnFileAnnotation implements FileAnnotation {
     return result;
   }
 
+  public boolean revisionsNotEmpty() {
+    return ! myRevisionMap.isEmpty();
+  }
+
   @Nullable
   public AnnotationSourceSwitcher getAnnotationSourceSwitcher() {
     return new AnnotationSourceSwitcher() {