Fix deprecation warnings
Change-Id: I958fb9e5edf00e3d8bf3e4db893dc0377196e164
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
diff --git a/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/AllTests.java b/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/AllTests.java
index 927d4c2..570caac 100644
--- a/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/AllTests.java
+++ b/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Obeo
+ * Copyright (c) 2009, 2017 Obeo 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
@@ -298,7 +298,7 @@
@Test
public void deprecatedGetEditPartWithLabelOnCanvas() throws Exception {
editor.activateTool(TOOL_LABEL);
- editor.mouseMoveLeftClick(10, 10);
+ editor.click(10, 10);
SWTBotGefEditPart botPart = editor.getEditPart("Label");
assertNotNull(botPart);
assertTrue(botPart.part() instanceof LogicLabelEditPart);
@@ -307,9 +307,9 @@
@Test
public void deprecatedGetEditPartWithLabelInsideNode() throws Exception {
editor.activateTool(TOOL_CIRCUIT);
- editor.mouseMoveLeftClick(10, 10);
+ editor.click(10, 10);
editor.activateTool("Label");
- editor.mouseMoveLeftClick(10 + 3, 10 + 3);
+ editor.click(10 + 3, 10 + 3);
SWTBotGefEditPart botPart = editor.getEditPart("Label");
assertNotNull(botPart);
@@ -319,8 +319,8 @@
@Test
public void deprecatedDrag() throws Exception {
editor.activateTool(TOOL_LABEL);
- editor.mouseMoveLeftClick(10, 10);
- editor.mouseDrag("Label", 100, 110);
+ editor.click(10, 10);
+ editor.drag("Label", 100, 110);
Rectangle bounds = ((GraphicalEditPart) editor.getEditPart("Label").part()).getFigure().getBounds();
assertEquals(100, bounds.x);
diff --git a/examples/rcp/org.rcpmail.test/src/org/rcpmail/MyFirstTest.java b/examples/rcp/org.rcpmail.test/src/org/rcpmail/MyFirstTest.java
index 711cb28..decb107 100644
--- a/examples/rcp/org.rcpmail.test/src/org/rcpmail/MyFirstTest.java
+++ b/examples/rcp/org.rcpmail.test/src/org/rcpmail/MyFirstTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2017 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
@@ -10,7 +10,7 @@
*******************************************************************************/
package org.rcpmail;
-import org.eclipse.swtbot.eclipse.finder.SWTBotEclipseTestCase;
+import org.eclipse.swtbot.swt.finder.SWTBotTestCase;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.junit.After;
import org.junit.Before;
@@ -20,7 +20,7 @@
import junit.framework.AssertionFailedError;
@RunWith(SWTBotJunit4ClassRunner.class)
-public class MyFirstTest extends SWTBotEclipseTestCase {
+public class MyFirstTest extends SWTBotTestCase {
@Override
@Before
diff --git a/examples/rcp/org.rcpmail.test/src/org/rcpmail/MySecondTest.java b/examples/rcp/org.rcpmail.test/src/org/rcpmail/MySecondTest.java
index 3645a39..24b9fdf 100644
--- a/examples/rcp/org.rcpmail.test/src/org/rcpmail/MySecondTest.java
+++ b/examples/rcp/org.rcpmail.test/src/org/rcpmail/MySecondTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2017 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
@@ -11,14 +11,14 @@
package org.rcpmail;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.swtbot.eclipse.finder.SWTBotEclipseTestCase;
+import org.eclipse.swtbot.swt.finder.SWTBotTestCase;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(SWTBotJunit4ClassRunner.class)
-public class MySecondTest extends SWTBotEclipseTestCase {
+public class MySecondTest extends SWTBotTestCase {
@Test
public void ThatSWTBotDoesNotRunOnTheUIThread() throws Exception {
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/finders/CommandFinderTest.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/finders/CommandFinderTest.java
index f5e6b16..1dfc916 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/finders/CommandFinderTest.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/finders/CommandFinderTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2017 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
@@ -31,6 +31,7 @@
* @author @author Stephen Paulin <paulin [at] spextreme [dot] com>
* @version $Id$
*/
+@SuppressWarnings("deprecation")
@RunWith(SWTBotJunit4ClassRunner.class)
public class CommandFinderTest extends AbstractSWTBotEclipseTest {
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/views/SWTBotTestView.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/views/SWTBotTestView.java
index 17f0016..ab7088d 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/views/SWTBotTestView.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/views/SWTBotTestView.java
@@ -30,7 +30,7 @@
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -83,7 +83,7 @@
viewer = new TableViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
viewer.setContentProvider(new SWTBotTestContentProvider());
viewer.setLabelProvider(new SWTBotTestLabelProvider());
- viewer.setSorter(new ViewerSorter());
+ viewer.setComparator(new ViewerComparator());
List<SWTBotTestData> data = new ArrayList<SWTBotTestData>();
data.add(new SWTBotTestData("Test Data 1"));
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotEclipseTestCase.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotEclipseTestCase.java
index 1d32d19..74f43bd 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotEclipseTestCase.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotEclipseTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2017 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
@@ -20,6 +20,7 @@
* @version $Id$
* @since 1.2
*/
+@Deprecated
public abstract class SWTBotEclipseTestCase extends SWTBotTestCase {
/**
* An instance of SWTEclipseBot.
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotCommand.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotCommand.java
index 0f83799..92855a7 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotCommand.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotCommand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2017 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
@@ -16,6 +16,8 @@
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotRootMenu;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.handlers.IHandlerService;
@@ -25,7 +27,11 @@
* @author @author Stephen Paulin <paulin [at] spextreme [dot] com>
* @version $Id$
* @since 1.2
+ * @deprecated Use {@link SWTBotView#viewMenu()} and
+ * {@link SWTBotRootMenu#menu(String...)} to get a
+ * {@link SWTBotMenu} instead.
*/
+@Deprecated
public class SWTBotCommand extends SWTBotViewMenu {
private IHandlerService handlerService = null;
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java
index 5127363..d09915e 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2017 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
@@ -24,8 +24,6 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
-import org.eclipse.swtbot.eclipse.finder.finders.CommandFinder;
-import org.eclipse.swtbot.eclipse.finder.finders.ViewMenuFinder;
import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.eclipse.finder.widgets.utils.PartLabelDescription;
import org.eclipse.swtbot.swt.finder.SWTBot;
@@ -49,7 +47,6 @@
*/
public class SWTBotView extends SWTBotWorkbenchPart<IViewReference> {
- private final ViewMenuFinder menuFinder;
/**
* Creates an instance of a view part.
*
@@ -70,7 +67,6 @@
*/
public SWTBotView(IViewReference partReference, SWTWorkbenchBot bot, SelfDescribing description) {
super(partReference, bot, description);
- this.menuFinder = new ViewMenuFinder();
}
@Override
@@ -142,7 +138,7 @@
*/
@Deprecated
public List<SWTBotViewMenu> menus() {
- return menuFinder.findMenus(partReference, anything(), true);
+ return new org.eclipse.swtbot.eclipse.finder.finders.ViewMenuFinder().findMenus(partReference, anything(), true);
}
/**
@@ -172,9 +168,9 @@
@Deprecated
public SWTBotViewMenu menu(String label, int index) throws WidgetNotFoundException {
try {
- List<SWTBotViewMenu> menuItems = menuFinder.findMenus(partReference, withMnemonic(label), true);
+ List<SWTBotViewMenu> menuItems = new org.eclipse.swtbot.eclipse.finder.finders.ViewMenuFinder().findMenus(partReference, withMnemonic(label), true);
if ((menuItems == null) || (menuItems.size() < 1)) {
- CommandFinder finder = new CommandFinder();
+ org.eclipse.swtbot.eclipse.finder.finders.CommandFinder finder = new org.eclipse.swtbot.eclipse.finder.finders.CommandFinder();
List<SWTBotCommand> command = finder.findCommand(equalTo(label));
return command.get(index);
}
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/SWTBotGefTestCase.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/SWTBotGefTestCase.java
index 665dccc..e545a1d 100644
--- a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/SWTBotGefTestCase.java
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/SWTBotGefTestCase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Obeo
+ * Copyright (c) 2009, 2017 Obeo 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
@@ -11,13 +11,14 @@
package org.eclipse.swtbot.eclipse.gef.finder;
-import org.eclipse.swtbot.eclipse.finder.SWTBotEclipseTestCase;
+import org.eclipse.swtbot.swt.finder.SWTBotTestCase;
/**
- * This is a wrapper test case to the SWTBotEclipseTestCase that adds a gef bot
- * instead of the standard eclipse bot.
+ * This is a wrapper test case to the SWTBotTestCase that adds a GEF bot instead
+ * of the standard bot.
+ *
* @author mchauvin
*/
-public class SWTBotGefTestCase extends SWTBotEclipseTestCase {
+public class SWTBotGefTestCase extends SWTBotTestCase {
protected SWTGefBot bot = new SWTGefBot();
}
diff --git a/org.eclipse.swtbot.nebula.gallery.finder/src/org/eclipse/swtbot/nebula/gallery/finder/SWTBotNebulaTestCase.java b/org.eclipse.swtbot.nebula.gallery.finder/src/org/eclipse/swtbot/nebula/gallery/finder/SWTBotNebulaTestCase.java
index 7c5bc63..247d456 100644
--- a/org.eclipse.swtbot.nebula.gallery.finder/src/org/eclipse/swtbot/nebula/gallery/finder/SWTBotNebulaTestCase.java
+++ b/org.eclipse.swtbot.nebula.gallery.finder/src/org/eclipse/swtbot/nebula/gallery/finder/SWTBotNebulaTestCase.java
@@ -1,5 +1,5 @@
/**
- * Copyright (C) 2010 Bonitasoft S.A.
+ * Copyright (C) 2010, 2017 Bonitasoft S.A. and others.
* Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble
*
* All rights reserved. This program and the accompanying materials
@@ -12,15 +12,15 @@
*/
package org.eclipse.swtbot.nebula.gallery.finder;
-import org.eclipse.swtbot.eclipse.finder.SWTBotEclipseTestCase;
+import org.eclipse.swtbot.swt.finder.SWTBotTestCase;
/**
- * This is a wrapper test case to the SWTBotEclipseTestCase that adds a Nebula bot
- * instead of the standard eclipse bot.
- *
+ * This is a wrapper test case to the SWTBotTestCase that adds a Nebula bot
+ * instead of the standard bot.
+ *
* @author Aurelien Pupier
*/
-public class SWTBotNebulaTestCase extends SWTBotEclipseTestCase {
+public class SWTBotNebulaTestCase extends SWTBotTestCase {
protected SWTNebulaBot bot = new SWTNebulaBot();
}
diff --git a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/AbstractKeyboardTest.java b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/AbstractKeyboardTest.java
index dfed4bd..c826e88 100644
--- a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/AbstractKeyboardTest.java
+++ b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/AbstractKeyboardTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Ketan Padegaonkar and others.
+ * Copyright (c) 2009, 2017 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
@@ -274,7 +274,7 @@
@Test
public void canTypeFunctionKeys() throws Exception {
styledText.setFocus();
- styledText.notifyKeyboardEvent(SWT.NONE, '\0', SWT.F2);
+ styledText.pressShortcut(SWT.NONE, SWT.F2, '\0');
assertEventMatches(listeners, "KeyDown [1]: KeyEvent{StyledText {} time=71024493 data=null character='\\0' keyCode=" + toKeyCode(16777227, styledText.widget) + " stateMask=0 doit=true}");
assertEventMatches(listeners, "KeyUp [2]: KeyEvent{StyledText {} time=71024597 data=null character='\\0' keyCode=" + toKeyCode(16777227, styledText.widget) + " stateMask=0 doit=true}");
}
diff --git a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardFactoryTest.java b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardFactoryTest.java
index 059cb18..977dc67 100644
--- a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardFactoryTest.java
+++ b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardFactoryTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2017 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
@@ -24,12 +24,12 @@
@Test
public void createsKeyboardForAWTKeyboardStrategy() throws Exception {
- assertEquals(AWTKeyboardStrategy.class, new KeyboardFactory(AWTKeyboardStrategy.class.getName()).strategyClass);
+ assertEquals(AWTKeyboardStrategy.class, new KeyboardFactory(AWTKeyboardStrategy.class).strategyClass);
}
@Test
public void createsKeyboardForSWTKeyboardStrategy() throws Exception {
- assertEquals(SWTKeyboardStrategy.class, new KeyboardFactory(SWTKeyboardStrategy.class.getName()).strategyClass);
+ assertEquals(SWTKeyboardStrategy.class, new KeyboardFactory(SWTKeyboardStrategy.class).strategyClass);
}
@Test
diff --git a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/FileUtilsTest.java b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/FileUtilsTest.java
index 7af3622..40b5434 100644
--- a/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/FileUtilsTest.java
+++ b/org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/FileUtilsTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Ketan Padegaonkar and others.
+ * Copyright (c) 2010, 2017 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
@@ -32,7 +32,7 @@
@Test
public void canWriteToAFile() throws Exception {
// the write part is execute @Before
- String read = FileUtils.read(FILE.toURL());
+ String read = FileUtils.read(FILE);
assertEquals("some text", read);
FileUtils.write("some other text", FILE);
@@ -48,7 +48,7 @@
@Test
public void canReadFromURL() throws Exception {
- String read = FileUtils.read(FILE.toURL());
+ String read = FileUtils.read(FILE);
assertEquals("some text", read);
}