Exemplo n.º 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());
         }
       });
 }
Exemplo n.º 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);
          }
        });
  }
Exemplo n.º 3
0
 /**
  * Executes the action.
  *
  * @param richText a rich text control
  */
 public void execute(IRichText richText) {
   if (richText != null) {
     richText.executeCommand(RichTextCommand.REMOVE_FORMAT, "2");
   }
 }
Exemplo n.º 4
0
 /**
  * Executes the action.
  *
  * @param richText a rich text control
  */
 public void execute(IRichText richText) {
   if (richText != null) {
     richText.executeCommand(RichTextCommand.UNDERLINE);
   }
 }