use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class GithubRebaseAction method rebaseCurrentBranch.
private static void rebaseCurrentBranch(@NotNull final Project project, @NotNull final GitRepository gitRepository, @NotNull final ProgressIndicator indicator) {
final Git git = ServiceManager.getService(project, Git.class);
AccessToken token = DvcsUtil.workingTreeChangeStarted(project);
try {
List<VirtualFile> rootsToSave = Collections.singletonList(gitRepository.getRoot());
GitPreservingProcess process = new GitPreservingProcess(project, git, rootsToSave, "Rebasing", "upstream/master", GitVcsSettings.UpdateChangesPolicy.STASH, indicator, () -> {
doRebaseCurrentBranch(project, gitRepository.getRoot(), indicator);
});
process.execute();
} finally {
token.finish();
}
}
use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class GradleStartupActivity method runActivity.
@Override
public void runActivity(@NotNull final Project project) {
configureBuildClasspath(project);
showNotificationForUnlinkedGradleProject(project);
final GradleResourceCompilerConfigurationGenerator buildConfigurationGenerator = new GradleResourceCompilerConfigurationGenerator(project);
CompilerManager.getInstance(project).addBeforeTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
AccessToken token = ReadAction.start();
try {
buildConfigurationGenerator.generateBuildConfiguration(context);
} finally {
token.finish();
}
return true;
}
});
}
use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class GradleCompilingTestCase method setUpInWriteAction.
@Override
protected void setUpInWriteAction() throws Exception {
super.setUpInWriteAction();
final GradleResourceCompilerConfigurationGenerator buildConfigurationGenerator = new GradleResourceCompilerConfigurationGenerator(myProject);
CompilerManager.getInstance(myProject).addBeforeTask(new CompileTask() {
@Override
public boolean execute(CompileContext context) {
AccessToken token = ReadAction.start();
try {
buildConfigurationGenerator.generateBuildConfiguration(context);
} finally {
token.finish();
}
return true;
}
});
}
use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class GradleClassFinderTest method testClassesFilter.
@Test
public void testClassesFilter() throws Exception {
createProjectSubFile("settings.gradle", "rootProject.name = 'multiproject'\n" + "include ':app'");
// app module files
createProjectSubFile("app/src/main/groovy/App.groovy", "class App {}");
// buildSrc module files
createProjectSubFile("buildSrc/src/main/groovy/org/buildsrc/BuildSrcClass.groovy", "package org.buildsrc;\n" + "import groovy.util.AntBuilder;\n" + "public class BuildSrcClass {}");
importProject("subprojects {\n" + " apply plugin: 'groovy'\n" + "}");
assertModules("multiproject", "app", "app_main", "app_test", "buildSrc", "buildSrc_main", "buildSrc_test");
Module buildSrcModule = getModule("buildSrc_main");
assertNotNull(buildSrcModule);
final AccessToken accessToken = ReadAction.start();
try {
PsiClass[] appClasses = JavaPsiFacade.getInstance(myProject).findClasses("App", GlobalSearchScope.allScope(myProject));
assertEquals(1, appClasses.length);
PsiClass[] buildSrcClasses = JavaPsiFacade.getInstance(myProject).findClasses("org.buildsrc.BuildSrcClass", GlobalSearchScope.moduleScope(buildSrcModule));
assertEquals(1, buildSrcClasses.length);
} finally {
accessToken.finish();
}
}
use of com.intellij.openapi.application.AccessToken in project intellij-community by JetBrains.
the class MavenRunner method runBatch.
public boolean runBatch(List<MavenRunnerParameters> commands, @Nullable MavenGeneralSettings coreSettings, @Nullable MavenRunnerSettings runnerSettings, @Nullable final String action, @Nullable ProgressIndicator indicator) {
LOG.assertTrue(!ApplicationManager.getApplication().isReadAccessAllowed());
if (commands.isEmpty())
return true;
MavenConsole console;
AccessToken accessToken = ReadAction.start();
try {
if (myProject.isDisposed())
return false;
console = createConsole();
} finally {
accessToken.finish();
}
try {
int count = 0;
for (MavenRunnerParameters command : commands) {
if (indicator != null) {
indicator.setFraction(((double) count++) / commands.size());
}
MavenExecutor executor;
accessToken = ReadAction.start();
try {
if (myProject.isDisposed())
break;
executor = createExecutor(command, coreSettings, runnerSettings, console);
} finally {
accessToken.finish();
}
executor.setAction(action);
if (!executor.execute(indicator)) {
updateTargetFolders();
return false;
}
}
updateTargetFolders();
} finally {
console.finish();
}
return true;
}
Aggregations