From b592442954711a8df84aba6e8c415e6be78c2c0f Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Wed, 24 Mar 2010 12:48:06 +0300 Subject: [PATCH] IDEA-53012: code folding : trying to fix --- .../intellij/codeInsight/folding/impl/FoldingUpdate.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java index 266cf04b32fd..3ed1e6921b5e 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java @@ -54,26 +54,24 @@ public class FoldingUpdate { } @Nullable - static Runnable updateFoldRegions(@NotNull final Editor editor, @NotNull final PsiFile file, final boolean applyDefaultState, final boolean quick) { + static Runnable updateFoldRegions(@NotNull final Editor editor, @NotNull PsiFile file, final boolean applyDefaultState, final boolean quick) { ApplicationManager.getApplication().assertReadAccessAllowed(); final Project project = file.getProject(); final Document document = editor.getDocument(); LOG.assertTrue(!PsiDocumentManager.getInstance(project).isUncommited(document)); - CachedValue value = editor.getUserData(CODE_FOLDING_KEY); if (value != null && value.hasUpToDateValue() && !applyDefaultState) return null; if (quick) return getUpdateResult(file, document, quick, project, editor, applyDefaultState).getValue(); return CachedValuesManager.getManager(project).getCachedValue(editor, CODE_FOLDING_KEY, new CachedValueProvider() { public Result compute() { - PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument()); + Document document = editor.getDocument(); + PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(document); return getUpdateResult(file, document, quick, project, editor, applyDefaultState); } }, false); - - } private static CachedValueProvider.Result getUpdateResult(PsiFile file,