diff: do not show 'contents identical' if we can't calculate diff
authorAleksey Pivovarov <Aleksey.Pivovarov@jetbrains.com>
Mon, 31 Mar 2014 07:43:45 +0000 (11:43 +0400)
committerAleksey Pivovarov <Aleksey.Pivovarov@jetbrains.com>
Mon, 31 Mar 2014 07:43:45 +0000 (11:43 +0400)
ex: modified image file

platform/platform-impl/src/com/intellij/openapi/diff/impl/DiffPanelImpl.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/FragmentedDiffPanelState.java
platform/platform-impl/src/com/intellij/openapi/diff/impl/highlighting/SimpleDiffPanelState.java

index e421492bf272955265032d62809dc082738d8560..13585f91fbcd904d84213afe167cbeee37d13610 100644 (file)
@@ -347,8 +347,8 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
         myPanel.removeTopComponent(myTopMessageDiffPanel);
       }
       LineBlocks blocks = myData.updateEditors();
         myPanel.removeTopComponent(myTopMessageDiffPanel);
       }
       LineBlocks blocks = myData.updateEditors();
-      setLineBlocks(blocks);
-      if (blocks.getCount() == 0) {
+      setLineBlocks(blocks != null ? blocks : LineBlocks.EMPTY);
+      if (blocks != null && blocks.getCount() == 0) {
         if (myData.isContentsEqual()) {
           setFileContentsAreIdentical();
         }
         if (myData.isContentsEqual()) {
           setFileContentsAreIdentical();
         }
@@ -420,7 +420,7 @@ public class DiffPanelImpl implements DiffPanelEx, ContentChangeListener, TwoSid
     setTitle(title, false);
   }
 
     setTitle(title, false);
   }
 
-  private void setLineBlocks(LineBlocks blocks) {
+  private void setLineBlocks(@NotNull LineBlocks blocks) {
     myLineBlocks = blocks;
     mySplitter.redrawDiffs();
     updateStatusBar();
     myLineBlocks = blocks;
     mySplitter.redrawDiffs();
     updateStatusBar();
index 7e395c1b4a9ecb0eabb822bd69fff5f34b66a590..3efb946fc0e10309ddb89707d5ad67dff3fa6c60 100644 (file)
@@ -32,6 +32,7 @@ import com.intellij.util.BeforeAfter;
 import com.intellij.util.Consumer;
 import com.intellij.util.diff.FilesTooBigForDiffException;
 import org.jetbrains.annotations.NotNull;
 import com.intellij.util.Consumer;
 import com.intellij.util.diff.FilesTooBigForDiffException;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import javax.swing.*;
 import java.awt.*;
 
 import javax.swing.*;
 import java.awt.*;
@@ -90,11 +91,12 @@ public class FragmentedDiffPanelState extends DiffPanelState {
     myAppender2.resetHighlighters();
   }
 
     myAppender2.resetHighlighters();
   }
 
+  @Nullable
   public LineBlocks updateEditors() throws FilesTooBigForDiffException {
     resetMarkup();
     mySeparatorsPositionConsumer.clear();
     if (myAppender1.getEditor() == null || myAppender2.getEditor() == null) {
   public LineBlocks updateEditors() throws FilesTooBigForDiffException {
     resetMarkup();
     mySeparatorsPositionConsumer.clear();
     if (myAppender1.getEditor() == null || myAppender2.getEditor() == null) {
-      return LineBlocks.EMPTY;
+      return null;
     }
 
     int previousBefore = -1;
     }
 
     int previousBefore = -1;
index d3e1dfd5a64a4b793f007d0c943b11144cc0cbef..fc26cf634e8833c58f42d0c55690d2939d329222 100644 (file)
@@ -28,6 +28,7 @@ import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.util.diff.FilesTooBigForDiffException;
 import org.jetbrains.annotations.NotNull;
 import com.intellij.openapi.util.Disposer;
 import com.intellij.util.diff.FilesTooBigForDiffException;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -108,10 +109,11 @@ public abstract class SimpleDiffPanelState implements Disposable  {
     ApplicationManager.getApplication().runWriteAction(new ResetMarkupRunnable(this));
   }
 
     ApplicationManager.getApplication().runWriteAction(new ResetMarkupRunnable(this));
   }
 
+  @Nullable
   public LineBlocks updateEditors() throws FilesTooBigForDiffException {
     resetMarkup();
     if (myAppender1.getEditor() == null || myAppender2.getEditor() == null) {
   public LineBlocks updateEditors() throws FilesTooBigForDiffException {
     resetMarkup();
     if (myAppender1.getEditor() == null || myAppender2.getEditor() == null) {
-      return LineBlocks.EMPTY;
+      return null;
     }
 
     return addMarkup(
     }
 
     return addMarkup(