Exemplo n.º 1
0
 @Override
 protected String getOkButtonText() {
   if (hasPatch()) {
     return ApplicationManager.getApplication().isRestartCapable()
         ? IdeBundle.message("updates.download.and.install.patch.button.restart")
         : IdeBundle.message("updates.download.and.install.patch.button");
   } else if (myLatestBuild.getButtons().size() > 0) {
     return myLatestBuild.getButtons().get(0).getName();
   } else {
     return IdeBundle.message("updates.more.info.button");
   }
 }
Exemplo n.º 2
0
  @Override
  protected void doOKAction() {
    if (hasPatch()) {
      super.doOKAction();
      return;
    }

    if (myLatestBuild.getButtons().size() > 0) {
      BrowserUtil.launchBrowser(myLatestBuild.getButtons().get(0).getUrl());
    } else {
      openDownloadPage();
    }
    super.doOKAction();
  }
Exemplo n.º 3
0
  @NotNull
  @Override
  protected Action[] createActions() {
    List<Action> actions = new ArrayList<Action>();
    actions.add(getOKAction());

    final List<ButtonInfo> buttons = myLatestBuild.getButtons();

    if (hasPatch()) {
      if (buttons.isEmpty()) {
        actions.add(
            new AbstractAction(IdeBundle.message("updates.more.info.button")) {
              @Override
              public void actionPerformed(ActionEvent e) {
                openDownloadPage();
              }
            });
      } else {
        for (ButtonInfo info : buttons) {
          if (!info.isDownload()) {
            actions.add(new ButtonAction(info));
          }
        }
      }
    } else {
      // the first button replaces the OK action
      for (int i = 1; i < buttons.size(); i++) {
        actions.add(new ButtonAction(buttons.get(i)));
      }
    }
    actions.add(getCancelAction());
    actions.add(
        new AbstractAction("&Ignore This Update") {
          @Override
          public void actionPerformed(ActionEvent e) {
            UpdateSettings.getInstance()
                .getIgnoredBuildNumbers()
                .add(myLatestBuild.getNumber().asString());
            doCancelAction();
          }
        });

    return actions.toArray(new Action[buttons.size()]);
  }
  public NewChannelDialog(@NotNull UpdateChannel channel) {
    super(false);
    myChannel = channel;
    myLatestBuild = channel.getLatestBuild();
    assert myLatestBuild != null;

    LicensingFacade facade = LicensingFacade.getInstance();
    if (facade != null) {
      if (!myChannel.getLicensing().equals(UpdateChannel.LICENSING_EAP)) {
        Boolean paidUpgrade =
            facade.isPaidUpgrade(myChannel.getMajorVersion(), myLatestBuild.getReleaseDate());
        if (paidUpgrade == Boolean.TRUE) {
          myShowUpgradeButton = true;
          myLicenseInfo = IdeBundle.message("updates.channel.key.needed", myChannel.getEvalDays());
        } else if (paidUpgrade == Boolean.FALSE) {
          myLicenseInfo = IdeBundle.message("updates.channel.existing.key");
        }
      } else {
        myLicenseInfo = IdeBundle.message("updates.channel.bundled.key");
      }
    }

    init();
  }
Exemplo n.º 5
0
 private boolean hasPatch() {
   return myLatestBuild.findPatchForCurrentBuild() != null;
 }