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);
}
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();
}
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;
}
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));
}
});
}
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());
}
Aggregations