Search in sources :

Example 41 with EmptyProgressIndicator

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

the class SvnCachingRepositoryPoolTest method testCancel.

@Test
public void testCancel() throws Exception {
    final SvnIdeaRepositoryPoolManager poolManager = new SvnIdeaRepositoryPoolManager(true, null, null, 1, 1);
    final SVNURL url = SVNURL.parseURIEncoded("http://a.b.c");
    poolManager.setCreator(svnurl -> new MockSvnRepository(svnurl, ISVNSession.DEFAULT));
    final MockSvnRepository repository1 = (MockSvnRepository) poolManager.createRepository(url, true);
    final Semaphore semaphore = new Semaphore();
    semaphore.down();
    poolManager.setCreator(svnurl -> {
        semaphore.waitFor();
        return new MockSvnRepository(svnurl, ISVNSession.DEFAULT);
    });
    final SVNException[] exc = new SVNException[1];
    final Runnable target = () -> {
        try {
            final MockSvnRepository repository = (MockSvnRepository) poolManager.createRepository(url, true);
            repository.fireConnectionClosed();
        } catch (SVNException e) {
            e.printStackTrace();
            exc[0] = e;
        }
    };
    final EmptyProgressIndicator indicator = new EmptyProgressIndicator();
    Thread thread = new Thread(() -> ((ProgressManagerImpl) ProgressManager.getInstance()).executeProcessUnderProgress(target, indicator), "svn cache repo");
    thread.start();
    TimeoutUtil.sleep(10);
    Assert.assertTrue(thread.isAlive());
    indicator.cancel();
    final Object obj = new Object();
    while (!timeout(System.currentTimeMillis()) && thread.isAlive()) {
        synchronized (obj) {
            try {
                obj.wait(300);
            } catch (InterruptedException e) {
            //
            }
        }
    }
    Assert.assertTrue(!thread.isAlive());
    thread.join();
    Assert.assertNotNull(exc[0]);
    //repository1.fireConnectionClosed(); // also test that used are also closed.. in dispose
    poolManager.dispose();
    checkAfterDispose(poolManager);
}
Also used : EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) SVNURL(org.tmatesoft.svn.core.SVNURL) SvnIdeaRepositoryPoolManager(org.jetbrains.idea.svn.svnkit.lowLevel.SvnIdeaRepositoryPoolManager) Semaphore(com.intellij.util.concurrency.Semaphore) SVNException(org.tmatesoft.svn.core.SVNException) FileBasedTest(com.intellij.testFramework.vcs.FileBasedTest) Test(org.junit.Test)

Example 42 with EmptyProgressIndicator

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

the class SvnTestCase method getChangesInScope.

protected List<Change> getChangesInScope(final VcsDirtyScope dirtyScope) throws VcsException {
    ChangeProvider changeProvider = SvnVcs.getInstance(myProject).getChangeProvider();
    MockChangelistBuilder builder = new MockChangelistBuilder();
    changeProvider.getChanges(dirtyScope, builder, new EmptyProgressIndicator(), myGate);
    return builder.getChanges();
}
Also used : EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) MockChangelistBuilder(com.intellij.testFramework.vcs.MockChangelistBuilder)

Example 43 with EmptyProgressIndicator

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

the class PsiBuilderImpl method merge.

@NotNull
private DiffLog merge(@NotNull final ASTNode oldRoot, @NotNull StartMarker newRoot, @NotNull CharSequence lastCommittedText) {
    DiffLog diffLog = new DiffLog();
    DiffTreeChangeBuilder<ASTNode, LighterASTNode> builder = new ConvertFromTokensToASTBuilder(newRoot, diffLog);
    MyTreeStructure treeStructure = new MyTreeStructure(newRoot, null);
    ShallowNodeComparator<ASTNode, LighterASTNode> comparator = new MyComparator(getUserDataUnprotected(CUSTOM_COMPARATOR), treeStructure);
    ProgressIndicator indicator = ProgressIndicatorProvider.getGlobalProgressIndicator();
    BlockSupportImpl.diffTrees(oldRoot, builder, comparator, treeStructure, indicator == null ? new EmptyProgressIndicator() : indicator, lastCommittedText);
    return diffLog;
}
Also used : EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) DiffLog(com.intellij.psi.impl.source.text.DiffLog) NotNull(org.jetbrains.annotations.NotNull)

Example 44 with EmptyProgressIndicator

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

the class PomModelImpl method reparseFile.

@Nullable
private Runnable reparseFile(@NotNull final PsiFile file, @NotNull FileElement treeElement, @NotNull CharSequence newText) {
    TextRange changedPsiRange = DocumentCommitThread.getChangedPsiRange(file, treeElement, newText);
    if (changedPsiRange == null)
        return null;
    Runnable reparseLeaf = tryReparseOneLeaf(treeElement, newText, changedPsiRange);
    if (reparseLeaf != null)
        return reparseLeaf;
    final DiffLog log = BlockSupport.getInstance(myProject).reparseRange(file, treeElement, changedPsiRange, newText, new EmptyProgressIndicator(), treeElement.getText());
    return () -> runTransaction(new PomTransactionBase(file, getModelAspect(TreeAspect.class)) {

        @Nullable
        @Override
        public PomModelEvent runInner() throws IncorrectOperationException {
            return new TreeAspectEvent(PomModelImpl.this, log.performActualPsiChange(file));
        }
    });
}
Also used : EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator) ThrowableRunnable(com.intellij.util.ThrowableRunnable) TextRange(com.intellij.openapi.util.TextRange) PomTransactionBase(com.intellij.pom.impl.PomTransactionBase) IncorrectOperationException(com.intellij.util.IncorrectOperationException) PomModelEvent(com.intellij.pom.event.PomModelEvent) TreeAspectEvent(com.intellij.pom.tree.TreeAspectEvent) DiffLog(com.intellij.psi.impl.source.text.DiffLog) Nullable(org.jetbrains.annotations.Nullable) Nullable(org.jetbrains.annotations.Nullable)

Example 45 with EmptyProgressIndicator

use of com.intellij.openapi.progress.EmptyProgressIndicator in project kotlin by JetBrains.

the class MavenImportingTestCase method executeGoal.

protected void executeGoal(String relativePath, String goal) {
    VirtualFile dir = myProjectRoot.findFileByRelativePath(relativePath);
    MavenRunnerParameters rp = new MavenRunnerParameters(true, dir.getPath(), Arrays.asList(goal), Collections.<String>emptyList());
    MavenRunnerSettings rs = new MavenRunnerSettings();
    MavenExecutor e = new MavenExternalExecutor(myProject, rp, getMavenGeneralSettings(), rs, new SoutMavenConsole());
    e.execute(new EmptyProgressIndicator());
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) EmptyProgressIndicator(com.intellij.openapi.progress.EmptyProgressIndicator)

Aggregations

EmptyProgressIndicator (com.intellij.openapi.progress.EmptyProgressIndicator)46 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)14 NotNull (org.jetbrains.annotations.NotNull)14 VirtualFile (com.intellij.openapi.vfs.VirtualFile)9 IOException (java.io.IOException)6 ProgressManager (com.intellij.openapi.progress.ProgressManager)5 Test (org.junit.Test)5 StudioProgressIndicatorAdapter (com.android.tools.idea.sdk.progress.StudioProgressIndicatorAdapter)4 Processor (com.intellij.util.Processor)4 File (java.io.File)4 UpdatedFiles (com.intellij.openapi.vcs.update.UpdatedFiles)3 DiffLog (com.intellij.psi.impl.source.text.DiffLog)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Future (java.util.concurrent.Future)3 Nullable (org.jetbrains.annotations.Nullable)3 Disposable (com.intellij.openapi.Disposable)2 ApplicationManager (com.intellij.openapi.application.ApplicationManager)2 Logger (com.intellij.openapi.diagnostic.Logger)2 PluginId (com.intellij.openapi.extensions.PluginId)2