Exemplo n.º 1
0
  @Override
  public void run() {
    updateContributionIndex();
    updateLibrariesIndex();

    long updatablePlatforms =
        BaseNoGui.indexer
            .getPackages()
            .stream()
            .flatMap(pack -> pack.getPlatforms().stream())
            .filter(new UpdatablePlatformPredicate())
            .count();

    long updatableLibraries =
        BaseNoGui.librariesIndexer
            .getInstalledLibraries()
            .stream()
            .filter(new UpdatableLibraryPredicate())
            .count();

    if (updatableLibraries <= 0 && updatablePlatforms <= 0) {
      return;
    }

    String text;
    if (updatableLibraries > 0 && updatablePlatforms <= 0) {
      text =
          I18n.format(
              tr("Updates available for some of your {0}libraries{1}"),
              "<a href=\"http://librarymanager\">",
              "</a>");
    } else if (updatableLibraries <= 0 && updatablePlatforms > 0) {
      text =
          I18n.format(
              tr("Updates available for some of your {0}boards{1}"),
              "<a href=\"http://boardsmanager\">",
              "</a>");
    } else {
      text =
          I18n.format(
              tr("Updates available for some of your {0}boards{1} and {2}libraries{3}"),
              "<a href=\"http://boardsmanager\">",
              "</a>",
              "<a href=\"http://librarymanager\">",
              "</a>");
    }

    if (cancelled) {
      return;
    }

    SwingUtilities.invokeLater(
        () -> {
          notificationPopup =
              new NotificationPopup(base.getActiveEditor(), hyperlinkListener, text);
          notificationPopup.setVisible(true);
        });
  }