Ejemplo n.º 1
0
  @Override
  public void aboutToBeShown() {
    super.aboutToBeShown();

    this.selectionListener =
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (!EEFButtonLifecycleManager.this.container.isRenderingInProgress()) {
              IStatus result = controller.pushed();
              if (result != null && result.getSeverity() == IStatus.ERROR) {
                EEFIdeUiPlugin.INSTANCE.log(result);
              } else {
                refresh();
              }
            }
          }
        };
    this.button.addSelectionListener(this.selectionListener);

    this.controller.onNewButtonLabel(
        new IConsumer<String>() {
          @Override
          public void apply(String value) {
            if (!button.isDisposed()
                && !(button.getText() != null && button.getText().equals(value))) {
              button.setText(Objects.firstNonNull(value, "")); // $NON-NLS-1$
            }
          }
        });
  }
Ejemplo n.º 2
0
  @Override
  public void aboutToBeHidden() {
    super.aboutToBeHidden();

    if (!button.isDisposed()) {
      this.button.removeSelectionListener(this.selectionListener);
    }
    this.controller.removeNewButtonLabelConsumer();
  }