コード例 #1
0
 /** 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());
         }
       });
 }
コード例 #2
0
  /** 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);
          }
        });
  }