public boolean prepareToInstall(@Nullable ProgressIndicator indicator) throws IOException {
    ThreadingAssertions.assertBackgroundThread();
    myShownErrors = false;

    if (myFile != null) {
      IdeaPluginDescriptorImpl actualDescriptor = loadDescriptorFromArtifact();
      if (actualDescriptor == null) {
        reportError(IdeBundle.message("error.descriptor.load.failed", myFile.getPath()));
        return false;
      }

      myDescriptor = actualDescriptor;
      return true;
    }

    IdeaPluginDescriptor descriptor = null;
    if (!Boolean.getBoolean(StartupActionScriptManager.STARTUP_WIZARD_MODE) &&
        PluginManagerCore.isPluginInstalled(myPluginId)) {
      //store old plugins file
      descriptor = PluginManagerCore.getPlugin(myPluginId);
      LOG.assertTrue(descriptor != null);


      if (myPluginVersion != null) {
        int result = compareVersionsSkipBrokenAndIncompatible(myPluginVersion, descriptor);
        if (result < 0 && isDowngradeAllowed(descriptor)) {
          LOG.info("Preparing to downgrade plugin '" + myPluginId + "' : " + myPluginVersion + " -> " + descriptor.getVersion());
        }
        else if (result <= 0) {
          LOG.info("Plugin " + myPluginId + ": current version (max) " + myPluginVersion);
          return false;
        }
      }
      myOldFile = descriptor.isBundled() ? null : descriptor.getPluginPath();
    }

    try {
      myFile = tryDownloadPlugin(indicator);
    }
    catch (IOException e) {
      LOG.info(e);

      String message = e.getMessage();
      reportError(message != null ? message : IdeBundle.message("unknown.error"));
      return false;
    }

    boolean loaded = LoadingState.COMPONENTS_LOADED.isOccurred(); // plugins can be requested during initial IDE setup (e.g. in Rider initial setup wizard).
    if (loaded &&
        !PluginSignatureChecker.verifyIfRequired(myDescriptor, myFile, isFromMarketplace(), true)) {
      myShownErrors = true;
      return false;
    }

    IdeaPluginDescriptorImpl actualDescriptor = loadDescriptorFromArtifact();
    if (actualDescriptor == null) {
      reportError(IdeBundle.message("error.downloaded.descriptor.load.failed"));
      return false;
    }

    if (loaded &&
        InstalledPluginsState.getInstance().wasUpdated(actualDescriptor.getPluginId())) {
      reportError(IdeBundle.message("error.pending.update", getPluginName()));
      return false; //already updated
    }

    myPluginVersion = actualDescriptor.getVersion();
    if (descriptor != null) {
      int result = compareVersionsSkipBrokenAndIncompatible(myPluginVersion, descriptor);
      if (result < 0 && isDowngradeAllowed(descriptor)) {
        LOG.info("Downgrading plugin '" + myPluginId + "' : " + myPluginVersion + " -> " + descriptor.getVersion());
      }
      else if (result <= 0) {
        LOG.info("Plugin " + myPluginId + ": current version (max) " + myPluginVersion);
        reportError(IdeBundle.message("error.older.update", myPluginVersion, descriptor.getVersion()));
        return false; //was not updated
      }
    }

    myDescriptor = actualDescriptor;

    BuildNumber buildNumber = myBuildNumber != null ? myBuildNumber : PluginManagerCore.getBuildNumber();
    PluginLoadingError incompatibleError = PluginManagerCore.checkBuildNumberCompatibility(actualDescriptor, buildNumber);
    if (incompatibleError != null) {
      LOG.info("Plugin " + myPluginId + " is incompatible with current installation " +
               "(since:" + actualDescriptor.getSinceBuild() + " until:" + actualDescriptor.getUntilBuild() + ")");
      reportError(IdeBundle.message("error.incompatible.update", XmlStringUtil.escapeString(incompatibleError.getDetailedMessage())));
      return false; //host outdated plugins, no compatible plugin for new version
    }

    return true;
  }
public boolean prepareToInstall(@Nullable ProgressIndicator indicator)