private void on()

in src/main/java/com/googlesource/gerrit/plugins/emoticons/client/OnEditEnabler.java [141:169]


  private void on(GwtEvent<?> e) {
    if (widget.isEnabled()
        || !(e.getSource() instanceof FocusWidget)
        || !((FocusWidget) e.getSource()).isEnabled()) {
      if (e.getSource() instanceof ValueBoxBase) {
        final TextBoxBase box = ((TextBoxBase) e.getSource());
        Scheduler.get()
            .scheduleDeferred(
                new ScheduledCommand() {
                  @Override
                  public void execute() {
                    if (box.getValue().trim().equals(originalValue)) {
                      widget.setEnabled(false);
                    }
                  }
                });
      }
      return;
    }

    if (e.getSource() instanceof TextBoxBase) {
      onTextBoxBase((TextBoxBase) e.getSource());
    } else {
      // For many widgets, we can assume that a change is an edit. If
      // a widget does not work that way, it should be special cased
      // above.
      widget.setEnabled(true);
    }
  }