Package org.eclipse.swtbot.swt.finder.widgets

Source Code of org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton

/*******************************************************************************
* Copyright (c) 2008, 2009 Ketan Padegaonkar and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*     Ketan Padegaonkar - initial API and implementation
*******************************************************************************/
package org.eclipse.swtbot.swt.finder.widgets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.results.BoolResult;
import org.hamcrest.SelfDescribing;

/**
* @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com>
* @version $Id$
*/
public abstract class SWTBotToolbarButton extends AbstractSWTBot<ToolItem> {

  /**
   * Constructs an new instance of this item.
   *
   * @param w the tool item.
   * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed.
   */
  public SWTBotToolbarButton(ToolItem w) throws WidgetNotFoundException {
    this(w, null);
  }

  /**
   * Constructs an new instance of this item.
   *
   * @param w the tool item.
   * @param description the description of the widget, this will be reported by {@link #toString()}
   * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed.
   */
  public SWTBotToolbarButton(ToolItem w, SelfDescribing description) throws WidgetNotFoundException {
    super(w, description);
  }

  /**
   * Click on the tool item.
   *
   * @since 1.0
   */
  public abstract SWTBotToolbarButton click();

  protected void sendNotifications() {
    notify(SWT.MouseEnter);
    notify(SWT.MouseMove);
    notify(SWT.Activate);
    notify(SWT.MouseDown);
    notify(SWT.MouseUp);
    notify(SWT.Selection);
    notify(SWT.MouseHover);
    notify(SWT.MouseMove);
    notify(SWT.MouseExit);
    notify(SWT.Deactivate);
    notify(SWT.FocusOut);
  }
 
  @Override
  public boolean isEnabled() {
    return syncExec(new BoolResult() {
      public Boolean run() {
        return widget.isEnabled();
      }
    });
  }
}
TOP

Related Classes of org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.