mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-81569 Poor performance when moving lines in web.xml (Alt-Shift-DOWN/UP) while the web.xml is displayed in change details (Changes tool window)
This commit is contained in:
+21
-2
@@ -16,6 +16,7 @@
|
||||
package com.intellij.openapi.diff.impl.highlighting;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.diff.DiffContent;
|
||||
import com.intellij.openapi.diff.impl.ContentChangeListener;
|
||||
@@ -24,7 +25,9 @@ import com.intellij.openapi.diff.impl.DiffVersionComponent;
|
||||
import com.intellij.openapi.diff.impl.util.ContentDocumentListener;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.EditorFactory;
|
||||
import com.intellij.openapi.editor.ex.DocumentEx;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import com.intellij.openapi.editor.impl.EditorImpl;
|
||||
import com.intellij.openapi.fileEditor.FileEditor;
|
||||
import com.intellij.openapi.fileEditor.FileEditorProvider;
|
||||
import com.intellij.openapi.fileEditor.TextEditor;
|
||||
@@ -65,11 +68,11 @@ class EditorPlaceHolder extends DiffMarkup implements DiffVersionComponent {
|
||||
}
|
||||
|
||||
public void setContent(final DiffContent content) {
|
||||
runRegisteredDisposables();
|
||||
myContent = content;
|
||||
if (myContent != null) {
|
||||
Document document = myContent.getDocument();
|
||||
final Document document = myContent.getDocument();
|
||||
if (myContent.isBinary() || document == null || myContent.getContentType() instanceof UIBasedFileType) {
|
||||
runRegisteredDisposables();
|
||||
final VirtualFile file = myContent.getFile();
|
||||
if (file != null) {
|
||||
final FileEditorProvider[] providers = FileEditorProviderManager.getInstance().getProviders(getProject(), file);
|
||||
@@ -93,6 +96,22 @@ class EditorPlaceHolder extends DiffMarkup implements DiffVersionComponent {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (myEditor != null) {
|
||||
final DocumentEx doc = ((EditorImpl)myEditor).getDocument();
|
||||
if (doc != null) {
|
||||
final boolean wasWriteable = doc.isWritable();
|
||||
doc.setReadOnly(false);
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
doc.setText(document.getText());
|
||||
}
|
||||
});
|
||||
doc.setReadOnly(! wasWriteable);
|
||||
return;
|
||||
}
|
||||
}
|
||||
runRegisteredDisposables();
|
||||
final EditorFactory editorFactory = EditorFactory.getInstance();
|
||||
myEditor = DiffUtil.createEditor(document, getProject(), false);
|
||||
addDisposable(new Disposable() {
|
||||
|
||||
@@ -220,6 +220,10 @@ public class ContentRevisionCache {
|
||||
Pair<VcsRevisionNumber, byte[]> loaded;
|
||||
while (true) {
|
||||
currentRevision = putIntoCurrentCache(cache, path, vcsKey, loader);
|
||||
final byte[] cachedCurrent = cache.getBytes(path, currentRevision, vcsKey, UniqueType.REPOSITORY_CONTENT);
|
||||
if (cachedCurrent != null) {
|
||||
return new Pair<VcsRevisionNumber, byte[]>(currentRevision, cachedCurrent);
|
||||
}
|
||||
loaded = loader.get();
|
||||
if (loaded.getFirst().equals(currentRevision)) break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user