use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class MavenImportingTestCase method getModule.
protected Module getModule(final String name) {
AccessToken accessToken = ApplicationManager.getApplication().acquireReadActionLock();
try {
Module m = ModuleManager.getInstance(myProject).findModuleByName(name);
assertNotNull("Module " + name + " not found", m);
return m;
} finally {
accessToken.finish();
}
}
use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class HgGraftCommand method graft.
@Nullable
private HgCommandResult graft(@NotNull List<String> params) {
List<String> args = new ArrayList<>();
args.add("--log");
args.addAll(params);
AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject);
try {
HgCommandResult result = new HgCommandExecutor(myProject).executeInCurrentThread(myRepository.getRoot(), "graft", args);
myRepository.update();
return result;
} finally {
token.finish();
}
}
use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class HgMergeCommand method executeInCurrentThread.
@Nullable
private HgCommandResult executeInCurrentThread() {
HgPromptCommandExecutor commandExecutor = new HgPromptCommandExecutor(project);
commandExecutor.setShowOutput(true);
List<String> arguments = new LinkedList<>();
if (!StringUtil.isEmptyOrSpaces(revision)) {
arguments.add("--rev");
arguments.add(revision);
}
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
HgCommandResult result = commandExecutor.executeInCurrentThread(repo.getRoot(), "merge", arguments);
repo.update();
return result;
} finally {
token.finish();
}
}
use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class HgRebaseCommand method performRebase.
@Nullable
private HgCommandResult performRebase(@NotNull String... args) {
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
final List<String> list = ContainerUtil.newArrayList(args);
list.add("--config");
list.add("extensions.rebase=");
HgCommandResult result = new HgCommandExecutor(project).executeInCurrentThread(repo.getRoot(), "rebase", list);
repo.update();
return result;
} finally {
token.finish();
}
}
use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class ConfigurationUtil method addAnnotatedMethodsAnSubclasses.
private static boolean addAnnotatedMethodsAnSubclasses(final GlobalSearchScope scope, final TestClassFilter testClassFilter, @Nullable final Module module, final Set<PsiClass> found, final Set<PsiClass> processed, final String annotation, final Project project) {
final Ref<Boolean> isJUnit4 = new Ref<>(Boolean.FALSE);
// annotated with @Test
final PsiClass testAnnotation = ReadAction.compute(() -> JavaPsiFacade.getInstance(project).findClass(annotation, GlobalSearchScope.allScope(project)));
if (testAnnotation != null) {
//allScope is used to find all abstract test cases which probably have inheritors in the current 'scope'
GlobalSearchScope allScope = module == null ? GlobalSearchScope.allScope(project) : module.getModuleRuntimeScope(true);
ClassesWithAnnotatedMembersSearch.search(testAnnotation, allScope).forEach(annotated -> {
AccessToken token = ReadAction.start();
try {
if (!processed.add(annotated)) {
return true;
}
final VirtualFile file = PsiUtilCore.getVirtualFile(annotated);
if (file != null && scope.contains(file) && testClassFilter.isAccepted(annotated)) {
if (!found.add(annotated)) {
return true;
}
isJUnit4.set(Boolean.TRUE);
}
} finally {
token.finish();
}
ClassInheritorsSearch.search(annotated, scope, true, true, false).forEach(new ReadActionProcessor<PsiClass>() {
@Override
public boolean processInReadAction(PsiClass aClass) {
if (testClassFilter.isAccepted(aClass)) {
found.add(aClass);
processed.add(aClass);
isJUnit4.set(Boolean.TRUE);
}
return true;
}
});
return true;
});
}
return isJUnit4.get().booleanValue();
}
Aggregations