Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
eadc8899
Commit
eadc8899
authored
11 years ago
by
Dmitry Batrak
Browse files
Options
Download
Email Patches
Plain Diff
build initial foldings in background (improvements as per CR-IC-5531)
parent
350760c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java
+9
-3
...llij/codeInsight/folding/impl/CodeFoldingManagerImpl.java
platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java
+1
-7
...napi/fileEditor/impl/text/PsiAwareTextEditorProvider.java
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
+5
-0
...tellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
with
15 additions
and
10 deletions
+15
-10
platform/lang-impl/src/com/intellij/codeInsight/folding/impl/CodeFoldingManagerImpl.java
+
9
-
3
View file @
eadc8899
...
...
@@ -207,7 +207,9 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec
if
(!((
FoldingModelEx
)
editor
.
getFoldingModel
()).
isFoldingEnabled
())
return
;
if
(!
EditorUtil
.
supportsDumbModeFolding
(
editor
))
return
;
CodeFoldingState
foldingState
=
buildInitialFoldings
(
editor
.
getDocument
());
Document
document
=
editor
.
getDocument
();
PsiDocumentManager
.
getInstance
(
myProject
).
commitDocument
(
document
);
CodeFoldingState
foldingState
=
buildInitialFoldings
(
document
);
if
(
foldingState
!=
null
)
{
foldingState
.
setToEditor
(
editor
);
}
...
...
@@ -220,13 +222,17 @@ public class CodeFoldingManagerImpl extends CodeFoldingManager implements Projec
return
null
;
}
ApplicationManager
.
getApplication
().
assertReadAccessAllowed
();
PsiDocumentManager
psiDocumentManager
=
PsiDocumentManager
.
getInstance
(
myProject
);
if
(
psiDocumentManager
.
isUncommited
(
document
))
{
// skip building foldings for uncommitted document, CodeFoldingPass invoked by daemon will do it later
return
null
;
}
//Do not save/restore folding for code fragments
final
PsiFile
file
=
P
siDocumentManager
.
getInstance
(
myProject
).
getPsiFile
(
document
);
final
PsiFile
file
=
p
siDocumentManager
.
getPsiFile
(
document
);
if
(
file
==
null
||
!
file
.
isValid
()
||
!
file
.
getViewProvider
().
isPhysical
()
&&
!
ApplicationManager
.
getApplication
().
isUnitTestMode
())
{
return
null
;
}
PsiDocumentManager
.
getInstance
(
myProject
).
commitDocument
(
document
);
final
FoldingUpdate
.
FoldingMap
foldingMap
=
FoldingUpdate
.
getFoldingsFor
(
myProject
,
file
,
document
,
true
);
...
...
This diff is collapsed.
Click to expand it.
platform/lang-impl/src/com/intellij/openapi/fileEditor/impl/text/PsiAwareTextEditorProvider.java
+
1
-
7
View file @
eadc8899
...
...
@@ -22,7 +22,6 @@ package com.intellij.openapi.fileEditor.impl.text;
import
com.intellij.codeHighlighting.BackgroundEditorHighlighter
;
import
com.intellij.codeInsight.daemon.impl.TextEditorBackgroundHighlighter
;
import
com.intellij.codeInsight.folding.CodeFoldingManager
;
import
com.intellij.openapi.application.ApplicationManager
;
import
com.intellij.openapi.diagnostic.Logger
;
import
com.intellij.openapi.editor.Document
;
import
com.intellij.openapi.editor.Editor
;
...
...
@@ -70,12 +69,7 @@ public class PsiAwareTextEditorProvider extends TextEditorProvider implements As
public
FileEditor
build
()
{
final
PsiAwareTextEditorImpl
editor
=
new
PsiAwareTextEditorImpl
(
project
,
file
,
PsiAwareTextEditorProvider
.
this
);
if
(
finalState
!=
null
)
{
ApplicationManager
.
getApplication
().
runReadAction
(
new
Runnable
()
{
@Override
public
void
run
()
{
finalState
.
setToEditor
(
editor
.
getEditor
());
}
});
finalState
.
setToEditor
(
editor
.
getEditor
());
}
return
editor
;
}
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/FileEditorManagerImpl.java
+
5
-
0
View file @
eadc8899
...
...
@@ -733,6 +733,8 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
@Nullable
final
HistoryEntry
entry
,
final
boolean
current
,
final
boolean
focusEditor
,
final
Boolean
pin
,
final
int
index
)
{
ApplicationManager
.
getApplication
().
assertReadAccessAllowed
();
final
Ref
<
EditorWithProviderComposite
>
compositeRef
=
new
Ref
<
EditorWithProviderComposite
>();
UIUtil
.
invokeAndWaitIfNeeded
(
new
Runnable
()
{
...
...
@@ -777,6 +779,9 @@ public class FileEditorManagerImpl extends FileEditorManagerEx implements Projec
UIUtil
.
invokeAndWaitIfNeeded
(
new
Runnable
()
{
@Override
public
void
run
()
{
if
(
myProject
.
isDisposed
()
||
!
file
.
isValid
())
{
return
;
}
compositeRef
.
set
(
window
.
findFileComposite
(
file
));
boolean
newEditor
=
compositeRef
.
isNull
();
if
(
newEditor
)
{
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help