Search in sources :

Example 1 with DumbProgressIndicator

use of com.intellij.openapi.progress.DumbProgressIndicator in project android by JetBrains.

the class ConvertToWebpAction method convert.

public void convert(@NotNull Project project, @NotNull WebpConversionSettings settings, boolean showBalloon, @NotNull Collection<VirtualFile> files) {
    boolean isUnitTest = ApplicationManager.getApplication().isUnitTestMode();
    WebpConversionTask task = new WebpConversionTask(project, settings, showBalloon && !isUnitTest, files);
    if (isUnitTest) {
        // Do it immediately
        task.run(new DumbProgressIndicator());
        settings.previewConversion = false;
        task.onFinished();
    } else {
        ProgressManager.getInstance().run(task);
    }
}
Also used : DumbProgressIndicator(com.intellij.openapi.progress.DumbProgressIndicator)

Example 2 with DumbProgressIndicator

use of com.intellij.openapi.progress.DumbProgressIndicator in project intellij-community by JetBrains.

the class DetectAndAdjustIndentOptionsTask method scheduleInBackgroundForCommittedDocument.

public void scheduleInBackgroundForCommittedDocument() {
    if (myProject.isDisposed())
        return;
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        PsiDocumentManager.getInstance(myProject).commitDocument(myDocument);
        Continuation continuation = performInReadAction(new DumbProgressIndicator());
        if (continuation != null) {
            continuation.getAction().run();
        }
    } else {
        PsiDocumentManager manager = PsiDocumentManager.getInstance(myProject);
        manager.performForCommittedDocument(myDocument, () -> ProgressIndicatorUtils.scheduleWithWriteActionPriority(myExecutor, this));
    }
}
Also used : DumbProgressIndicator(com.intellij.openapi.progress.DumbProgressIndicator) PsiDocumentManager(com.intellij.psi.PsiDocumentManager)

Example 3 with DumbProgressIndicator

use of com.intellij.openapi.progress.DumbProgressIndicator in project intellij-community by JetBrains.

the class JUnit4IntegrationTest method before.

@Before
public void before() throws Throwable {
    EdtTestUtil.runInEdtAndWait(() -> {
        setUp();
        Module module = createEmptyModule();
        String communityPath = PlatformTestUtil.getCommunityPath().replace(File.separatorChar, '/');
        String methodName = myNameRule.getMethodName();
        methodName = methodName.substring(0, methodName.indexOf("["));
        String testDataPath = communityPath + File.separator + "plugins" + File.separator + "junit5_rt_tests" + File.separator + "testData" + File.separator + "integration" + File.separator + methodName;
        MavenId mavenId = new MavenId("junit", "junit", myJUnitVersion);
        MavenRepositoryInfo repositoryInfo = new MavenRepositoryInfo("maven", "maven", "http://maven.labs.intellij.net/repo1");
        RepositoryAttachHandler.doResolveInner(getProject(), mavenId, Collections.emptyList(), Collections.singleton(repositoryInfo), artifacts -> {
            for (MavenArtifact artifact : artifacts) {
                ModuleRootModificationUtil.addModuleLibrary(module, VfsUtilCore.pathToUrl(artifact.getPath()));
            }
            return true;
        }, new DumbProgressIndicator());
        ModuleRootModificationUtil.setModuleSdk(module, JavaAwareProjectJdkTableImpl.getInstanceEx().getInternalJdk());
        ModuleRootModificationUtil.updateModel(module, model -> {
            ContentEntry contentEntry = model.addContentEntry(VfsUtilCore.pathToUrl(testDataPath));
            contentEntry.addSourceFolder(VfsUtilCore.pathToUrl(testDataPath + File.separator + "test"), true);
            CompilerModuleExtension moduleExtension = model.getModuleExtension(CompilerModuleExtension.class);
            moduleExtension.inheritCompilerOutputPath(false);
            moduleExtension.setCompilerOutputPathForTests(VfsUtilCore.pathToUrl(testDataPath + File.separator + "out"));
        });
    });
}
Also used : MavenId(org.jetbrains.idea.maven.model.MavenId) ContentEntry(com.intellij.openapi.roots.ContentEntry) MavenRepositoryInfo(org.jetbrains.idea.maven.model.MavenRepositoryInfo) Module(com.intellij.openapi.module.Module) DumbProgressIndicator(com.intellij.openapi.progress.DumbProgressIndicator) MavenArtifact(org.jetbrains.idea.maven.model.MavenArtifact) CompilerModuleExtension(com.intellij.openapi.roots.CompilerModuleExtension) Before(org.junit.Before)

Aggregations

DumbProgressIndicator (com.intellij.openapi.progress.DumbProgressIndicator)3 Module (com.intellij.openapi.module.Module)1 CompilerModuleExtension (com.intellij.openapi.roots.CompilerModuleExtension)1 ContentEntry (com.intellij.openapi.roots.ContentEntry)1 PsiDocumentManager (com.intellij.psi.PsiDocumentManager)1 MavenArtifact (org.jetbrains.idea.maven.model.MavenArtifact)1 MavenId (org.jetbrains.idea.maven.model.MavenId)1 MavenRepositoryInfo (org.jetbrains.idea.maven.model.MavenRepositoryInfo)1 Before (org.junit.Before)1