diff: oneside viewer - hide chevrone operations on state invalidation

* they will do nothing anyway
This commit is contained in:
Aleksey Pivovarov
2015-05-20 16:50:59 +03:00
parent c367d6f4e1
commit 28ff0b4a1e
2 changed files with 21 additions and 6 deletions
@@ -235,6 +235,7 @@ public class OnesideDiffChange {
@Nullable
public GutterIconRenderer createRenderer() {
if (myViewer.isStateIsOutOfDate()) return null;
if (!myViewer.isEditable(mySide.other(), true)) return null;
boolean bothEditable = myViewer.isEditable(mySide, true);
@@ -383,6 +383,22 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
updateEditorCanBeTyped();
}
@CalledInAwt
protected void markSuppressEditorTyping() {
mySuppressEditorTyping = true;
updateEditorCanBeTyped();
}
@CalledInAwt
protected void markStateIsOutOfDate() {
myStateIsOutOfDate = true;
if (myChangedBlockData != null) {
for (OnesideDiffChange diffChange : myChangedBlockData.getDiffChanges()) {
diffChange.updateGutterActions();
}
}
}
@Nullable
private EditorHighlighter buildHighlighter(@Nullable Project project,
@NotNull DocumentContent content1,
@@ -611,8 +627,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
if (twosideStartLine == -1 || twosideEndLine == -1) {
// this should never happen
logDebugInfo(e, onesideStartPosition, onesideEndPosition, twosideStartLine, twosideEndLine);
mySuppressEditorTyping = true;
updateEditorCanBeTyped();
markSuppressEditorTyping();
return;
}
@@ -630,7 +645,7 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
finally {
// TODO: we can avoid marking state out-of-date in some simple cases (like in SimpleDiffViewer)
// but this will greatly increase complexity, so let's wait if it's actually required by users
myStateIsOutOfDate = true;
markStateIsOutOfDate();
myFoldingModel.onDocumentChanged(e);
scheduleRediff();
@@ -673,9 +688,8 @@ public class OnesideDiffViewer extends TextDiffViewerBase {
protected void onDocumentChange(@NotNull DocumentEvent e) {
if (myDuringTwosideDocumentModification) return;
myStateIsOutOfDate = true;
mySuppressEditorTyping = true;
updateEditorCanBeTyped();
markStateIsOutOfDate();
markSuppressEditorTyping();
myFoldingModel.onDocumentChanged(e);
scheduleRediff();