Search in sources :

Example 16 with ReadAction

use of com.intellij.openapi.application.ReadAction in project intellij by bazelbuild.

the class TestFileSystem method getPsiFile.

/**
 * Finds PsiFile, and asserts that it's not null.
 */
// #api203: remove "@SuppressWarnings({"rawtypes", "RedundantSuppression"})"
@SuppressWarnings({ "rawtypes", "RedundantSuppression" })
public PsiFile getPsiFile(VirtualFile file) {
    return new ReadAction<PsiFile>() {

        @Override
        protected void run(// #api203 replace with "Result<? super PsiFile>"
        Result result) {
            PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
            assertThat(psiFile).isNotNull();
            result.setResult(psiFile);
        }
    }.execute().getResultObject();
}
Also used : ReadAction(com.intellij.openapi.application.ReadAction) PsiFile(com.intellij.psi.PsiFile) Result(com.intellij.openapi.application.Result)

Aggregations

ReadAction (com.intellij.openapi.application.ReadAction)16 Result (com.intellij.openapi.application.Result)16 VirtualFile (com.intellij.openapi.vfs.VirtualFile)7 NotNull (org.jetbrains.annotations.NotNull)7 Module (com.intellij.openapi.module.Module)3 GenericCompilerCache (com.intellij.compiler.impl.generic.GenericCompilerCache)2 Notification (com.intellij.notification.Notification)2 RunResult (com.intellij.openapi.application.RunResult)2 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)2 Project (com.intellij.openapi.project.Project)2 Artifact (com.intellij.packaging.artifacts.Artifact)2 THashSet (gnu.trove.THashSet)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 GradleBuildModel (com.android.tools.idea.gradle.dsl.model.GradleBuildModel)1 GradleInvocationResult (com.android.tools.idea.gradle.project.build.invoker.GradleInvocationResult)1 GradleBuildModelFixture (com.android.tools.idea.tests.gui.framework.fixture.gradle.GradleBuildModelFixture)1 GenericCompilerPersistentData (com.intellij.compiler.impl.generic.GenericCompilerPersistentData)1 NotificationListener (com.intellij.notification.NotificationListener)1 WriteCommandAction (com.intellij.openapi.command.WriteCommandAction)1