mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
AstLoadingFilter: allow enabling loading for a file before disabling it
This commit is contained in:
@@ -144,9 +144,6 @@ public class AstLoadingFilter {
|
||||
|
||||
public static <T, E extends Throwable>
|
||||
T forceEnableTreeLoading(@NotNull VirtualFile virtualFile, @NotNull ThrowableComputable<T, E> computable) throws E {
|
||||
if (myDisabledInfo.get() == null) {
|
||||
throw new IllegalStateException("It's not allowed to force enable loading before it has been disabled");
|
||||
}
|
||||
Set<VirtualFile> enabledFiles = myForcedEnabledFiles.get();
|
||||
if (enabledFiles.add(virtualFile)) {
|
||||
try {
|
||||
|
||||
@@ -89,20 +89,4 @@ public class AstLoadingFilterTest extends LightPlatformCodeInsightFixtureTestCas
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public void testForceEnableLoadingBeforeDisabling() throws Throwable {
|
||||
PsiFileImpl file = addFile();
|
||||
assertFalse(file.isContentsLoaded());
|
||||
assertException(new AbstractExceptionCase<IllegalStateException>() {
|
||||
@Override
|
||||
public Class<IllegalStateException> getExpectedExceptionClass() {
|
||||
return IllegalStateException.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tryClosure() throws IllegalStateException {
|
||||
forceEnableTreeLoading(file, () -> file.getNode());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user