Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
55f00c1f
Commit
55f00c1f
authored
9 years ago
by
peter
Browse files
Options
Download
Email Patches
Plain Diff
allow dumb mode for all open projects (RUBY-16985)
parent
757b8523
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
platform/core-api/src/com/intellij/openapi/project/DumbService.java
+17
-0
...ore-api/src/com/intellij/openapi/project/DumbService.java
platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
+5
-18
...ntellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
+2
-0
...mpl/src/com/intellij/openapi/project/DumbServiceImpl.java
with
24 additions
and
18 deletions
+24
-18
platform/core-api/src/com/intellij/openapi/project/DumbService.java
+
17
-
0
View file @
55f00c1f
...
...
@@ -296,4 +296,21 @@ public abstract class DumbService {
void
exitDumbMode
();
}
/**
* Executes {@link #allowStartingDumbModeInside(DumbModePermission, Runnable)} for all given projects.
*/
public
static
void
allowStartingDumbModeInside
(
@NotNull
final
DumbModePermission
permission
,
@NotNull
Project
[]
projects
,
@NotNull
Runnable
runnable
)
{
for
(
final
Project
project
:
projects
)
{
final
Runnable
prevRunnable
=
runnable
;
runnable
=
new
Runnable
()
{
@Override
public
void
run
()
{
getInstance
(
project
).
allowStartingDumbModeInside
(
permission
,
prevRunnable
);
}
};
}
runnable
.
run
();
}
}
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
+
5
-
18
View file @
55f00c1f
...
...
@@ -133,32 +133,19 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
selectInTree
(
toSelect
,
true
);
}
Runnable
showRunnable
=
new
Runnable
()
{
// file chooser calls VFS refresh which might lead to rootsChanged in any open project and dumb mode that the clients don't expect.
// so if reindexing has to happen, let it happen under a modal progress and be finished before the file chooser returns.
// this hack should be gone if file chooser doesn't use VFS (https://youtrack.jetbrains.com/issue/IDEA-101218)
DumbService
.
allowStartingDumbModeInside
(
DumbModePermission
.
MAY_START_MODAL
,
ProjectManager
.
getInstance
().
getOpenProjects
(),
new
Runnable
()
{
@Override
public
void
run
()
{
show
();
}
};
// file chooser calls VFS refresh which might lead to rootsChanged in any open project and dumb mode that the clients don't expect.
// so if reindexing has to happen, let it happen under a modal progress and be finished before the file chooser returns.
// this hack should be gone if file chooser doesn't use VFS (https://youtrack.jetbrains.com/issue/IDEA-101218)
for
(
final
Project
eachProject
:
ProjectManager
.
getInstance
().
getOpenProjects
())
{
showRunnable
=
allowModalDumbModeInside
(
showRunnable
,
eachProject
);
}
showRunnable
.
run
();
});
return
myChosenFiles
;
}
@NotNull
private
static
Runnable
allowModalDumbModeInside
(
final
@NotNull
Runnable
runnable
,
@NotNull
final
Project
eachProject
)
{
return
new
Runnable
()
{
@Override
public
void
run
()
{
DumbService
.
getInstance
(
eachProject
).
allowStartingDumbModeInside
(
DumbModePermission
.
MAY_START_MODAL
,
runnable
);
}
};
}
@NotNull
@Override
...
...
This diff is collapsed.
Click to expand it.
platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java
+
2
-
0
View file @
55f00c1f
...
...
@@ -114,6 +114,8 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica
@Override
public
void
allowStartingDumbModeInside
(
@NotNull
DumbModePermission
permission
,
@NotNull
Runnable
runnable
)
{
ApplicationManager
.
getApplication
().
assertIsDispatchThread
();
LOG
.
assertTrue
(!
myProject
.
isDefault
(),
"Don't call allowStartingDumbModeInside for default project"
);
ModalityState
modality
=
ModalityState
.
current
();
DumbModePermission
prev
=
myPermissions
.
put
(
modality
,
permission
);
try
{
...
...
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