/*
   * @see IContributionItem#fill(Composite)
   */
  public void fill(Composite parent) {

    Label sep = new Label(parent, SWT.SEPARATOR);
    fLabel = new CLabel(parent, SWT.SHADOW_NONE);

    fLabel.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(DisposeEvent e) {
            fMouseListener = null;
          }
        });
    if (fActionHandler != null) {
      fMouseListener = new Listener();
      fLabel.addMouseListener(fMouseListener);
    }

    StatusLineLayoutData data = new StatusLineLayoutData();
    data.widthHint = getWidthHint(parent);
    fLabel.setLayoutData(data);

    data = new StatusLineLayoutData();
    data.heightHint = getHeightHint(parent);
    sep.setLayoutData(data);

    updateMessageLabel();
  }
  public void setActionHandler(IAction actionHandler) {
    if (fActionHandler != null && actionHandler == null && fMouseListener != null) {
      if (!fLabel.isDisposed()) fLabel.removeMouseListener(fMouseListener);
      fMouseListener = null;
    }

    fActionHandler = actionHandler;

    if (fLabel != null
        && !fLabel.isDisposed()
        && fMouseListener == null
        && fActionHandler != null) {
      fMouseListener = new Listener();
      fLabel.addMouseListener(fMouseListener);
    }
  }
예제 #3
0
 protected void initializeLabel(CLabel label) {
   label.addMouseListener(this.sortMouseAdapter);
 }