public void setAction(final Action action) {
    if (this.action != null) {
      removeActionListener(this.action);
      action.removePropertyChangeListener(this);
    }
    this.action = action;
    String imgName = LARGE_ICONS.equals(iconDisplay) ? (String) action.getValue(Action.IMAGE_PATH) :
      	( SMALL_ICONS.equals(iconDisplay) ? (String) action.getValue(Action.SMALL_IMAGE_PATH) : null);
    Image img = null;
    if (imgName != null) {
      img = UIUtil.loadImage(action.getClass(), imgName);
      if (img != null) {
        setImage(UIUtil.waitFor(img, this));
      }
    }
    Boolean hide = (Boolean) action.getValue(Action.HIDE_TOOLBAR_TEXT);
    setToolTipText((String)action.getValue(Action.LONG_DESCRIPTION));
    setText( (String) action.getValue(Action.NAME));
    //	Also show text if icons were requested but this one is not available - prevents empty buttons
    setTextVisible( img == null || SHOW_TEXT.equals(textDisplay) || ( SELECTIVE_TEXT.equals(textDisplay) && ( hide == null || !hide.booleanValue() ) ));
    addActionListener(action);
    setEnabled(action.isEnabled());
    action.addPropertyChangeListener(this);
  }