@Override public boolean visitFile(@NotNull VirtualFile file) { return ReadAction.compute(() -> { boolean proceedToChildren; if (fileTypeManager.isFileIgnored(file)) { proceedToChildren = false; } else { proceedToChildren = true; if (file.isDirectory()) { propertiesUpdater.findAndUpdateValue(file, LevelPropertyPusher.this, level); } } return proceedToChildren; }); } });
@Override public void performInDumbMode(@NotNull ProgressIndicator indicator) { if (!project.isDisposed()) { final PerformanceWatcher.Snapshot snapshot = PerformanceWatcher.takeSnapshot(); final List<Runnable> tasks = ReadAction.compute(() -> rootUpdateTaskList(project, sdkSet)); PushedFilePropertiesUpdaterImpl.invokeConcurrentlyIfPossible(tasks); if (!ApplicationManager.getApplication().isUnitTestMode()) { snapshot.logResponsivenessSinceCreation( "Pushing Elixir language level to " + tasks.size() + " roots in " + sdkSet.size() + " SDKs"); } } } };
@Override public void run() { if (project.isDisposed() || !ReadAction.compute(root::isValid)) return; final FileTypeManager fileTypeManager = FileTypeManager.getInstance(); final PushedFilePropertiesUpdater propertiesUpdater = PushedFilePropertiesUpdater.getInstance(project); VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor() { @Override public boolean visitFile(@NotNull VirtualFile file) { return ReadAction.compute(() -> { boolean proceedToChildren; if (fileTypeManager.isFileIgnored(file)) { proceedToChildren = false; } else { proceedToChildren = true; if (file.isDirectory()) { propertiesUpdater.findAndUpdateValue(file, LevelPropertyPusher.this, level); } } return proceedToChildren; }); } }); }
public void process(final SonarLintJob job, ProgressIndicator indicator, final Collection<Issue> rawIssues, Collection<ClientInputFile> failedAnalysisFiles) { long start = System.currentTimeMillis(); Map<VirtualFile, Collection<LiveIssue>> transformedIssues = ReadAction.compute(() -> { Map<VirtualFile, Collection<LiveIssue>> issues = transformIssues(rawIssues, job.allFiles(), failedAnalysisFiles);
private static void showMissingLibraryNotification(@NotNull Project project, @NotNull Sdk sdk, @NotNull String libraryName) { Notification notification = new Notification( PerlBundle.message("perl.missing.library.notification"), PerlBundle.message("perl.missing.library.notification.title", libraryName), PerlBundle.message("perl.missing.library.notification.message", libraryName), NotificationType.ERROR ); AnAction installCpanmAction = ReadAction .compute(() -> CpanminusAdapter.createInstallAction(sdk, project, Collections.singletonList(libraryName), notification::expire)); if (installCpanmAction != null) { notification.addAction(installCpanmAction); } notification.addAction(CpanAdapter.createInstallAction(sdk, project, Collections.singletonList(libraryName), notification::expire)); Notifications.Bus.notify(notification, project); }
private static void showMissingLibraryNotification(@NotNull Project project, @NotNull Sdk sdk, @NotNull Collection<String> packageNames) { if (packageNames.isEmpty()) { return; } if (packageNames.size() == 1) { showMissingLibraryNotification(project, sdk, packageNames.iterator().next()); return; } Notification notification = new Notification( PerlBundle.message("perl.missing.library.notification"), PerlBundle.message("perl.missing.library.notification.title", packageNames.size()), StringUtil.join(ContainerUtil.sorted(packageNames), ", "), NotificationType.ERROR ); AnAction installCpanmAction = ReadAction.compute(() -> CpanminusAdapter.createInstallAction(sdk, project, packageNames, notification::expire)); if (installCpanmAction != null) { notification.addAction(installCpanmAction); } notification.addAction(CpanAdapter.createInstallAction(sdk, project, packageNames, notification::expire)); Notifications.Bus.notify(notification, project); }
@Nullable private PerlCommandLine getPerlTidyCommandLine(@NotNull Project project) throws ExecutionException { PerlSharedSettings sharedSettings = PerlSharedSettings.getInstance(project); VirtualFile perlTidyScript = ReadAction.compute(() -> PerlRunUtil.findLibraryScriptWithNotification(project, SCRIPT_NAME, PACKAGE_NAME)); if (perlTidyScript == null) { return null; } PerlCommandLine commandLine = PerlRunUtil.getPerlCommandLine(project, perlTidyScript); if (commandLine == null) { return null; } commandLine.withParameters("-st", "-se").withWorkDirectory(project.getBasePath()); if (StringUtil.isNotEmpty(sharedSettings.PERL_TIDY_ARGS)) { commandLine.addParameters(StringUtil.split(sharedSettings.PERL_TIDY_ARGS, " ")); } return commandLine; }
@Nullable protected PerlCommandLine getPerlCriticCommandLine(Project project) throws ExecutionException { PerlSharedSettings sharedSettings = PerlSharedSettings.getInstance(project); VirtualFile perlCriticScript = ReadAction.compute(() -> PerlRunUtil.findLibraryScriptWithNotification(project, SCRIPT_NAME, PACKAGE_NAME)); if (perlCriticScript == null) { return null; } PerlCommandLine commandLine = PerlRunUtil.getPerlCommandLine(project, perlCriticScript); if (commandLine == null) { return null; } commandLine.withWorkDirectory(project.getBasePath()); if (StringUtil.isNotEmpty(sharedSettings.PERL_CRITIC_ARGS)) { commandLine.addParameters(StringUtil.split(sharedSettings.PERL_CRITIC_ARGS, " ")); } return commandLine; }
byte[] sourceBytes = ReadAction.compute(sourcePsiFile::getPerlContentInBytes); if (sourceBytes == null) { return null;
@Override public void run(@NotNull ProgressIndicator indicator) { indicator.setIndeterminate(true); Map<String, Long> newFilesMap = ReadAction.compute(() -> { if (myProject.isDisposed()) { return null;
PerlCommandLine perlCommandLine = ReadAction.compute(() -> { if (project.isDisposed()) { return null;