예제 #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");
   }
 }
예제 #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();
  }
예제 #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()]);
  }