void (@NotNull IdeaPluginDescriptor descriptor, @NotNull Object state) { if (!(descriptor instanceof PluginNode node) || node.getExternalPluginIdForScreenShots() == null || ApplicationManager.getApplication().isHeadlessEnvironment()) { handleImages(state, null); return; } List<String> screenShots = node.getScreenShots(); if (ContainerUtil.isEmpty(screenShots)) { handleImages(state, null); return; } ProcessIOExecutorService.INSTANCE.execute(() -> { List<BufferedImage> images = new ArrayList<>(); File parentDir = new File(PathManager.getPluginTempPath(), "imageCache/" + node.getExternalPluginIdForScreenShots()); for (String screenShot : screenShots) { try { String name = Objects.requireNonNull(StringUtil.substringAfterLast(screenShot, "/")); if (!name.contains(".")) { name += ".png"; } File imageFile = new File(parentDir, name); if (!imageFile.exists()) { if (ApplicationManager.getApplication().isDisposed()) { return; } HttpRequests.request(Urls.newFromEncoded(screenShot)).productNameAsUserAgent().saveToFile(imageFile, null); } try (InputStream stream = new FileInputStream(imageFile)) { BufferedImage image = ImageIO.read(stream); if (image == null) { Logger.getInstance(PluginImagesComponent.class) .info("=== Plugin: " + node.getPluginId() + " screenshot: " + name + " not loaded ==="); } else { images.add(image); } } catch (IOException e) { throw new IOException("Unable to read image file " + imageFile.getAbsolutePath(), e); } } catch (IOException e) { Logger.getInstance(PluginImagesComponent.class).error(e); } } ApplicationManager.getApplication().invokeLater(() -> handleImages(state, images), ModalityState.stateForComponent(this)); }); }