public void run() { ApplicationManager.getApplication().runReadAction(cmd); } }
private static void readActionInPooledThread(@NotNull Runnable runnable) { ApplicationManager.getApplication().executeOnPooledThread(() -> ApplicationManager.getApplication().runReadAction(runnable)); }
private static void readActionInPooledThread(@NotNull Runnable runnable) { ApplicationManager.getApplication().executeOnPooledThread(() -> ApplicationManager.getApplication().runReadAction(runnable)); }
@NotNull public static Collection<VirtualFile> getYamlFiles(@NotNull Project project, @Nullable Module module) { UserDataHolder dataHolder = ObjectUtils.notNull(module, project); return CachedValuesManager.getManager(project).getCachedValue(dataHolder, () -> { Collection<VirtualFile> yamlFiles = ApplicationManager.getApplication().runReadAction(new Computable<Collection<VirtualFile>>() { @Override public Collection<VirtualFile> compute() { return FilenameIndex.getAllFilesByExt(project, "yaml", GoUtil.moduleScopeWithoutLibraries(project, module)); } }); return CachedValueProvider.Result.create(yamlFiles, getInstance(project)); }); } }
@Nullable @Override public String getSdkHomePath(@Nullable Module module) { ComponentManager holder = ObjectUtils.notNull(module, myProject); return CachedValuesManager.getManager(myProject).getCachedValue(holder, () -> CachedValueProvider.Result .create(ApplicationManager.getApplication().runReadAction(new Computable<String>() { @Nullable @Override public String compute() { LibraryTable table = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject); for (Library library : table.getLibraries()) { String libraryName = library.getName(); if (libraryName != null && libraryName.startsWith(LIBRARY_NAME)) { for (VirtualFile root : library.getFiles(OrderRootType.CLASSES)) { if (isGoSdkLibRoot(root)) { return libraryRootToSdkPath(root); } } } } return null; } }), this)); }
.append("\", \"points\": ["); if (!getSession().areBreakpointsMuted()) { ApplicationManager.getApplication().runReadAction(() -> { int size = breakpoints.size(); for (int i = 0; i < size; i++) {
@Nullable @Override public String getSdkHomePath(@Nullable Module module) { ComponentManager holder = ObjectUtils.notNull(module, myProject); return CachedValuesManager.getManager(myProject).getCachedValue(holder, () -> CachedValueProvider.Result .create(ApplicationManager.getApplication().runReadAction(new Computable<String>() { @Nullable @Override public String compute() { LibraryTable table = LibraryTablesRegistrar.getInstance().getLibraryTable(myProject); for (Library library : table.getLibraries()) { String libraryName = library.getName(); if (libraryName != null && libraryName.startsWith(LIBRARY_NAME)) { for (VirtualFile root : library.getFiles(OrderRootType.CLASSES)) { if (isBallerinaSdkLibRoot(root)) { return libraryRootToSdkPath(root); } } } } return null; } }), this)); }
ApplicationManager.getApplication().runReadAction(() -> { XBreakpoint<BallerinaBreakpointProperties> breakpoint = findBreakPoint(message.getLocation());
private void update() { ApplicationManager.getApplication().runReadAction(new Thread(this::updateTask)); }
private List<PsiFile> buildFilesList(final PsiManager psiManager, final VirtualFile virtualFile) { final List<PsiFile> allChildFiles = new ArrayList<>(); ApplicationManager.getApplication().runReadAction(() -> { final FindChildFiles visitor = new FindChildFiles(virtualFile, psiManager); VfsUtilCore.visitChildrenRecursively(virtualFile, visitor); allChildFiles.addAll(visitor.locatedFiles); }); return allChildFiles; }
@Override public void run(@NotNull final ProgressIndicator progressIndicator) { if (imageInformationList.isEmpty()) { return; } this.progressIndicator = progressIndicator; onPreExecute(); ApplicationManager.getApplication().runReadAction(new Runnable() { @Override public void run() { try { refactor(); } catch (ProcessCanceledException e) { FileUtils.deleteQuietly(ImageInformation.getTempDir()); } catch (Exception e) { LOGGER.error(e); } } }); }
@NotNull private Map<String, String> getRequestAttributes() { Map<String, String> requestAttributes = new HashMap<>(); String requestContent = getUrlContent(profilerUrl + "?panel=request"); String twigContent = getUrlContent(profilerUrl + "?panel=twig"); if(requestContent != null) { ApplicationManager.getApplication().runReadAction(() -> requestAttributes.putAll(ProfilerUtil.getRequestAttributes(project, requestContent)) ); } if(twigContent != null) { ApplicationManager.getApplication().runReadAction(() -> { Map<String, Integer> templates = getRenderedElementTwigTemplates(project, twigContent); if(templates.size() > 0) { requestAttributes.put("_template", templates.keySet().iterator().next()); } }); } return requestAttributes; }
public void convertSwaggerToHtmlAsync(@NotNull final PsiFile file) { executorService.submit( () -> ApplicationManager.getApplication() .runReadAction( () -> { try { convertSwaggerToHtmlWithCache(file, convertToJsonIfNecessary(file)); } catch (Exception e) { // This is a no-op; we don't want to notify the user if the // Swagger UI generation fails on file save. A user may // edit a spec file that is invalid on multiple saves, and // this would result in a large number of notifications. } })); }
@Nullable private static ScannableFile create(@NotNull final PsiFile psiFile, @Nullable final Module module) { try { final CreateScannableFileAction fileAction = new CreateScannableFileAction(psiFile, module); ApplicationManager.getApplication().runReadAction(fileAction); //noinspection ThrowableResultOfMethodCallIgnored if (fileAction.getFailure() != null) { throw fileAction.getFailure(); } return fileAction.getFile(); } catch (IOException e) { LOG.warn("Failure when creating temporary file", e); return null; } }
public static void collectRemoteFiles(final @NotNull Project project) { WebServerConfig defaultServer = PublishConfig.getInstance(project).findDefaultServer(); if(defaultServer == null) { return; } Deployable deployable = Deployable.create(defaultServer); RemoteConnection connection; try { connection = RemoteConnectionManager.getInstance().openConnection(ConnectionOwnerFactory.createConnectionOwner(project), "foo", deployable, FileTransferConfig.Origin.Default, null, null); } catch (FileSystemException e) { return; } for (final RemoteFileStorageInterface fileStorage : RemoteWebServerUtil.getExtension(project)) { final Collection<FileObject> contents = new ArrayList<>(); for (Object s : fileStorage.files(project)) { FileObject file; try { file = PublishUtils.findFile(connection.getFileSystem(), new WebServerConfig.RemotePath((String) s), deployable); } catch (FileSystemException e) { continue; } contents.add(file); } fileStorage.clear(); ApplicationManager.getApplication().runReadAction(() -> fileStorage.build(project, contents)); } connection.clone(); }
ApplicationManager.getApplication().runReadAction(scanAction);
ApplicationManager.getApplication().runReadAction(scanAction);
public static String getFindVocabFileNameFromGrammarFile(PsiFile file) { final FindVocabFileRunnable findVocabAction = new FindVocabFileRunnable(file); ApplicationManager.getApplication().runReadAction(findVocabAction); return findVocabAction.vocabName; }
@Override protected Response handle(final @NotNull Project project, @NotNull RequestMatcher requestMatcher) { final Collection<JsonConfigFile> files = new ArrayList<>(); ApplicationManager.getApplication().runReadAction(() -> { files.addAll(ExtensionProviderUtil.getJsonConfigs( project, ApplicationManager.getApplication().getComponent(PhpToolboxApplicationService.class) )); }); return new JsonResponse(files); } }
private void rememberChangedFile(final DocumentEvent e) { ApplicationManager.getApplication().invokeLater( () -> ApplicationManager.getApplication().runReadAction( () -> addFileFromEventToChangedFiles(e) ) ); }