mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-77177 Line status tracker: the modified marker is not removed after commit
This commit is contained in:
@@ -77,6 +77,7 @@ public class LineStatusTracker {
|
||||
private boolean myAnathemaThrown;
|
||||
private FileEditorManager myFileEditorManager;
|
||||
private final VirtualFile myVirtualFile;
|
||||
private volatile boolean myReleased;
|
||||
|
||||
private LineStatusTracker(final Document document, final Document upToDateDocument, final Project project, final VirtualFile virtualFile) {
|
||||
myVirtualFile = virtualFile;
|
||||
@@ -89,10 +90,12 @@ public class LineStatusTracker {
|
||||
myRanges = new ArrayList<Range>();
|
||||
myAnathemaThrown = false;
|
||||
myFileEditorManager = FileEditorManager.getInstance(myProject);
|
||||
myReleased = false;
|
||||
}
|
||||
|
||||
public void initialize(@NotNull final String upToDateContent, @NotNull RevisionPack baseRevisionNumber) {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
if (myReleased) return;
|
||||
|
||||
synchronized (myLock) {
|
||||
try {
|
||||
@@ -166,6 +169,7 @@ public class LineStatusTracker {
|
||||
|
||||
@SuppressWarnings({"AutoBoxing"})
|
||||
private RangeHighlighter createHighlighter(final Range range) {
|
||||
assert ! myReleased;
|
||||
int first =
|
||||
range.getOffset1() >= myDocument.getLineCount() ? myDocument.getTextLength() : myDocument.getLineStartOffset(range.getOffset1());
|
||||
|
||||
@@ -204,6 +208,7 @@ public class LineStatusTracker {
|
||||
removeHighlightersFromMarkupModel();
|
||||
myRanges.clear();
|
||||
}
|
||||
myReleased = true;
|
||||
}
|
||||
|
||||
public Document getDocument() {
|
||||
@@ -228,6 +233,7 @@ public class LineStatusTracker {
|
||||
}
|
||||
|
||||
public void startBulkUpdate() {
|
||||
if (myReleased) return;
|
||||
synchronized (myLock) {
|
||||
myBulkUpdate = true;
|
||||
removeAnathema();
|
||||
@@ -247,6 +253,7 @@ public class LineStatusTracker {
|
||||
}
|
||||
|
||||
public void finishBulkUpdate() {
|
||||
if (myReleased) return;
|
||||
synchronized (myLock) {
|
||||
myBulkUpdate = false;
|
||||
reinstallRanges();
|
||||
@@ -286,6 +293,7 @@ public class LineStatusTracker {
|
||||
private final VcsDirtyScopeManager myVcsDirtyScopeManager = VcsDirtyScopeManager.getInstance(myProject);
|
||||
|
||||
public void beforeDocumentChange(DocumentEvent e) {
|
||||
if (myReleased) return;
|
||||
myApplication.assertWriteAccessAllowed();
|
||||
|
||||
synchronized (myLock) {
|
||||
@@ -338,6 +346,11 @@ public class LineStatusTracker {
|
||||
}
|
||||
|
||||
public void documentChanged(final DocumentEvent e) {
|
||||
if (myReleased) {
|
||||
return;
|
||||
}
|
||||
// TODO: remove assertion when cached document listeners will work ok
|
||||
//assert ! myReleased;
|
||||
myApplication.assertWriteAccessAllowed();
|
||||
|
||||
synchronized (myLock) {
|
||||
|
||||
@@ -212,14 +212,9 @@ public class LineStatusTrackerManager implements ProjectComponent, LineStatusTra
|
||||
if (tracker == null && (! shouldBeInstalled)) return;
|
||||
|
||||
if (tracker != null) {
|
||||
if (! shouldBeInstalled) {
|
||||
releaseTracker(document);
|
||||
return;
|
||||
} else {
|
||||
tracker.resetForBaseRevisionLoad();
|
||||
startAlarm(document, virtualFile);
|
||||
}
|
||||
} else if (shouldBeInstalled) {
|
||||
releaseTracker(document);
|
||||
}
|
||||
if (shouldBeInstalled) {
|
||||
installTracker(virtualFile, document);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user