From 26e4b109ca00ddf5e96eedb9da8da4afd148ad0b Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Thu, 14 Apr 2016 14:33:02 +0300 Subject: [PATCH] lst: extract method --- .../intellij/openapi/vcs/ex/LineStatusTracker.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java index 943dda8fddde..c6eb9d17cdf9 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/ex/LineStatusTracker.java @@ -268,10 +268,14 @@ public class LineStatusTracker { public boolean isValid() { synchronized (LOCK) { - return myInitialized && !myReleased && !myAnathemaThrown && !myBulkUpdate && !myDuringRollback && myDirtyRange == null; + return !isSuppressed() && myDirtyRange == null; } } + private boolean isSuppressed() { + return !myInitialized || myReleased || myAnathemaThrown || myBulkUpdate || myDuringRollback; + } + public void release() { UIUtil.invokeLaterIfNeeded(() -> { if (myReleased) return; @@ -368,7 +372,7 @@ public class LineStatusTracker { private class MyApplicationListener extends ApplicationAdapter { @Override public void writeActionFinished(@NotNull Object action) { - if (!myInitialized || myReleased || myBulkUpdate || myDuringRollback || myAnathemaThrown) return; + if (isSuppressed()) return; if (myDirtyRange != null) { synchronized (LOCK) { try { @@ -408,8 +412,7 @@ public class LineStatusTracker { @Override public void beforeDocumentChange(DocumentEvent e) { - if (!myInitialized || myReleased) return; - if (myBulkUpdate || myDuringRollback || myAnathemaThrown) return; + if (isSuppressed()) return; assert myDocument == e.getDocument(); myLine1 = myDocument.getLineNumber(e.getOffset()); @@ -427,8 +430,7 @@ public class LineStatusTracker { public void documentChanged(final DocumentEvent e) { myApplication.assertIsDispatchThread(); - if (!myInitialized || myReleased) return; - if (myBulkUpdate || myDuringRollback || myAnathemaThrown) return; + if (isSuppressed()) return; assert myDocument == e.getDocument(); synchronized (LOCK) {