| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| SWTBotToolbarSeparatorButton |
|
| 1.0;1 |
| 1 | 0 | /******************************************************************************* |
| 2 | * Copyright (c) 2009 Obeo and others. | |
| 3 | * All rights reserved. This program and the accompanying materials | |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 | |
| 5 | * which accompanies this distribution, and is available at | |
| 6 | * http://www.eclipse.org/legal/epl-v10.html | |
| 7 | * | |
| 8 | * Contributors: | |
| 9 | * Mariot Chauvin <mariot.chauvin@obeo.fr> - initial API and implementation | |
| 10 | *******************************************************************************/ | |
| 11 | package org.eclipse.swtbot.swt.finder.widgets; | |
| 12 | ||
| 13 | import org.eclipse.swt.SWT; | |
| 14 | import org.eclipse.swt.widgets.ToolItem; | |
| 15 | import org.eclipse.swtbot.swt.finder.ReferenceBy; | |
| 16 | import org.eclipse.swtbot.swt.finder.SWTBotWidget; | |
| 17 | import org.eclipse.swtbot.swt.finder.Style; | |
| 18 | import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; | |
| 19 | import org.eclipse.swtbot.swt.finder.utils.MessageFormat; | |
| 20 | import org.eclipse.swtbot.swt.finder.utils.SWTUtils; | |
| 21 | import org.eclipse.swtbot.swt.finder.utils.internal.Assert; | |
| 22 | import org.hamcrest.SelfDescribing; | |
| 23 | ||
| 24 | /** | |
| 25 | * This represents a toolbar item that is a separator. | |
| 26 | * | |
| 27 | * @author Ketan Padegaonkar <KetanPadegaonkar [at] gmail [dot] com> | |
| 28 | * @version $Id: SWTBotToolbarDropDownButton.java 431 2009-11-06 07:11:15Z kpadegaonka $ | |
| 29 | * @since 2.0 | |
| 30 | */ | |
| 31 | @SWTBotWidget(clasz = ToolItem.class, preferredName = "toolbarSeparatorButton", style = @Style(name = "SWT.SEPARATOR", value = SWT.SEPARATOR), referenceBy = { | |
| 32 | ReferenceBy.MNEMONIC, ReferenceBy.TOOLTIP }, returnType = SWTBotToolbarButton.class) | |
| 33 | public class SWTBotToolbarSeparatorButton extends SWTBotToolbarButton { | |
| 34 | ||
| 35 | /** | |
| 36 | * Constructs an new instance of this item. | |
| 37 | * | |
| 38 | * @param w the tool item. | |
| 39 | * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed. | |
| 40 | */ | |
| 41 | public SWTBotToolbarSeparatorButton(ToolItem w) throws WidgetNotFoundException { | |
| 42 | 0 | this(w, null); |
| 43 | 0 | } |
| 44 | ||
| 45 | /** | |
| 46 | * Constructs an new instance of this item. | |
| 47 | * | |
| 48 | * @param w the tool item. | |
| 49 | * @param description the description of the widget, this will be reported by {@link #toString()} | |
| 50 | * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed. | |
| 51 | */ | |
| 52 | public SWTBotToolbarSeparatorButton(ToolItem w, SelfDescribing description) throws WidgetNotFoundException { | |
| 53 | 0 | super(w, description); |
| 54 | 0 | Assert.isTrue(SWTUtils.hasStyle(w, SWT.SEPARATOR), "Expecting a separator button."); //$NON-NLS-1$ |
| 55 | ||
| 56 | 0 | } |
| 57 | ||
| 58 | /** | |
| 59 | * Click on the tool item. | |
| 60 | * | |
| 61 | * @since 2.0 | |
| 62 | */ | |
| 63 | public SWTBotToolbarSeparatorButton click() { | |
| 64 | 0 | log.debug(MessageFormat.format("Clicking on {0}", this)); //$NON-NLS-1$ |
| 65 | 0 | waitForEnabled(); |
| 66 | 0 | sendNotifications(); |
| 67 | 0 | log.debug(MessageFormat.format("Clicked on {0}", this)); //$NON-NLS-1$ |
| 68 | 0 | return this; |
| 69 | } | |
| 70 | } |