/** Creates a new instance. */
 public UnderlineAction(final IRichText richText) {
   super(richText, IAction.AS_CHECK_BOX);
   setImageDescriptor(RichTextImages.IMG_DESC_UNDERLINE);
   setDisabledImageDescriptor(RichTextImages.DISABLED_IMG_DESC_UNDERLINE);
   setToolTipText(RichTextResources.underlineAction_toolTipText);
   // add listener
   richText.addListener(
       SWT.SELECTED,
       new Listener() {
         public void handleEvent(Event event) {
           setChecked(richText.getSelected().isUnderLine());
         }
       });
 }
  /** Creates a new instance. */
  public RemoveFormatAction(final IRichText richText) {
    super(richText, IAction.AS_CHECK_BOX);
    this.setEnabled(false);
    setImageDescriptor(RichTextImages.IMG_DESC_CLEAR_FORMATTING);
    setToolTipText(RichTextResources.removeFormatAction_toolTipText);
    richText.addListener(
        SWT.SELECTED,
        new Listener() {

          public void handleEvent(Event event) {
            if (richText.getSelected().getText().length() >= 1) setEnabled(true);
            else setEnabled(false);
          }
        });
  }
 /**
  * Executes the action.
  *
  * @param richText a rich text control
  */
 public void execute(IRichText richText) {
   if (richText != null) {
     richText.executeCommand(RichTextCommand.REMOVE_FORMAT, "2");
   }
 }
 /**
  * Executes the action.
  *
  * @param richText a rich text control
  */
 public void execute(IRichText richText) {
   if (richText != null) {
     richText.executeCommand(RichTextCommand.UNDERLINE);
   }
 }