mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
avoid explicit document commit when setting/getting editor state
This commit is contained in:
-1
@@ -186,7 +186,6 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec
|
||||
Document document = editor.getDocument();
|
||||
PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(document);
|
||||
if (file == null || !file.getViewProvider().isPhysical() || !file.isValid()) return;
|
||||
PsiDocumentManager.getInstance(myProject).commitDocument(document);
|
||||
|
||||
Editor[] otherEditors = EditorFactory.getInstance().getEditors(document, myProject);
|
||||
if (otherEditors.length == 0 && !editor.isDisposed()) {
|
||||
|
||||
+1
-3
@@ -80,9 +80,7 @@ class DocumentFoldingInfo implements JDOMExternalizable, CodeFoldingState {
|
||||
LOG.assertTrue(!editor.isDisposed());
|
||||
clear();
|
||||
|
||||
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject);
|
||||
documentManager.commitDocument(editor.getDocument());
|
||||
PsiFile file = documentManager.getPsiFile(editor.getDocument());
|
||||
PsiFile file = PsiDocumentManager.getInstance(myProject).getPsiFile(editor.getDocument());
|
||||
|
||||
SmartPointerManager smartPointerManager = SmartPointerManager.getInstance(myProject);
|
||||
EditorFoldingInfo info = EditorFoldingInfo.get(editor);
|
||||
|
||||
+1
-2
@@ -137,7 +137,6 @@ public class PsiAwareTextEditorProvider extends TextEditorProvider implements As
|
||||
if (FileEditorStateLevel.FULL == level) {
|
||||
// Folding
|
||||
if (project != null && !project.isDisposed() && !editor.isDisposed() && project.isInitialized()) {
|
||||
PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
|
||||
state.setFoldingState(CodeFoldingManager.getInstance(project).saveFoldingState(editor));
|
||||
}
|
||||
else {
|
||||
@@ -154,7 +153,7 @@ public class PsiAwareTextEditorProvider extends TextEditorProvider implements As
|
||||
// Folding
|
||||
final CodeFoldingState foldState = state.getFoldingState();
|
||||
if (project != null && foldState != null) {
|
||||
PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
|
||||
LOG.assertTrue(PsiDocumentManager.getInstance(project).isCommitted(editor.getDocument()));
|
||||
editor.getFoldingModel().runBatchFoldingOperation(
|
||||
() -> CodeFoldingManager.getInstance(project).restoreFoldingState(editor, foldState)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user