private boolean prepareDependencies(@NotNull IdeaPluginDescriptor pluginNode,
                                      @NotNull List<PluginNode> dependencies,
                                      @NotNull @NonNls String titleKey,
                                      @NotNull @NonNls String messageKey,
                                      boolean askConfirmation) {
    if (dependencies.isEmpty()) {
      return true;
    }

    try {
      Ref<Boolean> result = new Ref<>(false);

      ApplicationManager.getApplication().invokeAndWait(() -> {
        synchronized (ourInstallLock) {
          InstalledPluginsState pluginsState = InstalledPluginsState.getInstance();
          Set<PluginId> dependenciesToShow = new LinkedHashSet<>();
          for (Iterator<PluginNode> iterator = dependencies.iterator(); iterator.hasNext(); ) {
            PluginId pluginId = iterator.next().getPluginId();
            ActionCallback callback = ourInstallCallbacks.get(pluginId);
            if (callback == null || callback.isRejected()) {
              if (pluginsState.wasInstalled(pluginId) || pluginsState.wasInstalledWithoutRestart(pluginId)) {
                iterator.remove();
                continue;
              }
              dependenciesToShow.add(pluginId);
            }
            else {
              myLocalWaitInstallCallbacks.put(pluginId, callback);
            }
          }

          if (dependenciesToShow.isEmpty()) {
            result.set(true);
            return;
          }

          if (!askConfirmation) {
            for (PluginId dependency : dependenciesToShow) {
              createInstallCallback(dependency);
            }
            result.set(true);
          }
          else {
            String deps = getPluginsText(dependencies);
            int dialogResult =
              Messages.showYesNoDialog(IdeBundle.message(messageKey, pluginNode.getName(), deps),
                                       IdeBundle.message(titleKey),
                                       IdeBundle.message("plugins.configurable.install"),
                                       Messages.getCancelButton(),
                                       Messages.getWarningIcon());

            result.set(dialogResult == Messages.YES);
            if (result.get()) {
              for (PluginId dependency : dependenciesToShow) {
                createInstallCallback(dependency);
              }
            }
          }
        }
      }, ModalityState.any());

      return dependencies.isEmpty() ||
             result.get() && prepareToInstall(dependencies);
    }
    catch (Exception e) {
      return false;
    }
  }
private boolean prepareDependencies(@NotNull IdeaPluginDescriptor pluginNode,
                                      @NotNull List<PluginNode> dependencies,
                                      @NotNull @NonNls String titleKey,
                                      @NotNull @NonNls String messageKey,
                                      boolean askConfirmation)