Exemplo n.º 1
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()]);
  }