Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/generators/SWTBotEvent.java')
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/generators/SWTBotEvent.java113
1 files changed, 0 insertions, 113 deletions
diff --git a/org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/generators/SWTBotEvent.java b/org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/generators/SWTBotEvent.java
deleted file mode 100644
index 6df3edd3..00000000
--- a/org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/generators/SWTBotEvent.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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.recorder.generators;
-
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swtbot.swt.finder.utils.internal.Assert;
-import org.eclipse.swtbot.swt.recorder.methodargs.NullArgument;
-import org.eclipse.swtbot.swt.recorder.methodargs.SWTBotEventArguments;
-import org.eclipse.swtbot.swt.recorder.methodargs.StringArgument;
-import org.eclipse.swtbot.swt.recorder.methodargs.StringArrayArgument;
-
-/**
- * Represents an {@link Event} object as a method invocation on an SWTBot widget. For e.g. a click event on a button
- *
- * <pre>
- * SWTBotButton button = ...;
- * button.click();
- * </pre>
- *
- * is represented by <code>new SWTBotEvent("click")</code>
- *
- * @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt;
- * @version $Id$
- */
-public class SWTBotEvent {
-
- private final String methodCall;
- private final SWTBotEventArguments arguments;
-
- /**
- * @param methodCall the method to be invoked in order to generate an event, the method must not take any arguments.
- */
- public SWTBotEvent(String methodCall) {
- this(methodCall, new NullArgument());
- }
-
- /**
- * @param methodCall the method to be invoked in order to generate an event.
- * @param arguments the arguments that the method takes.
- */
- public SWTBotEvent(String methodCall, SWTBotEventArguments arguments) {
- if ((methodCall == null) || "".equals(methodCall.trim())) //$NON-NLS-1$
- throw new IllegalArgumentException("Argument cannot be empty or null"); //$NON-NLS-1$
- Assert.isNotNull(arguments);
- this.methodCall = methodCall;
- this.arguments = arguments;
- }
-
- /**
- * @param methodCall the method to be invoked in order to generate an event.
- * @param arg the string argument that the method takes.
- */
- public SWTBotEvent(String methodCall, String arg) {
- this(methodCall, new StringArgument(arg));
- }
-
- /**
- * @param methodCall the method to be invoked in order to generate an event.
- * @param arguments the string array that the method takes.
- */
- public SWTBotEvent(String methodCall, String[] arguments) {
- this(methodCall, new StringArrayArgument(arguments));
- }
-
- public String toString() {
- return methodCall();
- }
-
- /**
- * @return the {@link #methodCall()}
- */
- public String methodCall() {
- return methodCall;
- }
-
- /**
- * @return the arguments as a string.
- */
- public String args() {
- return arguments.asString();
- }
-
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- SWTBotEvent other = (SWTBotEvent) obj;
- return arguments.equals(other.arguments) && methodCall.equals(other.methodCall);
- }
-
- /**
- * This is useful when the user interacts with the same control multiple times, but only the last event is relevant;
- * or in case when multiple keystrokes in a textbox should generate one event with all the keystrokes.
- *
- * @param event the event to collate.
- * @return <code>true</code> if the specified event is similar to this instance.
- */
- public boolean canCollate(SWTBotEvent event) {
- return methodCall.equals(event.methodCall);
- }
-
-}

Back to the top