Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMickael Istria2012-07-20 05:15:22 -0400
committerMickael Istria2012-07-20 05:15:22 -0400
commitddfdc77792cd643fe273db051a05cfb83e10b152 (patch)
treeca2d32ed0c48b4933d89b767333008db71890e14
parent5ffc44fda184d195709e9d76d014b31da8e10cd1 (diff)
parent868b4309a90ac6d2691dec2e06dea273ae9a732f (diff)
downloadorg.eclipse.swtbot-recorder-spike.tar.gz
org.eclipse.swtbot-recorder-spike.tar.xz
org.eclipse.swtbot-recorder-spike.zip
Merge remote-tracking branch 'eclipse/master' into recorder-spikerecorder-spike
-rw-r--r--.git-svn-authors2
-rw-r--r--.gitignore21
-rw-r--r--.project8
-rw-r--r--examples/gef/org.eclipse.gef.examples.logic.test/META-INF/MANIFEST.MF6
-rw-r--r--examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/OpenGefEditorAndCreateContentsExampleTest.java (renamed from examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/OpenGefEditorTest.java)48
-rw-r--r--examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/AllTests.java351
-rw-r--r--examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/LogicModeler.java13
-rw-r--r--examples/gef/org.eclipse.gef.examples.logic/META-INF/MANIFEST.MF2
-rw-r--r--examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/CircuitEditPart.java10
-rw-r--r--examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPart.java1
-rw-r--r--examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPart.java1
-rw-r--r--examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/model/Circuit.java11
-rw-r--r--examples/rcp/org.rcpmail.test/META-INF/MANIFEST.MF2
-rw-r--r--examples/rcp/org.rcpmail.test/pom.xml25
-rw-r--r--examples/rcp/org.rcpmail/META-INF/MANIFEST.MF2
-rw-r--r--examples/rcp/org.rcpmail/pom.xml25
-rw-r--r--git-foo.txt6
-rw-r--r--org.eclipse.swt.examples/META-INF/MANIFEST.MF9
-rw-r--r--org.eclipse.swt.examples/build.properties9
-rw-r--r--org.eclipse.swt.examples/pom.xml25
-rw-r--r--org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java6
-rw-r--r--org.eclipse.swtbot.ant.junit/.project (renamed from org.eclipse.swtbot.ant.optional.junit4/.project)2
-rwxr-xr-xorg.eclipse.swtbot.ant.junit/META-INF/MANIFEST.MF (renamed from org.eclipse.swtbot.ant.optional.junit3/META-INF/MANIFEST.MF)8
-rwxr-xr-xorg.eclipse.swtbot.ant.junit/about.html (renamed from org.eclipse.swtbot.ant.optional.junit3/about.html)0
-rwxr-xr-xorg.eclipse.swtbot.ant.junit/build.properties (renamed from org.eclipse.swtbot.ant.optional.junit3/build.properties)0
-rw-r--r--org.eclipse.swtbot.ant.junit/pom.xml25
-rw-r--r--org.eclipse.swtbot.ant.optional.junit3/.project2
-rwxr-xr-xorg.eclipse.swtbot.ant.optional.junit4/META-INF/MANIFEST.MF10
-rwxr-xr-xorg.eclipse.swtbot.ant.optional.junit4/about.html28
-rw-r--r--org.eclipse.swtbot.eclipse.core/META-INF/MANIFEST.MF6
-rw-r--r--org.eclipse.swtbot.eclipse.core/build.properties17
-rw-r--r--org.eclipse.swtbot.eclipse.core/pom.xml25
-rw-r--r--org.eclipse.swtbot.eclipse.core/src/org/eclipse/swtbot/eclipse/core/UITestApplication.java10
-rw-r--r--org.eclipse.swtbot.eclipse.dsl.test/META-INF/MANIFEST.MF12
-rw-r--r--org.eclipse.swtbot.eclipse.dsl.test/build.properties9
-rw-r--r--org.eclipse.swtbot.eclipse.dsl/META-INF/MANIFEST.MF10
-rw-r--r--org.eclipse.swtbot.eclipse.dsl/build.properties15
-rw-r--r--org.eclipse.swtbot.eclipse.dsl/pom.xml25
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/META-INF/MANIFEST.MF20
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/build.properties11
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/plugin.xml65
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/pom.xml81
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/AllTests.java14
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/FinderTestIds.java14
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/data/internal/SWTBotTestContentProvider.java3
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/editors/MultiPageEditor.java261
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/editors/MultiPageEditorContributor.java125
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/handler/SampleParameterizedHandler.java42
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/perspectives/FormPerspective.java14
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/views/SWTBotFormView.java28
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/AbstractSWTBotEclipseTest.java55
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotMultiPageEditorTest.java131
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewTest.java42
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java11
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java12
-rw-r--r--org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/PackageExplorerView.java25
-rw-r--r--org.eclipse.swtbot.eclipse.finder/META-INF/MANIFEST.MF31
-rw-r--r--org.eclipse.swtbot.eclipse.finder/build.properties9
-rw-r--r--org.eclipse.swtbot.eclipse.finder/pom.xml25
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/Activator.java70
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/DefaultWorkbench.java113
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotInfo.java2
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTWorkbenchBot.java117
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/finders/ViewMenuFinder.java68
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/matchers/WidgetMatcherFactory.java4
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEclipseEditor.java2
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEditor.java11
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotMultiPageEditor.java181
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java7
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotView.java69
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewMenu.java23
-rw-r--r--org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotWorkbenchPart.java86
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/META-INF/MANIFEST.MF30
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/about.html (renamed from org.eclipse.swtbot.eclipse.junit3.headless/about.html)0
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/build.properties3
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/pom.xml25
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/SWTGefBot.java87
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/matchers/IsSelected.java40
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/waits/WaitForEditPartSelection.java50
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefConnectionEditPart.java32
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditPart.java202
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditor.java801
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefFigureCanvas.java125
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefView.java46
-rw-r--r--org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefViewer.java567
-rw-r--r--org.eclipse.swtbot.eclipse.gef/build.properties6
-rw-r--r--org.eclipse.swtbot.eclipse.gef/feature.properties141
-rw-r--r--org.eclipse.swtbot.eclipse.gef/feature.xml131
-rw-r--r--org.eclipse.swtbot.eclipse.gef/license.html94
-rw-r--r--org.eclipse.swtbot.eclipse.gef/pom.xml25
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/.classpath (renamed from org.eclipse.swtbot.eclipse.dsl.test/.classpath)0
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/.project (renamed from org.eclipse.swtbot.swt.recorder.ui.test/.project)2
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/.settings/org.eclipse.jdt.core.prefs (renamed from org.eclipse.swtbot.eclipse.junit3.headless/.settings/org.eclipse.jdt.core.prefs)0
-rwxr-xr-xorg.eclipse.swtbot.eclipse.junit.headless/JUNIT.XSL (renamed from org.eclipse.swtbot.eclipse.junit3.headless/JUNIT.XSL)10
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/LICENSE.EPL (renamed from org.eclipse.swtbot.eclipse.junit3.headless/LICENSE.EPL)0
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/META-INF/MANIFEST.MF (renamed from org.eclipse.swtbot.eclipse.junit4.headless/META-INF/MANIFEST.MF)12
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/about.html (renamed from org.eclipse.swtbot.eclipse.junit4.headless/about.html)0
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/build.properties (renamed from org.eclipse.swtbot.swt.recorder.ui.test/build.properties)20
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/library.xml (renamed from org.eclipse.swtbot.eclipse.junit4.headless/library.xml)18
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/plugin.xml (renamed from org.eclipse.swtbot.eclipse.junit4.headless/plugin.xml)2
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/pom.xml25
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/src/org/eclipse/swtbot/eclipse/junit/headless/EclipseTestRunner.java (renamed from org.eclipse.swtbot.eclipse.junit4.headless/src/org/eclipse/swtbot/eclipse/junit4/headless/EclipseTestRunner.java)2
-rw-r--r--org.eclipse.swtbot.eclipse.junit.headless/src/org/eclipse/swtbot/eclipse/junit/headless/UITestApplication.java (renamed from org.eclipse.swtbot.eclipse.junit4.headless/src/org/eclipse/swtbot/eclipse/junit4/headless/UITestApplication.java)9
-rw-r--r--org.eclipse.swtbot.eclipse.junit3.headless/META-INF/MANIFEST.MF19
-rw-r--r--org.eclipse.swtbot.eclipse.junit3.headless/build.properties29
-rw-r--r--org.eclipse.swtbot.eclipse.junit3.headless/library.xml192
-rw-r--r--org.eclipse.swtbot.eclipse.junit3.headless/plugin.xml19
-rw-r--r--org.eclipse.swtbot.eclipse.junit3.headless/src/org/eclipse/swtbot/eclipse/junit3/headless/EclipseTestRunner.java500
-rw-r--r--org.eclipse.swtbot.eclipse.junit3.headless/src/org/eclipse/swtbot/eclipse/junit3/headless/UITestApplication.java121
-rw-r--r--org.eclipse.swtbot.eclipse.junit4.headless/.project28
-rwxr-xr-xorg.eclipse.swtbot.eclipse.junit4.headless/JUNIT.XSL455
-rw-r--r--org.eclipse.swtbot.eclipse.junit4.headless/build.properties29
-rw-r--r--org.eclipse.swtbot.eclipse.spy/META-INF/MANIFEST.MF10
-rw-r--r--org.eclipse.swtbot.eclipse.spy/build.properties10
-rw-r--r--org.eclipse.swtbot.eclipse.spy/plugin.xml12
-rw-r--r--org.eclipse.swtbot.eclipse.spy/pom.xml25
-rw-r--r--org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseSpy.java11
-rw-r--r--org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java6
-rw-r--r--org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/PlayBackThread.java135
-rw-r--r--org.eclipse.swtbot.eclipse.test.junit/.project17
-rw-r--r--org.eclipse.swtbot.eclipse.test.junit/build.properties (renamed from org.eclipse.swtbot.eclipse.test/build.properties)6
-rw-r--r--org.eclipse.swtbot.eclipse.test.junit/epl-v10.html (renamed from org.eclipse.swtbot.eclipse.test/epl-v10.html)0
-rw-r--r--org.eclipse.swtbot.eclipse.test.junit/feature.properties140
-rw-r--r--org.eclipse.swtbot.eclipse.test.junit/feature.xml43
-rw-r--r--org.eclipse.swtbot.eclipse.test.junit/license.html107
-rw-r--r--org.eclipse.swtbot.eclipse.test.junit/pom.xml25
-rw-r--r--org.eclipse.swtbot.eclipse.test.junit4/.project17
-rw-r--r--org.eclipse.swtbot.eclipse.test/feature.xml129
-rw-r--r--org.eclipse.swtbot.eclipse.test/license.html79
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/.classpath1
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/META-INF/MANIFEST.MF10
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/build.properties5
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/AllTests.java (renamed from org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/methodargs/NullArgument.java)19
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/ProjectCreationWizardTest.java120
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/SWTBotProject.java40
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/pom.xml80
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotJUnitTabGroupTest.java23
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/project/ProjectCreatorTest.java37
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/project/TemplatizerTest.java46
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/test/AllTests.java6
-rw-r--r--org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/wizards/ProjectSettingValidatorTest.java87
-rw-r--r--org.eclipse.swtbot.eclipse.ui/.classpath (renamed from org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_5)1
-rw-r--r--org.eclipse.swtbot.eclipse.ui/META-INF/MANIFEST.MF (renamed from org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_5)38
-rw-r--r--org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_445
-rw-r--r--org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_540
-rw-r--r--org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_412
-rw-r--r--org.eclipse.swtbot.eclipse.ui/build.properties (renamed from org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_4)17
-rw-r--r--org.eclipse.swtbot.eclipse.ui/plugin.xml19
-rw-r--r--org.eclipse.swtbot.eclipse.ui/pom.xml25
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/Activator.java11
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchConfigurationDelegate.java (renamed from org.eclipse.swtbot.eclipse.ui/src_eclipse_3.5/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchConfigurationDelegate.java)0
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotJUnitTabGroup.java29
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotLaunchShortcut.java (renamed from org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchShortcut.java)3
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/Messages.java32
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/PreferenceInitializer.java58
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/SWTBotPreferencePage.java14
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/messages.properties2
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/project/ProjectCreator.java107
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/project/Templatizer.java36
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/project/_MANIFEST.MF9
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/project/_build.properties4
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/project/_classpath (renamed from org.eclipse.swtbot.eclipse.junit3.headless/.classpath)0
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/project/_project (renamed from org.eclipse.swtbot.swt.recorder.ui/.project)2
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/wizards/LaunchConfigPropertiesWizardPage.java54
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/wizards/NewPluginProjectWizardPage.java190
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/wizards/NewSWTBotTestPluginWizard.java60
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/wizards/ProjectSettingValidator.java89
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/wizards/WizardPageSettings.java19
-rw-r--r--org.eclipse.swtbot.eclipse.ui/src_eclipse_3.4/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchConfigurationDelegate.java428
-rw-r--r--org.eclipse.swtbot.eclipse/build.properties6
-rw-r--r--org.eclipse.swtbot.eclipse/feature.properties140
-rw-r--r--org.eclipse.swtbot.eclipse/feature.xml117
-rw-r--r--org.eclipse.swtbot.eclipse/license.html94
-rw-r--r--org.eclipse.swtbot.eclipse/pom.xml25
-rw-r--r--org.eclipse.swtbot.forms.finder.test/.classpath (renamed from org.eclipse.swtbot.eclipse.junit4.headless/.classpath)0
-rw-r--r--org.eclipse.swtbot.forms.finder.test/.project (renamed from org.eclipse.swtbot.eclipse.dsl.test/.project)2
-rw-r--r--org.eclipse.swtbot.forms.finder.test/.settings/org.eclipse.jdt.core.prefs (renamed from org.eclipse.swtbot.eclipse.dsl.test/.settings/org.eclipse.jdt.core.prefs)2
-rw-r--r--org.eclipse.swtbot.forms.finder.test/META-INF/MANIFEST.MF21
-rw-r--r--org.eclipse.swtbot.forms.finder.test/build.properties4
-rw-r--r--org.eclipse.swtbot.forms.finder.test/pom.xml80
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/AllTests.java (renamed from org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/methodargs/SWTBotEventArguments.java)28
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/AbstractSWTBotFormsTest.java90
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotHyperlinkTest.java42
-rw-r--r--org.eclipse.swtbot.forms.finder.test/src/org/eclipse/swtbot/forms/finder/test/widgets/SWTBotImageHyperlinkTest.java61
-rw-r--r--org.eclipse.swtbot.forms.finder/.classpath (renamed from org.eclipse.swtbot.swt.recorder.test/.classpath)0
-rw-r--r--org.eclipse.swtbot.forms.finder/.project (renamed from org.eclipse.swtbot.swt.recorder/.project)2
-rw-r--r--org.eclipse.swtbot.forms.finder/.settings/org.eclipse.jdt.core.prefs (renamed from org.eclipse.swtbot.eclipse.junit4.headless/.settings/org.eclipse.jdt.core.prefs)2
-rw-r--r--org.eclipse.swtbot.forms.finder/.settings/org.moreunit.prefs6
-rw-r--r--org.eclipse.swtbot.forms.finder/META-INF/MANIFEST.MF21
-rw-r--r--org.eclipse.swtbot.forms.finder/build.properties4
-rw-r--r--org.eclipse.swtbot.forms.finder/pom.xml25
-rw-r--r--org.eclipse.swtbot.forms.finder/src/org/eclipse/swtbot/forms/finder/SWTFormsBot.java324
-rw-r--r--org.eclipse.swtbot.forms.finder/src/org/eclipse/swtbot/forms/finder/widgets/SWTBotHyperlink.java93
-rw-r--r--org.eclipse.swtbot.forms.finder/src/org/eclipse/swtbot/forms/finder/widgets/SWTBotImageHyperlink.java134
-rw-r--r--org.eclipse.swtbot.forms/.project (renamed from org.eclipse.swtbot.recording/.project)2
-rw-r--r--org.eclipse.swtbot.forms/build.properties (renamed from org.eclipse.swtbot.swt.recorder.ui/build.properties)29
-rw-r--r--org.eclipse.swtbot.forms/epl-v10.html (renamed from org.eclipse.swtbot.recording/epl-v10.html)0
-rw-r--r--org.eclipse.swtbot.forms/feature.properties141
-rw-r--r--org.eclipse.swtbot.forms/feature.xml48
-rw-r--r--org.eclipse.swtbot.forms/license.html107
-rw-r--r--org.eclipse.swtbot.forms/pom.xml25
-rw-r--r--org.eclipse.swtbot.generator.test/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.swtbot.generator.test/pom.xml20
-rw-r--r--org.eclipse.swtbot.generator.test/src/org/eclipse/swtbot/generator/MethodGeneratorTest.java33
-rw-r--r--org.eclipse.swtbot.generator/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.swtbot.generator/README.txt58
-rw-r--r--org.eclipse.swtbot.generator/pom.xml25
-rw-r--r--org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/HamcrestFactoryWriter.java82
-rw-r--r--org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/MatcherGeneratorMain.java10
-rw-r--r--org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/MethodFactory.java12
-rw-r--r--org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/MethodGenerator.java24
-rw-r--r--org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/SWTBotGeneratorFactoryReader.java9
-rw-r--r--org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/SWTBotGeneratorMain.java3
-rw-r--r--org.eclipse.swtbot.generator/src/org/eclipse/swtbot/generator/XmlConfigurator.java4
-rw-r--r--org.eclipse.swtbot.generator/swtbot-matchers.xml2
-rw-r--r--org.eclipse.swtbot.generator/templates/SWTBot/additionalMethods3
-rw-r--r--org.eclipse.swtbot.generator/templates/SWTBot/imports19
-rw-r--r--org.eclipse.swtbot.generator/templates/SWTBot/javadoc35
-rw-r--r--org.eclipse.swtbot.generator/templates/SWTFormsBot/additionalMethods (renamed from org.eclipse.swtbot.eclipse.dsl.test/src/removeMe.txt)0
-rw-r--r--org.eclipse.swtbot.generator/templates/SWTFormsBot/imports13
-rw-r--r--org.eclipse.swtbot.generator/templates/SWTFormsBot/javadoc5
-rw-r--r--org.eclipse.swtbot.generator/widgets-forms.xml4
-rw-r--r--org.eclipse.swtbot.generator/widgets.xml7
-rw-r--r--org.eclipse.swtbot.go/.project22
-rw-r--r--org.eclipse.swtbot.go/.settings/org.eclipse.pde.core.prefs5
-rw-r--r--org.eclipse.swtbot.go/LICENSE.EPL (renamed from org.eclipse.swtbot.eclipse.junit4.headless/LICENSE.EPL)0
-rw-r--r--org.eclipse.swtbot.go/META-INF/MANIFEST.MF17
-rw-r--r--org.eclipse.swtbot.go/about.html (renamed from org.eclipse.swtbot.swt.recorder.ui.test/about.html)0
-rw-r--r--org.eclipse.swtbot.go/build.properties (renamed from org.eclipse.swtbot.swt.recorder.test/build.properties)11
-rw-r--r--org.eclipse.swtbot.go/pom.xml25
-rw-r--r--org.eclipse.swtbot.ide/.project (renamed from org.eclipse.swtbot.eclipse.test/.project)2
-rw-r--r--org.eclipse.swtbot.ide/build.properties (renamed from org.eclipse.swtbot.recording/build.properties)8
-rw-r--r--org.eclipse.swtbot.ide/epl-v10.html328
-rw-r--r--org.eclipse.swtbot.ide/feature.properties140
-rw-r--r--org.eclipse.swtbot.ide/feature.xml58
-rw-r--r--org.eclipse.swtbot.ide/license.html107
-rw-r--r--org.eclipse.swtbot.ide/pom.xml25
-rw-r--r--org.eclipse.swtbot.junit4_x/.classpath (renamed from org.eclipse.swtbot.swt.recorder.ui.test/.classpath)0
-rw-r--r--org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF (renamed from org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF_junit4_5)9
-rw-r--r--org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF_junit4_315
-rw-r--r--org.eclipse.swtbot.junit4_x/_build.properties.junit4_39
-rw-r--r--org.eclipse.swtbot.junit4_x/_build.properties.junit4_59
-rw-r--r--org.eclipse.swtbot.junit4_x/_classpath.junit4_38
-rw-r--r--org.eclipse.swtbot.junit4_x/_classpath.junit4_58
-rw-r--r--org.eclipse.swtbot.junit4_x/build.properties (renamed from org.eclipse.swtbot.swt.recorder/build.properties)9
-rw-r--r--org.eclipse.swtbot.junit4_x/junit4_3/org/eclipse/swtbot/swt/finder/junit/SWTBotJunit4ClassRunner.java61
-rw-r--r--org.eclipse.swtbot.junit4_x/pom.xml25
-rw-r--r--org.eclipse.swtbot.junit4_x/src/org/eclipse/swtbot/swt/finder/junit/SWTBotJUnit4Suite.java8
-rw-r--r--org.eclipse.swtbot.junit4_x/src/org/eclipse/swtbot/swt/finder/junit/SWTBotJunit4ClassRunner.java (renamed from org.eclipse.swtbot.junit4_x/junit4_5/org/eclipse/swtbot/swt/finder/junit/SWTBotJunit4ClassRunner.java)0
-rw-r--r--org.eclipse.swtbot.junit4_x/src/org/eclipse/swtbot/swt/finder/junit/ScreenshotCaptureListener.java5
-rw-r--r--org.eclipse.swtbot.recording/feature.xml120
-rw-r--r--org.eclipse.swtbot.recording/license.html79
-rw-r--r--org.eclipse.swtbot.releng/MakingARelease.HOWTO38
-rw-r--r--org.eclipse.swtbot.releng/allElements.xml37
-rw-r--r--org.eclipse.swtbot.releng/build-conf/e36.properties11
-rw-r--r--org.eclipse.swtbot.releng/build-conf/e37.properties11
-rw-r--r--org.eclipse.swtbot.releng/build-conf/e42.properties11
-rw-r--r--org.eclipse.swtbot.releng/build-conf/gef34.properties6
-rw-r--r--org.eclipse.swtbot.releng/build-conf/gef35.properties6
-rw-r--r--org.eclipse.swtbot.releng/build-conf/gef36.properties6
-rw-r--r--org.eclipse.swtbot.releng/build-conf/gef37.properties6
-rw-r--r--org.eclipse.swtbot.releng/build-conf/gef42.properties6
-rw-r--r--org.eclipse.swtbot.releng/build-conf/linux.gtk.ppc.properties1
-rw-r--r--org.eclipse.swtbot.releng/build-conf/linux.gtk.x86.properties1
-rw-r--r--org.eclipse.swtbot.releng/build-conf/linux.gtk.x86_64.properties1
-rw-r--r--org.eclipse.swtbot.releng/build-conf/macosx.carbon.x86.properties1
-rw-r--r--org.eclipse.swtbot.releng/build-conf/macosx.cocoa.x86_64.properties1
-rw-r--r--org.eclipse.swtbot.releng/build-conf/win32.win32.x86.properties1
-rw-r--r--org.eclipse.swtbot.releng/build.default.properties7
-rw-r--r--org.eclipse.swtbot.releng/build.developer.properties.sample40
-rw-r--r--org.eclipse.swtbot.releng/build.properties.template6
-rw-r--r--org.eclipse.swtbot.releng/build.xml93
-rw-r--r--org.eclipse.swtbot.releng/check-prerequisites.xml61
-rw-r--r--org.eclipse.swtbot.releng/download-dependencies.xml8
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.build.properties4
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.tw-studios.corporate.thoughtworks.com.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-opensuse32-02.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-opensuse32-03.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-opensuse32-04.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-opensuse32-05.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-ubuntu64-01.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-xp-01.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-xp-02.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-xp-03.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-xp-04.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twist-xp-05.properties28
-rw-r--r--org.eclipse.swtbot.releng/host-conf/build.twistcrwin.properties28
-rw-r--r--org.eclipse.swtbot.releng/javadoc.xml29
-rw-r--r--org.eclipse.swtbot.releng/javadoc/eclipse-package-list/package-list218
-rw-r--r--org.eclipse.swtbot.releng/javadoc/java-package-list/package-list166
-rw-r--r--org.eclipse.swtbot.releng/javadoc/junit-package-list/package-list18
-rwxr-xr-xorg.eclipse.swtbot.releng/make-release.rb71
-rwxr-xr-xorg.eclipse.swtbot.releng/make-release.sh31
-rw-r--r--org.eclipse.swtbot.releng/readme.txt6
-rw-r--r--org.eclipse.swtbot.releng/test-sandbox/org.eclipse.swtbot.eclipse.finder.test.xml53
-rw-r--r--org.eclipse.swtbot.releng/test-sandbox/org.eclipse.swtbot.eclipse.ui.test.xml114
-rw-r--r--org.eclipse.swtbot.releng/test-sandbox/org.eclipse.swtbot.forms.finder.test.xml76
-rw-r--r--org.eclipse.swtbot.releng/test-sandbox/org.eclipse.swtbot.generator.test.xml4
-rw-r--r--org.eclipse.swtbot.releng/test-sandbox/org.eclipse.swtbot.swt.finder.test.xml8
-rw-r--r--org.eclipse.swtbot.releng/test-sandbox/org.eclipse.swtbot.swt.recorder.test.xml118
-rw-r--r--org.eclipse.swtbot.releng/test-sandbox/org.eclipse.swtbot.swt.recorder.ui.test.xml106
-rw-r--r--org.eclipse.swtbot.releng/test-sandbox/passFail.xsl36
-rw-r--r--org.eclipse.swtbot.releng/test-sandbox/test.xml83
-rw-r--r--org.eclipse.swtbot.swt.demo/META-INF/MANIFEST.MF4
-rw-r--r--org.eclipse.swtbot.swt.demo/build.properties9
-rw-r--r--org.eclipse.swtbot.swt.demo/pom.xml25
-rw-r--r--org.eclipse.swtbot.swt.finder.test.keyboards/.classpath (renamed from org.eclipse.swtbot.swt.recorder.ui/.classpath)0
-rw-r--r--org.eclipse.swtbot.swt.finder.test.keyboards/.project (renamed from org.eclipse.swtbot.eclipse.junit3.headless/.project)2
-rw-r--r--org.eclipse.swtbot.swt.finder.test.keyboards/LICENSE.EPL (renamed from org.eclipse.swtbot.swt.recorder.ui.test/LICENSE.EPL)0
-rw-r--r--org.eclipse.swtbot.swt.finder.test.keyboards/META-INF/MANIFEST.MF8
-rw-r--r--org.eclipse.swtbot.swt.finder.test.keyboards/about.html (renamed from org.eclipse.swtbot.swt.recorder.ui/about.html)0
-rw-r--r--org.eclipse.swtbot.swt.finder.test.keyboards/build.properties4
-rw-r--r--org.eclipse.swtbot.swt.finder.test.keyboards/pom.xml25
-rw-r--r--org.eclipse.swtbot.swt.finder.test.keyboards/src/com/foo/bar/BAZ.keyboard1
-rw-r--r--org.eclipse.swtbot.swt.finder.test.keyboards/src/com/foo/bar/MAC_FOOBAR.keyboard1
-rw-r--r--org.eclipse.swtbot.swt.finder.test/META-INF/MANIFEST.MF17
-rw-r--r--org.eclipse.swtbot.swt.finder.test/build.properties9
-rw-r--r--org.eclipse.swtbot.swt.finder.test/pom.xml44
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/ReferenceByTest.java4
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/RunUIThreadRule.java150
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/SWTBot2Test.java39
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/SWTBotTest.java5
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/SWTBotTestCaseTest.java5
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/UIThread.java12
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/alltests/Controls.java53
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/alltests/Setup.java170
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/finders/AbstractSWTTestCase.java161
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/finders/ChildrenControlFinderTest.java8
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/finders/ControlFinder2Test.java23
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/finders/ControlFinderTest.java44
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/finders/MenuFinderTest.java2
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/finders/PathGeneratorTest.java23
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/AWTKeyboardTest.java2
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/AbstractKeyboardTest.java23
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardFactoryTest.java12
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/keyboard/SWTKeyboardTest.java2
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/matchers/AllOfTest.java41
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/matchers/AnyOfTest.java42
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/matchers/MessageMatcherTest.java58
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/matchers/MyMatcher.java34
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/matchers/ObjectWithGetMessage.java26
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/matchers/TextLabelMatcherTest.java12
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/matchers/WidgetMatcherFactoryTest.java29
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/matchers/WithItemTest.java28
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/test/AbstractBrowserExampleTest.java (renamed from org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/methodargs/StringArgument.java)29
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/test/AbstractClipboardExampleTest.java (renamed from org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/methodargs/AbstractSWTBotEventArguments.java)19
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/test/AbstractControlExampleTest.java (renamed from org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/SWTBotExecutionListener.java)26
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/test/AbstractCustomControlExampleTest.java29
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/test/AbstractMenuExampleTest.java (renamed from org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/AbstractMenuExampleTest.java)35
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/test/AbstractSWTShellTest.java75
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/test/AbstractSWTTest.java59
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/ClassUtilsTest.java5
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/CredentialsTest.java44
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/FileUtilsTest.java50
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/MultiValueMapTest.java4
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/PositionTest.java12
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/SWTUtilsTest.java25
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/utils/TreePathTest.java (renamed from org.eclipse.swtbot.swt.recorder.ui.test/src/org/eclipse/swtbot/swt/recorder/ui/MainTest.java)29
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/waits/ShellClosesTest.java15
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/waits/ShellIsActiveTest.java28
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/waits/TableHasRowsTest.java31
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/waits/TreeHasRowsTest.java101
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/waits/WaitForShellTest.java37
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/waits/WaitForWidgetInParentTest.java6
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBotTest.java4
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotArrowButtonTest.java80
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotBrowserTest.java78
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotButtonTest.java12
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotCComboTest.java18
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotCLabelTest.java16
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotCTabItemTest.java12
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotCheckBoxTest.java29
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotComboTest.java37
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotDateTimeTest.java45
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotExpandBarTest.java98
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotLabelTest.java13
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotLinkTest.java11
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotListTest.java10
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotMenuTest.java19
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotMenuTest2.java32
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotPopupMenuTest.java12
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotRadioTest.java82
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotScaleTest.java71
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotShellTest.java70
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotSliderTest.java9
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotSpinnerTest.java12
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotStyledTextTest.java36
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTabItemTest.java6
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTableClickTest.java51
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTableColumnTest.java17
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTableDoubleClickTest.java49
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTableItemTest.java9
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTableTest.java12
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTableTest2.java17
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTextTest.java37
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToggleButtonTest.java35
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarDropDownButtonTest.java16
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarDropDownButtonWithToolTipTest.java15
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarPushButtonTest.java26
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarPushButtonWithToolTipTest.java13
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarRadioButtonTest.java19
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarToggleButtonTest.java18
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTrayItemTest.java20
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTreeItemTest.java25
-rw-r--r--org.eclipse.swtbot.swt.finder.test/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTreeTest.java60
-rw-r--r--org.eclipse.swtbot.swt.finder/META-INF/MANIFEST.MF14
-rw-r--r--org.eclipse.swtbot.swt.finder/build.properties9
-rw-r--r--org.eclipse.swtbot.swt.finder/pom.xml25
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/ReferenceBy.java33
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBot.java1410
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotFactory.java11
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotInfo.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/SWTBotWidget.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/finders/Finder.java14
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/AWTKeyboardStrategy.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/DE_DE.keyboard31
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/FR_FR.keyboard54
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardFactory.java3
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/KeyboardLayout.java4
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/Keystrokes.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/MockKeyboardStrategy.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/keyboard/SWTKeyboardStrategy.java12
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/matchers/AnyOf.java66
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/matchers/InUIThread.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/matchers/WidgetMatcherFactory.java40
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/matchers/WithItem.java7
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/matchers/WithLabel.java33
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/matchers/WithMessage.java83
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/resolvers/ExpandBarResolver.java49
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/resolvers/ExpandItemResolver.java55
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/resolvers/Resolvable.java4
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/Credentials.java65
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/FileUtils.java41
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/MultiValueMap.java8
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/Position.java4
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/SWTBotPreferenceConstants.java5
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/SWTBotPreferences.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/SWTUtils.java48
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/TreePath.java21
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/utils/internal/Assert.java14
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/Conditions.java28
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/TreeHasRows.java70
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/waits/WidgetIsEnabledCondition.java32
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/AbstractSWTBot.java62
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/BrowserAuthenticationListener.java56
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotArrowButton.java82
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotBrowser.java290
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotButton.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotCCombo.java10
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotCTabItem.java6
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotCheckBox.java6
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotCombo.java31
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotDateTime.java7
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotExpandBar.java188
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotExpandItem.java145
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotLink.java5
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotList.java12
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotMenu.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotRadio.java62
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotScale.java133
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotShell.java9
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotSlider.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotSpinner.java2
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotStyledText.java24
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTabItem.java4
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTable.java6
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTableColumn.java19
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTableItem.java16
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotText.java4
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToggleButton.java6
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarDropDownButton.java6
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarPushButton.java5
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarRadioButton.java4
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarSeparatorButton.java4
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotToolbarToggleButton.java4
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTree.java147
-rw-r--r--org.eclipse.swtbot.swt.finder/src/org/eclipse/swtbot/swt/finder/widgets/SWTBotTreeItem.java305
-rw-r--r--org.eclipse.swtbot.swt.recorder.test/.settings/org.eclipse.jdt.core.prefs21
-rw-r--r--org.eclipse.swtbot.swt.recorder.test/META-INF/MANIFEST.MF14
-rw-r--r--org.eclipse.swtbot.swt.recorder.test/src/SWTBotRecorderMain.java93
-rw-r--r--org.eclipse.swtbot.swt.recorder.test/src/org/eclipse/swtbot/swt/recorder/AbstractSWTBotRecorderTest.java69
-rw-r--r--org.eclipse.swtbot.swt.recorder.test/src/org/eclipse/swtbot/swt/recorder/text/CheckBoxSelectionListenerTest.java33
-rw-r--r--org.eclipse.swtbot.swt.recorder.test/src/org/eclipse/swtbot/swt/recorder/text/PushButtonSelectionListenerTest.java34
-rw-r--r--org.eclipse.swtbot.swt.recorder.test/src/org/eclipse/swtbot/swt/recorder/text/RadioButtonSelectionListenerTest.java33
-rw-r--r--org.eclipse.swtbot.swt.recorder.test/src/org/eclipse/swtbot/swt/recorder/text/ShellEventListenerTest.java33
-rw-r--r--org.eclipse.swtbot.swt.recorder.test/src/org/eclipse/swtbot/swt/recorder/text/TabSelectionListenerTest.java33
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui.test/.settings/org.eclipse.jdt.core.prefs21
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui.test/META-INF/MANIFEST.MF11
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui.test/src/org/eclipse/swtbot/swt/recorder/ui/BootstrapperTest.java43
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/.settings/org.eclipse.jdt.core.prefs21
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/.settings/org.moreunit.prefs6
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/LICENSE.EPL70
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/META-INF/MANIFEST.MF25
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/icons/clear.gifbin595 -> 0 bytes
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/icons/pause.gifbin338 -> 0 bytes
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/icons/save.gifbin639 -> 0 bytes
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/icons/start.gifbin337 -> 0 bytes
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/icons/stop.gifbin215 -> 0 bytes
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/org/eclipse/swtbot/swt/recorder/ui/Bootstrapper.java46
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/org/eclipse/swtbot/swt/recorder/ui/ClearButtonSelectionListener.java44
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/org/eclipse/swtbot/swt/recorder/ui/Main.java42
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/org/eclipse/swtbot/swt/recorder/ui/SWTBotRecorderWindow.java250
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/org/eclipse/swtbot/swt/recorder/ui/SaveButtonSelectionListener.java45
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/org/eclipse/swtbot/swt/recorder/ui/StartPauseButtonToggleListener.java43
-rw-r--r--org.eclipse.swtbot.swt.recorder.ui/src/org/eclipse/swtbot/swt/recorder/ui/StopRecorderListener.java44
-rw-r--r--org.eclipse.swtbot.swt.recorder/.classpath7
-rw-r--r--org.eclipse.swtbot.swt.recorder/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--org.eclipse.swtbot.swt.recorder/.settings/org.moreunit.prefs6
-rw-r--r--org.eclipse.swtbot.swt.recorder/META-INF/MANIFEST.MF24
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/SWTBotRecorder.java283
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/generators/SWTBotAccessor.java88
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/generators/SWTBotAction.java75
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/generators/SWTBotEvent.java113
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/listeners/ActionList.java99
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/methodargs/StringArrayArgument.java42
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/widgets/AccessorCreatorStrategy.java104
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/widgets/text/AbstractTextBasedRecorderListener.java105
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/widgets/text/CheckBoxSelectionListener.java46
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/widgets/text/PushButtonSelectionListener.java39
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/widgets/text/RadioButtonSelectionListener.java38
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/widgets/text/ShellEventListener.java47
-rw-r--r--org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/widgets/text/TabSelectionListener.java51
-rw-r--r--org.eclipse.swtbot.swt.spy/.classpath8
-rw-r--r--org.eclipse.swtbot.swt.spy/.project28
-rw-r--r--org.eclipse.swtbot.swt.spy/LICENSE.EPL70
-rw-r--r--org.eclipse.swtbot.swt.spy/META-INF/MANIFEST.MF23
-rw-r--r--org.eclipse.swtbot.swt.spy/about.html28
-rw-r--r--org.eclipse.swtbot.swt.spy/build.properties28
-rw-r--r--org.eclipse.swtbot.swt.spy/src/org/eclipse/swtbot/swt/spy/SWTSpy.java112
-rw-r--r--org.eclipse.swtbot.swt.spy/src/org/eclipse/swtbot/swt/spy/WidgetTracker.java366
-rw-r--r--org.eclipse.swtbot.swt.spy/test/org/eclipse/swtbot/swt/spy/AllEventListenersTest.java80
-rw-r--r--org.eclipse.swtbot.swt.spy/test/org/eclipse/swtbot/swt/spy/SwtSpyTest.java66
-rw-r--r--org.eclipse.swtbot.test/build.properties6
-rw-r--r--org.eclipse.swtbot.test/feature.properties140
-rw-r--r--org.eclipse.swtbot.test/feature.xml131
-rw-r--r--org.eclipse.swtbot.test/license.html94
-rw-r--r--org.eclipse.swtbot.test/pom.xml25
-rw-r--r--org.eclipse.swtbot.updatesite/LICENSE.EPL70
-rw-r--r--org.eclipse.swtbot.updatesite/about.html28
-rw-r--r--org.eclipse.swtbot.updatesite/build.xml273
-rw-r--r--org.eclipse.swtbot.updatesite/category.xml24
-rw-r--r--org.eclipse.swtbot.updatesite/index.html60
-rw-r--r--org.eclipse.swtbot.updatesite/pom.xml25
-rw-r--r--org.eclipse.swtbot.updatesite/site.template.categories.xml23
-rw-r--r--org.eclipse.swtbot.updatesite/site.template.footer.xml1
-rw-r--r--org.eclipse.swtbot.updatesite/site.template.header.xml5
-rw-r--r--org.eclipse.swtbot.updatesite/site.template.org.eclipse.swtbot.featurelist.xml14
-rw-r--r--org.eclipse.swtbot.updatesite/site.template.org.eclipse.swtbot.pluginarchivelist.xml3
-rw-r--r--org.eclipse.swtbot.updatesite/web/site.css12
-rw-r--r--org.eclipse.swtbot.updatesite/web/site.xsl214
-rw-r--r--org.eclipse.swtbot/build.properties6
-rw-r--r--org.eclipse.swtbot/feature.properties140
-rw-r--r--org.eclipse.swtbot/feature.xml81
-rw-r--r--org.eclipse.swtbot/license.html94
-rw-r--r--org.eclipse.swtbot/pom.xml25
-rwxr-xr-xorg.eclipse.ui.forms.examples/.classpath7
-rwxr-xr-xorg.eclipse.ui.forms.examples/.cvsignore1
-rwxr-xr-x[-rw-r--r--]org.eclipse.ui.forms.examples/.project (renamed from org.eclipse.swtbot.swt.recorder.test/.project)4
-rwxr-xr-x[-rw-r--r--]org.eclipse.ui.forms.examples/.settings/org.eclipse.jdt.core.prefs (renamed from org.eclipse.swtbot.swt.spy/.settings/org.eclipse.jdt.core.prefs)60
-rwxr-xr-xorg.eclipse.ui.forms.examples/.settings/org.eclipse.jdt.ui.prefs3
-rwxr-xr-xorg.eclipse.ui.forms.examples/.settings/org.eclipse.pde.prefs12
-rw-r--r--org.eclipse.ui.forms.examples/META-INF/MANIFEST.MF20
-rwxr-xr-xorg.eclipse.ui.forms.examples/about.html22
-rwxr-xr-xorg.eclipse.ui.forms.examples/build.properties19
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/clear.gifbin0 -> 545 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/close_view.gifbin0 -> 73 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/container_obj.gifbin0 -> 562 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/e_search_menu.gifbin0 -> 592 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/file_obj.gifbin0 -> 152 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/form_banner.gifbin0 -> 5600 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/help.gifbin0 -> 259 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/help_topic.gifbin0 -> 136 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/large_image.gifbin0 -> 2300 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/linkto_help.gifbin0 -> 618 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/newprj_wiz.gifbin0 -> 2864 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/nw.gifbin0 -> 1210 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/progress.gifbin0 -> 4700 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/sample.gifbin0 -> 983 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/th_horizontal.gifbin0 -> 174 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/th_vertical.gifbin0 -> 217 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/toc_closed.gifbin0 -> 585 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/toc_open.gifbin0 -> 583 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/icons/topic_small.gifbin0 -> 322 bytes
-rwxr-xr-xorg.eclipse.ui.forms.examples/plugin.properties13
-rwxr-xr-xorg.eclipse.ui.forms.examples/plugin.xml106
-rw-r--r--org.eclipse.ui.forms.examples/pom.xml26
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/ExamplesPlugin.java150
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/ExamplesPluginResources.properties (renamed from org.eclipse.swtbot.ant.optional.junit4/build.properties)4
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/FormEditorInput.java69
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/OpenFormEditorAction.java34
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/dialogs/OpenFormDialog.java31
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/dialogs/SampleFormDialog.java41
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/ErrorMessagesPage.java370
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/FreeFormPage.java185
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/HeadlessPage.java49
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/IModelListener.java24
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/NamedObject.java36
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/NewStylePage.java581
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/OpenSimpleFormEditorAction.java25
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/OpenSingleHeaderEditorAction.java26
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/PageWithSubPages.java102
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/ScrolledPropertiesBlock.java136
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/ScrolledPropertiesPage.java36
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/SecondPage.java118
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/SimpleFormEditor.java84
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/SimpleFormEditorInput.java25
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/SimpleModel.java70
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/SingleHeaderEditor.java137
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/ThirdPage.java140
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/TypeOne.java59
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/TypeOneDetailsPage.java186
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/TypeTwo.java47
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/TypeTwoDetailsPage.java135
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/internal/rcp/index.xml163
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/views/FormView.java206
-rwxr-xr-xorg.eclipse.ui.forms.examples/src/org/eclipse/ui/forms/examples/views/ShowHelpAction.java56
-rw-r--r--pom.xml248
-rw-r--r--tools/README.textile35
-rwxr-xr-x[-rw-r--r--]tools/create-all-index.sh33
-rwxr-xr-x[-rw-r--r--]tools/create_index_html.rb (renamed from tools/create-index_html.rb)4
-rwxr-xr-xtools/monitor.sh21
-rwxr-xr-xtools/publish-build.sh25
-rw-r--r--tools/push-dev-build81
-rwxr-xr-xtools/sign-swbot.sh41
-rwxr-xr-xtools/version.rb17
625 files changed, 18805 insertions, 10955 deletions
diff --git a/.git-svn-authors b/.git-svn-authors
index 36897d98..b7e86b6e 100644
--- a/.git-svn-authors
+++ b/.git-svn-authors
@@ -1,3 +1,3 @@
kpadegaonka = Ketan Padegaonkar <ketanpadegaonkar@gmail.com>
mchauvin = Mariot Chauvin <mariot.chauvin@obeo.fr>
-
+caniszczyk = Chris Aniszczyk <caniszczyk@gmail.com>
diff --git a/.gitignore b/.gitignore
index 69ff7300..03ab73c9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,17 @@
/eclipse/
/.metadata/
-.svn/
/swtbot/
.DS_Store
/*/bin
+target/
examples/rcp/*/bin/
examples/gef/*/bin/
/*/screenshots
+org.eclipse.swtbot.releng/.git.properties
+
org.eclipse.swtbot.releng/externals/eclipse-SDK-*
org.eclipse.swtbot.releng/externals/libs
org.eclipse.swtbot.releng/externals/eclipse-test-framework-3.3.zip
@@ -20,7 +22,6 @@ org.eclipse.swtbot.releng/build.developer.properties
org.eclipse.swtbot.releng/build.properties
org.eclipse.swtbot.releng/artifacts/
org.eclipse.swtbot.releng/to-upload/
-org.eclipse.swtbot.releng/javadoc
org.eclipse.swtbot.releng/test-sandbox/results/
org.eclipse.swtbot.releng/test-sandbox/screenshots/
@@ -32,17 +33,17 @@ org.eclipse.swtbot.updatesite/build/
/swtbot/
-org.eclipse.swtbot.junit4_x/.classpath
-org.eclipse.swtbot.junit4_x/META-INF/MANIFEST.MF
-org.eclipse.swtbot.junit4_x/build.properties
-
-org.eclipse.swtbot.eclipse.ui/META-INF/MANIFEST.MF
-
org.eclipse.swtbot.releng/test-sandbox/passFail.txt
+org.eclipse.swtbot.releng/test-sandbox/org.eclipse.swtbot.eclipse.ui.test.ser
+
org.eclipse.swtbot.swt.finder.test/keyboard.layout
org.eclipse.swtbot.swt.finder.test/keyboard.layout.filtered
-org.eclipse.swtbot.eclipse.ui/.classpath
-org.eclipse.swtbot.eclipse.ui/build.properties
+
+org.eclipse.ui.forms.examples/examples.jar
+
/eclipse-3.4/
/eclipse-3.5/
/eclipse/
+
+*recorder*
+External Plug-in Libraries
diff --git a/.project b/.project
new file mode 100644
index 00000000..f104bbe1
--- /dev/null
+++ b/.project
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>swtbot</name>
+ <comment/>
+ <projects/>
+ <buildSpec/>
+ <natures/>
+</projectDescription>
diff --git a/examples/gef/org.eclipse.gef.examples.logic.test/META-INF/MANIFEST.MF b/examples/gef/org.eclipse.gef.examples.logic.test/META-INF/MANIFEST.MF
index 5f3b888b..4605293c 100644
--- a/examples/gef/org.eclipse.gef.examples.logic.test/META-INF/MANIFEST.MF
+++ b/examples/gef/org.eclipse.gef.examples.logic.test/META-INF/MANIFEST.MF
@@ -2,13 +2,14 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: GEF logic SWTBot Test
Bundle-SymbolicName: org.eclipse.gef.examples.logic.test
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.5.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: org.eclipse.gef.examples.logic,
org.eclipse.swtbot.eclipse.gef.finder,
org.eclipse.swtbot.eclipse.finder,
org.eclipse.swtbot.eclipse.core,
org.eclipse.swtbot.swt.finder,
+ org.eclipse.swtbot.junit4_x,
org.junit4,
org.eclipse.swt,
org.eclipse.ui,
@@ -16,4 +17,5 @@ Require-Bundle: org.eclipse.gef.examples.logic,
org.hamcrest,
org.eclipse.gef,
org.eclipse.core.runtime,
- org.apache.log4j
+ org.apache.log4j,
+ org.eclipse.core.resources
diff --git a/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/OpenGefEditorTest.java b/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/OpenGefEditorAndCreateContentsExampleTest.java
index 5f4d54e0..291eb405 100644
--- a/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/OpenGefEditorTest.java
+++ b/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/OpenGefEditorAndCreateContentsExampleTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Obeo
+ * Copyright (c) 2009, 2010 Obeo
* 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
@@ -22,13 +22,15 @@ import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher;
import org.hamcrest.Description;
-public class OpenGefEditorTest extends SWTBotGefTestCase {
+public class OpenGefEditorAndCreateContentsExampleTest extends SWTBotGefTestCase {
private NewEmptyEmfProject emfProject = new NewEmptyEmfProject();
+
private CreateLogicDiagram logicDiagram = new CreateLogicDiagram();
-
+ private SWTBotGefEditor editor;
+
@Override
protected void setUp() throws Exception {
@@ -36,7 +38,6 @@ public class OpenGefEditorTest extends SWTBotGefTestCase {
closeWelcomePage();
}
-
private void closeWelcomePage() {
try {
bot.viewByTitle("Welcome").close();
@@ -49,55 +50,44 @@ public class OpenGefEditorTest extends SWTBotGefTestCase {
bot.menu("File").menu("Save").click();
}
- public void testCreateFile() throws Exception {
-
+ public void testCreateContents() throws Exception {
emfProject.createProject("test");
logicDiagram.createFile("test", "test.logic");
- SWTBotGefEditor editor = bot.gefEditor("test.logic");
+ editor = bot.gefEditor("test.logic");
createContents(editor);
saveCurrentEditor();
- bot.sleep(3000);
}
-// public void testCreateMFile() throws Exception {
-// emfProject.createProject("testM");
-// logicDiagram.createMFile("testM", "test.logicm");
-// final SWTBotGefEditor editor = bot.gefEditor("Logic M Graphical Editor");
-// createContents(editor);
-// saveCurrentEditor();
-// bot.sleep(3000);
-// }
-
private void createContents(final SWTBotGefEditor editor) {
editor.activateTool("Circuit");
- editor.mouseDrag(55, 55, 150, 100);
+ editor.drag(55, 55, 150, 100);
editor.activateTool("Circuit");
- editor.mouseMoveLeftClick(150, 150);
+ editor.click(150, 150);
editor.activateTool("Connection");
- editor.mouseMoveLeftClick(150, 150);
- editor.mouseMoveLeftClick(55, 55);
+ editor.click(150, 150);
+ editor.click(55, 55);
editor.activateTool("Or Gate");
- editor.mouseMoveLeftClick(200, 200);
+ editor.click(200, 200);
editor.activateTool("Connection");
- editor.mouseMoveLeftClick(150, 150);
- editor.mouseMoveLeftClick(200, 200);
+ editor.click(150, 150);
+ editor.click(200, 200);
- editor.mouseMoveLeftClick(200, 150);
- editor.mouseMoveLeftClick(210, 200);
+ editor.click(200, 150);
+ editor.click(210, 200);
- editor.mouseMoveLeftClick(200, 200);
- editor.mouseMoveLeftClick(230, 230);
+ editor.click(200, 200);
+ editor.click(230, 230);
editor.activateTool("Label");
- editor.mouseMoveLeftClick(300, 300);
+ editor.click(300, 300);
List<SWTBotGefEditPart> editParts = editor.editParts(new AbstractMatcher<LogicLabelEditPart>() {
@Override
protected boolean doMatch(Object item) {
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
new file mode 100644
index 00000000..f3a2e624
--- /dev/null
+++ b/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/AllTests.java
@@ -0,0 +1,351 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 Obeo
+ * 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:
+ * Mariot Chauvin <mariot.chauvin@obeo.fr> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.gef.examples.logic.test.unit;
+
+import static org.eclipse.swtbot.eclipse.gef.finder.matchers.IsInstanceOf.instanceOf;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.examples.logic.test.CreateLogicDiagram;
+import org.eclipse.gef.examples.logic.test.NewEmptyEmfProject;
+import org.eclipse.gef.examples.logicdesigner.edit.CircuitEditPart;
+import org.eclipse.gef.examples.logicdesigner.edit.LogicLabelEditPart;
+import org.eclipse.gef.examples.logicdesigner.model.Circuit;
+import org.eclipse.gef.examples.logicdesigner.model.Wire;
+import org.eclipse.swtbot.eclipse.gef.finder.SWTBotGefTestCase;
+import org.eclipse.swtbot.eclipse.gef.finder.SWTGefBot;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefConnectionEditPart;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.ui.PlatformUI;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class AllTests extends SWTBotGefTestCase implements LogicModeler {
+
+ private static final String PROJECT_NAME = "Test";
+
+ private static final String FILE_NAME = "test.logic";
+
+ private NewEmptyEmfProject emfProject = new NewEmptyEmfProject();
+
+ private CreateLogicDiagram logicDiagram = new CreateLogicDiagram();
+
+ private SWTBotGefEditor editor;
+
+ @BeforeClass
+ public static void closeWelcomePage() {
+ try {
+ new SWTGefBot().viewByTitle("Welcome").close();
+ } catch (WidgetNotFoundException e) {
+ // do nothing
+ }
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+ emfProject.createProject(PROJECT_NAME);
+ logicDiagram.createFile(PROJECT_NAME, FILE_NAME);
+ editor = bot.gefEditor(FILE_NAME);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (editor != null)
+ editor.close();
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
+ project.delete(true, null);
+ super.tearDown();
+ }
+
+ public void saveCurrentEditor() throws Exception {
+ bot.menu("File").menu("Save").click();
+ }
+
+ @Test
+ public void activateTool() {
+ editor.activateTool(TOOL_CIRCUIT);
+ assertEquals(TOOL_CIRCUIT, getActiveToolLabel());
+
+ editor.activateTool(TOOL_CONNECTION);
+ assertEquals(TOOL_CONNECTION, getActiveToolLabel());
+
+ editor.activateTool(TOOL_OR_GATE);
+ assertEquals(TOOL_OR_GATE, getActiveToolLabel());
+
+ editor.activateTool(TOOL_CIRCUIT);
+ assertEquals(TOOL_CIRCUIT, getActiveToolLabel());
+ }
+
+ private String getActiveToolLabel() {
+ return editor.getActiveTool().getLabel();
+ }
+
+ @Test
+ public void doubleClick() throws Exception {
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(10, 10);
+
+ SWTBotGefEditPart circuitEditPart = editor.editParts(instanceOf(CircuitEditPart.class)).get(0);
+ Circuit circuit = (Circuit) circuitEditPart.part().getModel();
+ final String nameBeforeDoubleClick = circuit.getName();
+ editor.select(circuitEditPart).doubleClick(15, 15);
+
+ /* we need to wait that double click have been executed */
+ syncWithUIThread();
+
+ final String nameAfterDoubleClick = circuit.getName();
+ assertFalse("circuit name was not modified by double click", nameBeforeDoubleClick.equals(nameAfterDoubleClick));
+ }
+
+
+
+ @Test
+ public void getEditPartWithLabelOnCanvas() throws Exception {
+ editor.activateTool(TOOL_LABEL);
+ editor.click(10, 10);
+ SWTBotGefEditPart botPart = editor.getEditPart("Label");
+ assertNotNull(botPart);
+ assertTrue(botPart.part() instanceof LogicLabelEditPart);
+ }
+
+ @Test
+ public void getEditPartWithLabelInsideNode() throws Exception {
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(10, 10);
+ editor.activateTool(TOOL_LABEL);
+ editor.click(10 + 3, 10 + 3);
+
+ SWTBotGefEditPart botPart = editor.getEditPart("Label");
+ assertNotNull(botPart);
+ assertTrue(botPart.part() instanceof LogicLabelEditPart);
+ }
+
+ @Test
+ public void drag() throws Exception {
+ editor.activateTool(TOOL_LABEL);
+ editor.click(10, 10);
+ editor.drag("Label", 100, 110);
+
+ Rectangle bounds = ((GraphicalEditPart) editor.getEditPart("Label").part()).getFigure().getBounds();
+ assertEquals(100, bounds.x);
+ assertEquals(110, bounds.y);
+ }
+
+ @Test
+ public void dragOnResizableElement() throws Exception {
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(30, 30);
+ SWTBotGefEditPart circuitEditPart = editor.editParts(instanceOf(CircuitEditPart.class)).get(0);
+ Rectangle boundsBeforeDrag = getBounds(circuitEditPart);
+ editor.drag(circuitEditPart, 50, 50);
+ syncWithUIThread();
+ checkSize(getBounds(circuitEditPart), boundsBeforeDrag.width, boundsBeforeDrag.height);
+ }
+
+ @Test
+ public void dragAndDropWithRelativeCoodinatesFigure() throws Exception {
+
+ int offset = 30;
+ int circuitFigureSize = 100;
+
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(offset, offset);
+
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(circuitFigureSize * 2 + offset, offset);
+
+ SWTBotGefEditPart circuitEditPart1 = editor.editParts(instanceOf(CircuitEditPart.class)).get(0);
+ SWTBotGefEditPart circuitEditPart2 = editor.editParts(instanceOf(CircuitEditPart.class)).get(1);
+
+ /* create a child of circuitEditPart1 */
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(circuitFigureSize / 2 + offset, circuitFigureSize / 2 + offset);
+
+ SWTBotGefEditPart circuitEditPart1child = circuitEditPart1.children().get(0);
+
+ editor.drag(circuitEditPart1child, 5 * (circuitFigureSize / 2) + offset, circuitFigureSize / 2 + offset);
+ syncWithUIThread();
+ assertFalse(circuitEditPart2.children().isEmpty());
+ }
+
+ @Test
+ public void resize() throws Exception {
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(30, 30);
+ SWTBotGefEditPart circuitEditPart = editor.editParts(instanceOf(CircuitEditPart.class)).get(0);
+ Rectangle boundsBeforeResize = getBounds(circuitEditPart);
+
+ circuitEditPart.resize(PositionConstants.SOUTH_WEST, 200, 200);
+ syncWithUIThread();
+ Rectangle boundsAfterResize = getBounds(circuitEditPart);
+ checkLocation(boundsAfterResize, boundsBeforeResize.x, boundsBeforeResize.y);
+ checkSize(boundsAfterResize, 200, 200);
+
+ circuitEditPart.resize(PositionConstants.EAST, 150, 200);
+ syncWithUIThread();
+ boundsAfterResize = getBounds(circuitEditPart);
+ checkLocation(boundsAfterResize, boundsBeforeResize.x + 50, boundsBeforeResize.y);
+ checkSize(boundsAfterResize, 150, 200);
+
+ circuitEditPart.resize(PositionConstants.NORTH, 150, 50);
+ syncWithUIThread();
+ boundsAfterResize = getBounds(circuitEditPart);
+ checkLocation(boundsAfterResize, boundsBeforeResize.x + 50, boundsBeforeResize.y + 150);
+ checkSize(boundsAfterResize, 150, 50);
+
+ circuitEditPart.resize(PositionConstants.NORTH_EAST, 175, 75);
+ syncWithUIThread();
+ boundsAfterResize = getBounds(circuitEditPart);
+ checkLocation(boundsAfterResize, boundsBeforeResize.x + 25, boundsBeforeResize.y + 125);
+ checkSize(boundsAfterResize, 175, 75);
+
+ }
+
+ @Test
+ public void createBendpointFromEditor() throws Exception {
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(10, 10);
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(120, 10);
+ editor.activateTool(TOOL_CONNECTION);
+ editor.drag(100, 20, 130, 20);
+ editor.click(130, 20);
+
+ final SWTBotGefEditPart circuitPart = editor.editParts(instanceOf(CircuitEditPart.class)).get(0);
+ final SWTBotGefConnectionEditPart wirePart = circuitPart.sourceConnections().get(0);
+ final Wire wire = (Wire) (wirePart.part()).getModel();
+ final Connection connection = (Connection) wirePart.part().getFigure();
+
+ editor.activateTool("Select");
+ assertEquals("Select", getActiveToolLabel());
+
+ Point startMove = connection.getPoints().getMidpoint().getCopy();
+ editor.click(startMove.x, startMove.y);
+
+
+
+ /* we need to wait element selection before proceed or drag will fail */
+ syncWithUIThread();
+ assertTrue(editor.selectedEditParts().contains(wirePart));
+
+ assertEquals(0, wire.getBendpoints().size());
+
+ editor.drag(startMove.x, startMove.y, 130, 250);
+ /* we need to wait the drag operates */
+ syncWithUIThread();
+
+ assertEquals(1, wire.getBendpoints().size());
+ /* we do not check the location, as WireBendpoint overrides getLocation to return null */
+ }
+
+ @Test
+ public void createBendpointFromEditPart() throws Exception {
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(10, 10);
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.click(120, 10);
+ editor.activateTool(TOOL_CONNECTION);
+ editor.drag(100, 20, 130, 20);
+ editor.click(130, 20);
+
+ editor.activateTool("Select");
+ assertEquals("Select", getActiveToolLabel());
+
+ final SWTBotGefEditPart circuitPart = editor.editParts(instanceOf(CircuitEditPart.class)).get(0);
+ final SWTBotGefConnectionEditPart wirePart = circuitPart.sourceConnections().get(0);
+ final Wire wire = (Wire) wirePart.part().getModel();
+
+ assertEquals(0, wire.getBendpoints().size());
+ wirePart.createBenpoint(130, 250);
+ /* we need to wait the drag operates */
+ syncWithUIThread();
+ assertEquals(1, wire.getBendpoints().size());
+ }
+
+ @Test
+ public void directEdit() throws Exception {
+ // TODO
+ }
+
+ /* Deprecated methods */
+
+ @Test
+ public void deprecatedGetEditPartWithLabelOnCanvas() throws Exception {
+ editor.activateTool(TOOL_LABEL);
+ editor.mouseMoveLeftClick(10, 10);
+ SWTBotGefEditPart botPart = editor.getEditPart("Label");
+ assertNotNull(botPart);
+ assertTrue(botPart.part() instanceof LogicLabelEditPart);
+ }
+
+ @Test
+ public void deprecatedGetEditPartWithLabelInsideNode() throws Exception {
+ editor.activateTool(TOOL_CIRCUIT);
+ editor.mouseMoveLeftClick(10, 10);
+ editor.activateTool("Label");
+ editor.mouseMoveLeftClick(10 + 3, 10 + 3);
+
+ SWTBotGefEditPart botPart = editor.getEditPart("Label");
+ assertNotNull(botPart);
+ assertTrue(botPart.part() instanceof LogicLabelEditPart);
+ }
+
+ @Test
+ public void deprecatedDrag() throws Exception {
+ editor.activateTool(TOOL_LABEL);
+ editor.mouseMoveLeftClick(10, 10);
+ editor.mouseDrag("Label", 100, 110);
+
+ Rectangle bounds = ((GraphicalEditPart) editor.getEditPart("Label").part()).getFigure().getBounds();
+ assertEquals(100, bounds.x);
+ assertEquals(110, bounds.y);
+ }
+
+ private void syncWithUIThread() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ while (PlatformUI.getWorkbench().getDisplay().readAndDispatch()) {
+ }
+ }
+ });
+ }
+
+ private Rectangle getBounds(SWTBotGefEditPart editPart) throws Exception {
+ return ((GraphicalEditPart) editPart.part()).getFigure().getBounds().getCopy();
+ }
+
+ private void checkLocation(final Rectangle bounds, int x, int y) throws Exception {
+ assertEquals(x, bounds.x);
+ assertEquals(y, bounds.y);
+ }
+
+ private void checkSize(final Rectangle bounds, int width, int height) throws Exception {
+ assertEquals(width, bounds.width);
+ assertEquals(height, bounds.height);
+ }
+
+}
diff --git a/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/LogicModeler.java b/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/LogicModeler.java
new file mode 100644
index 00000000..5e31bf05
--- /dev/null
+++ b/examples/gef/org.eclipse.gef.examples.logic.test/src/org/eclipse/gef/examples/logic/test/unit/LogicModeler.java
@@ -0,0 +1,13 @@
+package org.eclipse.gef.examples.logic.test.unit;
+
+public interface LogicModeler {
+
+ String TOOL_LABEL = "Label";
+
+ String TOOL_CONNECTION = "Connection";
+
+ String TOOL_CIRCUIT = "Circuit";
+
+ String TOOL_OR_GATE = "Or Gate";
+
+}
diff --git a/examples/gef/org.eclipse.gef.examples.logic/META-INF/MANIFEST.MF b/examples/gef/org.eclipse.gef.examples.logic/META-INF/MANIFEST.MF
index f52fcdcf..528c6e06 100644
--- a/examples/gef/org.eclipse.gef.examples.logic/META-INF/MANIFEST.MF
+++ b/examples/gef/org.eclipse.gef.examples.logic/META-INF/MANIFEST.MF
@@ -40,8 +40,10 @@ Import-Package: org.eclipse.core.commands,
org.eclipse.gef.ui.palette.customize,
org.eclipse.gef.ui.parts,
org.eclipse.gef.ui.rulers,
+ org.eclipse.jface,
org.eclipse.jface.action,
org.eclipse.jface.dialogs,
+ org.eclipse.jface.operation,
org.eclipse.jface.preference,
org.eclipse.jface.resource,
org.eclipse.jface.util,
diff --git a/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/CircuitEditPart.java b/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/CircuitEditPart.java
index 78d56bb7..514df3b3 100644
--- a/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/CircuitEditPart.java
+++ b/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/CircuitEditPart.java
@@ -24,12 +24,15 @@ import org.eclipse.gef.AutoexposeHelper;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.ExposeHelper;
import org.eclipse.gef.MouseWheelHelper;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.editparts.ViewportAutoexposeHelper;
import org.eclipse.gef.editparts.ViewportExposeHelper;
import org.eclipse.gef.editparts.ViewportMouseWheelHelper;
import org.eclipse.gef.examples.logicdesigner.figures.CircuitFigure;
import org.eclipse.gef.examples.logicdesigner.figures.FigureFactory;
+import org.eclipse.gef.examples.logicdesigner.model.Circuit;
/**
* Holds a circuit, which is a container capable of
@@ -95,4 +98,11 @@ public IFigure getContentPane() {
return getCircuitBoardFigure().getContentsPane();
}
+public void performRequest(Request request){
+ if (request.getType() == RequestConstants.REQ_OPEN) {
+ Circuit circuit = (Circuit) this.getModel();
+ circuit.setName("doubleClicked");
+ }
+}
+
}
diff --git a/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPart.java b/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPart.java
index bede19a0..168a8867 100644
--- a/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPart.java
+++ b/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/LogicLabelEditPart.java
@@ -21,7 +21,6 @@ import org.eclipse.gef.AccessibleEditPart;
import org.eclipse.gef.EditPolicy;
import org.eclipse.gef.Request;
import org.eclipse.gef.RequestConstants;
-import org.eclipse.gef.tools.DirectEditManager;
import org.eclipse.gef.examples.logicdesigner.LogicMessages;
import org.eclipse.gef.examples.logicdesigner.figures.StickyNoteFigure;
diff --git a/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPart.java b/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPart.java
index 56dd817b..20a546a2 100644
--- a/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPart.java
+++ b/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/edit/WireEditPart.java
@@ -22,7 +22,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.draw2d.Connection;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.ManhattanConnectionRouter;
-import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.draw2d.RelativeBendpoint;
import org.eclipse.gef.AccessibleEditPart;
diff --git a/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/model/Circuit.java b/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/model/Circuit.java
index a50589e3..f1e732c8 100644
--- a/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/model/Circuit.java
+++ b/examples/gef/org.eclipse.gef.examples.logic/src/org/eclipse/gef/examples/logicdesigner/model/Circuit.java
@@ -19,6 +19,9 @@ public class Circuit
static final long serialVersionUID = 1;
private static int count;
+
+private static String name = "NoName";
+
public static String TERMINALS_OUT [] =
new String [] { "1","2","3","4", //$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
"5","6","7","8"};//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
@@ -40,4 +43,12 @@ public void update() {
setOutput(TERMINALS_OUT[i],getInput(TERMINALS_IN[i]));
}
+public void setName(String name) {
+ this.name = name;
+}
+
+public String getName() {
+ return this.name;
+}
+
}
diff --git a/examples/rcp/org.rcpmail.test/META-INF/MANIFEST.MF b/examples/rcp/org.rcpmail.test/META-INF/MANIFEST.MF
index 567b37a5..bb2dea30 100644
--- a/examples/rcp/org.rcpmail.test/META-INF/MANIFEST.MF
+++ b/examples/rcp/org.rcpmail.test/META-INF/MANIFEST.MF
@@ -12,4 +12,4 @@ Require-Bundle: org.eclipse.ui,
org.junit4,
org.eclipse.swtbot.junit4_x
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: Eclipse.org
+Bundle-Vendor: Eclipse.org - SWTBot
diff --git a/examples/rcp/org.rcpmail.test/pom.xml b/examples/rcp/org.rcpmail.test/pom.xml
new file mode 100644
index 00000000..35168e8c
--- /dev/null
+++ b/examples/rcp/org.rcpmail.test/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.plugins</groupId>
+ <artifactId>org.rcpmail.test</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/examples/rcp/org.rcpmail/META-INF/MANIFEST.MF b/examples/rcp/org.rcpmail/META-INF/MANIFEST.MF
index aefae279..2d4456a0 100644
--- a/examples/rcp/org.rcpmail/META-INF/MANIFEST.MF
+++ b/examples/rcp/org.rcpmail/META-INF/MANIFEST.MF
@@ -8,4 +8,4 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: Eclipse.org
+Bundle-Vendor: Eclipse.org - SWTBot
diff --git a/examples/rcp/org.rcpmail/pom.xml b/examples/rcp/org.rcpmail/pom.xml
new file mode 100644
index 00000000..783f56b5
--- /dev/null
+++ b/examples/rcp/org.rcpmail/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.plugins</groupId>
+ <artifactId>org.rcpmail</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/git-foo.txt b/git-foo.txt
deleted file mode 100644
index 66ec789f..00000000
--- a/git-foo.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Copy a range of commits from svn to master. Useful when someone checks in into svn and those changes are pulled into the svn branch via 'git svn rebase'.
-$ git format-patch from..to --stdout --full-index -k | grep -v 'git-svn-id: svn+ssh://dev.eclipse.org/svnroot/technology/' | git am -k -3
-
-Check in changes into svn.
-$ git branch -D svn; git co -b svn; git svn rebase; git svn dcommit
-
diff --git a/org.eclipse.swt.examples/META-INF/MANIFEST.MF b/org.eclipse.swt.examples/META-INF/MANIFEST.MF
index 936905f4..68405df2 100644
--- a/org.eclipse.swt.examples/META-INF/MANIFEST.MF
+++ b/org.eclipse.swt.examples/META-INF/MANIFEST.MF
@@ -2,10 +2,11 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse SWT Example plugin (based on Eclipse's SWT Examples) (incubation)
Bundle-SymbolicName: org.eclipse.swt.examples;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.5.qualifier
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
-Export-Package: org.eclipse.swt.examples.addressbook,
+Export-Package: org.eclipse.jface.snippets.viewers,
+ org.eclipse.swt.examples.addressbook,
org.eclipse.swt.examples.browserexample,
org.eclipse.swt.examples.clipboard,
org.eclipse.swt.examples.controlexample,
@@ -19,10 +20,9 @@ Export-Package: org.eclipse.swt.examples.addressbook,
org.eclipse.swt.examples.layoutexample,
org.eclipse.swt.examples.paint,
org.eclipse.swt.examples.texteditor
-Bundle-Vendor: Eclipse.org
+Bundle-Vendor: Eclipse.org - SWTBot
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.core.commands.common,
- org.eclipse.core.runtime,
org.eclipse.jface.viewers,
org.eclipse.swt,
org.eclipse.swt.accessibility,
@@ -35,3 +35,4 @@ Import-Package: org.eclipse.core.commands.common,
org.eclipse.swt.printing,
org.eclipse.swt.program,
org.eclipse.swt.widgets
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0"
diff --git a/org.eclipse.swt.examples/build.properties b/org.eclipse.swt.examples/build.properties
index d5c5d28f..d7992f7f 100644
--- a/org.eclipse.swt.examples/build.properties
+++ b/org.eclipse.swt.examples/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008 Ketan Padegaonkar and others.
+# Copyright (c) 2008, 2010 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
@@ -15,10 +15,5 @@ bin.includes = META-INF/,\
.,\
src/,\
about.html
-src.includes = .classpath,\
- .project,\
- LICENSE.EPL,\
- META-INF/,\
- build.properties,\
- src/,\
+src.includes = LICENSE.EPL,\
about.html
diff --git a/org.eclipse.swt.examples/pom.xml b/org.eclipse.swt.examples/pom.xml
new file mode 100644
index 00000000..7826b61f
--- /dev/null
+++ b/org.eclipse.swt.examples/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.test</groupId>
+ <artifactId>org.eclipse.swt.examples</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java b/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
index 03ab9f2d..5f657a0b 100644
--- a/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
+++ b/org.eclipse.swt.examples/src/org/eclipse/swt/examples/controlexample/ControlExample.java
@@ -29,6 +29,12 @@ import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
public class ControlExample {
+
+ static {
+ // System.setProperty(LogFactory.DIAGNOSTICS_DEST_PROPERTY, "STDOUT");
+ System.setProperty("org.eclipse.swt.internal.carbon.smallFonts", "");
+ }
+
private static ResourceBundle resourceBundle = ResourceBundle.getBundle("examples_control"); //$NON-NLS-1$
static final int ciClosedFolder = 0, ciOpenFolder = 1, ciTarget = 2, ciBackground = 3,
ciParentBackground = 4;
diff --git a/org.eclipse.swtbot.ant.optional.junit4/.project b/org.eclipse.swtbot.ant.junit/.project
index 68534e81..249a720d 100644
--- a/org.eclipse.swtbot.ant.optional.junit4/.project
+++ b/org.eclipse.swtbot.ant.junit/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.swtbot.ant.optional.junit4</name>
+ <name>org.eclipse.swtbot.ant.junit</name>
<comment></comment>
<projects>
</projects>
diff --git a/org.eclipse.swtbot.ant.optional.junit3/META-INF/MANIFEST.MF b/org.eclipse.swtbot.ant.junit/META-INF/MANIFEST.MF
index 4dac4bcc..b52fcf35 100755
--- a/org.eclipse.swtbot.ant.optional.junit3/META-INF/MANIFEST.MF
+++ b/org.eclipse.swtbot.ant.junit/META-INF/MANIFEST.MF
@@ -1,10 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.swtbot.ant.optional.junit3
-Bundle-Version: 2.0.0.qualifier
+Bundle-Name: Headless Ant support for JUnit
+Bundle-SymbolicName: org.eclipse.swtbot.ant.junit
+Bundle-Version: 2.0.5.qualifier
Fragment-Host: org.apache.ant
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime.compatibility,
org.junit
-Bundle-Vendor: %providerName
+Bundle-Vendor: Eclipse.org - SWTBot
diff --git a/org.eclipse.swtbot.ant.optional.junit3/about.html b/org.eclipse.swtbot.ant.junit/about.html
index 5d03fd4c..5d03fd4c 100755
--- a/org.eclipse.swtbot.ant.optional.junit3/about.html
+++ b/org.eclipse.swtbot.ant.junit/about.html
diff --git a/org.eclipse.swtbot.ant.optional.junit3/build.properties b/org.eclipse.swtbot.ant.junit/build.properties
index ddcdb5e3..ddcdb5e3 100755
--- a/org.eclipse.swtbot.ant.optional.junit3/build.properties
+++ b/org.eclipse.swtbot.ant.junit/build.properties
diff --git a/org.eclipse.swtbot.ant.junit/pom.xml b/org.eclipse.swtbot.ant.junit/pom.xml
new file mode 100644
index 00000000..84d368ce
--- /dev/null
+++ b/org.eclipse.swtbot.ant.junit/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.plugins</groupId>
+ <artifactId>org.eclipse.swtbot.ant.junit</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.ant.optional.junit3/.project b/org.eclipse.swtbot.ant.optional.junit3/.project
index ab878a95..249a720d 100644
--- a/org.eclipse.swtbot.ant.optional.junit3/.project
+++ b/org.eclipse.swtbot.ant.optional.junit3/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.swtbot.ant.optional.junit3</name>
+ <name>org.eclipse.swtbot.ant.junit</name>
<comment></comment>
<projects>
</projects>
diff --git a/org.eclipse.swtbot.ant.optional.junit4/META-INF/MANIFEST.MF b/org.eclipse.swtbot.ant.optional.junit4/META-INF/MANIFEST.MF
deleted file mode 100755
index 20cd7827..00000000
--- a/org.eclipse.swtbot.ant.optional.junit4/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,10 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.swtbot.ant.optional.junit4
-Bundle-Version: 2.0.0.qualifier
-Fragment-Host: org.apache.ant
-Bundle-Localization: plugin
-Require-Bundle: org.eclipse.core.runtime.compatibility,
- org.junit4
-Bundle-Vendor: %providerName
diff --git a/org.eclipse.swtbot.ant.optional.junit4/about.html b/org.eclipse.swtbot.ant.optional.junit4/about.html
deleted file mode 100755
index 5d03fd4c..00000000
--- a/org.eclipse.swtbot.ant.optional.junit4/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>May 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.core/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.core/META-INF/MANIFEST.MF
index 0a2911fe..16feb1b7 100644
--- a/org.eclipse.swtbot.eclipse.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.swtbot.eclipse.core/META-INF/MANIFEST.MF
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWTBot Test Launcher Application Plug-in
Bundle-SymbolicName: org.eclipse.swtbot.eclipse.core;singleton:=true
-Bundle-Version: 2.0.0.qualifier
-Bundle-Vendor: Eclipse.org
+Bundle-Version: 2.0.5.qualifier
+Bundle-Vendor: Eclipse.org - SWTBot
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.core.runtime;version="3.4.0",
org.eclipse.equinox.app;version="1.0.0",
org.eclipse.jdt.internal.junit.runner,
- org.eclipse.ui,
+ org.eclipse.ui;ui.workbench=split,
org.eclipse.ui.testing,
org.osgi.framework;version="1.4.0"
diff --git a/org.eclipse.swtbot.eclipse.core/build.properties b/org.eclipse.swtbot.eclipse.core/build.properties
index 922b4b08..107559e6 100644
--- a/org.eclipse.swtbot.eclipse.core/build.properties
+++ b/org.eclipse.swtbot.eclipse.core/build.properties
@@ -1,3 +1,13 @@
+###############################################################################
+# Copyright (c) 2010 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
+###############################################################################
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
@@ -7,9 +17,4 @@ bin.includes = META-INF/,\
src/,\
plugin.xml
src.includes = LICENSE.EPL,\
- META-INF/,\
- about.html,\
- build.properties,\
- src/,\
- .project,\
- .classpath
+ about.html
diff --git a/org.eclipse.swtbot.eclipse.core/pom.xml b/org.eclipse.swtbot.eclipse.core/pom.xml
new file mode 100644
index 00000000..4ce190dc
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.core/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.features</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.core</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.core/src/org/eclipse/swtbot/eclipse/core/UITestApplication.java b/org.eclipse.swtbot.eclipse.core/src/org/eclipse/swtbot/eclipse/core/UITestApplication.java
index 5cd57610..005dd87c 100644
--- a/org.eclipse.swtbot.eclipse.core/src/org/eclipse/swtbot/eclipse/core/UITestApplication.java
+++ b/org.eclipse.swtbot.eclipse.core/src/org/eclipse/swtbot/eclipse/core/UITestApplication.java
@@ -11,8 +11,6 @@
*******************************************************************************/
package org.eclipse.swtbot.eclipse.core;
-import java.util.Arrays;
-
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -47,7 +45,7 @@ public class UITestApplication implements IApplication, ITestHarness {
String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
Object app = getApplication(args);
- Assert.isNotNull(app);
+ Assert.isNotNull(app, "The application " + getApplicationToRun(args) + " could not be found. Please see the SWTBot troubleshooting guide: http://wiki.eclipse.org/SWTBot/Troubleshooting");
fTestableObject = PlatformUI.getTestableObject();
fTestableObject.setTestHarness(this);
@@ -74,10 +72,12 @@ public class UITestApplication implements IApplication, ITestHarness {
// Find the name of the application as specified by the PDE JUnit launcher.
// If no application is specified, the 3.0 default workbench application
// is returned.
+ String applicationToRun = getApplicationToRun(args);
+
IExtension extension = Platform.getExtensionRegistry().getExtension(Platform.PI_RUNTIME, Platform.PT_APPLICATIONS,
- getApplicationToRun(args));
+ applicationToRun);
- Assert.isNotNull(extension);
+ Assert.isNotNull(extension, "Could not find IExtension for application: " + applicationToRun);
// If the extension does not have the correct grammar, return null.
// Otherwise, return the application object.
diff --git a/org.eclipse.swtbot.eclipse.dsl.test/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.dsl.test/META-INF/MANIFEST.MF
deleted file mode 100644
index b2910b7a..00000000
--- a/org.eclipse.swtbot.eclipse.dsl.test/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,12 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: SWTBot Dsl for Eclipse IDE (incubation)
-Bundle-SymbolicName: org.eclipse.swtbot.eclipse.dsl.test
-Bundle-Version: 2.0.0.qualifier
-Bundle-Vendor: Eclipse.org
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.swtbot.eclipse.dsl,
- org.junit4
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.swtbot.eclipse.dsl.test/build.properties b/org.eclipse.swtbot.eclipse.dsl.test/build.properties
deleted file mode 100644
index 465a72ed..00000000
--- a/org.eclipse.swtbot.eclipse.dsl.test/build.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- src/
-src.includes = src/,\
- META-INF/,\
- .project,\
- .classpath
diff --git a/org.eclipse.swtbot.eclipse.dsl/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.dsl/META-INF/MANIFEST.MF
index 3b3be8b6..ced4501c 100644
--- a/org.eclipse.swtbot.eclipse.dsl/META-INF/MANIFEST.MF
+++ b/org.eclipse.swtbot.eclipse.dsl/META-INF/MANIFEST.MF
@@ -2,12 +2,12 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWTBot Dsl for Eclipse IDE (incubation)
Bundle-SymbolicName: org.eclipse.swtbot.eclipse.dsl
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.5.qualifier
Bundle-Activator: org.eclipse.swtbot.eclipse.dsl.Activator
-Bundle-Vendor: Eclipse.org
+Bundle-Vendor: Eclipse.org - SWTBot
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
-Import-Package: org.apache.log4j;version="1.2.12",
+Import-Package: org.apache.log4j;version="[1.2.13,1.3.0)",
org.eclipse.core.runtime;version="3.4.0",
org.eclipse.swt.widgets,
org.eclipse.swtbot.eclipse.finder,
@@ -17,7 +17,7 @@ Import-Package: org.apache.log4j;version="1.2.12",
org.eclipse.swtbot.swt.finder.results,
org.eclipse.swtbot.swt.finder.utils,
org.eclipse.swtbot.swt.finder.widgets,
- org.eclipse.ui,
org.eclipse.ui.plugin,
- org.hamcrest;version="1.1.0",
org.osgi.framework;version="1.4.0"
+Require-Bundle: org.eclipse.ui.workbench;bundle-version="3.6.0",
+ org.hamcrest.core;bundle-version="1.1.0"
diff --git a/org.eclipse.swtbot.eclipse.dsl/build.properties b/org.eclipse.swtbot.eclipse.dsl/build.properties
index 9d0c8c98..9025deb5 100644
--- a/org.eclipse.swtbot.eclipse.dsl/build.properties
+++ b/org.eclipse.swtbot.eclipse.dsl/build.properties
@@ -1,11 +1,16 @@
+###############################################################################
+# Copyright (c) 2010 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
+###############################################################################
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
src/,\
.settings/
-src.includes = src/,\
- META-INF/,\
- .settings/,\
- .project,\
- .classpath
diff --git a/org.eclipse.swtbot.eclipse.dsl/pom.xml b/org.eclipse.swtbot.eclipse.dsl/pom.xml
new file mode 100644
index 00000000..b0305c1a
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.dsl/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.features</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.dsl</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.finder.test/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.finder.test/META-INF/MANIFEST.MF
index c631f04c..66cfb7ab 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.swtbot.eclipse.finder.test/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWTBot Eclipse Control Finder Plug-in Test (incubation)
Bundle-SymbolicName: org.eclipse.swtbot.eclipse.finder.test;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.5.qualifier
Require-Bundle: org.eclipse.jface.text,
org.eclipse.core.resources,
org.eclipse.ui,
@@ -13,15 +13,13 @@ Require-Bundle: org.eclipse.jface.text,
org.eclipse.swtbot.eclipse.finder,
org.hamcrest,
org.junit4,
- org.apache.log4j;version="1.2.12",
- org.eclipse.swtbot.junit4_x
+ org.apache.log4j;bundle-version="[1.2.13,1.3.0)",
+ org.eclipse.swtbot.junit4_x,
+ org.eclipse.jdt.ui;bundle-version="3.6.0",
+ org.eclipse.ui.intro,
+ org.eclipse.ui.intro.universal,
+ org.eclipse.sdk;bundle-version="3.6.0",
+ org.eclipse.platform
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: Eclipse.org
-Export-Package: org.eclipse.swtbot.eclipse.finder,
- org.eclipse.swtbot.eclipse.finder.exceptions,
- org.eclipse.swtbot.eclipse.finder.test.ui.data.internal,
- org.eclipse.swtbot.eclipse.finder.test.ui.handler,
- org.eclipse.swtbot.eclipse.finder.test.ui.views,
- org.eclipse.swtbot.eclipse.finder.widgets,
- org.eclipse.swtbot.eclipse.finder.widgets.helpers
+Bundle-Vendor: Eclipse.org - SWTBot
Eclipse-RegisterBuddy: org.apache.log4j
diff --git a/org.eclipse.swtbot.eclipse.finder.test/build.properties b/org.eclipse.swtbot.eclipse.finder.test/build.properties
index 77caec59..934b8cea 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/build.properties
+++ b/org.eclipse.swtbot.eclipse.finder.test/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008 Ketan Padegaonkar and others.
+# Copyright (c) 2008, 2010 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
@@ -17,10 +17,5 @@ bin.includes = META-INF/,\
src/,\
plugin.xml
source.. = src/
-src.includes = .classpath,\
- LICENSE.EPL,\
- .project,\
- META-INF/,\
- about.html,\
- build.properties,\
- src/
+src.includes = LICENSE.EPL,\
+ about.html
diff --git a/org.eclipse.swtbot.eclipse.finder.test/plugin.xml b/org.eclipse.swtbot.eclipse.finder.test/plugin.xml
index d30dd74d..df1048fe 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/plugin.xml
+++ b/org.eclipse.swtbot.eclipse.finder.test/plugin.xml
@@ -15,6 +15,18 @@
id="org.eclipse.swtbot.eclipse.finder.test.ui.views.SWTBotTestView"
name="SWTBot Test View">
</view>
+ <view
+ class="org.eclipse.swtbot.eclipse.finder.test.ui.views.SWTBotFormView"
+ id="org.eclipse.swtbot.eclipse.finder.test.ui.views.SWTBotFormView1"
+ name="Form 1"
+ restorable="true">
+ </view>
+ <view
+ class="org.eclipse.swtbot.eclipse.finder.test.ui.views.SWTBotFormView"
+ id="org.eclipse.swtbot.eclipse.finder.test.ui.views.SWTBotFormView2"
+ name="Form 2"
+ restorable="true">
+ </view>
</extension>
<extension
point="org.eclipse.ui.handlers">
@@ -22,6 +34,10 @@
class="org.eclipse.swtbot.eclipse.finder.test.ui.handler.SampleHandler"
commandId="org.eclipse.swtbot.eclipse.finder.test.ui.commands.ContributionItemCommand">
</handler>
+ <handler
+ class="org.eclipse.swtbot.eclipse.finder.test.ui.handler.SampleParameterizedHandler"
+ commandId="org.eclipse.swtbot.eclipse.finder.test.ui.commands.ParameterizedContributionItemCommand">
+ </handler>
</extension>
<extension
point="org.eclipse.ui.bindings">
@@ -43,6 +59,26 @@
mnemonic="C"
style="toggle">
</command>
+ <command
+ commandId="org.eclipse.swtbot.eclipse.finder.test.ui.commands.ParameterizedContributionItemCommand"
+ id="org.eclipse.swtbot.eclipse.finder.test.ui.view.menu.ParameterizedContributionItemCommand"
+ label="Try the Strawberry"
+ mnemonic="S">
+ <parameter
+ name="org.eclipse.swtbot.eclipse.finder.test.flavor"
+ value="Strawberry">
+ </parameter>
+ </command>
+ <command
+ commandId="org.eclipse.swtbot.eclipse.finder.test.ui.commands.ParameterizedContributionItemCommand"
+ id="org.eclipse.swtbot.eclipse.finder.test.ui.view.menu.ParameterizedContributionItemCommand"
+ label="Try the Banana"
+ mnemonic="B">
+ <parameter
+ name="org.eclipse.swtbot.eclipse.finder.test.flavor"
+ value="Banana">
+ </parameter>
+ </command>
</menuContribution>
</extension>
<extension
@@ -56,6 +92,35 @@
id="org.eclipse.swtbot.eclipse.finder.test.ui.commands.ContributionItemCommand"
name="Contribution Item Command">
</command>
+ <command
+ categoryId="org.eclipse.swtbot.eclipse.finder.test.ui.commands.category"
+ id="org.eclipse.swtbot.eclipse.finder.test.ui.commands.ParameterizedContributionItemCommand"
+ name="Parameterized Contribution Item Command">
+ <commandParameter
+ id="org.eclipse.swtbot.eclipse.finder.test.flavor"
+ name="Flavor"
+ optional="true">
+ </commandParameter>
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.swtbot.eclipse.finder.test.ui.editors.MultiPageEditor"
+ contributorClass="org.eclipse.swtbot.eclipse.finder.test.ui.editors.MultiPageEditorContributor"
+ extensions="mpe"
+ icon="icons/sample.gif"
+ id="org.eclipse.swtbot.eclipse.finder.test.ui.editors.MultiPageEditor"
+ name="Sample Multi-page Editor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ class="org.eclipse.swtbot.eclipse.finder.test.ui.perspectives.FormPerspective"
+ id="org.eclipse.swtbot.eclipse.finder.test.ui.perspectives.FormPerspective"
+ name="name">
+ </perspective>
</extension>
</plugin>
diff --git a/org.eclipse.swtbot.eclipse.finder.test/pom.xml b/org.eclipse.swtbot.eclipse.finder.test/pom.xml
new file mode 100644
index 00000000..be279754
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder.test/pom.xml
@@ -0,0 +1,81 @@
+<!-- Copyright (c) 2011 PetalsLink. 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 Authors: * Mickael Istria (PetalsLink) -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.plugins</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.finder.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <properties>
+ <!-- tycho.testArgLine repeated to re-use the configuration for argLine for jacoco agent -->
+ <uitest.vmparams>${tycho.testArgLine} -Xms64m -Xmx1024m -XX:MaxPermSize=128M</uitest.vmparams>
+ </properties>
+ <profiles>
+ <profile>
+ <id>skip-ui-tests</id>
+ <activation>
+ <property>
+ <name>skip-ui-tests</name>
+ </property>
+ </activation>
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+ </profile>
+ <profile>
+ <id>macosx</id>
+ <activation>
+ <os>
+ <name>mac os x</name>
+ <family>mac</family>
+ </os>
+ </activation>
+ <properties>
+ <ui.test.vmargs>${uitest.vmparams} -XstartOnFirstThread</ui.test.vmargs>
+ </properties>
+ </profile>
+ <profile>
+ <id>other-os</id>
+ <activation>
+ <os>
+ <name>not-mac</name>
+ <family>!mac</family>
+ </os>
+ </activation>
+ <properties>
+ <ui.test.vmargs>${uitest.vmparams}</ui.test.vmargs>
+ </properties>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <argLine>${ui.test.vmargs}</argLine>
+ <useUIHarness>true</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <product>org.eclipse.sdk.ide</product>
+ <application>org.eclipse.ui.ide.workbench</application>
+ <testSuite>org.eclipse.swtbot.eclipse.finder.test</testSuite>
+ <testClass>org.eclipse.swtbot.eclipse.finder.AllTests</testClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/AllTests.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/AllTests.java
index 412baf14..6a192150 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/AllTests.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Ketan Padegaonkar and others.
+ * Copyright (c) 2008,2009,2010 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
@@ -13,16 +13,22 @@ package org.eclipse.swtbot.eclipse.finder;
import org.eclipse.swtbot.eclipse.finder.exceptions.QuickFixNotFoundExceptionTest;
import org.eclipse.swtbot.eclipse.finder.finders.CommandFinderTest;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditorTest;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditorTest;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotViewTest;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJUnit4Suite;
import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
/**
* @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt;
* @version $Id$
*/
-@RunWith(Suite.class)
-@SuiteClasses( { QuickFixNotFoundExceptionTest.class, CommandFinderTest.class, SWTBotEclipseEditorTest.class, SWTBotViewTest.class })
+@RunWith(SWTBotJUnit4Suite.class)
+@SuiteClasses({
+ QuickFixNotFoundExceptionTest.class,
+ CommandFinderTest.class,
+ SWTBotEclipseEditorTest.class,
+ SWTBotViewTest.class,
+ SWTBotMultiPageEditorTest.class })
public class AllTests {
}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/FinderTestIds.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/FinderTestIds.java
new file mode 100644
index 00000000..ad815467
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/FinderTestIds.java
@@ -0,0 +1,14 @@
+package org.eclipse.swtbot.eclipse.finder;
+
+import org.eclipse.swtbot.eclipse.finder.test.ui.perspectives.FormPerspective;
+import org.eclipse.swtbot.eclipse.finder.test.ui.views.SWTBotFormView;
+import org.eclipse.swtbot.eclipse.finder.test.ui.views.SWTBotTestView;
+
+public class FinderTestIds {
+
+ public static final String VIEW_ID_TEST = SWTBotTestView.class.getName();
+ public static final String VIEW_ID_FORM_1 = SWTBotFormView.class.getName() + "1";
+ public static final String VIEW_ID_FORM_2 = SWTBotFormView.class.getName() + "2";
+ public static final String PERSPECTIVE_ID_FORM = FormPerspective.class.getName();
+
+}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/data/internal/SWTBotTestContentProvider.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/data/internal/SWTBotTestContentProvider.java
index a4253c47..896ab611 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/data/internal/SWTBotTestContentProvider.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/data/internal/SWTBotTestContentProvider.java
@@ -68,7 +68,8 @@ public class SWTBotTestContentProvider implements IStructuredContentProvider {
}
public void dispose() {
- data.clear();
+ if (data != null)
+ data.clear();
data = null;
viewer.getTable().dispose();
viewer = null;
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/editors/MultiPageEditor.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/editors/MultiPageEditor.java
new file mode 100644
index 00000000..7ea25436
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/editors/MultiPageEditor.java
@@ -0,0 +1,261 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.finder.test.ui.editors;
+
+import java.io.StringWriter;
+import java.text.Collator;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FontDialog;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.MultiPageEditorPart;
+
+/**
+ * An example showing how to create a multi-page editor. This example has 3 pages:
+ * <ul>
+ * <li>page 0 contains a nested text editor.
+ * <li>page 1 allows you to change the font used in page 2
+ * <li>page 2 shows the words in page 0 in sorted order
+ * </ul>
+ */
+public class MultiPageEditor extends MultiPageEditorPart implements IResourceChangeListener {
+
+ /** The text editor used in page 0. */
+ private TextEditor editor;
+
+ /** The font chosen in page 1. */
+ private Font font;
+
+ /** The text widget used in page 2. */
+ private StyledText text;
+
+ /**
+ * Creates a multi-page editor example.
+ */
+ public MultiPageEditor() {
+ super();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(this);
+ }
+
+ /**
+ * Creates page 0 of the multi-page editor, which contains a text editor.
+ */
+ void createPage0() {
+ try {
+ editor = new TextEditor();
+ int index = addPage(editor, getEditorInput());
+ setPageText(index, editor.getTitle());
+ } catch (PartInitException e) {
+ ErrorDialog.openError(
+ getSite().getShell(),
+ "Error creating nested text editor",
+ null,
+ e.getStatus());
+ }
+ }
+
+ /**
+ * Creates page 1 of the multi-page editor, which allows you to change the font used in page 2.
+ */
+ void createPage1() {
+
+ Composite composite = new Composite(getContainer(), SWT.NONE);
+ GridLayout layout = new GridLayout();
+ composite.setLayout(layout);
+ layout.numColumns = 2;
+
+ Button fontButton = new Button(composite, SWT.NONE);
+ GridData gd = new GridData(GridData.BEGINNING);
+ gd.horizontalSpan = 2;
+ fontButton.setLayoutData(gd);
+ fontButton.setText("Change Font...");
+
+ fontButton.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ setFont();
+ }
+ });
+
+ int index = addPage(composite);
+ setPageText(index, "Properties");
+ }
+
+ /**
+ * Creates page 2 of the multi-page editor, which shows the sorted text.
+ */
+ void createPage2() {
+ Composite composite = new Composite(getContainer(), SWT.NONE);
+ FillLayout layout = new FillLayout();
+ composite.setLayout(layout);
+ text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
+ text.setEditable(false);
+
+ int index = addPage(composite);
+ setPageText(index, "Preview");
+ }
+
+ /**
+ * Creates the pages of the multi-page editor.
+ */
+ protected void createPages() {
+ createPage0();
+ createPage1();
+ createPage2();
+ }
+
+ /**
+ * The <code>MultiPageEditorPart</code> implementation of this <code>IWorkbenchPart</code> method disposes all
+ * nested editors. Subclasses may extend.
+ */
+ public void dispose() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
+ super.dispose();
+ }
+
+ /**
+ * Saves the multi-page editor's document.
+ */
+ public void doSave(IProgressMonitor monitor) {
+ getEditor(0).doSave(monitor);
+ }
+
+ /**
+ * Saves the multi-page editor's document as another file. Also updates the text for page 0's tab, and updates this
+ * multi-page editor's input to correspond to the nested editor's.
+ */
+ public void doSaveAs() {
+ IEditorPart editor = getEditor(0);
+ editor.doSaveAs();
+ setPageText(0, editor.getTitle());
+ setInput(editor.getEditorInput());
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IEditorPart
+ */
+ public void gotoMarker(IMarker marker) {
+ setActivePage(0);
+ IDE.gotoMarker(getEditor(0), marker);
+ }
+
+ /**
+ * The <code>MultiPageEditorExample</code> implementation of this method checks that the input is an instance of
+ * <code>IFileEditorInput</code>.
+ */
+ public void init(IEditorSite site, IEditorInput editorInput)
+ throws PartInitException {
+ // if (!(editorInput instanceof IFileEditorInput))
+ // throw new PartInitException("Invalid Input: Must be IFileEditorInput");
+ super.init(site, editorInput);
+ }
+
+ /*
+ * (non-Javadoc) Method declared on IEditorPart.
+ */
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * Calculates the contents of page 2 when the it is activated.
+ */
+ protected void pageChange(int newPageIndex) {
+ super.pageChange(newPageIndex);
+ if (newPageIndex == 2) {
+ sortWords();
+ }
+ }
+
+ /**
+ * Closes all project files on project close.
+ */
+ public void resourceChanged(final IResourceChangeEvent event) {
+ if (event.getType() == IResourceChangeEvent.PRE_CLOSE) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbenchPage[] pages = getSite().getWorkbenchWindow().getPages();
+ for (int i = 0; i < pages.length; i++) {
+ if (((FileEditorInput) editor.getEditorInput()).getFile().getProject().equals(event.getResource())) {
+ IEditorPart editorPart = pages[i].findEditor(editor.getEditorInput());
+ pages[i].closeEditor(editorPart, true);
+ }
+ }
+ }
+ });
+ }
+ }
+
+ /**
+ * Sets the font related data to be applied to the text in page 2.
+ */
+ void setFont() {
+ FontDialog fontDialog = new FontDialog(getSite().getShell());
+ fontDialog.setFontList(text.getFont().getFontData());
+ FontData fontData = fontDialog.open();
+ if (fontData != null) {
+ if (font != null)
+ font.dispose();
+ font = new Font(text.getDisplay(), fontData);
+ text.setFont(font);
+ }
+ }
+
+ /**
+ * Sorts the words in page 0, and shows them in page 2.
+ */
+ void sortWords() {
+
+ String editorText =
+ editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
+
+ StringTokenizer tokenizer =
+ new StringTokenizer(editorText, " \t\n\r\f!@#\u0024%^&*()-_=+`~[]{};:'\",.<>/?|\\");
+ ArrayList editorWords = new ArrayList();
+ while (tokenizer.hasMoreTokens()) {
+ editorWords.add(tokenizer.nextToken());
+ }
+
+ Collections.sort(editorWords, Collator.getInstance());
+ StringWriter displayText = new StringWriter();
+ for (int i = 0; i < editorWords.size(); i++) {
+ displayText.write(((String) editorWords.get(i)));
+ displayText.write(System.getProperty("line.separator"));
+ }
+ text.setText(displayText.toString());
+ }
+}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/editors/MultiPageEditorContributor.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/editors/MultiPageEditorContributor.java
new file mode 100644
index 00000000..1e82698e
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/editors/MultiPageEditorContributor.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.finder.test.ui.editors;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.ide.IDE;
+import org.eclipse.ui.ide.IDEActionFactory;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+
+/**
+ * Manages the installation/deinstallation of global actions for multi-page editors. Responsible for the redirection of
+ * global actions to the active editor. Multi-page contributor replaces the contributors for the individual editors in
+ * the multi-page editor.
+ */
+public class MultiPageEditorContributor extends MultiPageEditorActionBarContributor {
+ private IEditorPart activeEditorPart;
+ private Action sampleAction;
+
+ /**
+ * Creates a multi-page contributor.
+ */
+ public MultiPageEditorContributor() {
+ super();
+ createActions();
+ }
+
+ /**
+ * Returns the action registed with the given text editor.
+ *
+ * @return IAction or null if editor is null.
+ */
+ protected IAction getAction(ITextEditor editor, String actionID) {
+ return (editor == null ? null : editor.getAction(actionID));
+ }
+
+ /*
+ * (non-JavaDoc) Method declared in AbstractMultiPageEditorActionBarContributor.
+ */
+
+ public void setActivePage(IEditorPart part) {
+ if (activeEditorPart == part)
+ return;
+
+ activeEditorPart = part;
+
+ IActionBars actionBars = getActionBars();
+ if (actionBars != null) {
+
+ ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
+
+ actionBars.setGlobalActionHandler(
+ ActionFactory.DELETE.getId(),
+ getAction(editor, ITextEditorActionConstants.DELETE));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.UNDO.getId(),
+ getAction(editor, ITextEditorActionConstants.UNDO));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.REDO.getId(),
+ getAction(editor, ITextEditorActionConstants.REDO));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.CUT.getId(),
+ getAction(editor, ITextEditorActionConstants.CUT));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.COPY.getId(),
+ getAction(editor, ITextEditorActionConstants.COPY));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.PASTE.getId(),
+ getAction(editor, ITextEditorActionConstants.PASTE));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.SELECT_ALL.getId(),
+ getAction(editor, ITextEditorActionConstants.SELECT_ALL));
+ actionBars.setGlobalActionHandler(
+ ActionFactory.FIND.getId(),
+ getAction(editor, ITextEditorActionConstants.FIND));
+ actionBars.setGlobalActionHandler(
+ IDEActionFactory.BOOKMARK.getId(),
+ getAction(editor, IDEActionFactory.BOOKMARK.getId()));
+ actionBars.updateActionBars();
+ }
+ }
+
+ private void createActions() {
+ sampleAction = new Action() {
+ public void run() {
+ MessageDialog.openInformation(null, "SWTBot Eclipse Control Finder Plug-in Test (incubation)", "Sample Action Executed");
+ }
+ };
+ sampleAction.setText("Sample Action");
+ sampleAction.setToolTipText("Sample Action tool tip");
+ sampleAction.setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().
+ getImageDescriptor(IDE.SharedImages.IMG_OBJS_TASK_TSK));
+ }
+
+ public void contributeToMenu(IMenuManager manager) {
+ IMenuManager menu = new MenuManager("Editor &Menu");
+ manager.prependToGroup(IWorkbenchActionConstants.MB_ADDITIONS, menu);
+ menu.add(sampleAction);
+ }
+
+ public void contributeToToolBar(IToolBarManager manager) {
+ manager.add(new Separator());
+ manager.add(sampleAction);
+ }
+}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/handler/SampleParameterizedHandler.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/handler/SampleParameterizedHandler.java
new file mode 100644
index 00000000..cc78262d
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/handler/SampleParameterizedHandler.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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
+ * Jesper Steen Moeller - support for parameterized commands
+ *******************************************************************************/
+package org.eclipse.swtbot.eclipse.finder.test.ui.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Our sample handler extends AbstractHandler, an IHandler base class.
+ *
+ * @see org.eclipse.core.commands.IHandler
+ * @see org.eclipse.core.commands.AbstractHandler
+ */
+public class SampleParameterizedHandler extends AbstractHandler {
+ /**
+ * The constructor.
+ */
+ public SampleParameterizedHandler() {
+ }
+
+ /**
+ * the command has been executed, so extract extract the needed information from the application context.
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ MessageDialog.openInformation(window.getShell(), "Simple Dialog", "My parameters:" + event.getParameters().toString());
+ return null;
+ }
+}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/perspectives/FormPerspective.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/perspectives/FormPerspective.java
new file mode 100644
index 00000000..d18e08f0
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/perspectives/FormPerspective.java
@@ -0,0 +1,14 @@
+package org.eclipse.swtbot.eclipse.finder.test.ui.perspectives;
+
+import org.eclipse.swtbot.eclipse.finder.FinderTestIds;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+public class FormPerspective implements IPerspectiveFactory {
+
+ public void createInitialLayout(IPageLayout layout) {
+ layout.addView(FinderTestIds.VIEW_ID_FORM_1, IPageLayout.LEFT, 0.2f, layout.getEditorArea());
+ layout.addView(FinderTestIds.VIEW_ID_FORM_2, IPageLayout.RIGHT, 0.2f, FinderTestIds.VIEW_ID_FORM_1);
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/views/SWTBotFormView.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/views/SWTBotFormView.java
new file mode 100644
index 00000000..fd128940
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/test/ui/views/SWTBotFormView.java
@@ -0,0 +1,28 @@
+package org.eclipse.swtbot.eclipse.finder.test.ui.views;
+
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.ViewPart;
+
+public class SWTBotFormView extends ViewPart {
+
+ private Text text;
+
+ @Override
+ public void createPartControl(Composite parent) {
+ GridLayoutFactory.fillDefaults().numColumns(2).applyTo(parent);
+ Label label = new Label(parent, SWT.NONE);
+ label.setText(getPartName());
+ text = new Text(parent, SWT.BORDER);
+ text.setText(getPartName());
+ }
+
+ @Override
+ public void setFocus() {
+ text.setFocus();
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/AbstractSWTBotEclipseTest.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/AbstractSWTBotEclipseTest.java
new file mode 100644
index 00000000..7808f12a
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/AbstractSWTBotEclipseTest.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.finder.widgets;
+
+import java.util.List;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.junit.After;
+import org.junit.BeforeClass;
+
+public abstract class AbstractSWTBotEclipseTest {
+
+ protected static SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+ @BeforeClass
+ public static void beforeClass() {
+ closeWelcomePage();
+ }
+
+ private static void closeWelcomePage() {
+ try {
+ SWTBotPreferences.TIMEOUT = 0;
+ bot.viewByTitle("Welcome").close();
+ } catch (WidgetNotFoundException e) {
+ // do nothing
+ } finally {
+ SWTBotPreferences.TIMEOUT = 5000;
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ saveAndCloseAllEditors();
+ }
+
+ /**
+ * @throws WidgetNotFoundException
+ */
+ private void saveAndCloseAllEditors() {
+ List<? extends SWTBotEditor> editors = bot.editors();
+ for (SWTBotEditor editor : editors) {
+ editor.saveAndClose();
+ }
+ }
+}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotMultiPageEditorTest.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotMultiPageEditorTest.java
new file mode 100644
index 00000000..34606311
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotMultiPageEditorTest.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.finder.widgets;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasItems;
+import static org.hamcrest.Matchers.startsWith;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.utils.FileUtils;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotStyledText;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class SWTBotMultiPageEditorTest extends AbstractSWTBotEclipseTest {
+
+ private File testFile;
+ private SampleMultiPageEditor editor;
+
+ @Before
+ public void before() throws Exception {
+ testFile = File.createTempFile("multipage", ".mpe");
+ testFile.deleteOnExit();
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ try {
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IDE.openEditor(activePage, testFile.toURI(),
+ "org.eclipse.swtbot.eclipse.finder.test.ui.editors.MultiPageEditor", true);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ }
+ }
+ });
+ this.editor = new SampleMultiPageEditor(bot.multipageEditorByTitle("Sample Multi-page Editor"), bot);
+ }
+
+ @After
+ public void after() {
+ if (testFile != null) {
+ testFile.delete();
+ }
+ }
+
+ @Test
+ public void shouldGetPageCount() throws Exception {
+ assertEquals(3, editor.getPageCount());
+ }
+
+ @Test
+ public void shouldGetActivePage() throws Exception {
+ assertTrue(editor.isActive());
+ assertEquals(testFile.getName(), editor.getActivePageTitle());
+ }
+
+ @Test
+ public void shouldGetListOfPageTitles() throws Exception {
+ List<String> pages = editor.getPagesTitles();
+ assertThat("Pages", pages, hasItems(testFile.getName(), "Properties", "Preview"));
+ assertEquals(3, pages.size());
+ }
+
+ @Test
+ public void shouldAnswerIsActivePageCorrectly() throws Exception {
+ assertTrue(editor.isActivePage(testFile.getName()));
+ assertTrue(editor.isActivePage(startsWith("multipage")));
+ assertFalse(editor.isActivePage("Properties"));
+ }
+
+ @Test
+ public void shouldSetActivePage() throws Exception {
+ assertFalse(editor.isActivePage("Properties"));
+ editor.activatePage("Properties");
+ assertTrue(editor.isActivePage("Properties"));
+ editor.activatePage("Preview");
+ assertTrue(editor.isActivePage("Preview"));
+ }
+
+ @Test
+ public void editorShouldBeMarkedDirtyOnChanges() {
+ assertFalse(editor.isDirty());
+ editor.getText().setText("Make editor dirty");
+ assertTrue(editor.isDirty());
+ editor.save();
+ assertFalse(editor.isDirty());
+ }
+
+ @Test
+ public void shouldSaveEditorContents() throws Exception {
+ String expectedContent = "Some content...";
+ editor.getText().setText(expectedContent);
+ editor.save();
+ assertEquals(expectedContent, FileUtils.read(testFile));
+ }
+
+ private static class SampleMultiPageEditor extends SWTBotMultiPageEditor {
+ public SampleMultiPageEditor(SWTBotMultiPageEditor editor, SWTWorkbenchBot bot) {
+ super(editor.getReference(), bot);
+ }
+
+ public SWTBotStyledText getText() {
+ return new SWTBotStyledText(findWidget(widgetOfType(StyledText.class)));
+ }
+ }
+}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewTest.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewTest.java
index f87cb943..47fc269e 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewTest.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewTest.java
@@ -16,9 +16,11 @@ import static org.junit.Assert.fail;
import java.util.List;
+import org.eclipse.swtbot.eclipse.finder.FinderTestIds;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarRadioButton;
@@ -104,8 +106,17 @@ public class SWTBotViewTest {
cICMenu.click();
bot.button("OK").click();
// assertTrue(cICMenu.isChecked());
- }
+ // Runs an action that has a contribution ID instead of the action.
+ List<SWTBotViewMenu> menus = view.menus();
+ System.out.println(menus);
+
+ // Runs an action that has a contribution ID instead of the action.
+ SWTBotViewMenu pCICMenu = view.menu("Try the Banana");
+ pCICMenu.click();
+ bot.button("OK").click();
+}
+
@Test
public void getToolbarButtons() throws Exception {
SWTBotView view = bot.viewByTitle("SWTBot Test View");
@@ -169,4 +180,33 @@ public class SWTBotViewTest {
// This is expected.
}
}
+
+ @Test
+ public void viewBotWidgetScope() {
+ try {
+ SWTBotPreferences.TIMEOUT = 0;
+ bot.perspectiveById(FinderTestIds.PERSPECTIVE_ID_FORM).activate();
+ SWTBotView form1 = bot.viewByTitle("Form 1");
+ try {
+ form1.bot().textWithLabel("Form 2");
+ fail("Form 2 text with label should not be reachable in form 1");
+ } catch (WidgetNotFoundException e) {
+ // expected
+ }
+ assertEquals("Form 1", form1.bot().textWithLabel("Form 1").getText());
+
+ SWTBotView form2 = bot.viewByTitle("Form 2");
+ try {
+ form2.bot().textWithLabel("Form 1");
+ fail("Form 1 text with label should not be reachable in form 2");
+ } catch (WidgetNotFoundException e) {
+ // expected
+ }
+ assertEquals("Form 2", form2.bot().textWithLabel("Form 2").getText());
+ } finally {
+ SWTBotPreferences.TIMEOUT = 5000;
+ bot.resetWorkbench();
+ }
+ }
+
}
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java
index 7b58b9ad..2cd790b6 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaClass.java
@@ -12,6 +12,7 @@ package org.eclipse.swtbot.eclipse.finder.widgets.helpers;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
/**
@@ -25,6 +26,16 @@ public class NewJavaClass {
private SWTWorkbenchBot bot = new SWTWorkbenchBot();
public void createClass(String packageName, String className) {
+ try {
+ SWTBotMenu windowMenu = bot.menu("Window");
+ SWTBotMenu perspectiveMenu = windowMenu.menu("Open Perspective");
+ SWTBotMenu javaPerspectiveMenu = perspectiveMenu.menu("Java");
+ if (javaPerspectiveMenu.isVisible() && javaPerspectiveMenu.isEnabled()) {
+ javaPerspectiveMenu.click();
+ }
+ } catch (Exception ex) {
+ // Java menu not available: already selected
+ }
bot.menu("File").menu("New").menu("Class").click();
SWTBotShell shell = bot.shell("New Java Class");
shell.activate();
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java
index 0d0fd228..90ffd797 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/NewJavaProject.java
@@ -12,6 +12,7 @@ package org.eclipse.swtbot.eclipse.finder.widgets.helpers;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
/**
@@ -25,7 +26,18 @@ public class NewJavaProject {
private SWTWorkbenchBot bot = new SWTWorkbenchBot();
public void createProject(String projectName) throws Exception {
+ try {
+ SWTBotMenu windowMenu = bot.menu("Window");
+ SWTBotMenu perspectiveMenu = windowMenu.menu("Open Perspective");
+ SWTBotMenu javaPerspectiveMenu = perspectiveMenu.menu("Java");
+ if (javaPerspectiveMenu.isVisible() && javaPerspectiveMenu.isEnabled()) {
+ javaPerspectiveMenu.click();
+ }
+ } catch (Exception ex) {
+ // Java menu not available: already selected
+ }
bot.menu("File").menu("New").menu("Java Project").click();
+
SWTBotShell shell = bot.shell("New Java Project");
shell.activate();
diff --git a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/PackageExplorerView.java b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/PackageExplorerView.java
index 8f13d969..f19d992f 100644
--- a/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/PackageExplorerView.java
+++ b/org.eclipse.swtbot.eclipse.finder.test/src/org/eclipse/swtbot/eclipse/finder/widgets/helpers/PackageExplorerView.java
@@ -12,14 +12,12 @@ package org.eclipse.swtbot.eclipse.finder.widgets.helpers;
import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCheckBox;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotRadio;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
@@ -38,23 +36,12 @@ public class PackageExplorerView {
tree.setFocus();
tree.select(projectName);
bot.menu("Edit").menu("Delete").click();
- String version = (String) Platform.getBundle("org.eclipse.core.runtime").getHeaders().get("Bundle-Version");
- if (version.startsWith("3.3")) {
- SWTBotShell shell = bot.shell("Confirm Project Delete");
- shell.activate();
- Button button = bot.widget(widgetOfType(Button.class), shell.widget);
- new SWTBotRadio(button).click();
- bot.button("Yes").click();
- bot.waitUntil(Conditions.shellCloses(shell));
- }
- if (version.startsWith("3.4") || version.startsWith("3.5")) {
- SWTBotShell shell = bot.shell("Delete Resources");
- shell.activate();
- Button button = bot.widget(widgetOfType(Button.class), shell.widget);
- new SWTBotCheckBox(button).select();
- bot.button("OK").click();
- bot.waitUntil(Conditions.shellCloses(shell));
- }
+ SWTBotShell shell = bot.shell("Delete Resources");
+ shell.activate();
+ Button button = bot.widget(widgetOfType(Button.class), shell.widget);
+ new SWTBotCheckBox(button).select();
+ bot.button("OK").click();
+ bot.waitUntil(Conditions.shellCloses(shell));
}
/**
diff --git a/org.eclipse.swtbot.eclipse.finder/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.finder/META-INF/MANIFEST.MF
index 24ffdc6f..ca1d041c 100644
--- a/org.eclipse.swtbot.eclipse.finder/META-INF/MANIFEST.MF
+++ b/org.eclipse.swtbot.eclipse.finder/META-INF/MANIFEST.MF
@@ -2,10 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWTBot Eclipse Control Finder Plug-in (incubation)
Bundle-SymbolicName: org.eclipse.swtbot.eclipse.finder;singleton:=true
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.eclipse.swtbot.eclipse.finder.Activator
+Bundle-Version: 2.0.5.qualifier
Bundle-ActivationPolicy: lazy
-Bundle-Vendor: Eclipse.org
+Bundle-Vendor: Eclipse.org - SWTBot
Export-Package: org.eclipse.swtbot.eclipse.finder,
org.eclipse.swtbot.eclipse.finder.exceptions,
org.eclipse.swtbot.eclipse.finder.finders,
@@ -15,8 +14,8 @@ Export-Package: org.eclipse.swtbot.eclipse.finder,
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ClassPath: .
Import-Package: javax.swing.text,
- junit.framework;version="4.3.1",
- org.apache.log4j;version="1.2.12",
+ junit.framework;version="4.5.0",
+ org.apache.log4j;version="[1.2.13,1.3.0)",
org.eclipse.core.commands,
org.eclipse.core.commands.common,
org.eclipse.core.runtime;version="3.4.0",
@@ -27,21 +26,9 @@ Import-Package: javax.swing.text,
org.eclipse.swt.custom,
org.eclipse.swt.graphics,
org.eclipse.swt.widgets,
- org.eclipse.swtbot.swt.finder,
- org.eclipse.swtbot.swt.finder.exceptions,
- org.eclipse.swtbot.swt.finder.finders,
- org.eclipse.swtbot.swt.finder.keyboard,
- org.eclipse.swtbot.swt.finder.matchers,
- org.eclipse.swtbot.swt.finder.results,
- org.eclipse.swtbot.swt.finder.utils,
- org.eclipse.swtbot.swt.finder.utils.internal,
- org.eclipse.swtbot.swt.finder.waits,
- org.eclipse.swtbot.swt.finder.widgets,
- org.eclipse.ui; ui.workbench="split",
- org.eclipse.ui.commands,
- org.eclipse.ui.handlers,
- org.eclipse.ui.internal,
- org.eclipse.ui.plugin,
- org.eclipse.ui.texteditor;resolution:=optional,
- org.hamcrest;version="1.1.0",
org.osgi.framework;version="1.4.0"
+Require-Bundle: org.eclipse.swtbot.swt.finder;visibility:=reexport,
+ org.hamcrest.core;bundle-version="1.1.0",
+ org.hamcrest;bundle-version="1.1.0",
+ org.eclipse.ui;bundle-version="3.6.0",
+ org.eclipse.ui.editors;bundle-version="3.6.0"
diff --git a/org.eclipse.swtbot.eclipse.finder/build.properties b/org.eclipse.swtbot.eclipse.finder/build.properties
index 3714ba65..76d73f26 100644
--- a/org.eclipse.swtbot.eclipse.finder/build.properties
+++ b/org.eclipse.swtbot.eclipse.finder/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008 Ketan Padegaonkar and others.
+# Copyright (c) 2008, 2010 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,10 +16,5 @@ bin.includes = META-INF/,\
about.html,\
src/
jars.compile.order = .
-src.includes = src/,\
- build.properties,\
- META-INF/,\
- .project,\
- .classpath,\
- LICENSE.EPL,\
+src.includes = LICENSE.EPL,\
about.html
diff --git a/org.eclipse.swtbot.eclipse.finder/pom.xml b/org.eclipse.swtbot.eclipse.finder/pom.xml
new file mode 100644
index 00000000..edc2ad9a
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.features</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.finder</artifactId>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <packaging>eclipse-plugin</packaging>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/Activator.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/Activator.java
deleted file mode 100644
index 0acfb729..00000000
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/Activator.java
+++ /dev/null
@@ -1,70 +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.eclipse.finder;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- /** The plugin ID */
- public static final String PLUGIN_ID = "org.eclipse.swtbot.eclipse.finder"; //$NON-NLS-1$
-
- /** The shared instance */
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- //Nothing to do.
- }
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /**
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
-}
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/DefaultWorkbench.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/DefaultWorkbench.java
new file mode 100644
index 00000000..150b149a
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/DefaultWorkbench.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2009 - 2010 David Green 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:
+ * David Green - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swtbot.eclipse.finder;
+
+import java.util.List;
+
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.ui.IPerspectiveDescriptor;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * A default implementation of the workbench. May be subclassed to provide alternate implementations for different
+ * versions of Eclipse.
+ * <p>
+ * Do not access directly. Instead use <code>Eclipse.workbench()</code>
+ * </p>
+ *
+ * @author David Green
+ * @see Eclipse
+ */
+class DefaultWorkbench {
+
+ /** The bot that may be used to drive the workbench. */
+ private final SWTWorkbenchBot bot;
+
+ /**
+ * Creates an instance of the default workbench.
+ *
+ * @param bot the bot that can drive the workbench.
+ */
+ DefaultWorkbench(SWTWorkbenchBot bot) {
+ this.bot = bot;
+ }
+
+ DefaultWorkbench resetActivePerspective() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ activePage().resetPerspective();
+ }
+ });
+ return this;
+ }
+
+ DefaultWorkbench resetWorkbench() {
+ return closeAllShells().saveAllEditors().closeAllEditors();
+ }
+
+ DefaultWorkbench closeAllShells() {
+ SWTBotShell[] shells = bot.shells();
+ for (SWTBotShell shell : shells) {
+ if (!isEclipseShell(shell)) {
+ shell.close();
+ }
+ }
+ return this;
+ }
+
+ DefaultWorkbench saveAllEditors() {
+ List<? extends SWTBotEditor> editors = bot.editors();
+ for (SWTBotEditor editor : editors) {
+ editor.save();
+ }
+ return this;
+ }
+
+ DefaultWorkbench closeAllEditors() {
+ List<? extends SWTBotEditor> editors = bot.editors();
+ for (SWTBotEditor editor : editors) {
+ editor.close();
+ }
+ return this;
+ }
+
+ private boolean isEclipseShell(final SWTBotShell shell) {
+ return getActiveWorkbenchWindowShell() == shell.widget;
+ }
+
+ private IWorkbenchWindow getActiveWorkbenchWindow() {
+ return UIThreadRunnable.syncExec(bot.getDisplay(), new Result<IWorkbenchWindow>() {
+ public IWorkbenchWindow run() {
+ return PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ }
+ });
+ }
+
+ private Widget getActiveWorkbenchWindowShell() {
+ return getActiveWorkbenchWindow().getShell();
+ }
+
+ private IWorkbenchPage activePage() {
+ return getActiveWorkbenchWindow().getActivePage();
+ }
+
+ private IPerspectiveDescriptor[] perspectives() {
+ return PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives();
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotInfo.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotInfo.java
index 963f5896..beda1d05 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotInfo.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTBotInfo.java
@@ -20,7 +20,7 @@ import org.eclipse.swt.SWT;
*/
public class SWTBotInfo {
- private static final String VERSION = "@svn.version@";
+ private static final String VERSION = "@git.version@";
/**
* Prints out some platform specific information useful for diagnosis.
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTWorkbenchBot.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTWorkbenchBot.java
index 4fab5556..0cf9dec6 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTWorkbenchBot.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/SWTWorkbenchBot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 SWTBot Committers and others
+ * Copyright (c) 2009,2010 SWTBot Committers 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Ralf Ebert www.ralfebert.de - (bug 271630) SWTBot Improved RCP / Workbench support
+ * Ketan Padegaonkar - (bug 260088) Support for MultiPageEditorPart
*******************************************************************************/
package org.eclipse.swtbot.eclipse.finder;
@@ -16,6 +17,7 @@ import static org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory.wi
import static org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory.withPerspectiveLabel;
import static org.eclipse.swtbot.eclipse.finder.waits.Conditions.waitForEditor;
import static org.eclipse.swtbot.eclipse.finder.waits.Conditions.waitForView;
+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;
import java.util.ArrayList;
import java.util.List;
@@ -25,13 +27,17 @@ import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
import org.eclipse.swtbot.eclipse.finder.waits.WaitForEditor;
import org.eclipse.swtbot.eclipse.finder.waits.WaitForView;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotMultiPageEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotPerspective;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.results.Result;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IPerspectiveDescriptor;
import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
import org.hamcrest.Matcher;
import org.hamcrest.Matchers;
@@ -252,8 +258,66 @@ public class SWTWorkbenchBot extends SWTBot {
throw new WidgetNotFoundException("There is no active editor"); //$NON-NLS-1$
return new SWTBotEditor(editor, this);
}
+
+ /**
+ * Waits for a multipage editor matching the given matcher to appear in the active workbench page and returns it
+ *
+ * @param matcher the matcher used to find the editor
+ * @return an editor that matches the matcher
+ * @throws WidgetNotFoundException if the editor is not found
+ */
+ public SWTBotMultiPageEditor multipageEditor(Matcher<IEditorReference> matcher) {
+ WaitForEditor waitForEditor = waitForEditor(matcher);
+ waitUntilWidgetAppears(waitForEditor);
+ return new SWTBotMultiPageEditor(waitForEditor.get(0), this);
+ }
+
+ /**
+ * @return all multipage editors which are opened currently (no waiting!) which match the given matcher
+ * @param matcher the matcher used to find all editors
+ */
+ public List<SWTBotMultiPageEditor> multipageEditors(Matcher<?> matcher) {
+ List<IEditorReference> editors = workbenchContentsFinder.findEditors(matcher);
+
+ List<SWTBotMultiPageEditor> editorBots = new ArrayList<SWTBotMultiPageEditor>();
+ for (IEditorReference editorReference : editors)
+ editorBots.add(new SWTBotMultiPageEditor(editorReference, this));
+
+ return editorBots;
+ }
+
+ /**
+ * @return all editors which are opened currently
+ */
+ public List<? extends SWTBotMultiPageEditor> multipageEditors() {
+ return multipageEditors(Matchers.anything());
+ }
+
+ /**
+ * Shortcut for multipageEditor(withPartName(title))
+ *
+ * @param fileName the the filename on the editor tab
+ * @return the editor with the specified title
+ * @see #editor(Matcher)
+ */
+ public SWTBotMultiPageEditor multipageEditorByTitle(String fileName) {
+ Matcher<IEditorReference> withPartName = withPartName(fileName);
+ return multipageEditor(withPartName);
+ }
/**
+ * Shortcut for multipageEditor(withPartId(id))
+ *
+ * @param id the the id on the editor tab
+ * @return the editor with the specified title
+ * @see #editor(Matcher)
+ */
+ public SWTBotMultiPageEditor multipageEditorById(String id) {
+ Matcher<IEditorReference> withPartId = withPartId(id);
+ return multipageEditor(withPartId);
+ }
+
+ /**
* @return the active perspective in the active workbench page
*/
public SWTBotPerspective activePerspective() {
@@ -262,4 +326,55 @@ public class SWTWorkbenchBot extends SWTBot {
throw new WidgetNotFoundException("There is no active perspective"); //$NON-NLS-1$
return new SWTBotPerspective(perspective, this);
}
+
+ /**
+ * Does a <em>best effort</em> to reset the workbench. This method attempts to:
+ * <ul>
+ * <li>close all non-workbench windows</li>
+ * <li>save and close all open editors</li>
+ * <li>reset the <em>active</em> perspective</li>
+ * <li>switch to the default perspective for the workbench</li>
+ * <li>reset the <em>default</em> perspective for the workbench</li>
+ * <ul>
+ */
+ public void resetWorkbench() {
+ closeAllShells();
+ saveAllEditors();
+ closeAllEditors();
+ resetActivePerspective();
+
+ defaultPerspective().activate();
+ resetActivePerspective();
+ }
+
+ /**
+ * Returns the default perspective as defined in the WorkbenchAdvisor of the application.
+ */
+ public SWTBotPerspective defaultPerspective() {
+ return syncExec(new Result<SWTBotPerspective>() {
+
+ public SWTBotPerspective run() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ return perspectiveById(workbench.getPerspectiveRegistry().getDefaultPerspective());
+ }
+ });
+ }
+
+ public void closeAllEditors() {
+ new DefaultWorkbench(this).closeAllEditors();
+ }
+
+ public void saveAllEditors() {
+ new DefaultWorkbench(this).saveAllEditors();
+ }
+
+ public SWTBotPerspective resetActivePerspective() {
+ new DefaultWorkbench(this).resetActivePerspective();
+ return activePerspective();
+ }
+
+ public void closeAllShells() {
+ new DefaultWorkbench(this).closeAllShells();
+ }
+
}
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/finders/ViewMenuFinder.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/finders/ViewMenuFinder.java
index ce04bd66..309ebad4 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/finders/ViewMenuFinder.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/finders/ViewMenuFinder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2012 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,14 +16,17 @@ import java.util.List;
import org.apache.log4j.Logger;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.SubContributionItem;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotViewMenu;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.ListResult;
+import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
+import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.internal.ViewPane;
-import org.eclipse.ui.internal.WorkbenchPartReference;
+import org.eclipse.ui.menus.CommandContributionItem;
import org.hamcrest.Matcher;
/**
@@ -59,13 +62,14 @@ public class ViewMenuFinder {
return UIThreadRunnable.syncExec(new ListResult<SWTBotViewMenu>() {
public List<SWTBotViewMenu> run() {
- ViewPane viewPane = (ViewPane) ((WorkbenchPartReference) view).getPane();
- MenuManager mgr = viewPane.getMenuManager();
List<SWTBotViewMenu> l = new ArrayList<SWTBotViewMenu>();
-
- l.addAll(getMenuItemsInternal(mgr.getItems(), matcher, recursive));
-
- return l;
+ IViewPart viewPart = view.getView(false);
+ if (viewPart == null) {
+ return l;
+ }
+ IMenuManager viewMenuManager = viewPart.getViewSite().getActionBars().getMenuManager();
+ l.addAll(getMenuItemsInternal(viewMenuManager.getItems(), matcher, recursive));
+ return l;
}
});
}
@@ -84,12 +88,10 @@ public class ViewMenuFinder {
MenuManager menuManager = (MenuManager) item;
l.addAll(getMenuItemsInternal(menuManager.getItems(), matcher, recursive));
- } else if (item instanceof ActionContributionItem) {
- // Menus
- ActionContributionItem actionContribution = (ActionContributionItem) item;
-
- if (matcher.matches(actionContribution.getAction()))
- l.add(new SWTBotViewMenu(actionContribution));
+ } else {
+ SWTBotViewMenu menu = getMenuItem(item, matcher);
+ if (menu != null)
+ l.add(menu);
}
} catch (WidgetNotFoundException e) {
log.warn(e);
@@ -98,4 +100,40 @@ public class ViewMenuFinder {
return l;
}
+
+ private SWTBotViewMenu getMenuItem(IContributionItem item, Matcher<?> matcher) {
+ SWTBotViewMenu menu = null;
+ if (item instanceof ActionContributionItem) {
+ ActionContributionItem actionContribution = (ActionContributionItem) item;
+ if (matcher.matches(actionContribution.getAction()))
+ menu = new SWTBotViewMenu(actionContribution);
+ } else if (item instanceof SubContributionItem ) {
+ menu = getMenuItem(((SubContributionItem) item).getInnerItem(), matcher);
+ } else if (item instanceof CommandContributionItem) {
+ CommandContributionItem cmdContribution = (CommandContributionItem) item;
+ if (matcher.matches(new CommandItemWithTextMatcherWrapper(cmdContribution)))
+ menu = new SWTBotViewMenu(cmdContribution.getCommand());
+ }
+ return menu;
+ }
+
+ /* This class should be public at it will be accessed outside of its parent class*/
+ public static class CommandItemWithTextMatcherWrapper {
+
+ private CommandContributionItem wrappedCommandItem;
+
+ public CommandItemWithTextMatcherWrapper(CommandContributionItem item) {
+ this.wrappedCommandItem = item;
+ }
+
+ /*
+ * This method will be called reflectively by a matcher.
+ */
+ @SuppressWarnings("unused")
+ public String getText() throws Exception {
+ /* label attribute of command contribution item is not available */
+ String label = (String) SWTUtils.getAttribute(wrappedCommandItem, "label"); ////$NON-NLS-1$
+ return label != null ? label:""; ////$NON-NLS-1$
+ }
+ }
}
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/matchers/WidgetMatcherFactory.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/matchers/WidgetMatcherFactory.java
index 1cb1cbe2..00c304b7 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/matchers/WidgetMatcherFactory.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/matchers/WidgetMatcherFactory.java
@@ -1,4 +1,6 @@
-// Generated source.
+// Generated source. DO NOT MODIFY.
+// To add new new methods, please see README file in the generator plugin.
+
package org.eclipse.swtbot.eclipse.finder.matchers;
public abstract class WidgetMatcherFactory extends org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory {
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEclipseEditor.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEclipseEditor.java
index 413afd1b..1ee569a7 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEclipseEditor.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEclipseEditor.java
@@ -535,6 +535,8 @@ public class SWTBotEclipseEditor extends SWTBotEditor {
}
/**
+ * Get the text on line number given as parameter.
+ * Note that in eclipse editors, folding has no incidence on line numbers.
* @param line the line number, 0 based.
* @return the text on the given line number, without the line delimiters.
* @see SWTBotStyledText#getTextOnLine(int)
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEditor.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEditor.java
index 47fea3b8..d1f7154a 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEditor.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2009 Ketan Padegaonkar and others.
+ * Copyright (c) 2008,2009,2010 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,9 +10,12 @@
* Ketan Patel - https://bugs.eclipse.org/bugs/show_bug.cgi?id=259837
* Ralf Ebert www.ralfebert.de - (bug 271630) SWTBot Improved RCP / Workbench support
* Ralf Ebert - (bug 294452) - SWTBotEditor does not pass an IProgressMonitor when saving an editor
+ * Ketan Padegaonkar - (bug 260088) Support for MultiPageEditorPart
*******************************************************************************/
package org.eclipse.swtbot.eclipse.finder.widgets;
+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;
+
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
@@ -60,6 +63,12 @@ public class SWTBotEditor extends SWTBotWorkbenchPart<IEditorReference> {
}
public void setFocus() {
+ syncExec(new VoidResult() {
+ public void run() {
+ IEditorPart editor = partReference.getEditor(true);
+ editor.setFocus();
+ }
+ });
}
/**
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotMultiPageEditor.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotMultiPageEditor.java
new file mode 100644
index 00000000..3b124368
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotMultiPageEditor.java
@@ -0,0 +1,181 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.finder.widgets;
+
+import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.allOf;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withMnemonic;
+import static org.hamcrest.Matchers.equalTo;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swt.custom.CTabItem;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.matchers.WithItem;
+import org.eclipse.swtbot.swt.finder.results.IntResult;
+import org.eclipse.swtbot.swt.finder.results.Result;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCTabItem;
+import org.eclipse.ui.IEditorReference;
+import org.hamcrest.Matcher;
+
+/**
+ * Base class for all multi-page editors in Eclipse.
+ * <p>
+ * <b>Note:</b> It is recommend that clients decorate this class with their own custom wrappers.
+ * </p>
+ * <p>
+ * <b>Note:</b> This API is very new, experimental and subject to change.
+ * </p>
+ *
+ * <pre>
+ * public class PDEManifestEditor extends SWTBotMultiPageEditor {
+ * public PDEManifestEditor(SWTBotMultiPageEditor editor, SWTWorkbenchBot bot) {
+ * super(editor.getReference(), bot);
+ * this.editor = editor;
+ * }
+ *
+ * // any custom behavior you need to test
+ * public activateBuildPropertiesTab() {
+ * activatePage(&quot;build.properties&quot;);
+ * }
+ *
+ * public SWTBotStyledText buildProperties() {
+ * activateBuildPropertiesTab();
+ * return SWTBotStyledText((StyledText) findWidget(widgetOfType(StyledText.class)));
+ * }
+ * }
+ * </pre>
+ *
+ * @author Ketan Patel
+ * @author Ketan Padegaonkar
+ * @since 2.0
+ */
+public class SWTBotMultiPageEditor extends SWTBotEditor {
+ /**
+ * The tabFolder widget.
+ */
+ protected final CTabFolder tabFolder;
+
+ /**
+ * Constructs an instance of the given object.
+ *
+ * @param editorReference the editor reference.
+ * @param bot the instance of {@link SWTWorkbenchBot} which will be used to drive operations on behalf of this
+ * object.
+ * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed.
+ */
+ public SWTBotMultiPageEditor(IEditorReference editorReference, SWTWorkbenchBot bot) {
+ super(editorReference, bot);
+ tabFolder = findWidget(widgetOfType(CTabFolder.class));
+ }
+
+ /**
+ * Find the CTabItem whose text matches the given matcher.
+ *
+ * @param titleMatcher the text matcher
+ * @return a {@link SWTBotCTabItem} with the specified tab name.
+ */
+ private SWTBotCTabItem findPage(Matcher<? extends Widget> titleMatcher) {
+ WithItem<CTabItem> itemMatcher = WithItem.withItem(allOf(widgetOfType(CTabItem.class), titleMatcher));
+ if (itemMatcher.matches(tabFolder))
+ return new SWTBotCTabItem(itemMatcher.get(0));
+ throw new WidgetNotFoundException("Could not find page with title " + titleMatcher);
+ }
+
+ /**
+ * Returns the number of pages in this multi-page editor.
+ *
+ * @return the number of pages
+ */
+ public int getPageCount() {
+ return syncExec(new IntResult() {
+ public Integer run() {
+ return tabFolder.getItemCount();
+ }
+ });
+ }
+
+ /**
+ * Sets the currently active page.
+ *
+ * @param pageText the text label for the page to be activated
+ * @return the {@link CTabItem} that was activated.
+ */
+ public SWTBotCTabItem activatePage(String pageText) {
+ return activatePage(withMnemonic(pageText));
+ }
+
+ /**
+ * Sets the currently active page.
+ *
+ * @param titleMatcher the title matcher for the page to be activated.
+ * @return the {@link CTabItem} that was activated.
+ */
+ public SWTBotCTabItem activatePage(Matcher<? extends Widget> titleMatcher) {
+ return findPage(titleMatcher).show().activate();
+ }
+
+ /**
+ * Returns the title of the currently active page or <code>null</code> if there is no active page
+ *
+ * @return the title of the currently active page or <code>null</code> if there is no active page
+ */
+ public String getActivePageTitle() {
+ CTabItem tab = tabFolder.getSelection();
+ if (tab != null) {
+ return new SWTBotCTabItem(tab).getText();
+ }
+ return null;
+ }
+
+ /**
+ * Returns a list of title of all the pages in this multi-page editor.
+ *
+ * @return List of title of all pages; empty list if no pages.
+ */
+ public List<String> getPagesTitles() {
+ List<String> pages = null;
+ if (getPageCount() > 0) {
+ pages = UIThreadRunnable.syncExec(new Result<List<String>>() {
+ public List<String> run() {
+ ArrayList<String> titles = new ArrayList<String>();
+ for (CTabItem item : tabFolder.getItems()) {
+ titles.add(item.getText());
+ }
+ return titles;
+ }
+ });
+ }
+ return pages == null ? new ArrayList<String>() : pages;
+ }
+
+ /**
+ * @param pageText the page title to test
+ * @return <code>true</code> if the currently active page has given title, <code>false</code> otherwise.
+ */
+ public boolean isActivePage(String pageText) {
+ return isActivePage(equalTo(pageText));
+ }
+
+ /**
+ * @param titleMatcher the title matcher for the active page
+ * @return <code>true</code> if the currently active page title matches, <code>false</code> otherwise.
+ */
+ public boolean isActivePage(Matcher<String> titleMatcher) {
+ return titleMatcher.matches(getActivePageTitle());
+ }
+}
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java
index d393fa23..02011649 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotPerspective.java
@@ -68,6 +68,13 @@ public class SWTBotPerspective {
return bot.activePerspective().perspectiveDescriptor.getId().equals(this.perspectiveDescriptor.getId());
}
+ /**
+ * @return the perspective label
+ */
+ public String getLabel() {
+ return this.perspectiveDescriptor.getLabel();
+ }
+
public String toString() {
return "SWTBotEclipsePerspective[id=\"" + perspectiveDescriptor.getLabel() + "\", label=\"" + perspectiveDescriptor.getLabel()
+ "\"]";
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 fda837ec..c740ffff 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
@@ -12,12 +12,23 @@
package org.eclipse.swtbot.eclipse.finder.widgets;
import static org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable.syncExec;
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withMnemonic;
+import static org.hamcrest.Matchers.anything;
+import static org.hamcrest.Matchers.equalTo;
+
+import java.util.List;
import javax.swing.text.View;
import org.eclipse.swt.widgets.Control;
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.widgets.utils.PartLabelDescription;
+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.ui.IViewReference;
import org.hamcrest.SelfDescribing;
@@ -30,6 +41,7 @@ import org.hamcrest.SelfDescribing;
*/
public class SWTBotView extends SWTBotWorkbenchPart<IViewReference> {
+ private final ViewMenuFinder menuFinder;
/**
* Creates an instance of a view part.
*
@@ -38,7 +50,7 @@ public class SWTBotView extends SWTBotWorkbenchPart<IViewReference> {
* @since 2.0
*/
public SWTBotView(IViewReference partReference, SWTWorkbenchBot bot) {
- super(partReference, bot);
+ this(partReference, bot, new PartLabelDescription<IViewReference>(partReference));
}
/**
@@ -50,6 +62,7 @@ public class SWTBotView extends SWTBotWorkbenchPart<IViewReference> {
*/
public SWTBotView(IViewReference partReference, SWTWorkbenchBot bot, SelfDescribing description) {
super(partReference, bot, description);
+ this.menuFinder = new ViewMenuFinder();
}
public void setFocus() {
@@ -71,4 +84,58 @@ public class SWTBotView extends SWTBotWorkbenchPart<IViewReference> {
return partReference.getPage().getActivePartReference() == partReference;
}
+ /**
+ * Close the partReference.
+ */
+ public void close() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ partReference.getPage().hideView(partReference);
+ }
+ });
+ }
+
+ /**
+ * Gets a list of all menus within the partReference. This will also include sub menus.
+ *
+ * @return The list of menus
+ */
+ public List<SWTBotViewMenu> menus() {
+ return menuFinder.findMenus(partReference, anything(), true);
+ }
+
+ /**
+ * Gets a menu item matching the give label within the partReference menu if one exists.
+ *
+ * @param label The label matching name in the menu.
+ * @return The {@link SWTBotMenu} item.
+ * @throws WidgetNotFoundException Thrown if the menu can not be found or if the partReference does not contain a
+ * menu.
+ */
+ public SWTBotViewMenu menu(String label) throws WidgetNotFoundException {
+ return menu(label, 0);
+ }
+
+ /**
+ * Gets a menu item matching the give label within the partReference menu if one exists.
+ *
+ * @param label The label matching name in the menu.
+ * @param index The index of the menu to choose.
+ * @return The {@link SWTBotMenu} item.
+ * @throws WidgetNotFoundException Thrown if the menu can not be found or if the partReference does not contain a
+ * menu.
+ */
+ public SWTBotViewMenu menu(String label, int index) throws WidgetNotFoundException {
+ try {
+ List<SWTBotViewMenu> menuItems = menuFinder.findMenus(partReference, withMnemonic(label), true);
+ if ((menuItems == null) || (menuItems.size() < 1)) {
+ CommandFinder finder = new CommandFinder();
+ List<SWTBotCommand> command = finder.findCommand(equalTo(label));
+ return command.get(index);
+ }
+ return menuItems.get(index);
+ } catch (Exception e) {
+ throw new WidgetNotFoundException("Could not find view menu with label " + label + " at index " + index, e); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
}
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewMenu.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewMenu.java
index 5f545191..7b0ac8ba 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewMenu.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotViewMenu.java
@@ -11,6 +11,7 @@
package org.eclipse.swtbot.eclipse.finder.widgets;
import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.AssertionFailedException;
@@ -42,6 +43,10 @@ public class SWTBotViewMenu {
*/
protected Command cmdItem = null;
/**
+ * Holds parameterized command if setup.
+ */
+ protected ParameterizedCommand paraCmdItem = null;
+ /**
* Holds the id of the command if one exists.
*/
protected String commandID = null;
@@ -63,6 +68,24 @@ public class SWTBotViewMenu {
text = ""; //$NON-NLS-1$
}
}
+
+ /**
+ * Constructs a SWTBot View Menu item.
+ *
+ * @param commandItem The parameterized command contribution item.
+ * @throws WidgetNotFoundException Thrown if both values are <code>null</code>.
+ * @throws AssertionFailedException If the contribution item is <code>null</code>.
+ */
+ public SWTBotViewMenu(ParameterizedCommand commandItem) throws WidgetNotFoundException {
+ paraCmdItem = commandItem;
+
+ commandID = paraCmdItem.getId();
+ try {
+ text = paraCmdItem.getName();
+ } catch (NotDefinedException e) {
+ text = ""; //$NON-NLS-1$
+ }
+ }
/**
* Constructs a SWTBot View Menu item.
diff --git a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotWorkbenchPart.java b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotWorkbenchPart.java
index fa573b85..cba27675 100644
--- a/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotWorkbenchPart.java
+++ b/org.eclipse.swtbot.eclipse.finder/src/org/eclipse/swtbot/eclipse/finder/widgets/SWTBotWorkbenchPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008-2009 Ketan Padegaonkar and others.
+ * Copyright (c) 2008, 2012 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,23 +10,20 @@
*******************************************************************************/
package org.eclipse.swtbot.eclipse.finder.widgets;
-import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.withMnemonic;
import static org.hamcrest.Matchers.any;
-import static org.hamcrest.Matchers.anything;
-import static org.hamcrest.Matchers.equalTo;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Widget;
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.widgets.utils.PartLabelDescription;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
@@ -37,17 +34,16 @@ import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.utils.MessageFormat;
import org.eclipse.swtbot.swt.finder.utils.SWTUtils;
import org.eclipse.swtbot.swt.finder.utils.internal.Assert;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarPushButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarRadioButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarSeparatorButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarToggleButton;
-import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkbenchPartSite;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.PartPane;
import org.eclipse.ui.internal.WorkbenchPartReference;
import org.hamcrest.Matcher;
import org.hamcrest.SelfDescribing;
@@ -69,7 +65,6 @@ public abstract class SWTBotWorkbenchPart<T extends IWorkbenchPartReference> {
protected final Logger log;
/** A helper swtbot instance. */
protected final SWTWorkbenchBot bot;
- private final ViewMenuFinder menuFinder;
private final SelfDescribing description;
private Widget widget;
@@ -97,7 +92,6 @@ public abstract class SWTBotWorkbenchPart<T extends IWorkbenchPartReference> {
this.description = description;
Assert.isNotNull(partReference, "The part reference cannot be null"); //$NON-NLS-1$
this.partReference = partReference;
- this.menuFinder = new ViewMenuFinder();
log = Logger.getLogger(getClass());
}
@@ -108,18 +102,10 @@ public abstract class SWTBotWorkbenchPart<T extends IWorkbenchPartReference> {
return partReference;
}
-
/**
* Close the partReference.
*/
- public void close() {
- UIThreadRunnable.syncExec(new VoidResult() {
- public void run() {
- IViewReference viewReference = (IViewReference) partReference;
- viewReference.getPage().hideView(viewReference);
- }
- });
- }
+ public abstract void close();
/**
* Shows the part if it is visible.
@@ -147,50 +133,6 @@ public abstract class SWTBotWorkbenchPart<T extends IWorkbenchPartReference> {
}
/**
- * Gets a list of all menus within the partReference. This will also include sub menus.
- *
- * @return The list of menus
- */
- public List<SWTBotViewMenu> menus() {
- return menuFinder.findMenus((IViewReference) partReference, anything(), true);
- }
-
- /**
- * Gets a menu item matching the give label within the partReference menu if one exists.
- *
- * @param label The label matching name in the menu.
- * @return The {@link SWTBotMenu} item.
- * @throws WidgetNotFoundException Thrown if the menu can not be found or if the partReference does not contain a
- * menu.
- */
- public SWTBotViewMenu menu(String label) throws WidgetNotFoundException {
- return menu(label, 0);
- }
-
- /**
- * Gets a menu item matching the give label within the partReference menu if one exists.
- *
- * @param label The label matching name in the menu.
- * @param index The index of the menu to choose.
- * @return The {@link SWTBotMenu} item.
- * @throws WidgetNotFoundException Thrown if the menu can not be found or if the partReference does not contain a
- * menu.
- */
- public SWTBotViewMenu menu(String label, int index) throws WidgetNotFoundException {
- try {
- List<SWTBotViewMenu> menuItems = menuFinder.findMenus((IViewReference) partReference, withMnemonic(label), true);
- if ((menuItems == null) || (menuItems.size() < 1)) {
- CommandFinder finder = new CommandFinder();
- List<SWTBotCommand> command = finder.findCommand(equalTo(label));
- return command.get(index);
- }
- return menuItems.get(index);
- } catch (Exception e) {
- throw new WidgetNotFoundException("Could not find view menu with label " + label + " at index " + index, e); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
- /**
* Gets the toolbar buttons currently visible.
*
* @return The set of toolbar buttons.
@@ -198,11 +140,19 @@ public abstract class SWTBotWorkbenchPart<T extends IWorkbenchPartReference> {
public List<SWTBotToolbarButton> getToolbarButtons() {
return UIThreadRunnable.syncExec(new ListResult<SWTBotToolbarButton>() {
- public List<SWTBotToolbarButton> run() {
- PartPane obj = ((WorkbenchPartReference) partReference).getPane();
- ToolBar toolbar = (ToolBar) obj.getToolBar();
+ public List<SWTBotToolbarButton> run() {
+ ToolBar toolbar = null;
+
+ IWorkbenchPartSite site = partReference.getPart(false).getSite();
+ if (site instanceof IViewSite) {
+ IToolBarManager t = ((IViewSite) site).getActionBars().getToolBarManager();
+ if (t instanceof ToolBarManager) {
+ toolbar = ((ToolBarManager)t).getControl();
+ }
+ }
+
final List<SWTBotToolbarButton> l = new ArrayList<SWTBotToolbarButton>();
-
+
if (toolbar == null)
return l;
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.gef.finder/META-INF/MANIFEST.MF
index 2cb67bf7..cd9049dd 100644
--- a/org.eclipse.swtbot.eclipse.gef.finder/META-INF/MANIFEST.MF
+++ b/org.eclipse.swtbot.eclipse.gef.finder/META-INF/MANIFEST.MF
@@ -2,14 +2,14 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWTBot Gef Plug-in (incubation)
Bundle-SymbolicName: org.eclipse.swtbot.eclipse.gef.finder;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.5.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.swtbot.eclipse.gef.finder,
org.eclipse.swtbot.eclipse.gef.finder.finders,
org.eclipse.swtbot.eclipse.gef.finder.matchers,
org.eclipse.swtbot.eclipse.gef.finder.widgets
-Bundle-Vendor: Eclipse.org
-Import-Package: org.apache.log4j;version="1.2.13",
+Bundle-Vendor: Eclipse.org - SWTBot
+Import-Package: org.apache.log4j;version="[1.2.13,1.3.0)",
org.eclipse.core.commands,
org.eclipse.core.runtime;version="3.4.0",
org.eclipse.draw2d,
@@ -24,23 +24,9 @@ Import-Package: org.apache.log4j;version="1.2.13",
org.eclipse.swt,
org.eclipse.swt.events,
org.eclipse.swt.widgets,
- org.eclipse.swtbot.eclipse.finder,
- org.eclipse.swtbot.eclipse.finder.matchers,
- org.eclipse.swtbot.eclipse.finder.waits,
- org.eclipse.swtbot.eclipse.finder.widgets,
- org.eclipse.swtbot.swt.finder,
- org.eclipse.swtbot.swt.finder.exceptions,
- org.eclipse.swtbot.swt.finder.finders,
- org.eclipse.swtbot.swt.finder.matchers,
- org.eclipse.swtbot.swt.finder.resolvers,
- org.eclipse.swtbot.swt.finder.results,
- org.eclipse.swtbot.swt.finder.utils,
- org.eclipse.swtbot.swt.finder.utils.internal,
- org.eclipse.swtbot.swt.finder.waits,
- org.eclipse.swtbot.swt.finder.widgets,
- org.eclipse.ui,
- org.eclipse.ui.internal,
- org.eclipse.ui.part,
- org.hamcrest;version="1.1.0",
org.hamcrest.core;version="1.1.0",
- org.junit;version="4.3.1"
+ org.junit;version="4.5.0"
+Require-Bundle: org.eclipse.swtbot.eclipse.finder;visibility:=reexport,
+ org.eclipse.ui.workbench;bundle-version="3.6.0",
+ org.hamcrest.core;bundle-version="1.1.0",
+ org.hamcrest;bundle-version="1.1.0"
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/about.html b/org.eclipse.swtbot.eclipse.gef.finder/about.html
index 88cfbc91..88cfbc91 100644
--- a/org.eclipse.swtbot.eclipse.junit3.headless/about.html
+++ b/org.eclipse.swtbot.eclipse.gef.finder/about.html
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/build.properties b/org.eclipse.swtbot.eclipse.gef.finder/build.properties
index ab04390d..a998d559 100644
--- a/org.eclipse.swtbot.eclipse.gef.finder/build.properties
+++ b/org.eclipse.swtbot.eclipse.gef.finder/build.properties
@@ -15,7 +15,8 @@ bin.includes = META-INF/,\
.,\
LICENSE.EPL,\
src/,\
- build.properties
+ build.properties,\
+ about.html
src.includes = LICENSE.EPL,\
.project,\
.classpath,\
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/pom.xml b/org.eclipse.swtbot.eclipse.gef.finder/pom.xml
new file mode 100644
index 00000000..11651131
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.gef.finder/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.plugins</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.gef.finder</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/SWTGefBot.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/SWTGefBot.java
index dea6e5b0..046fb457 100644
--- a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/SWTGefBot.java
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/SWTGefBot.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Obeo
+ * Copyright (c) 2009, 2010 Obeo
* 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
@@ -13,14 +13,19 @@ package org.eclipse.swtbot.eclipse.gef.finder;
import static org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory.withPartName;
import static org.eclipse.swtbot.eclipse.finder.waits.Conditions.waitForEditor;
+import static org.eclipse.swtbot.eclipse.finder.waits.Conditions.waitForView;
import static org.hamcrest.Matchers.allOf;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.waits.WaitForEditor;
+import org.eclipse.swtbot.eclipse.finder.waits.WaitForView;
import org.eclipse.swtbot.eclipse.gef.finder.matchers.IsInstanceOf;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditor;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefView;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefViewer;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IViewReference;
import org.hamcrest.Matcher;
public class SWTGefBot extends SWTWorkbenchBot {
@@ -52,9 +57,87 @@ public class SWTGefBot extends SWTWorkbenchBot {
Matcher<IEditorReference> matcher = allOf(IsInstanceOf.instanceOf(IEditorReference.class), withPartName);
WaitForEditor waitForEditor = waitForEditor(matcher);
waitUntilWidgetAppears(waitForEditor);
- return new SWTBotGefEditor(waitForEditor.get(index), this);
+ return createEditor(waitForEditor.get(index), this);
}
+ /**
+ * Create the editor. Subclass if necessary to instance your own GEF editor.
+ * @param reference the editor reference
+ * @param bot the bot
+ * @return the created editor instance
+ */
+ protected SWTBotGefEditor createEditor(final IEditorReference reference, final SWTWorkbenchBot bot) {
+ return new SWTBotGefEditor(reference, bot);
+ }
+
+ /**
+ * Attempts to locate the view matching the given name. If no match is found an exception will be thrown. The name
+ * is the name as displayed on the view in eclipse.
+ *
+ * @param viewName the name of the view.
+ * @return a view with the specified name.
+ * @throws WidgetNotFoundException if the view is not found.
+ */
+ public SWTBotGefView gefView(String viewName) throws WidgetNotFoundException {
+ return gefView(viewName, 0);
+ }
+ /**
+ * Attempts to locate the view matching the given name. If no match is found an exception will be thrown. The name
+ * is the name as displayed on the view in eclipse.
+ *
+ * @param viewName the name of the view.
+ * @param index in case of multiple views with the same fileName.
+ * @return a view with the specified name.
+ * @throws WidgetNotFoundException if the view is not found.
+ */
+ @SuppressWarnings("unchecked")
+ public SWTBotGefView gefView(String viewName, int index) throws WidgetNotFoundException {
+ Matcher<IViewReference> withPartName = withPartName(viewName);
+ Matcher<IViewReference> matcher = allOf(IsInstanceOf.instanceOf(IViewReference.class), withPartName);
+ WaitForView waitForView = waitForView(matcher);
+ waitUntilWidgetAppears(waitForView);
+ return createView(waitForView.get(index), this);
+ }
+
+
+ /**
+ * Create the view. Subclass if necessary to instance your own GEF view.
+ * @param reference the view reference
+ * @param bot the bot
+ * @return the created view instance
+ */
+ protected SWTBotGefView createView(final IViewReference reference, final SWTWorkbenchBot bot) {
+ return new SWTBotGefView(reference, bot);
+ }
+
+ /**
+ * Attempts to locate a gef viewer that is embedded in a workbench part with the specified title.
+ *
+ * @param partTitle the workbench part title
+ * @return The gef viewer
+ * @throws WidgetNotFoundException if a workbench part with the specified title cannot be found.
+ */
+ public SWTBotGefViewer gefViewer(String partTitle) throws WidgetNotFoundException {
+
+ Object editorOrView = null;
+ try {
+ editorOrView = gefEditor(partTitle);
+ } catch (WidgetNotFoundException exception) {
+ /* NOOP, means that it is not an editor. Search for a view instead then.*/
+ try {
+ editorOrView = gefView(partTitle);
+ } catch (WidgetNotFoundException e) {
+ /* It's not a view either! */
+ throw new WidgetNotFoundException("Unable to find a part with title " + partTitle);
+ }
+ }
+ if (editorOrView instanceof SWTBotGefEditor) {
+ return ((SWTBotGefEditor) editorOrView).getSWTBotGefViewer();
+ } else {
+ return ((SWTBotGefView) editorOrView).getSWTBotGefViewer();
+ }
+ }
}
+ \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/matchers/IsSelected.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/matchers/IsSelected.java
new file mode 100644
index 00000000..85d6618e
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/matchers/IsSelected.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Obeo.
+ * 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:
+ * Mariot Chauvin <mariot.chauvin@obeo.fr> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.swtbot.eclipse.gef.finder.matchers;
+
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
+import org.hamcrest.BaseMatcher;
+import org.hamcrest.Description;
+
+/**
+ * Match if an edit part is selected.
+ * @author mchauvin
+ */
+public class IsSelected extends BaseMatcher<SWTBotGefEditPart>{
+
+ private EditPartViewer viewer;
+
+ public IsSelected(final EditPartViewer viewer) {
+ this.viewer = viewer;
+ }
+
+ public boolean matches(Object item) {
+ if (item instanceof SWTBotGefEditPart && viewer.getSelectedEditParts().contains(((SWTBotGefEditPart) item).part()))
+ return true;
+ return false;
+ }
+
+ public void describeTo(Description description) {
+ description.appendText("is a selected edit part");
+ }
+}
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/waits/WaitForEditPartSelection.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/waits/WaitForEditPartSelection.java
new file mode 100644
index 00000000..e37f007b
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/waits/WaitForEditPartSelection.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Obeo.
+ * 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:
+ * Mariot Chauvin <mariot.chauvin@obeo.fr> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.swtbot.eclipse.gef.finder.waits;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.swtbot.eclipse.gef.finder.matchers.IsSelected;
+import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditPart;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.waits.WaitForObjectCondition;
+
+/**
+ * Condition that waits that given edit part is selected.
+ *
+ * @see Conditions
+ * @author mchauvin
+ */
+public class WaitForEditPartSelection extends WaitForObjectCondition<SWTBotGefEditPart> {
+
+ private SWTBotGefEditPart part;
+
+ public WaitForEditPartSelection(final SWTBotGefEditPart part, final EditPartViewer viewer) {
+ super(new IsSelected(viewer));
+ this.part = part;
+ }
+
+ @Override
+ protected List<SWTBotGefEditPart> findMatches() {
+ List<SWTBotGefEditPart> list = new ArrayList<SWTBotGefEditPart>(2);
+ if (matcher.matches(part))
+ list.add(part);
+ return list;
+ }
+
+ public String getFailureMessage() {
+ return "Could not find edit part in selected edit part list"; //$NON-NLS-1$
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefConnectionEditPart.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefConnectionEditPart.java
index 85a126b6..05000ac7 100644
--- a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefConnectionEditPart.java
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefConnectionEditPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 MAKE Technologies Inc and others.
+ * Copyright (c) 2004, 2010 MAKE Technologies Inc 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
@@ -7,12 +7,16 @@
*
* Contributors:
* MAKE Technologies Inc - initial API and implementation
- * Mariot Chauvin <mariot.chauvin@obeo.fr> - refactoring
+ * Mariot Chauvin <mariot.chauvin@obeo.fr> - Improvements and bug fixes
+ * Pascal Gelinas <pascal.gelinas @nuecho.com> - Improvements and bug fixes
*******************************************************************************/
package org.eclipse.swtbot.eclipse.gef.finder.widgets;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.swtbot.eclipse.gef.finder.waits.WaitForEditPartSelection;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.Result;
@@ -28,13 +32,27 @@ public class SWTBotGefConnectionEditPart extends SWTBotGefEditPart {
/**
* Construct a new {@link SWTBotGefConnectionEditPart} instance.
- * @param graphicalEditor the graphical editor
+ * @param viewer the viewer
* @param part the {@link ConnectionEditPart} to wrap
*/
- SWTBotGefConnectionEditPart(SWTBotGefEditor graphicalEditor, org.eclipse.gef.ConnectionEditPart part) {
- super(graphicalEditor, part);
+ SWTBotGefConnectionEditPart(SWTBotGefViewer viewer, org.eclipse.gef.ConnectionEditPart part) {
+ super(viewer, part);
}
+ /**
+ * Create a new bendpoint for this connection to the given location,
+ * @param toXPosition x position of the bendpoint location
+ * @param toYPosition y position for the bendpoint location
+ */
+ public void createBenpoint(final int toXPosition, final int toYPosition) {
+ Point startMove = ((Connection) part().getFigure()).getPoints().getMidpoint().getCopy();
+ viewer.click(startMove.x, startMove.y);
+ /* we need to wait element selection before proceed or drag will fail */
+ viewer.bot().waitUntil(new WaitForEditPartSelection(this, viewer.graphicalViewer));
+
+ viewer.drag(startMove.x, startMove.y, toXPosition, 250);
+ }
+
/*
* {@inheritDoc}
* @see SWTBotGefEditPart#part()
@@ -52,7 +70,7 @@ public class SWTBotGefConnectionEditPart extends SWTBotGefEditPart {
return UIThreadRunnable.syncExec(new Result<SWTBotGefEditPart>() {
public SWTBotGefEditPart run() {
org.eclipse.gef.EditPart source = part().getSource();
- return graphicalEditor.createEditPart(source);
+ return viewer.createEditPart(source);
}
});
}
@@ -65,7 +83,7 @@ public class SWTBotGefConnectionEditPart extends SWTBotGefEditPart {
return UIThreadRunnable.syncExec(new Result<SWTBotGefEditPart>() {
public SWTBotGefEditPart run() {
org.eclipse.gef.EditPart target = part().getTarget();
- return graphicalEditor.createEditPart(target);
+ return viewer.createEditPart(target);
}
});
}
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditPart.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditPart.java
index 1402672c..addf7572 100644
--- a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditPart.java
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditPart.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 MAKE Technologies Inc and others
+ * Copyright (c) 2004, 2010 MAKE Technologies Inc 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
@@ -7,17 +7,24 @@
*
* Contributors:
* MAKE Technologies Inc - initial API and implementation
- * Mariot Chauvin <mariot.chauvin@obeo.fr> - refactoring
+ * Mariot Chauvin <mariot.chauvin@obeo.fr> - Improvements and bug fixes
+ * Pascal Gelinas <pascal.gelinas @nuecho.com> - Improvements and bug fixes
*******************************************************************************/
package org.eclipse.swtbot.eclipse.gef.finder.widgets;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import java.util.Stack;
import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.ScrollBar;
+import org.eclipse.draw2d.ScrollPane;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
@@ -32,21 +39,19 @@ import org.hamcrest.Matcher;
* represent an edit part of a graphical viewer.
*
* @author David Green
- *
* @see SWTBotGefEditor
*/
public class SWTBotGefEditPart {
- protected final EditPart part;
- protected final SWTBotGefEditor graphicalEditor;
-
+ protected final EditPart part;
+ protected final SWTBotGefViewer viewer;
+
/**
- *
- * @param graphicalEditor
+ * @param veiwer viewer
* @param parent the parent, or null if this is the root edit part
* @param part the GEF part
*/
- SWTBotGefEditPart(final SWTBotGefEditor graphicalEditor, final EditPart part) {
- this.graphicalEditor = graphicalEditor;
+ SWTBotGefEditPart(final SWTBotGefViewer viewer, final EditPart part) {
+ this.viewer = viewer;
this.part = part;
}
@@ -56,13 +61,14 @@ public class SWTBotGefEditPart {
public SWTBotGefEditPart parent() {
return UIThreadRunnable.syncExec(new Result<SWTBotGefEditPart>() {
public SWTBotGefEditPart run() {
- return graphicalEditor.createEditPart(part.getParent());
+ return viewer.createEditPart(part.getParent());
}
});
}
/**
* Get the children of this edit part.
+ *
* @return the edit part's children
*/
@SuppressWarnings("unchecked")
@@ -70,8 +76,8 @@ public class SWTBotGefEditPart {
return UIThreadRunnable.syncExec(new Result<List<SWTBotGefEditPart>>() {
public List<SWTBotGefEditPart> run() {
List<SWTBotGefEditPart> children = new ArrayList<SWTBotGefEditPart>();
- for (org.eclipse.gef.EditPart child: ((List<org.eclipse.gef.EditPart>)part.getChildren())) {
- children.add(graphicalEditor.createEditPart(child));
+ for (org.eclipse.gef.EditPart child : ((List<org.eclipse.gef.EditPart>) part.getChildren())) {
+ children.add(viewer.createEditPart(child));
}
return children;
}
@@ -82,34 +88,34 @@ public class SWTBotGefEditPart {
* find descendants that match.
*
* @param matcher the matcher that matches against {@link org.eclipse.gef.EditPart}
- *
* @return a list of matches or an empty list if there are none
*/
@SuppressWarnings("unchecked")
public List<SWTBotGefEditPart> descendants(final Matcher<? extends EditPart> matcher) {
- return UIThreadRunnable.syncExec(new Result<List<SWTBotGefEditPart>>() {
+ return UIThreadRunnable.syncExec(new Result<List<SWTBotGefEditPart>>() {
public List<SWTBotGefEditPart> run() {
List<SWTBotGefEditPart> descendants = new ArrayList<SWTBotGefEditPart>();
Stack<SWTBotGefEditPart> parts = new Stack<SWTBotGefEditPart>();
parts.push(SWTBotGefEditPart.this);
while (!parts.isEmpty()) {
SWTBotGefEditPart part = parts.pop();
- for (org.eclipse.gef.EditPart child: ((List<org.eclipse.gef.EditPart>) part.part.getChildren())) {
- SWTBotGefEditPart childPart = graphicalEditor.createEditPart(child);
+ for (org.eclipse.gef.EditPart child : ((List<org.eclipse.gef.EditPart>) part.part.getChildren())) {
+ SWTBotGefEditPart childPart = viewer.createEditPart(child);
if (matcher.matches(child)) {
descendants.add(childPart);
}
parts.push(childPart);
- }
+ }
}
return descendants;
}
});
}
-
+
/**
* get the underlying wrapped {@link EditPart} instance
- * @return the wrapped {@link EditPart}.
+ *
+ * @return the wrapped {@link EditPart}.
*/
public EditPart part() {
return part;
@@ -121,16 +127,16 @@ public class SWTBotGefEditPart {
public void focus() {
UIThreadRunnable.syncExec(new VoidResult() {
public void run() {
- graphicalEditor.graphicalViewer.setFocus(part);
+ viewer.graphicalViewer.setFocus(part);
}
});
}
-
+
/**
* select this edit part as a single selection
*/
public SWTBotGefEditPart select() {
- graphicalEditor.select(this);
+ viewer.select(this);
return this;
}
@@ -141,16 +147,12 @@ public class SWTBotGefEditPart {
final Rectangle bounds = getBounds();
return click(bounds.getTopLeft());
}
-
+
/**
* click on the edit part at the specified location
*/
public SWTBotGefEditPart click(final Point location) {
- UIThreadRunnable.asyncExec(new VoidResult() {
- public void run() {
- graphicalEditor.getCanvas().mouseEnterLeftClickAndExit(location.x, location.y);
- }
- });
+ viewer.getCanvas().mouseEnterLeftClickAndExit(location.x, location.y);
return this;
}
@@ -159,26 +161,115 @@ public class SWTBotGefEditPart {
*/
public SWTBotGefEditPart doubleClick() {
final Rectangle bounds = getBounds();
- UIThreadRunnable.asyncExec(new VoidResult() {
- public void run() {
- graphicalEditor.getCanvas().mouseMoveDoubleClick(bounds.x, bounds.y);
- }
- });
+ viewer.getCanvas().mouseMoveDoubleClick(bounds.x, bounds.y);
return this;
}
+
+ /* this method is not finished. She will become public when finished, but API is not guaranteed */
+ private void scrollUp() {
+ final IFigure figure = ((GraphicalEditPart) part).getFigure();
+ for (final Object child : figure.getChildren()) {
+ if (child instanceof ScrollPane) {
+ Collection<ScrollBar> scrollbars = getScrollBars((ScrollPane) child);
+ Point pointToClick = scrollbars.iterator().next().getBounds().getCenter();
+ viewer.getCanvas().mouseMoveLeftClick(pointToClick.x, pointToClick.y);
+ }
+ }
+ }
+
+ /* this method is not finished. She will become public when finished, but API is not guaranteed */
+ private Collection<ScrollBar> getScrollBars(final ScrollPane scrollPane) {
+ Set<ScrollBar> scrollbars = new HashSet<ScrollBar>();
+ for (final Object child :scrollPane.getChildren()) {
+ if (child instanceof ScrollBar) {
+ scrollbars.add((ScrollBar) child);
+ }
+ }
+ return scrollbars;
+ }
+
+ /**
+ * Resize the current edit part from the corner orientation to the new size. The direction is specified using using
+ * {@link PositionConstants#NORTH}, {@link PositionConstants#NORTH_EAST}, etc.
+ *
+ * @param direction the direction
+ * @param width the new width
+ * @param height the new height
+ */
+ public void resize(int direction, int width, int height) {
+ Rectangle bounds = getBounds();
+ int fromX = 0 ;
+ int fromY = 0;
+ int toX = 0;
+ int toY = 0;
+
+ switch(direction) {
+ case PositionConstants.NORTH:
+ fromX = bounds.x + bounds.width / 2;
+ fromY = bounds.y;
+ toX= bounds.x + bounds.width / 2;
+ toY= bounds.y + bounds.height - height;
+ break;
+ case PositionConstants.SOUTH:
+ fromX = bounds.x + bounds.width / 2;
+ fromY = bounds.y + bounds.height;
+ toX=bounds.x + bounds.width / 2;
+ toY=bounds.y +height;
+ break;
+ case PositionConstants.EAST:
+ fromX = bounds.x;
+ fromY = bounds.y + bounds.height/2;
+ toX = bounds.x + bounds.width - width;
+ toY = bounds.y + bounds.height/2;
+ break;
+ case PositionConstants.WEST:
+ fromX = bounds.x + bounds.width;
+ fromY = bounds.y + bounds.height/2;
+ toX = bounds.x + width;
+ toY = bounds.y + bounds.height/2;
+ break;
+ case PositionConstants.NORTH_EAST:
+ fromX = bounds.x;
+ fromY = bounds.y;
+ toX = bounds.x + bounds.width - width;
+ toY= bounds.y + bounds.height - height;
+ break;
+ case PositionConstants.NORTH_WEST:
+ fromX = bounds.x + bounds.width;
+ fromY = bounds.y;
+ toX = bounds.x + width;
+ toY= bounds.y + bounds.height - height;
+ break;
+ case PositionConstants.SOUTH_EAST:
+ fromX = bounds.x;
+ fromY = bounds.y + bounds.height;
+ toX = bounds.x + bounds.width - width;
+ toY = bounds.y +height;
+ break;
+ case PositionConstants.SOUTH_WEST:
+ fromX = bounds.x + bounds.width;
+ fromY = bounds.y + bounds.height;
+ toX = bounds.x + width;
+ toY = bounds.y +height;
+ break;
+ default:
+ new IllegalArgumentException("direction given is not a valid one");
+ }
+ viewer.drag(fromX, fromY, toX, toY);
+ }
+
private Rectangle getBounds() {
final IFigure figure = ((GraphicalEditPart) part).getFigure();
final Rectangle bounds = figure.getBounds().getCopy();
figure.translateToAbsolute(bounds);
return bounds;
}
-
+
public SWTBotGefEditPart activateDirectEdit() {
return activateDirectEdit(null);
}
-
-
+
public SWTBotGefEditPart activateDirectEdit(final Object feature) {
UIThreadRunnable.asyncExec(new VoidResult() {
public void run() {
@@ -191,39 +282,36 @@ public class SWTBotGefEditPart {
return this;
}
-
-
/**
* provide a description of this edit part that is useful for debugging purposes.
*/
public String toString() {
StringWriter writer = new StringWriter();
PrintWriter out = new PrintWriter(writer);
-
- describe(out,0);
-
+
+ describe(out, 0);
+
out.close();
return writer.toString();
}
-
- private void describe(PrintWriter out,int indent) {
+ private void describe(PrintWriter out, int indent) {
out.print(indent(indent));
out.print(part.getClass().getName());
List<SWTBotGefEditPart> children = children();
- out.print(" children="+children.size());
+ out.print(" children=" + children.size());
out.println();
- for (SWTBotGefEditPart child: children) {
- child.describe(out, indent+1);
+ for (SWTBotGefEditPart child : children) {
+ child.describe(out, indent + 1);
}
}
-
+
private String indent(int size) {
if (size == 0) {
return "";
}
StringBuilder buf = new StringBuilder(size);
- for (int x = 0;x<size;++x) {
+ for (int x = 0; x < size; ++x) {
buf.append("\t");
}
return buf.toString();
@@ -234,26 +322,26 @@ public class SWTBotGefEditPart {
return UIThreadRunnable.syncExec(new Result<List<SWTBotGefConnectionEditPart>>() {
public List<SWTBotGefConnectionEditPart> run() {
List<SWTBotGefConnectionEditPart> connections = new ArrayList<SWTBotGefConnectionEditPart>();
- List<org.eclipse.gef.ConnectionEditPart> sourceConnections = ((GraphicalEditPart)part).getSourceConnections();
- for (org.eclipse.gef.ConnectionEditPart c: sourceConnections) {
- connections.add(graphicalEditor.createEditPart(c));
+ List<org.eclipse.gef.ConnectionEditPart> sourceConnections = ((GraphicalEditPart) part).getSourceConnections();
+ for (org.eclipse.gef.ConnectionEditPart c : sourceConnections) {
+ connections.add(viewer.createEditPart(c));
}
return connections;
}
});
}
-
+
@SuppressWarnings("unchecked")
public List<SWTBotGefConnectionEditPart> targetConnections() {
return UIThreadRunnable.syncExec(new Result<List<SWTBotGefConnectionEditPart>>() {
public List<SWTBotGefConnectionEditPart> run() {
List<SWTBotGefConnectionEditPart> connections = new ArrayList<SWTBotGefConnectionEditPart>();
- List<org.eclipse.gef.ConnectionEditPart> targetConnections = ((GraphicalEditPart)part).getTargetConnections();
- for (org.eclipse.gef.ConnectionEditPart c: targetConnections) {
- connections.add(graphicalEditor.createEditPart(c));
+ List<org.eclipse.gef.ConnectionEditPart> targetConnections = ((GraphicalEditPart) part).getTargetConnections();
+ for (org.eclipse.gef.ConnectionEditPart c : targetConnections) {
+ connections.add(viewer.createEditPart(c));
}
return connections;
}
});
- }
+ }
}
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditor.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditor.java
index dd566fce..6c9057ba 100644
--- a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditor.java
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 MAKE Technologies Inc and others
+ * Copyright (c) 2004, 2010 MAKE Technologies Inc 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
@@ -7,41 +7,25 @@
*
* Contributors:
* MAKE Technologies Inc - initial API and implementation
- * Mariot Chauvin <mariot.chauvin@obeo.fr> - refactoring
- * Steve Monnier <steve.monnier@obeo.fr> - add mouseMoveDoubleClick action
- * Nathalie Lepine <nathalie.lepine@obeo.fr> - add mouseMoveDoubleClick action
+ * Mariot Chauvin <mariot.chauvin@obeo.fr> - Improvements and bug fixes
+ * Steve Monnier <steve.monnier@obeo.fr> - Improvements and bug fixes
+ * Nathalie Lepine <nathalie.lepine@obeo.fr> - Improvements and bug fixes
+ * Pascal Gelinas <pascal.gelinas @nuecho.com> - Improvements and bug fixes
+ * Mickael Istria <mickael.istria@bonitasoft.com> - Improvements and bug fixes
*******************************************************************************/
package org.eclipse.swtbot.eclipse.gef.finder.widgets;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import java.util.Map;
-import java.util.WeakHashMap;
-import java.util.regex.Pattern;
-
-import org.eclipse.draw2d.FigureCanvas;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Rectangle;
-import org.eclipse.draw2d.text.TextFlow;
+
import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.EditDomain;
import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.GraphicalViewer;
-import org.eclipse.gef.palette.PaletteEntry;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.gef.ui.parts.GraphicalViewerImpl;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
-import org.eclipse.swtbot.eclipse.gef.finder.finders.PaletteFinder;
-import org.eclipse.swtbot.eclipse.gef.finder.matchers.IsInstanceOf;
-import org.eclipse.swtbot.eclipse.gef.finder.matchers.ToolEntryLabelMatcher;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
import org.eclipse.swtbot.swt.finder.results.Result;
@@ -51,454 +35,343 @@ import org.eclipse.ui.IEditorReference;
import org.hamcrest.Matcher;
/**
- * represent a graphical editor that uses the GEF framework. The underlying
- * editor must adapt to a {@link GraphicalViewer} which must extend
- * {@link GraphicalViewerImpl} (this is the default for all GEF-based editors
- * that extend {@link org.eclipse.gef.ui.parts.GraphicalEditor}).
- *
- * Unlike most of SWTBot, this editor uses {@link org.eclipse.gef.EditPart edit
- * parts} to target UI events instead of SWT widgets. This is due to the fact
- * that GEF editors paint on a canvas and rarely use widgets at all.
+ * represent a graphical editor that uses the GEF framework. The underlying editor must adapt to a
+ * {@link GraphicalViewer} which must extend {@link GraphicalViewerImpl} (this is the default for all GEF-based editors
+ * that extend {@link org.eclipse.gef.ui.parts.GraphicalEditor}). Unlike most of SWTBot, this editor uses
+ * {@link org.eclipse.gef.EditPart edit parts} to target UI events instead of SWT widgets. This is due to the fact that
+ * GEF editors paint on a canvas and rarely use widgets at all.
*
* @author David Green
*/
public class SWTBotGefEditor extends SWTBotEditor {
- protected GraphicalViewer graphicalViewer;
-
- protected EditDomain editDomain;
-
- protected SWTBotGefFigureCanvas canvas;
-
- private Map<EditPart, SWTBotGefEditPart> editPartMapping = new WeakHashMap<EditPart, SWTBotGefEditPart>();
-
- //TODO comment.
- public SWTBotGefEditor(final IEditorReference reference, final SWTWorkbenchBot bot) throws WidgetNotFoundException {
- super(reference, bot);
- init();
- }
-
- /**
- * clear the cache of edit parts
- */
- public void clear() {
- editPartMapping.clear();
- }
-
- protected void init() throws WidgetNotFoundException {
- UIThreadRunnable.syncExec(new VoidResult() {
- public void run() {
- final IEditorPart editor = partReference.getEditor(true);
- graphicalViewer = (GraphicalViewer) editor.getAdapter(GraphicalViewer.class);
- final Control control = graphicalViewer.getControl();
- if (control instanceof FigureCanvas) {
- canvas = new SWTBotGefFigureCanvas((FigureCanvas) control);
- }
- editDomain = graphicalViewer.getEditDomain();
- }
- });
-
- if (graphicalViewer == null) {
- throw new WidgetNotFoundException("Editor does not adapt to a GraphicalViewer");
- }
- }
-
- public SWTBotGefEditPart mainEditPart() throws WidgetNotFoundException {
- List<SWTBotGefEditPart> children = rootEditPart().children();
- if (children.size() != 1) {
- throw new WidgetNotFoundException(String.format("Root edit part has %s children", children.size()));
- }
- return children.get(0);
- }
-
- /**
- * retrieve the root edit part.
- * @return the root edit part
- * @throws WidgetNotFoundException if root edit part could not be found
- * @see {@link GraphicalViewer#getRootEditPart()}
- */
- public SWTBotGefEditPart rootEditPart() throws WidgetNotFoundException {
- Object o = UIThreadRunnable.syncExec(new Result<Object>() {
- public Object run() {
- return createEditPart(graphicalViewer.getRootEditPart());
- }
- });
- if (o instanceof WidgetNotFoundException) {
- throw (WidgetNotFoundException) o;
- }
- return (SWTBotGefEditPart) o;
- }
-
- /**
- * lazily creates a {@link SWTBotGefEditPart} if this edit part does not exist yet. If an instance encapsulating the specified edit part has been created before, that instance is returned.
- * @param part the edit part to create a {@link SWTBotGefEditPart} for
- * @return the created {@link SWTBotGefEditPart}
- */
- protected SWTBotGefEditPart createEditPart(final EditPart part) {
- SWTBotGefEditPart editPart = editPartMapping.get(part);
- if (editPart == null) {
- if (part instanceof ConnectionEditPart) {
- editPart = new SWTBotGefConnectionEditPart(this, (ConnectionEditPart) part);
- } else {
- editPart = new SWTBotGefEditPart(this, part);
- }
- editPartMapping.put(part, editPart);
- }
- return editPart;
- }
-
- /**
- * lazily creates a {@link SWTBotGefConnectionEditPart} if this edit part does not exist yet. If an instance encapsulating the specified edit part has been created before, that instance is returned.
- * @param part a connection edit part connecting graphical nodes
- * @return a {@link SWTBotGefConnectionEditPart} encapsulating the connection edit part
- */
- protected SWTBotGefConnectionEditPart createEditPart(ConnectionEditPart part) {
- return (SWTBotGefConnectionEditPart) createEditPart((EditPart) part);
- }
-
- /**
- * Activate the default tool.
- */
- public void activateDefaultTool() {
- UIThreadRunnable.syncExec(new VoidResult() {
- public void run() {
- final EditDomain editDomain = getEditDomain();
- editDomain.setActiveTool(editDomain.getDefaultTool());
- }
- });
- }
-
- /**
- * Activate the tool with the specified label. If there is many tools with the same label the first one will be used. See {@link SWTBotGefEditor#activateTool(String, int)}
- * @param label the label of the tool to activate
- * @return the editor bot
- * @throws WidgetNotFoundException if the tool with label specified could not be found
- */
- public SWTBotGefEditor activateTool(final String label) throws WidgetNotFoundException {
- activateTool(Pattern.compile(Pattern.quote(label)), 0);
- return this;
- }
-
- /**
- * Activate the tool with the specified label and the specified index. This method should be used only if there is many tools with the same label. See {@link SWTBotGefEditor#activateTool(String)}
- * @param label the label of the tool to activate
- * @param index the index to use in order to make the selection.
- * @return the editor bot
- * @throws WidgetNotFoundException if the tool with label specified could not be found
- */
- public SWTBotGefEditor activateTool(final String label, int index) throws WidgetNotFoundException {
- activateTool(Pattern.compile(Pattern.quote(label)), index);
- return this;
- }
-
-
- private SWTBotGefEditor activateTool(final Pattern labelMatcher, final int index) throws WidgetNotFoundException {
- final WidgetNotFoundException[] exception = new WidgetNotFoundException[1];
- UIThreadRunnable.syncExec(new VoidResult() {
- public void run() {
- final EditDomain editDomain = getEditDomain();
- final List<PaletteEntry> entries = new PaletteFinder(editDomain).findEntries(new ToolEntryLabelMatcher(labelMatcher));
- if (entries.size() > 0) {
- final PaletteEntry paletteEntry = entries.get(index);
- if (paletteEntry instanceof ToolEntry) {
- editDomain.setActiveTool(((ToolEntry) paletteEntry).createTool());
- } else {
- exception[0] = new WidgetNotFoundException(String.format("%s is not a tool entry, it's a %s", labelMatcher.toString(), paletteEntry.getClass().getName()));
- }
- } else {
- exception[0] = new WidgetNotFoundException(labelMatcher.toString());
- }
- }
- });
- if (exception[0] != null) {
- throw exception[0];
- }
- return this;
- }
-
- /**
- * call on UI thread only
- */
- private EditDomain getEditDomain() {
- return editDomain;
- }
-
- /**
- * type the given text into the graphical editor, presuming that it is
- * already in 'direct edit' mode.
- *
- * @param text
- * the text to type.
- * @throws WidgetNotFoundException
- */
- public void directEditType(String text) throws WidgetNotFoundException {
- /* wait until text widget appears */
- bot.text();
- /* find it now */
- List<Text> controls = bot.getFinder().findControls(getWidget(), new IsInstanceOf<Text>(Text.class), true);
- if (controls.size() == 1) {
- final Text textControl = controls.get(0);
- canvas.typeText(textControl, text);
- } else {
- throw new WidgetNotFoundException(String.format("Expected to find one text control, but found %s. Is the editor in direct-edit mode?", controls.size()));
- }
- }
-
- /**
- *
- * @param matcher
- * the matcher that matches on {@link org.eclipse.gef.EditPart}
- * @return a collection of {@link SWTBotGefEditPart}
- * @throws WidgetNotFoundException
- */
- public List<SWTBotGefEditPart> editParts(Matcher<? extends EditPart> matcher) throws WidgetNotFoundException {
- return rootEditPart().descendants(matcher);
- }
+ protected final SWTBotGefViewer viewer;
+
+ /**
+ * Create a new bot GEF editor instance.
+ *
+ * @param reference the editor reference
+ * @param bot the workbench bot
+ * @throws WidgetNotFoundException if widget could not be found
+ */
+ public SWTBotGefEditor(final IEditorReference reference, final SWTWorkbenchBot bot) throws WidgetNotFoundException {
+ super(reference, bot);
+ GraphicalViewer graphicalViewer = UIThreadRunnable.syncExec(new Result<GraphicalViewer>() {
+ public GraphicalViewer run() {
+ final IEditorPart editor = partReference.getEditor(true);
+ return (GraphicalViewer) editor.getAdapter(GraphicalViewer.class);
+ }
+ });
+ viewer = new SWTBotGefViewer(graphicalViewer);
+ viewer.init();
+ }
+
+ /**
+ * Get the wrapped SWTBotGefViewer instance.
+ * @return a SWTBotGefViewer instance
+ */
+ public SWTBotGefViewer getSWTBotGefViewer() {
+ return viewer;
+ }
+
+ /**
+ * clear the cache of edit parts
+ */
+ public void clear() {
+ viewer.clear();
+ }
+
+ public SWTBotGefEditPart mainEditPart() throws WidgetNotFoundException {
+ return viewer.mainEditPart();
+ }
+
+ /**
+ * retrieve the root edit part.
+ *
+ * @return the root edit part
+ * @throws WidgetNotFoundException if root edit part could not be found
+ * @see {@link GraphicalViewer#getRootEditPart()}
+ */
+ public SWTBotGefEditPart rootEditPart() throws WidgetNotFoundException {
+ return viewer.rootEditPart();
+ }
- protected SWTBotGefFigureCanvas getCanvas() {
- return canvas;
- }
+ /**
+ * Get the selected edit parts.
+ * @return the selected edit parts
+ */
+ public List<SWTBotGefEditPart> selectedEditParts() {
+ return viewer.selectedEditParts();
+ }
- protected Control getControl() {
- return graphicalViewer.getControl();
- }
-
- /**
- * select this edit part as a single selection
- */
- public SWTBotGefEditor select(SWTBotGefEditPart... parts) {
- return select(Arrays.asList(parts));
- }
-
- /**
- * select this edit part as a single selection
- */
- public SWTBotGefEditor select(final Collection<SWTBotGefEditPart> parts) {
- UIThreadRunnable.syncExec(new VoidResult() {
- public void run() {
- List<EditPart> selectParts = new ArrayList<EditPart>(parts.size());
- for (SWTBotGefEditPart p : parts) {
- selectParts.add(p.part);
- }
- graphicalViewer.setFocus(selectParts.get(0));
- graphicalViewer.setSelection(new StructuredSelection(selectParts));
- }
- });
- return this;
- }
-
- @Override
- public boolean isActive() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public void setFocus() {
- // TODO Auto-generated method stub
-
- }
-
- public SWTBotGefEditor clickContextMenu(String text) throws WidgetNotFoundException {
- new SWTBotGefContextMenu(getControl(), text).click();
- return this;
- }
-
-
- /**
- * this method emits mouse events that handle a mouse move and double click to the specified position within the editor.<br>
- * Note that a move is required before double clicking in order to update the mouse cursor with the target editpart.
- *
- * @param xPosition the relative x position within the graphical viewer
- * @param yPosition the relative y position within the graphical viewer
- */
- public void mouseMoveDoubleClick(final int xPosition, final int yPosition) {
- UIThreadRunnable.asyncExec(new VoidResult() {
- public void run() {
- canvas.mouseMoveDoubleClick(xPosition, yPosition);
- }
- });
- }
-
- /**
- * this method emits mouse events that handle a mouse move and left click to the specified position within the editor.<br>
- * Note that a move is required before left clicking in order to update the mouse cursor with the target editpart.
- *
- * @param xPosition the relative x position within the graphical viewer
- * @param yPosition the relative y position within the graphical viewer
- */
- public void mouseMoveLeftClick(final int xPosition, final int yPosition) {
- UIThreadRunnable.asyncExec(new VoidResult() {
- public void run() {
- canvas.mouseMoveLeftClick(xPosition, yPosition);
- }
- });
- }
-
- //TODO should be commented
- /**
- * this method emits mouse events that handle drags within the editor
- *
- * @param fromXPosition the relative x position within the graphical viewer to drag from
- * @param fromYPosition the relative y position within the graphical viewer to drag from
- * @param toXPosition the relative x position within the graphical viewer to drag to
- * @param toYPosition the relative y position within the graphical viewer to drag to
- */
- public void mouseDrag(final int fromXPosition, final int fromYPosition, final int toXPosition, final int toYPosition) {
- UIThreadRunnable.asyncExec(new VoidResult() {
- public void run() {
- canvas.mouseDrag(fromXPosition, fromYPosition, toXPosition, toYPosition);
- }
- });
- }
+ /**
+ * lazily creates a {@link SWTBotGefEditPart} if this edit part does not exist yet. If an instance encapsulating the
+ * specified edit part has been created before, that instance is returned.
+ *
+ * @param part the edit part to create a {@link SWTBotGefEditPart} for
+ * @return the created {@link SWTBotGefEditPart}
+ */
+ protected SWTBotGefEditPart createEditPart(final EditPart part) {
+ return viewer.createEditPart(part);
+ }
+
+ /**
+ * lazily creates a {@link SWTBotGefConnectionEditPart} if this edit part does not exist yet. If an instance
+ * encapsulating the specified edit part has been created before, that instance is returned.
+ *
+ * @param part a connection edit part connecting graphical nodes
+ * @return a {@link SWTBotGefConnectionEditPart} encapsulating the connection edit part
+ */
+ protected SWTBotGefConnectionEditPart createEditPart(ConnectionEditPart part) {
+ return viewer.createEditPart(part);
+ }
+
+ /**
+ * Get the active tool.
+ * @return the active tool
+ */
+ public ToolEntry getActiveTool() {
+ return viewer.getActiveTool();
+ }
+ /**
+ * Activate the default tool.
+ */
+ public void activateDefaultTool() {
+ viewer.activateDefaultTool();
+ }
+
+ /**
+ * Activate the tool with the specified label. If there is many tools with the same label the first one will be
+ * used. See {@link SWTBotGefEditor#activateTool(String, int)}
+ *
+ * @param label the label of the tool to activate
+ * @return the editor bot
+ * @throws WidgetNotFoundException if the tool with label specified could not be found
+ */
+ public SWTBotGefEditor activateTool(final String label) throws WidgetNotFoundException {
+ viewer.activateTool(label);
+ return this;
+ }
+
+ /**
+ * Activate the tool with the specified label and the specified index. This method should be used only if there is
+ * many tools with the same label. See {@link SWTBotGefEditor#activateTool(String)}
+ *
+ * @param label the label of the tool to activate
+ * @param index the index to use in order to make the selection.
+ * @return the editor bot
+ * @throws WidgetNotFoundException if the tool with label specified could not be found
+ */
+ public SWTBotGefEditor activateTool(final String label, int index) throws WidgetNotFoundException {
+ viewer.activateTool(label, index);
+ return this;
+ }
+
+ /**
+ * type the given text into the graphical editor, presuming that it is already in 'direct edit' mode.
+ *
+ * @param text the text to type.
+ * @throws WidgetNotFoundException
+ */
+ public void directEditType(String text) throws WidgetNotFoundException {
+ viewer.directEditType(text);
+ }
+
+ /**
+ * @param matcher the matcher that matches on {@link org.eclipse.gef.EditPart}
+ * @return a collection of {@link SWTBotGefEditPart}
+ * @throws WidgetNotFoundException
+ */
+ public List<SWTBotGefEditPart> editParts(Matcher<? extends EditPart> matcher) throws WidgetNotFoundException {
+ return viewer.editParts(matcher);
+ }
+
+ /**
+ * select this edit part as a single selection
+ */
+ public SWTBotGefEditor select(SWTBotGefEditPart... parts) {
+ return select(Arrays.asList(parts));
+ }
+
+ /**
+ * select this edit part as a single selection
+ */
+ public SWTBotGefEditor select(final Collection<SWTBotGefEditPart> parts) {
+ viewer.select(parts);
+ return this;
+ }
+
+ @Override
+ public boolean isActive() {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor#setFocus()
+ */
+ @Override
+ public void setFocus() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ IEditorPart editor = partReference.getEditor(false);
+ if (editor != null) {
+ editor.setFocus();
+ }
+ }
+ });
+ }
+
+ public SWTBotGefEditor clickContextMenu(String text) throws WidgetNotFoundException {
+ viewer.clickContextMenu(text);
+ return this;
+ }
+
+ /**
+ * Click on the editor at the specified location.
+ *
+ * @param xPosition the x relative position
+ * @param yPosition the y relative position
+ */
+ public void click(final int xPosition, final int yPosition) {
+ viewer.click(xPosition, yPosition);
+ }
+
+ /**
+ * Click on the specified edit part at the top left hand corner of its bounds.
+ *
+ * @param editPart the edit part to click on
+ */
+ public void click(final SWTBotGefEditPart editPart) {
+ viewer.click(editPart);
+ }
+
+ /**
+ * Click on the edit part which owns the specified label at the top left hand corner of its bounds.
+ *
+ * @param label the label to retrieve edit part to click on
+ */
+ public void click(final String label) {
+ viewer.click(label);
+ }
+
+ /**
+ * Double click on the editor at the specified location.
+ *
+ * @param xPosition the x relative position
+ * @param yPosition the y relative position
+ */
+ public void doubleClick(final int xPosition, final int yPosition) {
+ viewer.doubleClick(xPosition, yPosition);
+ }
+
+ /**
+ * Double click on the edit part which owns the specified label at the top left hand corner (with an offset) of its
+ * bounds.
+ *
+ * @param editPart the edit part to double click on
+ */
+ public void doubleClick(final SWTBotGefEditPart editPart) {
+ viewer.doubleClick(editPart);
+ }
+
+ /**
+ * Double click on the edit part which owns the specified label at the top left hand corner (with an offset) of its
+ * bounds.
+ *
+ * @param label the label to retrieve edit part to double click on
+ */
+ public void doubleClick(final String label) {
+ viewer.doubleClick(label);
+ }
+
+ /**
+ * Drag and drop from the specified to the specified location.
+ *
+ * @param toXPosition the x relative location
+ * @param toYPosition the y relative location
+ */
+ public void drag(final int fromXPosition, final int fromYPosition, final int toXPosition, final int toYPosition) {
+ viewer.drag(fromXPosition, fromYPosition, toXPosition, toYPosition);
+ }
+
+ /**
+ * Drag and drop the specified edit part to the specified location.
+ *
+ * @param editPart the edit part to drag and drop
+ * @param toXPosition the x relative location
+ * @param toYPosition the y relative location
+ */
+ public void drag(final SWTBotGefEditPart editPart, final int toXPosition, final int toYPosition) {
+ viewer.drag(editPart, toXPosition, toYPosition);
+ }
+
+ /**
+ * Drag and drop the edit part which owns the specified label to the specified location
+ *
+ * @param label the label to retrieve the edit part to drag and drop
+ * @param toXPosition the x relative position
+ * @param toYPosition the y relative position
+ */
+ public void drag(final String label, final int toXPosition, final int toYPosition) {
+ viewer.drag(label, toXPosition, toYPosition);
+ }
+
+ /**
+ * select the edit part with the label as a single selection.
+ */
+ public SWTBotGefEditor select(String label) {
+ viewer.select(label);
+ return this;
+ }
+
+ /**
+ * get this edit part with the label as a single selection.
+ */
+ public SWTBotGefEditPart getEditPart(String label) {
+ return viewer.getEditPart(label);
+ }
+
+ // FIXME should moved in a finder
+ @Deprecated
+ /*
+ * * get this edit part with the label as a single selection
+ */
+ public SWTBotGefEditPart getEditpart(String label, List<SWTBotGefEditPart> allEditParts) {
+ return viewer.getEditpart(label, allEditParts);
+ }
+
+ /* deprecated methods -> keeped for compatibility */
+
+ @Deprecated
+ public void mouseDrag(final int fromXPosition, final int fromYPosition, final int toXPosition, final int toYPosition) {
+ drag(fromXPosition, fromYPosition, toXPosition, toYPosition);
+ }
+
+ @Deprecated
+ public void mouseDrag(final String label, final int toXPosition, final int toYPosition) {
+ drag(label, toXPosition, toYPosition);
+ }
+
+ @Deprecated
+ public void mouseMoveDoubleClick(final int xPosition, final int yPosition) {
+ doubleClick(xPosition, yPosition);
+ }
+
+ @Deprecated
+ public void mouseMoveDoubleClick(final String label) {
+ doubleClick(label);
+ }
+
+ @Deprecated
+ public void mouseMoveLeftClick(final int xPosition, final int yPosition) {
+ click(xPosition, yPosition);
+ }
- //TODO should be commented
- /**
- * this method emits mouse events that handle a mouse move and left click to the specified position within the editor.<br>
- * Note that a move is required before left clicking in order to update the mouse cursor with the target editpart.
- *
- * @param label the label
- */
- public void mouseMoveLeftClick(String label) {
- SWTBotGefEditPart selectedEP = getEditPart(label);
- if (selectedEP==null) {
- throw new WidgetNotFoundException(String.format("Expected to find widget %s",label));
- }
- Rectangle bounds = ((GraphicalEditPart) selectedEP.part()).getFigure().getBounds();
- mouseMoveLeftClick(bounds.x, bounds.y);
- }
-
- /**
- * this method emits mouse events that handle a mouse move and double click to the specified position within the editor.<br>
- * Note that a move is required before double clicking in order to update the mouse cursor with the target editpart.
- * As we can not double click on the corner, we move the double click position
- * @param label the label
- */
- public void mouseMoveDoubleClick(final String label) {
- SWTBotGefEditPart selectedEP = getEditPart(label);
- if (selectedEP==null) {
- throw new WidgetNotFoundException(String.format("Expected to find widget %s",label));
- }
- Rectangle bounds = ((GraphicalEditPart) selectedEP.part()).getFigure().getBounds();
- mouseMoveDoubleClick(bounds.x, bounds.y+MOVE);
- }
-
- private static final int MOVE = 3;
-
- /**
- * this method emits mouse events that handle drags within the editor
- *
- * @param label the label
- * @param toXPosition the relative x position within the graphical viewer to drag to
- * @param toYPosition the relative y position within the graphical viewer to drag to
- */
- public void mouseDrag(final String label, final int toXPosition, final int toYPosition) {
- SWTBotGefEditPart selectedEP = getEditPart(label);
- if (selectedEP==null) {
- throw new WidgetNotFoundException(String.format("Expected to find widget %s",label));
- }
- Rectangle bounds = ((GraphicalEditPart) selectedEP.part()).getFigure().getBounds();
- mouseDrag(bounds.x, bounds.y, toXPosition, toYPosition);
- }
-
- /**
- * select the edit part with the label as a single selection
- */
- public SWTBotGefEditor select(String label)
- {
- SWTBotGefEditPart selectedEP = getEditPart(label);
- if (selectedEP == null) {
- throw new WidgetNotFoundException(String.format("Expected to find widget %s",label));
- }
- List<SWTBotGefEditPart> editParts = new ArrayList<SWTBotGefEditPart>();
- editParts.add(selectedEP);
- return select(selectedEP);
- }
-
- /**
- * get this edit part with the label as a single selection
- */
- public SWTBotGefEditPart getEditPart(String label)
- {
- List<SWTBotGefEditPart> allEditParts = mainEditPart().children();
- allEditParts.addAll(mainEditPart().sourceConnections());
- return getEditpart(label, allEditParts);
- }
-
- //FIXME should moved in a finder
- @Deprecated
- /**
- * get this edit part with the label as a single selection
- */
- public SWTBotGefEditPart getEditpart(String label, List<SWTBotGefEditPart> allEditParts)
- {
- for (SWTBotGefEditPart child : allEditParts) {
- IFigure figure = ((GraphicalEditPart) child.part()).getFigure();
-
- if (isLabel(figure, label)) {
- return child;
- }
-
- SWTBotGefEditPart childEditPart = getEditPart(child, label);
- if (childEditPart!=null) {
- return childEditPart;
- }
-
- if (findLabelFigure(figure, label))
- return child;
- return null;
- }
- return null;
- }
-
- /**
- * get this edit part with the label as a single selection
- */
- private SWTBotGefEditPart getEditPart(SWTBotGefEditPart editPart, String label)
- {
- if (editPart.children().isEmpty() && findLabelFigure(((GraphicalEditPart) editPart.part()).getFigure(), label)) {
- return editPart;
- }
-
- List<SWTBotGefEditPart> allEditParts = editPart.children();
- allEditParts.addAll(editPart.sourceConnections());
- return getEditpart(label, allEditParts);
- }
-
- //FIXME should moved in a finder
- /**
- * @return if the figure is a label
- */
- private boolean isLabel(IFigure figure, String label)
- {
- // case 1 : gef label
- if ((figure instanceof Label && ((Label)figure).getText().equals(label)))
- {
- return true;
- }
-
- // case 2 : no gef label
- if ((figure instanceof TextFlow && ((TextFlow)figure).getText().equals(label)))
- {
- return true;
- }
- return false;
- }
-
- //FIXME should moved in a finder
- /**
- * @return if the figure or all its children contain the label
- */
- private boolean findLabelFigure(IFigure figure, String label) {
- if (isLabel(figure, label)) {
- return true;
- }
- for (Object figureChild : figure.getChildren()) {
- if (isLabel((IFigure) figureChild, label) || findLabelFigure((IFigure) figureChild, label)) {
- return true;
- }
- }
- return false;
- }
+ @Deprecated
+ public void mouseMoveLeftClick(String label) {
+ click(label);
+ }
}
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefFigureCanvas.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefFigureCanvas.java
index 7207f55c..2a834f2d 100644
--- a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefFigureCanvas.java
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefFigureCanvas.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Obeo and others
+ * Copyright (c) 2009, 2010 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
@@ -13,7 +13,9 @@ package org.eclipse.swtbot.eclipse.gef.finder.widgets;
import org.eclipse.draw2d.EventDispatcher;
import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
@@ -22,58 +24,109 @@ import org.eclipse.swtbot.swt.finder.results.VoidResult;
import org.eclipse.swtbot.swt.finder.widgets.AbstractSWTBotControl;
/**
- * TODO comment
+ * A bot which wraps the swt canvas control.
* @author mchauvin
*/
-public class SWTBotGefFigureCanvas extends AbstractSWTBotControl<FigureCanvas>{
+public class SWTBotGefFigureCanvas extends AbstractSWTBotControl<Canvas>{
protected EventDispatcher eventDispatcher;
-
- //TODO should be documented
- public SWTBotGefFigureCanvas(FigureCanvas w) throws WidgetNotFoundException {
- super(w);
- eventDispatcher = w.getLightweightSystem().getRootFigure().internalGetEventDispatcher();
+
+ /**
+ * Constructs a new instance from a {@link FigureCanvas}.
+ * @param canvas the canvas to wrap
+ * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed.
+ */
+ public SWTBotGefFigureCanvas(FigureCanvas canvas) throws WidgetNotFoundException {
+ this(canvas, canvas.getLightweightSystem());
}
- public void mouseMoveDoubleClick(int xPosition, int yPosition) {
- org.eclipse.swt.events.MouseEvent meMove = wrapMouseEvent(xPosition, yPosition, 0, 0, 0);
- eventDispatcher.dispatchMouseMoved(meMove);
- org.eclipse.swt.events.MouseEvent meDown = wrapMouseEvent(xPosition, yPosition, 1, SWT.BUTTON1, 1);
- eventDispatcher.dispatchMousePressed(meDown);
- org.eclipse.swt.events.MouseEvent meDoubleClick = wrapMouseEvent(xPosition, yPosition, 1, SWT.BUTTON1, 1);
- eventDispatcher.dispatchMouseDoubleClicked(meDoubleClick);
+ /**
+ * Constructs a new instance from a {@link Canvas} and a {@link LightweightSystem}. If the canvas is an instance of {@link FigureCanvas}, use {@link SWTBotGefFigureCanvas#SWTBotGefFigureCanvas(FigureCanvas)} instead.
+ * @param canvas the canvas to wrap
+ * @param lightweightSystem the lightweight system to use
+ * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed.
+ */
+ public SWTBotGefFigureCanvas(Canvas canvas, LightweightSystem lightweightSystem) throws WidgetNotFoundException {
+ super(canvas);
+ eventDispatcher = lightweightSystem.getRootFigure().internalGetEventDispatcher();
+ }
+
+ /**
+ * this method emits mouse events that handle a mouse move and double click to the specified position within the canvas.
+ * @param xPosition the relative x position
+ * @param yPosition the relative y position
+ */
+ public void mouseMoveDoubleClick(final int xPosition, final int yPosition) {
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ public void run() {
+ org.eclipse.swt.events.MouseEvent meMove = wrapMouseEvent(xPosition, yPosition, 0, 0, 0);
+ eventDispatcher.dispatchMouseMoved(meMove);
+ org.eclipse.swt.events.MouseEvent meDown = wrapMouseEvent(xPosition, yPosition, 1, SWT.None, 1);
+ eventDispatcher.dispatchMousePressed(meDown);
+ org.eclipse.swt.events.MouseEvent meUp = wrapMouseEvent(xPosition, yPosition, 1 , SWT.BUTTON1, 1);
+ eventDispatcher.dispatchMouseReleased(meUp);
+ org.eclipse.swt.events.MouseEvent meDown2 = wrapMouseEvent(xPosition, yPosition, 1, SWT.None, 2);
+ eventDispatcher.dispatchMousePressed(meDown2);
+ org.eclipse.swt.events.MouseEvent meDoubleClick = wrapMouseEvent(xPosition, yPosition, 1, SWT.None, 2);
+ meDoubleClick.time = meDown2.time;
+ eventDispatcher.dispatchMouseDoubleClicked(meDoubleClick);
+ org.eclipse.swt.events.MouseEvent meUp2 = wrapMouseEvent(xPosition, yPosition, 1 , SWT.BUTTON1, 2);
+ eventDispatcher.dispatchMouseReleased(meUp2);
+ }
+ });
}
private org.eclipse.swt.events.MouseEvent wrapMouseEvent(int x, int y, int button, int stateMask, int count) {
return new org.eclipse.swt.events.MouseEvent(createMouseEvent(x, y, button, stateMask, count));
}
- public void mouseDrag(int fromXPosition, int fromYPosition, int toXPosition, int toYPosition) {
- org.eclipse.swt.events.MouseEvent meMove = wrapMouseEvent(fromXPosition, fromYPosition, 0, 0, 0);
- eventDispatcher.dispatchMouseMoved(meMove);
- org.eclipse.swt.events.MouseEvent meDown = wrapMouseEvent(fromXPosition, fromYPosition, 1, SWT.BUTTON1, 1);
- eventDispatcher.dispatchMousePressed(meDown);
- org.eclipse.swt.events.MouseEvent meMoveTarget = wrapMouseEvent(toXPosition, toYPosition, 1, SWT.BUTTON1, 0);
- eventDispatcher.dispatchMouseMoved(meMoveTarget);
- org.eclipse.swt.events.MouseEvent meUp = wrapMouseEvent(toXPosition, toYPosition, 1 , SWT.BUTTON1, 1);
- eventDispatcher.dispatchMouseReleased(meUp);
+
+ /**
+ * this method emits mouse events that handle drags within the canvas
+ *
+ * @param fromXPosition the relative x position within the canvas to drag from
+ * @param fromYPosition the relative y position within the canvas to drag from
+ * @param toXPosition the relative x position within the canvas to drag to
+ * @param toYPosition the relative y position within the canvas to drag to
+ */
+ public void mouseDrag(final int fromXPosition, final int fromYPosition, final int toXPosition, final int toYPosition) {
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ public void run() {
+ org.eclipse.swt.events.MouseEvent meMove = wrapMouseEvent(fromXPosition, fromYPosition, 0, 0, 0);
+ eventDispatcher.dispatchMouseMoved(meMove);
+ org.eclipse.swt.events.MouseEvent meDown = wrapMouseEvent(fromXPosition, fromYPosition, 1, SWT.BUTTON1, 1);
+ eventDispatcher.dispatchMousePressed(meDown);
+ org.eclipse.swt.events.MouseEvent meMoveTarget = wrapMouseEvent(toXPosition, toYPosition, 1, SWT.BUTTON1, 0);
+ eventDispatcher.dispatchMouseMoved(meMoveTarget);
+ org.eclipse.swt.events.MouseEvent meUp = wrapMouseEvent(toXPosition, toYPosition, 1 , SWT.BUTTON1, 1);
+ eventDispatcher.dispatchMouseReleased(meUp);
+ }
+ });
}
public void mouseMoveLeftClick(final int xPosition, final int yPosition) {
- org.eclipse.swt.events.MouseEvent meMove = wrapMouseEvent(xPosition, yPosition, 0, 0, 0);
- eventDispatcher.dispatchMouseMoved(meMove);
- org.eclipse.swt.events.MouseEvent meDown = wrapMouseEvent(xPosition, yPosition, 1, SWT.BUTTON1, 1);
- eventDispatcher.dispatchMousePressed(meDown);
- org.eclipse.swt.events.MouseEvent meUp = wrapMouseEvent(xPosition, yPosition, 1 , SWT.BUTTON1, 1);
- eventDispatcher.dispatchMouseReleased(meUp);
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ public void run() {
+ org.eclipse.swt.events.MouseEvent meMove = wrapMouseEvent(xPosition, yPosition, 0, 0, 0);
+ eventDispatcher.dispatchMouseMoved(meMove);
+ org.eclipse.swt.events.MouseEvent meDown = wrapMouseEvent(xPosition, yPosition, 1, SWT.BUTTON1, 1);
+ eventDispatcher.dispatchMousePressed(meDown);
+ org.eclipse.swt.events.MouseEvent meUp = wrapMouseEvent(xPosition, yPosition, 1 , SWT.BUTTON1, 1);
+ eventDispatcher.dispatchMouseReleased(meUp);
+ }
+ });
}
- public void mouseEnterLeftClickAndExit(int xPosition, int yPosition) {
- eventDispatcher.dispatchMouseEntered(wrapMouseEvent(xPosition, yPosition, 0, 0, 0));
- eventDispatcher.dispatchMouseMoved(wrapMouseEvent(xPosition, yPosition, 0, 0, 0));
- eventDispatcher.dispatchMousePressed(wrapMouseEvent(xPosition, yPosition, 1, SWT.BUTTON1, 1));
- eventDispatcher.dispatchMouseReleased(wrapMouseEvent(xPosition, yPosition, 1, SWT.BUTTON1, 1));
- eventDispatcher.dispatchMouseExited(wrapMouseEvent(xPosition, yPosition, 0, 0, 0));
+ public void mouseEnterLeftClickAndExit(final int xPosition, final int yPosition) {
+ UIThreadRunnable.asyncExec(new VoidResult() {
+ public void run() {
+ eventDispatcher.dispatchMouseEntered(wrapMouseEvent(xPosition, yPosition, 0, 0, 0));
+ eventDispatcher.dispatchMouseMoved(wrapMouseEvent(xPosition, yPosition, 0, 0, 0));
+ eventDispatcher.dispatchMousePressed(wrapMouseEvent(xPosition, yPosition, 1, SWT.BUTTON1, 1));
+ eventDispatcher.dispatchMouseReleased(wrapMouseEvent(xPosition, yPosition, 1, SWT.BUTTON1, 1));
+ eventDispatcher.dispatchMouseExited(wrapMouseEvent(xPosition, yPosition, 0, 0, 0));
+ }
+ });
}
public void typeText(final Text textControl, final String text) {
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefView.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefView.java
new file mode 100644
index 00000000..7e36dbe9
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefView.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Obeo.
+ * 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:
+ * Mariot Chauvin <mariot.chauvin@obeo.fr> - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.swtbot.eclipse.gef.finder.widgets;
+
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+
+public class SWTBotGefView extends SWTBotView {
+
+ protected final SWTBotGefViewer viewer;
+
+ public SWTBotGefView(final IViewReference partReference, SWTWorkbenchBot bot) {
+ super(partReference, bot);
+ GraphicalViewer graphicalViewer = UIThreadRunnable.syncExec(new Result<GraphicalViewer>() {
+ public GraphicalViewer run() {
+ final IViewPart view = partReference.getView(true);
+ return (GraphicalViewer) view.getAdapter(GraphicalViewer.class);
+ }
+ });
+ viewer = new SWTBotGefViewer(graphicalViewer);
+ viewer.init();
+ }
+
+ /**
+ * Get the wrapped SWTBotGefViewer instance.
+ * @return a SWTBotGefViewer instance
+ */
+ public SWTBotGefViewer getSWTBotGefViewer() {
+ return viewer;
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefViewer.java b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefViewer.java
new file mode 100644
index 00000000..ff61bafb
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.gef.finder/src/org/eclipse/swtbot/eclipse/gef/finder/widgets/SWTBotGefViewer.java
@@ -0,0 +1,567 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2011 MAKE Technologies Inc 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:
+ * MAKE Technologies Inc - initial API and implementation
+ * Mariot Chauvin <mariot.chauvin@obeo.fr> - Improvements and bug fixes
+ * Steve Monnier <steve.monnier@obeo.fr> - Improvements and bug fixes
+ * Nathalie Lepine <nathalie.lepine@obeo.fr> - Improvements and bug fixes
+ * Pascal Gelinas <pascal.gelinas @nuecho.com> - Improvements and bug fixes
+ * Mickael Istria <mickael.istria@bonitasoft.com> - Improvements and bug fixes
+ * Tim Kaiser <tim.kaiser@sap.com> - Improvements and bug fixes
+ *******************************************************************************/
+package org.eclipse.swtbot.eclipse.gef.finder.widgets;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.WeakHashMap;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.FigureCanvas;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.LightweightSystem;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.draw2d.text.TextFlow;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swtbot.eclipse.gef.finder.finders.PaletteFinder;
+import org.eclipse.swtbot.eclipse.gef.finder.matchers.ToolEntryLabelMatcher;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
+import org.eclipse.swtbot.swt.finder.results.VoidResult;
+import org.hamcrest.Matcher;
+
+/**
+ * represent a graphical viewer that uses the GEF framework.
+ *
+ * @author David Green
+ */
+public class SWTBotGefViewer {
+
+ protected GraphicalViewer graphicalViewer;
+
+ protected EditDomain editDomain;
+
+ protected SWTBotGefFigureCanvas canvas;
+
+ private Map<EditPart, SWTBotGefEditPart> editPartMapping = new WeakHashMap<EditPart, SWTBotGefEditPart>();
+
+ /**
+ * Create a new bot GEF graphical viewer instance.
+ *
+ * @param graphicalViewer the graphical viewer to wrap
+ * @throws WidgetNotFoundException if graphical viewer is null
+ */
+ public SWTBotGefViewer(final GraphicalViewer graphicalViewer) throws WidgetNotFoundException {
+ if (graphicalViewer == null) {
+ throw new WidgetNotFoundException("The graphical viewer is null.");
+ }
+ this.graphicalViewer = graphicalViewer;
+ init();
+ }
+
+ public SWTBot bot() {
+ return new SWTBot(canvas.widget);
+ }
+
+ /**
+ * clear the cache of edit parts
+ */
+ public void clear() {
+ editPartMapping.clear();
+ }
+
+ protected void init() throws WidgetNotFoundException {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ final Control control = graphicalViewer.getControl();
+ if (control instanceof FigureCanvas) {
+ canvas = new SWTBotGefFigureCanvas((FigureCanvas) control);
+ } else if (control instanceof Canvas) {
+ if (control instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) control;
+ Object adapter = adaptable.getAdapter(LightweightSystem.class);
+ if (adapter instanceof LightweightSystem) {
+ canvas = new SWTBotGefFigureCanvas((Canvas) control, (LightweightSystem) adapter);
+ }
+ }
+ }
+ editDomain = graphicalViewer.getEditDomain();
+ }
+ });
+
+ if (graphicalViewer == null) {
+ throw new WidgetNotFoundException("Editor does not adapt to a GraphicalViewer");
+ }
+ }
+
+ public SWTBotGefEditPart mainEditPart() throws WidgetNotFoundException {
+ List<SWTBotGefEditPart> children = rootEditPart().children();
+ if (children.size() != 1) {
+ throw new WidgetNotFoundException(String.format("Root edit part has %s children", children.size()));
+ }
+ return children.get(0);
+ }
+
+ /**
+ * retrieve the root edit part.
+ *
+ * @return the root edit part
+ * @throws WidgetNotFoundException if root edit part could not be found
+ * @see {@link GraphicalViewer#getRootEditPart()}
+ */
+ public SWTBotGefEditPart rootEditPart() throws WidgetNotFoundException {
+ Object o = UIThreadRunnable.syncExec(new Result<Object>() {
+ public Object run() {
+ return createEditPart(graphicalViewer.getRootEditPart());
+ }
+ });
+ if (o instanceof WidgetNotFoundException) {
+ throw (WidgetNotFoundException) o;
+ }
+ return (SWTBotGefEditPart) o;
+ }
+
+ /**
+ * Get the selected edit parts.
+ * @return the selected edit parts
+ */
+ @SuppressWarnings("unchecked")
+ public List<SWTBotGefEditPart> selectedEditParts() {
+ List<SWTBotGefEditPart> toReturn = new ArrayList<SWTBotGefEditPart>();
+ List<EditPart> parts = graphicalViewer.getSelectedEditParts();
+ for (EditPart editPart : parts) {
+ toReturn.add(createEditPart(editPart));
+ }
+ return toReturn;
+ }
+
+ /**
+ * lazily creates a {@link SWTBotGefEditPart} if this edit part does not exist yet. If an instance encapsulating the
+ * specified edit part has been created before, that instance is returned.
+ *
+ * @param part the edit part to create a {@link SWTBotGefEditPart} for
+ * @return the created {@link SWTBotGefEditPart}
+ */
+ protected SWTBotGefEditPart createEditPart(final EditPart part) {
+ SWTBotGefEditPart editPart = editPartMapping.get(part);
+ if (editPart == null) {
+ if (part instanceof ConnectionEditPart) {
+ editPart = new SWTBotGefConnectionEditPart(this, (ConnectionEditPart) part);
+ } else {
+ editPart = new SWTBotGefEditPart(this, part);
+ }
+ editPartMapping.put(part, editPart);
+ }
+ return editPart;
+ }
+
+ /**
+ * lazily creates a {@link SWTBotGefConnectionEditPart} if this edit part does not exist yet. If an instance
+ * encapsulating the specified edit part has been created before, that instance is returned.
+ *
+ * @param part a connection edit part connecting graphical nodes
+ * @return a {@link SWTBotGefConnectionEditPart} encapsulating the connection edit part
+ */
+ protected SWTBotGefConnectionEditPart createEditPart(ConnectionEditPart part) {
+ return (SWTBotGefConnectionEditPart) createEditPart((EditPart) part);
+ }
+
+ /**
+ * Activate the default tool.
+ */
+ public void activateDefaultTool() {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ final EditDomain editDomain = getEditDomain();
+ editDomain.setActiveTool(editDomain.getDefaultTool());
+ }
+ });
+ }
+
+ /**
+ * Activate the tool with the specified label. If there is many tools with the same label the first one will be
+ * used. See {@link SWTBotGefViewer#activateTool(String, int)}
+ *
+ * @param label the label of the tool to activate
+ * @return the editor bot
+ * @throws WidgetNotFoundException if the tool with label specified could not be found
+ */
+ public SWTBotGefViewer activateTool(final String label) throws WidgetNotFoundException {
+ activateTool(Pattern.compile(Pattern.quote(label)), 0);
+ return this;
+ }
+
+ /**
+ * Activate the tool with the specified label and the specified index. This method should be used only if there is
+ * many tools with the same label. See {@link SWTBotGefViewer#activateTool(String)}
+ *
+ * @param label the label of the tool to activate
+ * @param index the index to use in order to make the selection.
+ * @return the editor bot
+ * @throws WidgetNotFoundException if the tool with label specified could not be found
+ */
+ public SWTBotGefViewer activateTool(final String label, int index) throws WidgetNotFoundException {
+ activateTool(Pattern.compile(Pattern.quote(label)), index);
+ return this;
+ }
+
+ private SWTBotGefViewer activateTool(final Pattern labelMatcher, final int index) throws WidgetNotFoundException {
+ final WidgetNotFoundException[] exception = new WidgetNotFoundException[1];
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ final EditDomain editDomain = getEditDomain();
+ final List<PaletteEntry> entries = new PaletteFinder(editDomain).findEntries(new ToolEntryLabelMatcher(labelMatcher));
+ if (entries.size() > 0) {
+ final PaletteEntry paletteEntry = entries.get(index);
+ if (paletteEntry instanceof ToolEntry) {
+ editDomain.getPaletteViewer().setActiveTool((ToolEntry) paletteEntry);
+ } else {
+ exception[0] = new WidgetNotFoundException(String.format("%s is not a tool entry, it's a %s", labelMatcher
+ .toString(), paletteEntry.getClass().getName()));
+ }
+ } else {
+ exception[0] = new WidgetNotFoundException(labelMatcher.toString());
+ }
+ }
+ });
+ if (exception[0] != null) {
+ throw exception[0];
+ }
+ return this;
+ }
+
+ /**
+ * call on UI thread only
+ */
+ private EditDomain getEditDomain() {
+ return editDomain;
+ }
+
+ /**
+ * type the given text into the graphical editor, presuming that it is already in 'direct edit' mode.
+ *
+ * @param text the text to type.
+ * @throws WidgetNotFoundException
+ */
+ public void directEditType(String text) throws WidgetNotFoundException {
+
+ /*
+ * we use 'bot()' and not 'bot' to scope the widget search to the editor. Otherwise if another widget of the
+ * same type is present in the workspace and is found first, the code after will fail.
+ * We specify the parent widget, to narrow the search to the supplied canvas.
+ */
+
+ /* by using SWTBot#widgets() we get the added benefit of an implicit wait condition */
+ List<? extends Text> controls = bot().widgets(widgetOfType(Text.class), canvas.widget);
+ if (controls.size() == 1) {
+ final Text textControl = controls.get(0);
+ canvas.typeText(textControl, text);
+ } else {
+ throw new WidgetNotFoundException(String.format(
+ "Expected to find one text control, but found %s. Is the editor in direct-edit mode?", controls.size()));
+ }
+ }
+
+ /**
+ * @param matcher the matcher that matches on {@link org.eclipse.gef.EditPart}
+ * @return a collection of {@link SWTBotGefEditPart}
+ * @throws WidgetNotFoundException
+ */
+ public List<SWTBotGefEditPart> editParts(Matcher<? extends EditPart> matcher) throws WidgetNotFoundException {
+ return rootEditPart().descendants(matcher);
+ }
+
+ /**
+ * Get the canvas to do low-level operations.
+ *
+ * @return the canvas
+ */
+ protected SWTBotGefFigureCanvas getCanvas() {
+ return canvas;
+ }
+
+ protected Control getControl() {
+ return graphicalViewer.getControl();
+ }
+
+ /**
+ * Get active tool.
+ *
+ * @return the active tool
+ */
+ public ToolEntry getActiveTool() {
+ return editDomain.getPaletteViewer().getActiveTool();
+ }
+
+ /**
+ * select this edit part as a single selection
+ */
+ public SWTBotGefViewer select(SWTBotGefEditPart... parts) {
+ return select(Arrays.asList(parts));
+ }
+
+ /**
+ * select this edit part as a single selection
+ */
+ public SWTBotGefViewer select(final Collection<SWTBotGefEditPart> parts) {
+ UIThreadRunnable.syncExec(new VoidResult() {
+ public void run() {
+ List<EditPart> selectParts = new ArrayList<EditPart>(parts.size());
+ for (SWTBotGefEditPart p : parts) {
+ selectParts.add(p.part);
+ }
+ graphicalViewer.setFocus(selectParts.get(0));
+ graphicalViewer.setSelection(new StructuredSelection(selectParts));
+ }
+ });
+ return this;
+ }
+
+ public SWTBotGefViewer clickContextMenu(String text) throws WidgetNotFoundException {
+ new SWTBotGefContextMenu(getControl(), text).click();
+ return this;
+ }
+
+ /**
+ * Click on the editor at the specified location.
+ *
+ * @param xPosition the x relative position
+ * @param yPosition the y relative position
+ */
+ public void click(final int xPosition, final int yPosition) {
+ canvas.mouseMoveLeftClick(xPosition, yPosition);
+ }
+
+ /**
+ * Click on the specified edit part at the top left hand corner of its bounds.
+ *
+ * @param editPart the edit part to click on
+ */
+ public void click(final SWTBotGefEditPart editPart) {
+ Rectangle bounds = getAbsoluteBounds(editPart);
+ click(bounds.x, bounds.y);
+ }
+
+ /**
+ * Click on the edit part which owns the specified label at the top left hand corner of its bounds.
+ *
+ * @param label the label to retrieve edit part to click on
+ */
+ public void click(final String label) {
+ SWTBotGefEditPart selectedEP = getEditPart(label);
+ if (selectedEP == null) {
+ throw new WidgetNotFoundException(String.format("Expected to find widget %s", label));
+ }
+ click(selectedEP);
+ }
+
+ /**
+ * Double click on the editor at the specified location.
+ *
+ * @param xPosition the x relative position
+ * @param yPosition the y relative position
+ */
+ public void doubleClick(final int xPosition, final int yPosition) {
+ canvas.mouseMoveDoubleClick(xPosition, yPosition);
+ }
+
+ /**
+ * Double click on the edit part which owns the specified label at the top left hand corner (with an offset) of its
+ * bounds.
+ *
+ * @param editPart the edit part to double click on
+ */
+ public void doubleClick(final SWTBotGefEditPart editPart) {
+ Rectangle bounds = getAbsoluteBounds(editPart);
+ /*
+ * Note that a move is required before double clicking in order to update the mouse cursor with the target
+ * editpart. As we can not double click on the corner, we move the double click position
+ */
+ int move = 3;
+ doubleClick(bounds.x, bounds.y + move);
+ }
+
+ /**
+ * Double click on the edit part which owns the specified label at the top left hand corner (with an offset) of its
+ * bounds.
+ *
+ * @param label the label to retrieve edit part to double click on
+ */
+ public void doubleClick(final String label) {
+ SWTBotGefEditPart selectedEP = getEditPart(label);
+ if (selectedEP == null) {
+ throw new WidgetNotFoundException(String.format("Expected to find widget %s", label));
+ }
+ doubleClick(selectedEP);
+ }
+
+ /**
+ * Drag and drop from the specified to the specified location.
+ *
+ * @param toXPosition the x relative location
+ * @param toYPosition the y relative location
+ */
+ public void drag(final int fromXPosition, final int fromYPosition, final int toXPosition, final int toYPosition) {
+ canvas.mouseDrag(fromXPosition, fromYPosition, toXPosition, toYPosition);
+ }
+
+ /**
+ * Drag and drop the specified edit part to the specified location.
+ *
+ * @param editPart the edit part to drag and drop
+ * @param toXPosition the x relative location
+ * @param toYPosition the y relative location
+ */
+ public void drag(final SWTBotGefEditPart editPart, final int toXPosition, final int toYPosition) {
+ Rectangle bounds = getAbsoluteBounds(editPart);
+ /*
+ * We should increment drag location to avoid a resize. 7 comes from SquareHandle#DEFAULT_HANDLE_SIZE and we
+ * divided by 2 as AbstractHandle#getAccessibleLocation do that by default
+ */
+ int offset = 7 / 2 + 1;
+ drag(bounds.x + offset, bounds.y + offset, toXPosition + offset, toYPosition + offset);
+ }
+
+ /**
+ * Get absolute bounds of the edit part.
+ *
+ * @param editPart edit part
+ * @return the absolute bounds
+ */
+ private Rectangle getAbsoluteBounds(final SWTBotGefEditPart editPart) {
+ IFigure figure = ((GraphicalEditPart) editPart.part()).getFigure();
+ Rectangle bounds = figure.getBounds().getCopy();
+ figure.translateToAbsolute(bounds);
+ return bounds;
+ }
+
+ /**
+ * Drag and drop the edit part which owns the specified label to the specified location
+ *
+ * @param label the label to retrieve the edit part to drag and drop
+ * @param toXPosition the x relative position
+ * @param toYPosition the y relative position
+ */
+ public void drag(final String label, final int toXPosition, final int toYPosition) {
+ SWTBotGefEditPart selectedEP = getEditPart(label);
+ if (selectedEP == null) {
+ throw new WidgetNotFoundException(String.format("Expected to find widget %s", label));
+ }
+ drag(selectedEP, toXPosition, toYPosition);
+ }
+
+ /**
+ * select the edit part with the label as a single selection.
+ */
+ public SWTBotGefViewer select(String label) {
+ SWTBotGefEditPart selectedEP = getEditPart(label);
+ if (selectedEP == null) {
+ throw new WidgetNotFoundException(String.format("Expected to find widget %s", label));
+ }
+ List<SWTBotGefEditPart> editParts = new ArrayList<SWTBotGefEditPart>();
+ editParts.add(selectedEP);
+ return select(selectedEP);
+ }
+
+ /**
+ * get this edit part with the label as a single selection.
+ */
+ public SWTBotGefEditPart getEditPart(String label) {
+ List<SWTBotGefEditPart> allEditParts = mainEditPart().children();
+ allEditParts.addAll(mainEditPart().sourceConnections());
+ return getEditpart(label, allEditParts);
+ }
+
+ // FIXME should moved in a finder
+ @Deprecated
+ /*
+ * * get this edit part with the label as a single selection
+ */
+ public SWTBotGefEditPart getEditpart(String label, List<SWTBotGefEditPart> allEditParts) {
+ for (SWTBotGefEditPart child : allEditParts) {
+ IFigure figure = ((GraphicalEditPart) child.part()).getFigure();
+
+ if (isLabel(figure, label)) {
+ return child;
+ }
+
+ SWTBotGefEditPart childEditPart = getEditPart(child, label);
+ if (childEditPart != null) {
+ return childEditPart;
+ }
+
+ if (findLabelFigure(figure, label))
+ return child;
+ }
+ return null;
+ }
+
+ /**
+ * get this edit part with the label as a single selection
+ */
+ private SWTBotGefEditPart getEditPart(SWTBotGefEditPart editPart, String label) {
+ if (editPart.children().isEmpty() && findLabelFigure(((GraphicalEditPart) editPart.part()).getFigure(), label)) {
+ return editPart;
+ }
+
+ List<SWTBotGefEditPart> allEditParts = editPart.children();
+ allEditParts.addAll(editPart.sourceConnections());
+ return getEditpart(label, allEditParts);
+ }
+
+ // FIXME should moved in a finder
+ /**
+ * @return if the figure is a label
+ */
+ private boolean isLabel(IFigure figure, String label) {
+ // case 1 : gef label
+ if ((figure instanceof Label && ((Label) figure).getText().equals(label))) {
+ return true;
+ }
+
+ // case 2 : no gef label
+ if ((figure instanceof TextFlow && ((TextFlow) figure).getText().equals(label))) {
+ return true;
+ }
+ return false;
+ }
+
+ // FIXME should moved in a finder
+ /**
+ * @return if the figure or all its children contain the label
+ */
+ private boolean findLabelFigure(IFigure figure, String label) {
+ if (isLabel(figure, label)) {
+ return true;
+ }
+ for (Object figureChild : figure.getChildren()) {
+ if (isLabel((IFigure) figureChild, label) || findLabelFigure((IFigure) figureChild, label)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.swtbot.eclipse.gef/build.properties b/org.eclipse.swtbot.eclipse.gef/build.properties
index d774ab85..3bf4cca0 100644
--- a/org.eclipse.swtbot.eclipse.gef/build.properties
+++ b/org.eclipse.swtbot.eclipse.gef/build.properties
@@ -10,10 +10,12 @@
###############################################################################
bin.includes = feature.xml,\
license.html,\
- epl-v10.html
+ epl-v10.html,\
+ feature.properties
jars.compile.order = .
source.. =
src.includes = feature.xml,\
build.properties,\
epl-v10.html,\
- license.html \ No newline at end of file
+ license.html,\
+ feature.properties
diff --git a/org.eclipse.swtbot.eclipse.gef/feature.properties b/org.eclipse.swtbot.eclipse.gef/feature.properties
new file mode 100644
index 00000000..26c62399
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.gef/feature.properties
@@ -0,0 +1,141 @@
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+copyright=\
+Copyright (c) 2004, 2009 MAKE Technologies Inc and others.\n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ MAKE Technologies Inc - initial API and implementation\n\
+ Mariot Chauvin (Obeo) - SWTBot contribution\n
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+April 14, 2010\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/org.eclipse.swtbot.eclipse.gef/feature.xml b/org.eclipse.swtbot.eclipse.gef/feature.xml
index bc243d1a..bae26d61 100644
--- a/org.eclipse.swtbot.eclipse.gef/feature.xml
+++ b/org.eclipse.swtbot.eclipse.gef/feature.xml
@@ -2,7 +2,7 @@
<feature
id="org.eclipse.swtbot.eclipse.gef"
label="SWTBot for GEF Testing (incubation)"
- version="2.0.0.qualifier"
+ version="2.0.5.qualifier"
provider-name="Eclipse.org"
plugin="org.eclipse.swtbot.eclipse.ui">
@@ -10,113 +10,12 @@
SWTBot for testing Gef based plugins and applications (incubation)
</description>
- <copyright url="http://eclipse.org/">
- Copyright (c) 2004, 2009 MAKE Technologies Inc 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:
- MAKE Technologies Inc - initial API and implementation
- Mariot Chauvin (Obeo) - SWTBot contribution
+ <copyright>
+ %copyright
</copyright>
- <license url="license.html">
- Eclipse.org Software User Agreement
-Eclipse Foundation Software User Agreement
-March 17, 2005
-Usage Of Content
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION,
-INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
-(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY
-THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
-CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED
-BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
-OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS
-AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
-NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO
-THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
-CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED
-OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.
-Applicable Licenses
-Unless otherwise indicated, all Content made available by the
-Eclipse Foundation is provided to you under the terms and conditions
-of the Eclipse Public License Version 1.0
-(&quot;EPL&quot;). A copy of the EPL is provided with this Content and
-is also available at http://www.eclipse.org/legal/epl-v10.html.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.
-Content includes, but is not limited to, source code, object
-code, documentation and other files maintained in the Eclipse.org
-CVS repository (&quot;Repository&quot;) in CVS
-modules (&quot;Modules&quot;) and made available as downloadable archives
-(&quot;Downloads&quot;).
-* Content may be structured and packaged into modules to facilitate
-delivering, extending, and upgrading the Content. Typical modules
-may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;),
-and features (&quot;Features&quot;).
-* Each Plug-in or Fragment may be packaged as a sub-directory
-or JAR (Java(tm) ARchive) in a directory named &quot;plugins&quot;.
-* A Feature is a bundle of one or more Plug-ins and/or Fragments
-and associated material. Each Feature may be packaged as a sub-directory
-in a directory named &quot;features&quot;. Within a Feature, files named
-&quot;feature.xml&quot; may contain a list of the names and version numbers
-of the Plug-ins
-and/or Fragments associated with that Feature.
-* Features may also include other Features (&quot;Included Features&quot;).
-Within a Feature, files named &quot;feature.xml&quot; may contain a list
-of the names and version numbers of Included Features.
-The terms and conditions governing Plug-ins and Fragments should
-be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms
-and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot;
-(&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located
-in any directory of a Download or Module
-including, but not limited to the following locations:
-* The top-level (root) directory
-* Plug-in and Fragment directories
-* Inside Plug-ins and Fragments packaged as JARs
-* Sub-directories of the directory named &quot;src&quot; of certain Plug-ins
-* Feature directories
-Note: if a Feature made available by the Eclipse Foundation is
-installed using the Eclipse Update Manager, you must agree to
-a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features,
-the Feature Update License should either provide you with the
-terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses
-may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot;
-found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain
-the terms and conditions (or references to such terms and conditions)
-that govern your use of the associated Content in
-that directory.
-THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY
-REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS
-AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):
-* Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
-* Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)
-* Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)
-* IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)
-* Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)
-* Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS
-PRIOR TO USE OF THE CONTENT. If no About, Feature License, or
-Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions
-govern that particular Content.
-Cryptography
-Content may contain encryption software. The country in which
-you are currently may have restrictions on the import, possession,
-and use, and/or re-export to
-another country, of encryption software. BEFORE using any encryption
-software, please check the country&apos;s laws, regulations and policies
-concerning the import,
-possession, or use, and re-export of encryption software, to
-see if this is permitted.
-Java and all Java-based trademarks are trademarks of Sun Microsystems,
-Inc. in the United States, other countries, or both.
+ <license url="%licenseURL">
+ %license
</license>
<url>
@@ -128,16 +27,16 @@ Inc. in the United States, other countries, or both.
version="0.0.0"/>
<requires>
- <import plugin="org.junit" version="3.7.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.core.resources" version="3.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.core.runtime" version="3.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.swt" version="3.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.ui" version="3.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.ui.ide" version="3.3.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.swtbot.swt.finder" version="2.0.0" match="greaterOrEqual"/>
- <import plugin="org.eclipse.swtbot.eclipse.finder" version="2.0.0" match="greaterOrEqual"/>
- <import plugin="org.hamcrest" version="1.1.0" match="greaterOrEqual"/>
- <import plugin="org.apache.log4j" version="1.2.13" match="greaterOrEqual"/>
+ <import plugin="org.junit"/>
+ <import plugin="org.eclipse.core.resources"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.swt"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.eclipse.ui.ide"/>
+ <import plugin="org.eclipse.swtbot.swt.finder"/>
+ <import plugin="org.eclipse.swtbot.eclipse.finder"/>
+ <import plugin="org.hamcrest"/>
+ <import plugin="org.apache.log4j"/>
</requires>
<plugin
diff --git a/org.eclipse.swtbot.eclipse.gef/license.html b/org.eclipse.swtbot.eclipse.gef/license.html
index c6af966b..c184ca36 100644
--- a/org.eclipse.swtbot.eclipse.gef/license.html
+++ b/org.eclipse.swtbot.eclipse.gef/license.html
@@ -1,13 +1,14 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
<head>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<title>Eclipse.org Software User Agreement</title>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
</head>
-<body lang="EN-US" link=blue vlink=purple>
+<body lang="EN-US">
<h2>Eclipse Foundation Software User Agreement</h2>
-<p>March 17, 2005</p>
+<p>April 14, 2010</p>
<h3>Usage Of Content</h3>
@@ -17,37 +18,37 @@
OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
+
+<h3>Applicable Licenses</h3>
+
<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
(&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository (&quot;Repository&quot;) in CVS
- modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
-
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
<ul>
- <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
- <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
- <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
and/or Fragments associated with that Feature.</li>
- <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
-</ul>
-
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
including, but not limited to the following locations:</p>
<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Inside Plug-ins and Fragments packaged as JARs</li>
- <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
- <li>Feature directories</li>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
</ul>
-
-<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license (&quot;Feature Update License&quot;) during the
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
@@ -57,23 +58,50 @@ that directory.</p>
OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
<ul>
- <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
- <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
</ul>
<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
<h3>Cryptography</h3>
<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-
-<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
</body>
</html>
diff --git a/org.eclipse.swtbot.eclipse.gef/pom.xml b/org.eclipse.swtbot.eclipse.gef/pom.xml
new file mode 100644
index 00000000..439bd5ba
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.gef/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.features</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.gef</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.dsl.test/.classpath b/org.eclipse.swtbot.eclipse.junit.headless/.classpath
index 64c5e31b..64c5e31b 100644
--- a/org.eclipse.swtbot.eclipse.dsl.test/.classpath
+++ b/org.eclipse.swtbot.eclipse.junit.headless/.classpath
diff --git a/org.eclipse.swtbot.swt.recorder.ui.test/.project b/org.eclipse.swtbot.eclipse.junit.headless/.project
index 164a3b76..2d5e3c46 100644
--- a/org.eclipse.swtbot.swt.recorder.ui.test/.project
+++ b/org.eclipse.swtbot.eclipse.junit.headless/.project
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>org.eclipse.swtbot.swt.recorder.ui.test</name>
+ <name>org.eclipse.swtbot.eclipse.junit.headless</name>
<comment></comment>
<projects>
</projects>
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.swtbot.eclipse.junit.headless/.settings/org.eclipse.jdt.core.prefs
index c7ff7f4e..c7ff7f4e 100644
--- a/org.eclipse.swtbot.eclipse.junit3.headless/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.swtbot.eclipse.junit.headless/.settings/org.eclipse.jdt.core.prefs
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/JUNIT.XSL b/org.eclipse.swtbot.eclipse.junit.headless/JUNIT.XSL
index b4265723..9fe45bb1 100755
--- a/org.eclipse.swtbot.eclipse.junit3.headless/JUNIT.XSL
+++ b/org.eclipse.swtbot.eclipse.junit.headless/JUNIT.XSL
@@ -1,4 +1,6 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:param name="screenshot_dir">.</xsl:param>
+<xsl:param name="screenshot_format">jpeg</xsl:param>
<xsl:output method="html" indent="yes"/>
<xsl:decimal-format decimal-separator="." grouping-separator="," />
@@ -395,6 +397,14 @@
<xsl:with-param name="word" select="."/>
</xsl:call-template>
</code>
+ <p><br/><br/>Screenshot:</p>
+ <p>
+ <img>
+ <xsl:attribute name="src">
+ <xsl:value-of select="concat($screenshot_dir, '/', ../@name, '(', ../@classname, ').', $screenshot_format)"/>
+ </xsl:attribute>
+ </img>
+ </p>
<!-- the later is better but might be problematic for non-21" monitors... -->
<!--pre><xsl:value-of select="."/></pre-->
</xsl:template>
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/LICENSE.EPL b/org.eclipse.swtbot.eclipse.junit.headless/LICENSE.EPL
index 3d967aee..3d967aee 100644
--- a/org.eclipse.swtbot.eclipse.junit3.headless/LICENSE.EPL
+++ b/org.eclipse.swtbot.eclipse.junit.headless/LICENSE.EPL
diff --git a/org.eclipse.swtbot.eclipse.junit4.headless/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.junit.headless/META-INF/MANIFEST.MF
index ba80138f..1ebf6c8c 100644
--- a/org.eclipse.swtbot.eclipse.junit4.headless/META-INF/MANIFEST.MF
+++ b/org.eclipse.swtbot.eclipse.junit.headless/META-INF/MANIFEST.MF
@@ -1,19 +1,19 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWTBot Headless JUnit4 Launch Plug-in (incubation)
-Bundle-SymbolicName: org.eclipse.swtbot.eclipse.junit4.headless;singleton:=true
-Bundle-Version: 2.0.0.qualifier
-Bundle-Vendor: Eclipse.org
+Bundle-SymbolicName: org.eclipse.swtbot.eclipse.junit.headless;singleton:=true
+Bundle-Version: 2.0.5.qualifier
+Bundle-Vendor: Eclipse.org - SWTBot
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.swtbot.eclipse.junit4.headless
-Import-Package: junit.framework;version="4.3.0",
+Export-Package: org.eclipse.swtbot.eclipse.junit.headless
+Import-Package: junit.framework;version="4.5.0",
org.apache.tools.ant,
org.apache.tools.ant.taskdefs.optional.junit,
org.eclipse.core.runtime;version="3.4.0",
org.eclipse.equinox.app;version="1.0.0",
org.eclipse.osgi.util;version="1.1.0",
org.eclipse.swt.widgets,
- org.eclipse.ui,
org.eclipse.ui.testing,
org.osgi.framework;version="1.4.0"
+Require-Bundle: org.eclipse.ui.workbench;bundle-version="3.6.0"
diff --git a/org.eclipse.swtbot.eclipse.junit4.headless/about.html b/org.eclipse.swtbot.eclipse.junit.headless/about.html
index 88cfbc91..88cfbc91 100644
--- a/org.eclipse.swtbot.eclipse.junit4.headless/about.html
+++ b/org.eclipse.swtbot.eclipse.junit.headless/about.html
diff --git a/org.eclipse.swtbot.swt.recorder.ui.test/build.properties b/org.eclipse.swtbot.eclipse.junit.headless/build.properties
index 3672fd03..3c6bcff9 100644
--- a/org.eclipse.swtbot.swt.recorder.ui.test/build.properties
+++ b/org.eclipse.swtbot.eclipse.junit.headless/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008 Ketan Padegaonkar and others.
+# Copyright (c) 2010 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
@@ -8,17 +8,15 @@
# Contributors:
# Ketan Padegaonkar - initial API and implementation
###############################################################################
-source.. = src/
-output.. = bin/
bin.includes = META-INF/,\
- .,\
+ plugin.xml,\
+ library.xml,\
about.html,\
LICENSE.EPL,\
- src/
-src.includes = .classpath,\
- .project,\
+ src/,\
+ .,\
+ JUNIT.XSL
+src.includes = library.xml,\
LICENSE.EPL,\
- META-INF/,\
- about.html,\
- build.properties,\
- src/
+ about.html
+source.. = src/
diff --git a/org.eclipse.swtbot.eclipse.junit4.headless/library.xml b/org.eclipse.swtbot.eclipse.junit.headless/library.xml
index a7d3e351..cc3c8484 100644
--- a/org.eclipse.swtbot.eclipse.junit4.headless/library.xml
+++ b/org.eclipse.swtbot.eclipse.junit.headless/library.xml
@@ -9,7 +9,7 @@ this has been copied from o.e.test plugin with some targets for SWTBot
-->
-<project name="Library" default="usage" basedir=".">
+<project name="swtbot-library-headless-junit4" default="usage" basedir=".">
<target name="usage">
<echo message="Please refer to the testframework.html in org.eclipse.test for instructions on usage." />
@@ -164,7 +164,21 @@ this has been copied from o.e.test plugin with some targets for SWTBot
</fileset>
</junitreport>
- <style style="${eclipse-home}/plugins/org.eclipse.test/JUNIT.XSL" basedir="${junit-report-output}" includes="${classname}.result.xml" destdir="${junit-report-output}" />
+ <dirname property="swtbot.junit4.headless.dir" file="${ant.file.swtbot-library-headless-junit4}"/>
+
+ <mkdir dir="${junit-report-output}/screenshots" />
+ <move todir="${junit-report-output}/screenshots" failonerror="false">
+ <fileset dir="${eclipse-home}/screenshots" includes="*.*" />
+ </move>
+
+ <xslt style="${swtbot.junit4.headless.dir}/JUNIT.XSL" basedir="${junit-report-output}" includes="${classname}.xml" destdir="${junit-report-output}">
+ <param name="screenshot_dir" expression="screenshots"/>
+ <!--
+ Only use this if you've set SWTBotPreferences#SCREENSHOT_FORMAT preference
+ Optional: possible values are bmp, gif, ico, jpeg, jpg, png or tiff
+ <param name="screenshot_format" expression="jpeg"/>
+ -->
+ </xslt>
<!--save .log content and *.log content from configuration directory-->
<concat destfile="${junit-report-output}/${classname}.log">
diff --git a/org.eclipse.swtbot.eclipse.junit4.headless/plugin.xml b/org.eclipse.swtbot.eclipse.junit.headless/plugin.xml
index c7b3b2d0..554ebba5 100644
--- a/org.eclipse.swtbot.eclipse.junit4.headless/plugin.xml
+++ b/org.eclipse.swtbot.eclipse.junit.headless/plugin.xml
@@ -7,7 +7,7 @@
<application
visible="false">
<run
- class="org.eclipse.swtbot.eclipse.junit4.headless.UITestApplication">
+ class="org.eclipse.swtbot.eclipse.junit.headless.UITestApplication">
<parameter
name="productInfo"
value="product.ini">
diff --git a/org.eclipse.swtbot.eclipse.junit.headless/pom.xml b/org.eclipse.swtbot.eclipse.junit.headless/pom.xml
new file mode 100644
index 00000000..c8541832
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.junit.headless/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.plugins</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.junit.headless</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.junit4.headless/src/org/eclipse/swtbot/eclipse/junit4/headless/EclipseTestRunner.java b/org.eclipse.swtbot.eclipse.junit.headless/src/org/eclipse/swtbot/eclipse/junit/headless/EclipseTestRunner.java
index b13e60dd..f4a84187 100644
--- a/org.eclipse.swtbot.eclipse.junit4.headless/src/org/eclipse/swtbot/eclipse/junit4/headless/EclipseTestRunner.java
+++ b/org.eclipse.swtbot.eclipse.junit.headless/src/org/eclipse/swtbot/eclipse/junit/headless/EclipseTestRunner.java
@@ -8,7 +8,7 @@
* Contributors:
* Ketan Padegaonkar - initial API and implementation
*******************************************************************************/
-package org.eclipse.swtbot.eclipse.junit4.headless;
+package org.eclipse.swtbot.eclipse.junit.headless;
import java.io.ByteArrayOutputStream;
import java.io.File;
diff --git a/org.eclipse.swtbot.eclipse.junit4.headless/src/org/eclipse/swtbot/eclipse/junit4/headless/UITestApplication.java b/org.eclipse.swtbot.eclipse.junit.headless/src/org/eclipse/swtbot/eclipse/junit/headless/UITestApplication.java
index b8bea58d..64fafe4d 100644
--- a/org.eclipse.swtbot.eclipse.junit4.headless/src/org/eclipse/swtbot/eclipse/junit4/headless/UITestApplication.java
+++ b/org.eclipse.swtbot.eclipse.junit.headless/src/org/eclipse/swtbot/eclipse/junit/headless/UITestApplication.java
@@ -8,7 +8,7 @@
* Contributors:
* Ketan Padegaonkar - initial API and implementation
*******************************************************************************/
-package org.eclipse.swtbot.eclipse.junit4.headless;
+package org.eclipse.swtbot.eclipse.junit.headless;
import java.io.IOException;
@@ -44,7 +44,7 @@ public class UITestApplication implements IApplication, ITestHarness {
String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
Object app = getApplication(args);
- Assert.isNotNull(app);
+ Assert.isNotNull(app, "The application " + getApplicationToRun(args) + " could not be found. Please see the SWTBot troubleshooting guide: http://wiki.eclipse.org/SWTBot/Troubleshooting");
fTestableObject = PlatformUI.getTestableObject();
fTestableObject.setTestHarness(this);
@@ -71,10 +71,11 @@ public class UITestApplication implements IApplication, ITestHarness {
// Find the name of the application as specified by the PDE JUnit launcher.
// If no application is specified, the 3.0 default workbench application
// is returned.
+ String applicationToRun = getApplicationToRun(args);
IExtension extension = Platform.getExtensionRegistry().getExtension(Platform.PI_RUNTIME, Platform.PT_APPLICATIONS,
- getApplicationToRun(args));
+ applicationToRun);
- Assert.isNotNull(extension);
+ Assert.isNotNull(extension, "Could not find IExtension for application: " + applicationToRun);
// If the extension does not have the correct grammar, return null.
// Otherwise, return the application object.
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.junit3.headless/META-INF/MANIFEST.MF
deleted file mode 100644
index 88c428fe..00000000
--- a/org.eclipse.swtbot.eclipse.junit3.headless/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,19 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: SWTBot Headless JUnit3 Launch Plug-in (incubation)
-Bundle-SymbolicName: org.eclipse.swtbot.eclipse.junit3.headless;singleton:=true
-Bundle-Version: 2.0.0.qualifier
-Bundle-Vendor: Eclipse.org
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Export-Package: org.eclipse.swtbot.eclipse.junit3.headless
-Import-Package: junit.framework;version="[3.8.2,4.0.0)",
- org.apache.tools.ant,
- org.apache.tools.ant.taskdefs.optional.junit,
- org.eclipse.core.runtime;version="3.4.0",
- org.eclipse.equinox.app;version="1.0.0",
- org.eclipse.osgi.util;version="1.1.0",
- org.eclipse.swt.widgets,
- org.eclipse.ui,
- org.eclipse.ui.testing,
- org.osgi.framework;version="1.4.0"
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/build.properties b/org.eclipse.swtbot.eclipse.junit3.headless/build.properties
deleted file mode 100644
index 6d79d9cb..00000000
--- a/org.eclipse.swtbot.eclipse.junit3.headless/build.properties
+++ /dev/null
@@ -1,29 +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
-###############################################################################
-bin.includes = META-INF/,\
- plugin.xml,\
- library.xml,\
- about.html,\
- LICENSE.EPL,\
- src/,\
- .,\
- JUNIT.XSL
-src.includes = src/,\
- plugin.xml,\
- library.xml,\
- build.properties,\
- .project,\
- .classpath,\
- LICENSE.EPL,\
- META-INF/,\
- about.html,\
- .settings/
-source.. = src/
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/library.xml b/org.eclipse.swtbot.eclipse.junit3.headless/library.xml
deleted file mode 100644
index 5b726afb..00000000
--- a/org.eclipse.swtbot.eclipse.junit3.headless/library.xml
+++ /dev/null
@@ -1,192 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
-
-======================================================================
-this has been copied from o.e.test plugin with some targets for SWTBot
-======================================================================
-
-
--->
-
-<project name="Library" default="usage" basedir=".">
-
- <target name="usage">
- <echo message="Please refer to the testframework.html in org.eclipse.test for instructions on usage." />
- </target>
-
- <target name="init">
- <!--
- Parameters:
- (Mandatory)
- data-dir - the directory for Eclipse to write its data
- plugin-name - the name of the plugin to test
- classname - the name of the test class
-
- (Optional - overrides defaults set in script)
- testProduct - a string containing the product id to test.
- testApplication - a string containing the application id to test.
- vmargs - a string containing arguments to pass to the VM.
- extraVMargs - allows separate setting of VM args from separate caller.
- timeout - overrides default test timeout value (in milliseconds).
- test-output - overrides default output file produced from test run.
- plugin-path - path to root of plug-in
- useEclipseExe - property setting forces test to launch via eclipse executable.
- junit-report-output - output directory for junit reports produced for specified classname.
- -->
-
- <tstamp>
- <format property="TIMENOW" pattern="HHmmssSSSS" />
- </tstamp>
- <!--property setting useEclipseExe launches tests using the eclipse executable-->
- <condition property="launchTarget" value="eclipse-test">
- <isset property="useEclipseExe" />
- </condition>
- <!--default launch target for launching tests-->
- <property name="launchTarget" value="java-test" />
-
- <!-- default product/application to launch -->
- <condition property="testproduct.if.available" value="-product ${testProduct}">
- <isset property="testProduct" />
- </condition>
- <property name="testproduct.if.available" value="" />
-
- <condition property="testapplication.if.available" value="-testApplication ${testApplication}">
- <isset property="testApplication" />
- </condition>
-
- <property name="testapplication.if.available" value="" />
-
- <!--default heap sizes when running performance tests-->
- <condition property="vmargs" value=" -Xms256M -Xmx256M">
- <equals arg1="${test.target}" arg2="performance" />
- </condition>
- <property name="extraVMargs" value="" />
- <property name="plugin-path" value="" />
- <property name="timeout" value="7200000" />
- <property name="test-output" value="${eclipse-home}/${classname}.xml" />
- <property name="junit-report-output" value="${eclipse-home}/results" />
- <mkdir dir="${junit-report-output}" />
- </target>
-
- <target name="swtbot-test" description="Eclipse application used to launch UI plugin tests." depends="init">
- <antcall target="${launchTarget}">
- <!--param name="application" value="org.eclipse.test.uitestapplication"/-->
- <param name="application" value="org.eclipse.swtbot.eclipse.junit3.headless.swtbottestapplication" />
- </antcall>
- </target>
-
- <target name="java-test">
- <!--default vm args-->
- <property name="vmargs" value="-Xms256m -Xmx512m" />
-
- <!-- this argument is needed for macosx -->
- <condition property="jvmOption" value="-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts">
- <os family="mac" />
- </condition>
-
- <property name="jvmOption" value="" />
-
- <!--set default jvm to use for testing-->
- <property name="jvm" value="${java.home}/bin/java" />
-
- <property name="launcher-arg-line" value="
- -application ${application}
- ${testproduct.if.available}
- ${testapplication.if.available}
- -data ${data-dir}
- formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test-output} formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter
- -testPluginName ${plugin-name}
- -className ${classname}
- -os ${os}
- -ws ${ws}
- -arch ${arch}
- -consoleLog
- -debug" />
- <property name="jvm-arg-line" value="${vmargs} ${extraVMargs} ${jvmOption}" />
-
- <echo>======================================</echo>
- <echo>Running swtbot junit tests in ${classname}</echo>
- <echo>Command line args are ${launcher-arg-line}</echo>
- <echo>JVM args are ${jvm-arg-line}</echo>
- <echo>JUnit Result File: ${junit-report-output}/${classname}.xml.</echo>
- <echo>Console output File: ${junit-report-output}/${classname}.txt.</echo>
- <echo>======================================</echo>
-
- <fail unless="application" message="variable 'application' not defined." />
- <fail unless="data-dir" message="variable 'data-dir' not defined." />
- <fail unless="test-output" message="variable 'test-output' not defined" />
- <fail unless="plugin-name" message="variable 'plugin-name' not defined" />
- <fail unless="classname" message="variable 'classname' not defined" />
- <fail unless="os" message="variable 'os' not defined. os can be one of win32, linux, macosx" />
- <fail unless="ws" message="variable 'ws' not defined. ws can be one of win32, wpf, gtk, carbon, cocoa" />
- <fail unless="arch" message="variable 'arch' not defined. arch can be one of x86, x86_64, ppc" />
-
- <pathconvert property="foundJunit4" setonempty="false" pathsep=" ">
- <path>
- <fileset dir="${eclipse-home}/plugins" includes="org.eclipse.swtbot.eclipse.junit4.headless*/META-INF/MANIFEST.MF" />
- <fileset dir="${eclipse-home}/plugins" includes="org.eclipse.swtbot.ant.optional.junit4*" />
- </path>
- </pathconvert>
-
- <fail if="foundJunit4">
- .
- Found org.eclipse.swtbot.eclipse.junit4.headless or org.eclipse.swtbot.ant.optional.junit4 in the plugins directory.
- JUnit 3.x and 4.x don't play well together.
- Please remove org.eclipse.swtbot.eclipse.junit4.headless and org.eclipse.swtbot.ant.optional.junit4 from the plugins dir.
- </fail>
-
- <java fork="true" dir="." timeout="${timeout}" jvm="${jvm}" logError="true" classname="org.eclipse.core.launcher.Main" output="${junit-report-output}/${classname}.txt">
- <classpath>
- <fileset dir="${eclipse-home}/plugins">
- <include name="org.eclipse.equinox.launcher_*.jar" />
- </fileset>
- </classpath>
- <arg line="${launcher-arg-line}" />
- <jvmarg line="${jvm-arg-line}" />
- <sysproperty key="PLUGIN_PATH" value="${plugin-path}" />
- </java>
-
- <echo>======================================</echo>
- <echo>If you see errors above please see the file ${junit-report-output}/${classname}.txt for more information.</echo>
- <echo>Errors are generally caused by missing or incorrect dependencies.</echo>
- <echo>======================================</echo>
-
- <antcall target="collect-results" />
- </target>
-
- <target name="collect-results">
- <dirname property="output-dir" file="${test-output}" />
- <basename property="output-file-name" file="${test-output}" />
- <junitreport todir="${junit-report-output}" tofile="${classname}.xml">
- <fileset dir="${output-dir}">
- <include name="${output-file-name}" />
- </fileset>
- </junitreport>
-
- <style style="${eclipse-home}/plugins/org.eclipse.test/JUNIT.XSL" basedir="${junit-report-output}" includes="${classname}.result.xml" destdir="${junit-report-output}" />
-
- <!--save .log content and *.log content from configuration directory-->
- <concat destfile="${junit-report-output}/${classname}.log">
- <fileset dir="${eclipse-home}" includes="${data-dir}/.metadata/*.log" />
- <fileset dir="${eclipse-home}" includes="configuration/*.log" />
- </concat>
- </target>
-
- <target name="collect">
- <!--
- This target can be used to aggragate test runs from multiple test suites into a single report.
-
- Parameters to this target:
- includes - the names of the files to include
- output-file - the name of the output file to produce
- -->
- <junitreport todir="." tofile="${output-file}">
- <fileset dir=".">
- <include name="${includes}" />
- </fileset>
- </junitreport>
- </target>
-
-</project>
-
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/plugin.xml b/org.eclipse.swtbot.eclipse.junit3.headless/plugin.xml
deleted file mode 100644
index 9c5bd895..00000000
--- a/org.eclipse.swtbot.eclipse.junit3.headless/plugin.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <extension
- id="swtbottestapplication"
- point="org.eclipse.core.runtime.applications">
- <application
- visible="false">
- <run
- class="org.eclipse.swtbot.eclipse.junit3.headless.UITestApplication">
- <parameter
- name="productInfo"
- value="product.ini">
- </parameter>
- </run>
- </application>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/src/org/eclipse/swtbot/eclipse/junit3/headless/EclipseTestRunner.java b/org.eclipse.swtbot.eclipse.junit3.headless/src/org/eclipse/swtbot/eclipse/junit3/headless/EclipseTestRunner.java
deleted file mode 100644
index a81ca295..00000000
--- a/org.eclipse.swtbot.eclipse.junit3.headless/src/org/eclipse/swtbot/eclipse/junit3/headless/EclipseTestRunner.java
+++ /dev/null
@@ -1,500 +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.eclipse.junit3.headless;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.PrintStream;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Properties;
-import java.util.Vector;
-
-import junit.framework.AssertionFailedError;
-import junit.framework.Test;
-import junit.framework.TestListener;
-import junit.framework.TestResult;
-import junit.framework.TestSuite;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.optional.junit.JUnitResultFormatter;
-import org.apache.tools.ant.taskdefs.optional.junit.JUnitTest;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.osgi.util.ManifestElement;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-
-/**
- * An exact copy of {@link org.eclipse.test.EclipseTestRunner}. A TestRunner for JUnit that supports Ant
- * JUnitResultFormatters and running tests inside Eclipse. Example call: EclipseTestRunner -classname
- * junit.samples.SimpleTest formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter
- */
-@SuppressWarnings("all")
-public class EclipseTestRunner implements TestListener {
- class TestFailedException extends Exception {
-
- private static final long serialVersionUID = 6009335074727417445L;
-
- TestFailedException(String message) {
- super(message);
- }
-
- TestFailedException(Throwable e) {
- super(e);
- }
- }
-
- /**
- * No problems with this test.
- */
- public static final int SUCCESS = 0;
- /**
- * Some tests failed.
- */
- public static final int FAILURES = 1;
- /**
- * An error occured.
- */
- public static final int ERRORS = 2;
-
- private static final String SUITE_METHODNAME = "suite"; //$NON-NLS-1$
- /**
- * The current test result
- */
- private TestResult fTestResult;
- /**
- * The name of the plugin containing the test
- */
- private final String fTestPluginName;
- /**
- * The corresponding testsuite.
- */
- private Test fSuite;
- /**
- * Formatters from the command line.
- */
- private static Vector fgFromCmdLine = new Vector();
- /**
- * Holds the registered formatters.
- */
- private final Vector formatters = new Vector();
- /**
- * Do we stop on errors.
- */
- private boolean fHaltOnError = false;
- /**
- * Do we stop on test failures.
- */
- private boolean fHaltOnFailure = false;
- /**
- * The TestSuite we are currently running.
- */
- private final JUnitTest fJunitTest;
- /**
- * output written during the test
- */
- private PrintStream fSystemError;
- /**
- * Error output during the test
- */
- private PrintStream fSystemOut;
- /**
- * Exception caught in constructor.
- */
- private Exception fException;
- /**
- * Returncode
- */
- private int fRetCode = SUCCESS;
-
- /**
- * The main entry point (the parameters are not yet consistent with the Ant JUnitTestRunner, but eventually they
- * should be). Parameters
- *
- * <pre>
- * -className: the name of the testSuite
- * -testPluginName: the name of the containing plugin
- * haltOnError: halt test on errors?
- * haltOnFailure: halt test on failures?
- * -testlistener listenerClass: deprecated
- * print a warning that this option is deprecated
- * formatter: a JUnitResultFormatter given as classname,filename.
- * If filename is ommitted, System.out is assumed.
- * </pre>
- */
- public static void main(String[] args) throws IOException {
- System.exit(run(args));
- }
-
- public static int run(String[] args) throws IOException {
- String className = null;
- String testPluginName = null;
-
- boolean haltError = false;
- boolean haltFail = false;
-
- Properties props = new Properties();
-
- int startArgs = 0;
- if (args.length > 0)
- // support the JUnit task commandline syntax where
- // the first argument is the name of the test class
- if (!args[0].startsWith("-")) { //$NON-NLS-1$
- className = args[0];
- startArgs++;
- }
- for (int i = startArgs; i < args.length; i++)
- if (args[i].toLowerCase().equals("-classname")) { //$NON-NLS-1$
- if (i < args.length - 1)
- className = args[i + 1];
- i++;
- } else if (args[i].toLowerCase().equals("-testpluginname")) { //$NON-NLS-1$
- if (i < args.length - 1)
- testPluginName = args[i + 1];
- i++;
- } else if (args[i].startsWith("haltOnError=")) //$NON-NLS-1$
- haltError = Project.toBoolean(args[i].substring(12));
- else if (args[i].startsWith("haltOnFailure=")) //$NON-NLS-1$
- haltFail = Project.toBoolean(args[i].substring(14));
- else if (args[i].startsWith("formatter=")) //$NON-NLS-1$
- try {
- createAndStoreFormatter(args[i].substring(10));
- } catch (BuildException be) {
- System.err.println(be.getMessage());
- return ERRORS;
- }
- else if (args[i].startsWith("propsfile=")) { //$NON-NLS-1$
- FileInputStream in = new FileInputStream(args[i].substring(10));
- props.load(in);
- in.close();
- } else if (args[i].equals("-testlistener")) { //$NON-NLS-1$
- System.err.println("The -testlistener option is no longer supported\nuse the formatter= option instead"); //$NON-NLS-1$
- return ERRORS;
- }
-
- if (className == null)
- throw new IllegalArgumentException("Test class name not specified"); //$NON-NLS-1$
-
- JUnitTest t = new JUnitTest(className);
-
- // Add/overlay system properties on the properties from the Ant project
- Hashtable p = System.getProperties();
- for (Enumeration _enum = p.keys(); _enum.hasMoreElements();) {
- Object key = _enum.nextElement();
- props.put(key, p.get(key));
- }
- t.setProperties(props);
-
- EclipseTestRunner runner = new EclipseTestRunner(t, testPluginName, haltError, haltFail);
- transferFormatters(runner);
- runner.run();
- return runner.getRetCode();
- }
-
- /**
- *
- */
- public EclipseTestRunner(JUnitTest test, String testPluginName, boolean haltOnError, boolean haltOnFailure) {
- fJunitTest = test;
- fTestPluginName = testPluginName;
- fHaltOnError = haltOnError;
- fHaltOnFailure = haltOnFailure;
-
- try {
- fSuite = getTest(test.getName());
- } catch (Exception e) {
- fRetCode = ERRORS;
- fException = e;
- }
- }
-
- /**
- * Returns the Test corresponding to the given suite.
- */
- protected Test getTest(String suiteClassName) throws TestFailedException {
- if (suiteClassName.length() <= 0) {
- clearStatus();
- return null;
- }
- Class testClass = null;
- try {
- testClass = loadSuiteClass(suiteClassName);
- } catch (ClassNotFoundException e) {
- if (e.getCause() != null)
- runFailed(e.getCause());
- String clazz = e.getMessage();
- if (clazz == null)
- clazz = suiteClassName;
- runFailed("Class not found \"" + clazz + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- return null;
- } catch (Exception e) {
- runFailed(e);
- return null;
- }
- Method suiteMethod = null;
- try {
- suiteMethod = testClass.getMethod(SUITE_METHODNAME, new Class[0]);
- } catch (Exception e) {
- // try to extract a test suite automatically
- clearStatus();
- return new TestSuite(testClass);
- }
- if (!Modifier.isStatic(suiteMethod.getModifiers())) {
- runFailed("suite() method must be static"); //$NON-NLS-1$
- return null;
- }
- Test test = null;
- try {
- test = (Test) suiteMethod.invoke(null, new Class[0]); // static method
- if (test == null)
- return test;
- } catch (InvocationTargetException e) {
- runFailed("Failed to invoke suite():" + e.getTargetException().toString()); //$NON-NLS-1$
- return null;
- } catch (IllegalAccessException e) {
- runFailed("Failed to invoke suite():" + e.toString()); //$NON-NLS-1$
- return null;
- }
- clearStatus();
- return test;
- }
-
- protected void runFailed(String message) throws TestFailedException {
- System.err.println(message);
- throw new TestFailedException(message);
- }
-
- protected void runFailed(Throwable e) throws TestFailedException {
- e.printStackTrace();
- throw new TestFailedException(e);
- }
-
- protected void clearStatus() {
- }
-
- /**
- * Loads the class either with the system class loader or a plugin class loader if a plugin name was specified
- */
- protected Class loadSuiteClass(String suiteClassName) throws ClassNotFoundException {
- if (fTestPluginName == null)
- return Class.forName(suiteClassName);
- Bundle bundle = Platform.getBundle(fTestPluginName);
- if (bundle == null)
- throw new ClassNotFoundException(suiteClassName, new Exception("Could not find plugin \"" + fTestPluginName + "\"")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // is the plugin a fragment?
- Dictionary headers = bundle.getHeaders();
- String hostHeader = (String) headers.get(Constants.FRAGMENT_HOST);
- if (hostHeader != null) {
- // we are a fragment for sure
- // we need to find which is our host
- ManifestElement[] hostElement = null;
- try {
- hostElement = ManifestElement.parseHeader(Constants.FRAGMENT_HOST, hostHeader);
- } catch (BundleException e) {
- throw new RuntimeException("Could not find host for fragment:" + fTestPluginName, e); //$NON-NLS-1$
- }
- Bundle host = Platform.getBundle(hostElement[0].getValue());
- // we really want to get the host not the fragment
- bundle = host;
- }
-
- return bundle.loadClass(suiteClassName);
- }
-
- public void run() {
- // IPerformanceMonitor pm = PerfMsrCorePlugin.getPerformanceMonitor(true);
-
- fTestResult = new TestResult();
- fTestResult.addListener(this);
- for (int i = 0; i < formatters.size(); i++)
- fTestResult.addListener((TestListener) formatters.elementAt(i));
-
- long start = System.currentTimeMillis();
- fireStartTestSuite();
-
- if (fException != null) { // had an exception in the constructor
- for (int i = 0; i < formatters.size(); i++)
- ((TestListener) formatters.elementAt(i)).addError(null, fException);
- fJunitTest.setCounts(1, 0, 1);
- fJunitTest.setRunTime(0);
- } else {
- ByteArrayOutputStream errStrm = new ByteArrayOutputStream();
- fSystemError = new PrintStream(errStrm);
-
- ByteArrayOutputStream outStrm = new ByteArrayOutputStream();
- fSystemOut = new PrintStream(outStrm);
-
- try {
- // pm.snapshot(1); // before
- fSuite.run(fTestResult);
- } finally {
- // pm.snapshot(2); // after
- fSystemError.close();
- fSystemError = null;
- fSystemOut.close();
- fSystemOut = null;
- sendOutAndErr(new String(outStrm.toByteArray()), new String(errStrm.toByteArray()));
- fJunitTest.setCounts(fTestResult.runCount(), fTestResult.failureCount(), fTestResult.errorCount());
- fJunitTest.setRunTime(System.currentTimeMillis() - start);
- }
- }
- fireEndTestSuite();
-
- if ((fRetCode != SUCCESS) || (fTestResult.errorCount() != 0))
- fRetCode = ERRORS;
- else if (fTestResult.failureCount() != 0)
- fRetCode = FAILURES;
-
- // pm.upload(getClass().getName());
- }
-
- /**
- * Returns what System.exit() would return in the standalone version.
- *
- * @return 2 if errors occurred, 1 if tests failed else 0.
- */
- public int getRetCode() {
- return fRetCode;
- }
-
- /*
- * @see TestListener.addFailure
- */
- public void startTest(Test t) {
- }
-
- /*
- * @see TestListener.addFailure
- */
- public void endTest(Test test) {
- }
-
- /*
- * @see TestListener.addFailure
- */
- public void addFailure(Test test, AssertionFailedError t) {
- if (fHaltOnFailure)
- fTestResult.stop();
- }
-
- /*
- * @see TestListener.addError
- */
- public void addError(Test test, Throwable t) {
- if (fHaltOnError)
- fTestResult.stop();
- }
-
- private void fireStartTestSuite() {
- for (int i = 0; i < formatters.size(); i++)
- ((JUnitResultFormatter) formatters.elementAt(i)).startTestSuite(fJunitTest);
- }
-
- private void fireEndTestSuite() {
- for (int i = 0; i < formatters.size(); i++)
- ((JUnitResultFormatter) formatters.elementAt(i)).endTestSuite(fJunitTest);
- }
-
- public void addFormatter(JUnitResultFormatter f) {
- formatters.addElement(f);
- }
-
- /**
- * Line format is: formatter=<classname>(,<pathname>)?
- */
- private static void createAndStoreFormatter(String line) throws BuildException {
- String formatterClassName = null;
- File formatterFile = null;
-
- int pos = line.indexOf(',');
- if (pos == -1)
- formatterClassName = line;
- else {
- formatterClassName = line.substring(0, pos);
- formatterFile = new File(line.substring(pos + 1)); // the method is package visible
- }
- fgFromCmdLine.addElement(createFormatter(formatterClassName, formatterFile));
- }
-
- private static void transferFormatters(EclipseTestRunner runner) {
- for (int i = 0; i < fgFromCmdLine.size(); i++)
- runner.addFormatter((JUnitResultFormatter) fgFromCmdLine.elementAt(i));
- }
-
- /*
- * DUPLICATED from FormatterElement, since it is package visible only
- */
- private static JUnitResultFormatter createFormatter(String classname, File outfile) throws BuildException {
- OutputStream out = System.out;
-
- if (classname == null)
- throw new BuildException("you must specify type or classname"); //$NON-NLS-1$
- Class f = null;
- try {
- f = EclipseTestRunner.class.getClassLoader().loadClass(classname);
- } catch (ClassNotFoundException e) {
- throw new BuildException(e);
- }
-
- Object o = null;
- try {
- o = f.newInstance();
- } catch (InstantiationException e) {
- throw new BuildException(e);
- } catch (IllegalAccessException e) {
- throw new BuildException(e);
- }
-
- if (!(o instanceof JUnitResultFormatter))
- throw new BuildException(classname + " is not a JUnitResultFormatter"); //$NON-NLS-1$
-
- JUnitResultFormatter r = (JUnitResultFormatter) o;
-
- if (outfile != null)
- try {
- out = new FileOutputStream(outfile);
- } catch (java.io.IOException e) {
- throw new BuildException(e);
- }
- r.setOutput(out);
- return r;
- }
-
- private void sendOutAndErr(String out, String err) {
- for (int i = 0; i < formatters.size(); i++) {
- JUnitResultFormatter formatter = ((JUnitResultFormatter) formatters.elementAt(i));
-
- formatter.setSystemOutput(out);
- formatter.setSystemError(err);
- }
- }
-
- protected void handleOutput(String line) {
- if (fSystemOut != null)
- fSystemOut.println(line);
- }
-
- protected void handleErrorOutput(String line) {
- if (fSystemError != null)
- fSystemError.println(line);
- }
-}
diff --git a/org.eclipse.swtbot.eclipse.junit3.headless/src/org/eclipse/swtbot/eclipse/junit3/headless/UITestApplication.java b/org.eclipse.swtbot.eclipse.junit3.headless/src/org/eclipse/swtbot/eclipse/junit3/headless/UITestApplication.java
deleted file mode 100644
index 8f8543fd..00000000
--- a/org.eclipse.swtbot.eclipse.junit3.headless/src/org/eclipse/swtbot/eclipse/junit3/headless/UITestApplication.java
+++ /dev/null
@@ -1,121 +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.eclipse.junit3.headless;
-
-import java.io.IOException;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IProduct;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.equinox.app.IApplication;
-import org.eclipse.equinox.app.IApplicationContext;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.testing.ITestHarness;
-import org.eclipse.ui.testing.TestableObject;
-
-/**
- * This is just a copy of org.eclipse.test.UITestApplication from the eclipse test plugin, with {@link #runTests()}
- * overridden to return a custom {@link EclipseTestRunner} that runs in a non-UI thread. A Workbench that runs a test
- * suite specified in the command line arguments.
- */
-public class UITestApplication implements IApplication, ITestHarness {
-
- private static final String DEFAULT_APP_3_0 = "org.eclipse.ui.ide.workbench"; //$NON-NLS-1$
-
- private TestableObject fTestableObject;
- private IApplication fApplication;
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext)
- */
- public Object start(IApplicationContext context) throws Exception {
- String[] args = (String[]) context.getArguments().get(IApplicationContext.APPLICATION_ARGS);
- Object app = getApplication(args);
-
- Assert.isNotNull(app);
-
- fTestableObject = PlatformUI.getTestableObject();
- fTestableObject.setTestHarness(this);
- if (app instanceof IApplication) {
- fApplication = (IApplication) app;
- return fApplication.start(context);
- }
- throw new IllegalArgumentException("Could not execute application " + getApplicationToRun(args));
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.app.IApplication#stop()
- */
- public void stop() {
- if (fApplication != null)
- fApplication.stop();
- }
-
- /*
- * return the application to run, or null if not even the default application is found.
- */
- private Object getApplication(String[] args) throws CoreException {
- // Find the name of the application as specified by the PDE JUnit launcher.
- // If no application is specified, the 3.0 default workbench application
- // is returned.
- IExtension extension = Platform.getExtensionRegistry().getExtension(Platform.PI_RUNTIME, Platform.PT_APPLICATIONS,
- getApplicationToRun(args));
-
- Assert.isNotNull(extension);
-
- // If the extension does not have the correct grammar, return null.
- // Otherwise, return the application object.
- IConfigurationElement[] elements = extension.getConfigurationElements();
- if (elements.length > 0) {
- IConfigurationElement[] runs = elements[0].getChildren("run"); //$NON-NLS-1$
- if (runs.length > 0) {
- Object runnable = runs[0].createExecutableExtension("class"); //$NON-NLS-1$
- if (runnable instanceof IApplication)
- return runnable;
- }
- }
- return null;
- }
-
- /*
- * The -testApplication argument specifies the application to be run. If the PDE JUnit launcher did not set this
- * argument, then return the name of the default application. In 3.0, the default is the
- * "org.eclipse.ui.ide.worbench" application.
- */
- private String getApplicationToRun(String[] args) {
- IProduct product = Platform.getProduct();
- if (product != null)
- return product.getApplication();
- for (int i = 0; i < args.length; i++)
- if (args[i].equals("-testApplication") && (i < args.length - 1)) //$NON-NLS-1$
- return args[i + 1];
- return DEFAULT_APP_3_0;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.testing.ITestHarness#runTests()
- */
- public void runTests() {
- fTestableObject.testingStarting();
- try {
- EclipseTestRunner.run(Platform.getCommandLineArgs());
- } catch (IOException e) {
- e.printStackTrace();
- }
- fTestableObject.testingFinished();
- }
-}
diff --git a/org.eclipse.swtbot.eclipse.junit4.headless/.project b/org.eclipse.swtbot.eclipse.junit4.headless/.project
deleted file mode 100644
index 867b3f44..00000000
--- a/org.eclipse.swtbot.eclipse.junit4.headless/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.swtbot.eclipse.junit4.headless</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.swtbot.eclipse.junit4.headless/JUNIT.XSL b/org.eclipse.swtbot.eclipse.junit4.headless/JUNIT.XSL
deleted file mode 100755
index b4265723..00000000
--- a/org.eclipse.swtbot.eclipse.junit4.headless/JUNIT.XSL
+++ /dev/null
@@ -1,455 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
-<xsl:output method="html" indent="yes"/>
-<xsl:decimal-format decimal-separator="." grouping-separator="," />
-
-<xsl:template match="testsuites">
- <HTML>
- <HEAD>
- <style type="text/css">
- body {
- font:normal 68% verdana,arial,helvetica;
- color:#000000;
- }
- table tr td, table tr th {
- font-size: 68%;
- }
- table.details tr th{
- font-weight: bold;
- text-align:left;
- background:#a6caf0;
- }
- table.details tr td{
- background:#eeeee0;
- }
-
- p {
- line-height:1.5em;
- margin-top:0.5em; margin-bottom:1.0em;
- }
- h1 {
- margin: 0px 0px 5px; font: 165% verdana,arial,helvetica
- }
- h2 {
- margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica
- }
- h3 {
- margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica
- }
- h4 {
- margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
- }
- h5 {
- margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
- }
- h6 {
- margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica
- }
- .Error {
- font-weight:bold; color:red;
- }
- .Failure {
- font-weight:bold; color:purple;
- }
- .Properties {
- text-align:right;
- }
- </style>
- <script language="JavaScript">
- var TestCases = new Array();
- var cur;
- <xsl:for-each select="./testsuite">
- <xsl:apply-templates select="properties"/>
- </xsl:for-each>
-
- </script>
- <script language="JavaScript"><![CDATA[
- function displayProperties (name) {
- var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
- var doc = win.document.open();
- doc.write("<html><head><title>Properties of " + name + "</title>");
- doc.write("<style>")
- doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }");
- doc.write("table tr td, table tr th { font-size: 68%; }");
- doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }");
- doc.write("table.properties th { text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#eeeeee; }");
- doc.write("table.properties td { font:normal; text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#fffffff; }");
- doc.write("h3 { margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica }");
- doc.write("</style>");
- doc.write("</head><body>");
- doc.write("<h3>Properties of " + name + "</h3>");
- doc.write("<div align=\"right\"><a href=\"javascript:window.close();\">Close</a></div>");
- doc.write("<table class='properties'>");
- doc.write("<tr><th>Name</th><th>Value</th></tr>");
- for (prop in TestCases[name]) {
- doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] + "</td></tr>");
- }
- doc.write("</table>");
- doc.write("</body></html>");
- doc.close();
- win.focus();
- }
- ]]>
- </script>
- </HEAD>
- <body>
- <a name="top"></a>
- <xsl:call-template name="pageHeader"/>
-
- <!-- Summary part -->
- <xsl:call-template name="summary"/>
- <hr size="1" width="95%" align="left"/>
-
- <!-- Package List part -->
- <xsl:call-template name="packagelist"/>
- <hr size="1" width="95%" align="left"/>
-
- <!-- For each package create its part -->
- <xsl:call-template name="packages"/>
- <hr size="1" width="95%" align="left"/>
-
- <!-- For each class create the part -->
- <xsl:call-template name="classes"/>
-
- </body>
- </HTML>
-</xsl:template>
-
-
-
- <!-- ================================================================== -->
- <!-- Write a list of all packages with an hyperlink to the anchor of -->
- <!-- of the package name. -->
- <!-- ================================================================== -->
- <xsl:template name="packagelist">
- <h2>Packages</h2>
- Note: package statistics are not computed recursively, they only sum up all of its testsuites numbers.
- <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
- <xsl:call-template name="testsuite.test.header"/>
- <!-- list all packages recursively -->
- <xsl:for-each select="./testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
- <xsl:sort select="@package"/>
- <xsl:variable name="testsuites-in-package" select="/testsuites/testsuite[./@package = current()/@package]"/>
- <xsl:variable name="testCount" select="sum($testsuites-in-package/@tests)"/>
- <xsl:variable name="errorCount" select="sum($testsuites-in-package/@errors)"/>
- <xsl:variable name="failureCount" select="sum($testsuites-in-package/@failures)"/>
- <xsl:variable name="timeCount" select="sum($testsuites-in-package/@time)"/>
-
- <!-- write a summary for the package -->
- <tr valign="top">
- <!-- set a nice color depending if there is an error/failure -->
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="$failureCount &gt; 0">Failure</xsl:when>
- <xsl:when test="$errorCount &gt; 0">Error</xsl:when>
- </xsl:choose>
- </xsl:attribute>
- <td><a href="#{@package}"><xsl:value-of select="@package"/></a></td>
- <td><xsl:value-of select="$testCount"/></td>
- <td><xsl:value-of select="$errorCount"/></td>
- <td><xsl:value-of select="$failureCount"/></td>
- <td>
- <xsl:call-template name="display-time">
- <xsl:with-param name="value" select="$timeCount"/>
- </xsl:call-template>
- </td>
- </tr>
- </xsl:for-each>
- </table>
- </xsl:template>
-
-
- <!-- ================================================================== -->
- <!-- Write a package level report -->
- <!-- It creates a table with values from the document: -->
- <!-- Name | Tests | Errors | Failures | Time -->
- <!-- ================================================================== -->
- <xsl:template name="packages">
- <!-- create an anchor to this package name -->
- <xsl:for-each select="/testsuites/testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
- <xsl:sort select="@package"/>
- <a name="{@package}"></a>
- <h3>Package <xsl:value-of select="@package"/></h3>
-
- <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
- <xsl:call-template name="testsuite.test.header"/>
-
- <!-- match the testsuites of this package -->
- <xsl:apply-templates select="/testsuites/testsuite[./@package = current()/@package]" mode="print.test"/>
- </table>
- <a href="#top">Back to top</a>
- <p/>
- <p/>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="classes">
- <xsl:for-each select="testsuite">
- <xsl:sort select="@name"/>
- <!-- create an anchor to this class name -->
- <a name="{@name}"></a>
- <h3>TestCase <xsl:value-of select="@name"/></h3>
-
- <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
- <xsl:call-template name="testcase.test.header"/>
- <!--
- test can even not be started at all (failure to load the class)
- so report the error directly
- -->
- <xsl:if test="./error">
- <tr class="Error">
- <td colspan="4"><xsl:apply-templates select="./error"/></td>
- </tr>
- </xsl:if>
- <xsl:apply-templates select="./testcase" mode="print.test"/>
- </table>
- <div class="Properties">
- <a>
- <xsl:attribute name="href">javascript:displayProperties('<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute>
- Properties &gt;&gt;
- </a>
- </div>
- <p/>
-
- <a href="#top">Back to top</a>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template name="summary">
- <h2>Summary</h2>
- <xsl:variable name="testCount" select="sum(testsuite/@tests)"/>
- <xsl:variable name="errorCount" select="sum(testsuite/@errors)"/>
- <xsl:variable name="failureCount" select="sum(testsuite/@failures)"/>
- <xsl:variable name="timeCount" select="sum(testsuite/@time)"/>
- <xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/>
- <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
- <tr valign="top">
- <th>Tests</th>
- <th>Failures</th>
- <th>Errors</th>
- <th>Success rate</th>
- <th>Time</th>
- </tr>
- <tr valign="top">
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="$failureCount &gt; 0">Failure</xsl:when>
- <xsl:when test="$errorCount &gt; 0">Error</xsl:when>
- </xsl:choose>
- </xsl:attribute>
- <td><xsl:value-of select="$testCount"/></td>
- <td><xsl:value-of select="$failureCount"/></td>
- <td><xsl:value-of select="$errorCount"/></td>
- <td>
- <xsl:call-template name="display-percent">
- <xsl:with-param name="value" select="$successRate"/>
- </xsl:call-template>
- </td>
- <td>
- <xsl:call-template name="display-time">
- <xsl:with-param name="value" select="$timeCount"/>
- </xsl:call-template>
- </td>
-
- </tr>
- </table>
- <table border="0" width="95%">
- <tr>
- <td style="text-align: justify;">
- Note: <i>failures</i> are anticipated and checked for with assertions while <i>errors</i> are unanticipated.
- </td>
- </tr>
- </table>
- </xsl:template>
-
- <!--
- Write properties into a JavaScript data structure.
- This is based on the original idea by Erik Hatcher (erik@hatcher.net)
- -->
- <xsl:template match="properties">
- cur = TestCases['<xsl:value-of select="../@package"/>.<xsl:value-of select="../@name"/>'] = new Array();
- <xsl:for-each select="property">
- <xsl:sort select="@name"/>
- cur['<xsl:value-of select="@name"/>'] = '<xsl:call-template name="JS-escape"><xsl:with-param name="string" select="@value"/></xsl:call-template>';
- </xsl:for-each>
- </xsl:template>
-
-<!-- Page HEADER -->
-<xsl:template name="pageHeader">
- <h1>Unit Test Results</h1>
- <table width="100%">
- <tr>
- <td align="left"></td>
- <td align="right">Designed for use with <a href='http://www.junit.org'>JUnit</a> and <a href='http://ant.apache.org'>Ant</a>.</td>
- </tr>
- </table>
- <hr size="1"/>
-</xsl:template>
-
-<xsl:template match="testsuite" mode="header">
- <tr valign="top">
- <th width="80%">Name</th>
- <th>Tests</th>
- <th>Errors</th>
- <th>Failures</th>
- <th nowrap="nowrap">Time(s)</th>
- </tr>
-</xsl:template>
-
-<!-- class header -->
-<xsl:template name="testsuite.test.header">
- <tr valign="top">
- <th width="80%">Name</th>
- <th>Tests</th>
- <th>Errors</th>
- <th>Failures</th>
- <th nowrap="nowrap">Time(s)</th>
- </tr>
-</xsl:template>
-
-<!-- method header -->
-<xsl:template name="testcase.test.header">
- <tr valign="top">
- <th>Name</th>
- <th>Status</th>
- <th width="80%">Type</th>
- <th nowrap="nowrap">Time(s)</th>
- </tr>
-</xsl:template>
-
-
-<!-- class information -->
-<xsl:template match="testsuite" mode="print.test">
- <tr valign="top">
- <!-- set a nice color depending if there is an error/failure -->
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="@failures[.&gt; 0]">Failure</xsl:when>
- <xsl:when test="@errors[.&gt; 0]">Error</xsl:when>
- </xsl:choose>
- </xsl:attribute>
-
- <!-- print testsuite information -->
- <td><a href="#{@name}"><xsl:value-of select="@name"/></a></td>
- <td><xsl:value-of select="@tests"/></td>
- <td><xsl:value-of select="@errors"/></td>
- <td><xsl:value-of select="@failures"/></td>
- <td>
- <xsl:call-template name="display-time">
- <xsl:with-param name="value" select="@time"/>
- </xsl:call-template>
- </td>
- </tr>
-</xsl:template>
-
-<xsl:template match="testcase" mode="print.test">
- <tr valign="top">
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="failure | error">Error</xsl:when>
- </xsl:choose>
- </xsl:attribute>
- <td><xsl:value-of select="@name"/></td>
- <xsl:choose>
- <xsl:when test="failure">
- <td>Failure</td>
- <td><xsl:apply-templates select="failure"/></td>
- </xsl:when>
- <xsl:when test="error">
- <td>Error</td>
- <td><xsl:apply-templates select="error"/></td>
- </xsl:when>
- <xsl:otherwise>
- <td>Success</td>
- <td></td>
- </xsl:otherwise>
- </xsl:choose>
- <td>
- <xsl:call-template name="display-time">
- <xsl:with-param name="value" select="@time"/>
- </xsl:call-template>
- </td>
- </tr>
-</xsl:template>
-
-
-<xsl:template match="failure">
- <xsl:call-template name="display-failures"/>
-</xsl:template>
-
-<xsl:template match="error">
- <xsl:call-template name="display-failures"/>
-</xsl:template>
-
-<!-- Style for the error and failure in the tescase template -->
-<xsl:template name="display-failures">
- <xsl:choose>
- <xsl:when test="not(@message)">N/A</xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="@message"/>
- </xsl:otherwise>
- </xsl:choose>
- <!-- display the stacktrace -->
- <code>
- <p/>
- <xsl:call-template name="br-replace">
- <xsl:with-param name="word" select="."/>
- </xsl:call-template>
- </code>
- <!-- the later is better but might be problematic for non-21" monitors... -->
- <!--pre><xsl:value-of select="."/></pre-->
-</xsl:template>
-
-<xsl:template name="JS-escape">
- <xsl:param name="string"/>
- <xsl:choose><!-- something isn't right here, basically all single quotes need to be replaced with backslash-single-quote
- <xsl:when test="contains($string,'&apos;')">
- <xsl:value-of select="substring-before($string,'&apos;')"/>
- \&apos;
- <xsl:call-template name="JS-escape">
- <xsl:with-param name="string" select="substring-after($string,'&apos;')"/>
- </xsl:call-template>
- </xsl:when> -->
- <xsl:when test="contains($string,'\')">
- <xsl:value-of select="substring-before($string,'\')"/>\\<xsl:call-template name="JS-escape">
- <xsl:with-param name="string" select="substring-after($string,'\')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$string"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-
-<!--
- template that will convert a carriage return into a br tag
- @param word the text from which to convert CR to BR tag
--->
-<xsl:template name="br-replace">
- <xsl:param name="word"/>
- <xsl:choose>
- <xsl:when test="contains($word,'&#xA;')">
- <xsl:value-of select="substring-before($word,'&#xA;')"/>
- <br/>
- <xsl:call-template name="br-replace">
- <xsl:with-param name="word" select="substring-after($word,'&#xA;')"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$word"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="display-time">
- <xsl:param name="value"/>
- <xsl:value-of select="format-number($value,'0.000')"/>
-</xsl:template>
-
-<xsl:template name="display-percent">
- <xsl:param name="value"/>
- <xsl:value-of select="format-number($value,'0.00%')"/>
-</xsl:template>
-
-</xsl:stylesheet>
-
diff --git a/org.eclipse.swtbot.eclipse.junit4.headless/build.properties b/org.eclipse.swtbot.eclipse.junit4.headless/build.properties
deleted file mode 100644
index 6d79d9cb..00000000
--- a/org.eclipse.swtbot.eclipse.junit4.headless/build.properties
+++ /dev/null
@@ -1,29 +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
-###############################################################################
-bin.includes = META-INF/,\
- plugin.xml,\
- library.xml,\
- about.html,\
- LICENSE.EPL,\
- src/,\
- .,\
- JUNIT.XSL
-src.includes = src/,\
- plugin.xml,\
- library.xml,\
- build.properties,\
- .project,\
- .classpath,\
- LICENSE.EPL,\
- META-INF/,\
- about.html,\
- .settings/
-source.. = src/
diff --git a/org.eclipse.swtbot.eclipse.spy/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.spy/META-INF/MANIFEST.MF
index 7a1fd153..741f714a 100644
--- a/org.eclipse.swtbot.eclipse.spy/META-INF/MANIFEST.MF
+++ b/org.eclipse.swtbot.eclipse.spy/META-INF/MANIFEST.MF
@@ -2,15 +2,15 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWTBot Eclipse Spy (incubation)
Bundle-SymbolicName: org.eclipse.swtbot.eclipse.spy;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.5.qualifier
Bundle-Activator: org.eclipse.swtbot.eclipse.spy.Activator
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: Eclipse.org
+Bundle-Vendor: Eclipse.org - SWTBot
Export-Package: org.eclipse.swtbot.eclipse.spy,
org.eclipse.swtbot.eclipse.spy.views
-Import-Package: org.apache.log4j;version="1.2.12",
+Import-Package: org.apache.log4j;version="[1.2.13,1.3.0)",
org.eclipse.core.commands.common,
org.eclipse.core.runtime;version="3.4.0",
org.eclipse.jface.action,
@@ -29,7 +29,5 @@ Import-Package: org.apache.log4j;version="1.2.12",
org.eclipse.swtbot.swt.finder.utils,
org.eclipse.swtbot.swt.finder.waits,
org.eclipse.swtbot.swt.finder.widgets,
- org.eclipse.ui.part,
- org.eclipse.ui.plugin,
- org.hamcrest;version="1.1.0",
org.osgi.framework;version="1.4.0"
+Require-Bundle: org.eclipse.ui.workbench;bundle-version="3.6.0"
diff --git a/org.eclipse.swtbot.eclipse.spy/build.properties b/org.eclipse.swtbot.eclipse.spy/build.properties
index 1b4ab79a..0992a63c 100644
--- a/org.eclipse.swtbot.eclipse.spy/build.properties
+++ b/org.eclipse.swtbot.eclipse.spy/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008 Ketan Padegaonkar and others.
+# Copyright (c) 2008, 2010 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
@@ -19,12 +19,6 @@ bin.includes = plugin.xml,\
LICENSE.EPL,\
src/
jars.compile.order = .
-src.includes = src/,\
- plugin.xml,\
- icons/,\
- build.properties,\
- META-INF/,\
- .project,\
- .classpath,\
+src.includes = icons/,\
about.html,\
LICENSE.EPL
diff --git a/org.eclipse.swtbot.eclipse.spy/plugin.xml b/org.eclipse.swtbot.eclipse.spy/plugin.xml
index 628bbc95..66aed8f2 100644
--- a/org.eclipse.swtbot.eclipse.spy/plugin.xml
+++ b/org.eclipse.swtbot.eclipse.spy/plugin.xml
@@ -16,16 +16,4 @@
id="org.eclipse.swtbot.eclipse.spy.views.EclipseSpyView">
</view>
</extension>
- <extension
- point="org.eclipse.ui.perspectiveExtensions">
- <perspectiveExtension
- targetID="org.eclipse.jdt.ui.JavaPerspective">
- <view
- id="org.eclipse.swtbot.eclipse.spy.views.EclipseSpyView"
- minimized="false"
- relationship="stack"
- relative="org.eclipse.ui.views.TaskList">
- </view>
- </perspectiveExtension>
- </extension>
</plugin>
diff --git a/org.eclipse.swtbot.eclipse.spy/pom.xml b/org.eclipse.swtbot.eclipse.spy/pom.xml
new file mode 100644
index 00000000..539ea130
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.spy/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.plugins</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.spy</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseSpy.java b/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseSpy.java
index a44bbe7f..5e129285 100644
--- a/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseSpy.java
+++ b/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseSpy.java
@@ -67,7 +67,11 @@ public class EclipseSpy {
private void createOutputText() {
output = new StyledText(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
output.setLayoutData(new GridData(GridData.FILL_HORIZONTAL, GridData.FILL_VERTICAL, true, true));
- output.setFont(new Font(Display.getCurrent(), "Courier New", 10, SWT.NONE)); //$NON-NLS-1$
+ output.setText("To toggle, or freeze info on a particular control, press CTRL+SHIFT: \n");
+ if (isMac()){
+ output.setFont(new Font(Display.getCurrent(), "Monaco", 11, SWT.NONE)); //$NON-NLS-1$
+ }else
+ output.setFont(new Font(Display.getCurrent(), "Courier New", 10, SWT.NONE)); //$NON-NLS-1$
}
private void hookAccelerator() {
@@ -86,6 +90,11 @@ public class EclipseSpy {
// parent.getDisplay().addFilter(SWT.KeyDown, new SWTBotExecutionListener());
}
+ private static boolean isMac() {
+ String swtPlatform = SWT.getPlatform();
+ return ("carbon".equals(swtPlatform) || "cocoa".equals(swtPlatform));
+ }
+
private void initialize(Display display) {
createOutputText();
createActionMonitor();
diff --git a/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java b/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java
index eba8d003..7c112fed 100644
--- a/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java
+++ b/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/EclipseWidgetTracker.java
@@ -190,6 +190,8 @@ class EclipseWidgetTracker implements Runnable {
private void getInformation(Control control, StringBuffer buf) {
+ getToggleInformation(control, buf);
+
getLocationInformation(control, buf);
getLayoutInformation(control, buf);
@@ -202,6 +204,10 @@ class EclipseWidgetTracker implements Runnable {
}
+ private void getToggleInformation(Control control, StringBuffer buf) {
+ buf.append("To toggle, or freeze info on a particular control, press CTRL+SHIFT: \n").append("\n\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
String getStyle(Widget w) {
int style = w.getStyle();
diff --git a/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/PlayBackThread.java b/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/PlayBackThread.java
deleted file mode 100644
index eeba3705..00000000
--- a/org.eclipse.swtbot.eclipse.spy/src/org/eclipse/swtbot/eclipse/spy/PlayBackThread.java
+++ /dev/null
@@ -1,135 +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.eclipse.spy;
-
-
-
-import org.apache.log4j.Logger;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swtbot.eclipse.finder.SWTEclipseBot;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
-import org.eclipse.swtbot.swt.finder.SWTBot;
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.waits.Conditions;
-
-/**
- * @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt;
- * @version $Id$
- */
-public class PlayBackThread extends Thread {
-
- private static final Logger log = Logger.getLogger(PlayBackThread.class);
- /** the e */
- private final Event e;
-
- public PlayBackThread(Event e) {
- super("PlayBackThread"); //$NON-NLS-1$
- this.e = e;
- }
-
- public void run() {
- log.debug("running..."); //$NON-NLS-1$
-
- try {
- perform();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- }
-
- /**
- * @throws WidgetNotFoundException
- */
- private void perform() throws Exception {
- Display display = e.display;
- SWTEclipseBot bot = new SWTEclipseBot();
-
- createJavaProject(bot);
- createJavaClass(bot);
- Thread.sleep(1000);
- SWTBotEclipseEditor editor = bot.editor("HelloWorld.java"); //$NON-NLS-1$
-
- Thread.sleep(1000);
- editor.notifyKeyboardEvent(SWT.CTRL, '.');
- editor.quickfix("Add unimplemented methods"); //$NON-NLS-1$
-
- editor.navigateTo(7, 0);
- editor.autoCompleteProposal("sys", "sysout - print to standard out"); //$NON-NLS-1$ //$NON-NLS-2$
-
- editor.typeText("\"Hello World\""); //$NON-NLS-1$
-
- editor.navigateTo(3, 0);
- editor.autoCompleteProposal("main", "main - main method"); //$NON-NLS-1$ //$NON-NLS-2$
-
- editor.typeText("new Thread (new HelloWorld ());"); //$NON-NLS-1$
- if (true)
- return;
- editor.notifyKeyboardEvent(SWT.CTRL, '2');
- editor.notifyKeyboardEvent(SWT.NONE, 'L');
- editor.notifyKeyboardEvent(SWT.NONE, '\n');
-
- editor.typeText("\n"); //$NON-NLS-1$
- editor.typeText("thread.start();\n"); //$NON-NLS-1$
- editor.typeText("thread.join();"); //$NON-NLS-1$
- editor.quickfix("Add throws declaration"); //$NON-NLS-1$
- editor.notifyKeyboardEvent(SWT.NONE, (char) 27);
- editor.notifyKeyboardEvent(SWT.NONE, '\n');
-
- editor.notifyKeyboardEvent(SWT.CTRL, 's');
-
- editor.notifyKeyboardEvent(SWT.ALT | SWT.SHIFT, 'x');
- editor.notifyKeyboardEvent(SWT.NONE, 'j');
-
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- }
-
- /**
- * @param bot
- */
- private void createJavaClass(SWTEclipseBot bot) throws Exception {
- bot.menu("File").menu("New").menu("Class").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- bot.shell("New Java Class").activate(); //$NON-NLS-1$
- bot.textWithLabel("Name:").setText("HelloWorld"); //$NON-NLS-1$ //$NON-NLS-2$
- bot.textWithLabel("Package:").setText("com.helloworld"); //$NON-NLS-1$ //$NON-NLS-2$
- implementsInterface(bot, "java.lang.Runnable"); //$NON-NLS-1$
- bot.checkBox("Inherited abstract methods").click(); //$NON-NLS-1$
- bot.button("Finish").click(); //$NON-NLS-1$
- }
-
- /**
- * @param bot
- */
- private void implementsInterface(final SWTEclipseBot bot, String interfaceClass) throws Exception {
- bot.button("Add...").click(); //$NON-NLS-1$
- bot.shell("Implemented Interfaces Selection").activate(); //$NON-NLS-1$
- bot.textWithLabel("Choose interfaces:").setText(interfaceClass); //$NON-NLS-1$
- bot.waitUntil(Conditions.tableHasRows(bot.table(), 1));
- bot.button("OK").click(); //$NON-NLS-1$
- bot.shell("New Java Class").activate(); //$NON-NLS-1$
- }
-
- /**
- * @param bot
- */
- private void createJavaProject(SWTBot bot) throws Exception {
- bot.menu("File").menu("New").menu("Java Project").click(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- bot.shell("New Java Project").activate(); //$NON-NLS-1$
- bot.textWithLabel("Project name:").setText("MyProject"); //$NON-NLS-1$ //$NON-NLS-2$
- bot.button("Finish").click(); //$NON-NLS-1$
- }
-}
diff --git a/org.eclipse.swtbot.eclipse.test.junit/.project b/org.eclipse.swtbot.eclipse.test.junit/.project
new file mode 100644
index 00000000..139236ff
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.test.junit/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.swtbot.eclipse.test.junit</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.swtbot.eclipse.test/build.properties b/org.eclipse.swtbot.eclipse.test.junit/build.properties
index 0e97b857..275f92aa 100644
--- a/org.eclipse.swtbot.eclipse.test/build.properties
+++ b/org.eclipse.swtbot.eclipse.test.junit/build.properties
@@ -1,8 +1,10 @@
bin.includes = feature.xml,\
license.html,\
- epl-v10.html
+ epl-v10.html,\
+ feature.properties
src.includes = license.html,\
feature.xml,\
epl-v10.html,\
build.properties,\
- .project
+ .project,\
+ feature.properties
diff --git a/org.eclipse.swtbot.eclipse.test/epl-v10.html b/org.eclipse.swtbot.eclipse.test.junit/epl-v10.html
index ed4b1966..ed4b1966 100644
--- a/org.eclipse.swtbot.eclipse.test/epl-v10.html
+++ b/org.eclipse.swtbot.eclipse.test.junit/epl-v10.html
diff --git a/org.eclipse.swtbot.eclipse.test.junit/feature.properties b/org.eclipse.swtbot.eclipse.test.junit/feature.properties
new file mode 100644
index 00000000..b3dd40db
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.test.junit/feature.properties
@@ -0,0 +1,140 @@
+# "licenseURL" property - URL of the "Feature License"
+# do not translate value - just change to point to a locale-specific HTML page
+licenseURL=license.html
+
+copyright=\
+Copyright (c) 2007-2010 Ketan Padegaonkar and others.\n\
+All rights reserved. This program and the accompanying materials\n\
+are made available under the terms of the Eclipse Public License v1.0\n\
+which accompanies this distribution, and is available at\n\
+http://www.eclipse.org/legal/epl-v10.html\n\
+\n\
+Contributors:\n\
+ Ketan Padegaonkar - initial API and implementation
+
+# "license" property - text of the "Feature Update License"
+# should be plain text version of license agreement pointed to be "licenseURL"
+license=\
+Eclipse Foundation Software User Agreement\n\
+April 14, 2010\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
+########### end of license property ##########################################
diff --git a/org.eclipse.swtbot.eclipse.test.junit/feature.xml b/org.eclipse.swtbot.eclipse.test.junit/feature.xml
new file mode 100644
index 00000000..a37bf95a
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.test.junit/feature.xml
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.swtbot.eclipse.test.junit"
+ label="SWTBot JUnit Headless launchers for Eclipse (incubation)"
+ version="2.0.5.qualifier"
+ provider-name="Eclipse.org">
+
+ <description url="http://eclipse.org/">
+ SWTBot Eclipse Headless Launchers to launch tests from within ant (incubation)
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="%licenseURL">
+ %license
+ </license>
+
+ <requires>
+ <import plugin="org.eclipse.core.runtime.compatibility"/>
+ <import plugin="org.apache.ant"/>
+ <import plugin="org.eclipse.core.runtime"/>
+ <import plugin="org.eclipse.equinox.app"/>
+ <import plugin="org.eclipse.ui"/>
+ <import plugin="org.junit"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.swtbot.ant.junit"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ fragment="true"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.swtbot.eclipse.junit.headless"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
+</feature>
diff --git a/org.eclipse.swtbot.eclipse.test.junit/license.html b/org.eclipse.swtbot.eclipse.test.junit/license.html
new file mode 100644
index 00000000..c184ca36
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.test.junit/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
+Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ (&quot;Specification&quot;).</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
+ on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/org.eclipse.swtbot.eclipse.test.junit/pom.xml b/org.eclipse.swtbot.eclipse.test.junit/pom.xml
new file mode 100644
index 00000000..d1ec3de3
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.test.junit/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.features</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.test.junit</artifactId>
+ <packaging>eclipse-feature</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.test.junit4/.project b/org.eclipse.swtbot.eclipse.test.junit4/.project
new file mode 100644
index 00000000..973c2298
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.test.junit4/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.swtbot.eclipse.test.junit4</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.swtbot.eclipse.test/feature.xml b/org.eclipse.swtbot.eclipse.test/feature.xml
deleted file mode 100644
index baaf0d55..00000000
--- a/org.eclipse.swtbot.eclipse.test/feature.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.swtbot.eclipse.test"
- label="SWTBot Headless launchers for Eclipse (incubation)"
- version="2.0.0.qualifier"
- provider-name="Eclipse.org">
-
- <description url="http://eclipse.org/">
- SWTBot Eclipse Headless Launchers to launch tests from within ant (incubation)
- </description>
-
- <copyright url="http://eclipse.org/">
- Copyright (c) 2007, 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
- </copyright>
-
- <license url="license.html">
- Eclipse.org Software User Agreement
-
-Eclipse Foundation Software User Agreement
-March 17, 2005
-
-Usage Of Content
-
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
-(COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
-CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
-OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
-NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
-CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.
-
-Applicable Licenses
-
-Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
-(&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.
-
-Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository (&quot;Repository&quot;) in CVS
-modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).
-
-* Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).
-* Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(tm) ARchive) in a directory named &quot;plugins&quot;.
-* A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
- and/or Fragments associated with that Feature.
-* Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.
-
-The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:
-
-* The top-level (root) directory
-* Plug-in and Fragment directories
-* Inside Plug-ins and Fragments packaged as JARs
-* Sub-directories of the directory named &quot;src&quot; of certain Plug-ins
-* Feature directories
-
-Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.
-
-THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):
-
-* Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
-* Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)
-* Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)
-* IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)
-* Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)
-* Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)
-
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.
-
-Cryptography
-
-Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
-another country, of encryption software. BEFORE using any encryption software, please check the country&apos;s laws, regulations and policies concerning the import,
-possession, or use, and re-export of encryption software, to see if this is permitted.
-
-Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.
- </license>
-
- <requires>
- <import plugin="org.eclipse.core.runtime.compatibility"/>
- <import plugin="org.junit"/>
- <import plugin="org.apache.ant"/>
- <import plugin="org.junit4"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.equinox.app"/>
- </requires>
-
- <plugin
- id="org.eclipse.swtbot.ant.optional.junit3"
- download-size="0"
- install-size="0"
- version="0.0.0"
- fragment="true"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.swtbot.ant.optional.junit4"
- download-size="0"
- install-size="0"
- version="0.0.0"
- fragment="true"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.swtbot.eclipse.junit3.headless"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.swtbot.eclipse.junit4.headless"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
-</feature>
diff --git a/org.eclipse.swtbot.eclipse.test/license.html b/org.eclipse.swtbot.eclipse.test/license.html
deleted file mode 100644
index c6af966b..00000000
--- a/org.eclipse.swtbot.eclipse.test/license.html
+++ /dev/null
@@ -1,79 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=iso-8859-1">
-<title>Eclipse.org Software User Agreement</title>
-</head>
-
-<body lang="EN-US" link=blue vlink=purple>
-<h2>Eclipse Foundation Software User Agreement</h2>
-<p>March 17, 2005</p>
-
-<h3>Usage Of Content</h3>
-
-<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
- (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
- CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
- OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
- NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
- CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
-<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
- (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
- For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository (&quot;Repository&quot;) in CVS
- modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
-
-<ul>
- <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
- <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
- <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
- and/or Fragments associated with that Feature.</li>
- <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
-</ul>
-
-<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:</p>
-
-<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Inside Plug-ins and Fragments packaged as JARs</li>
- <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
- <li>Feature directories</li>
-</ul>
-
-<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.</p>
-
-<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
-
-<ul>
- <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
- <li>IBM Public License 1.0 (available at <a href="http://oss.software.ibm.com/developerworks/opensource/license10.html">http://oss.software.ibm.com/developerworks/opensource/license10.html</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
-</ul>
-
-<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
-
-<h3>Cryptography</h3>
-
-<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
- another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
- possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-
-<small>Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.</small>
-</body>
-</html>
diff --git a/org.eclipse.swtbot.eclipse.ui.test/.classpath b/org.eclipse.swtbot.eclipse.ui.test/.classpath
index 64c5e31b..ba349240 100644
--- a/org.eclipse.swtbot.eclipse.ui.test/.classpath
+++ b/org.eclipse.swtbot.eclipse.ui.test/.classpath
@@ -3,5 +3,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="functional"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.swtbot.eclipse.ui.test/META-INF/MANIFEST.MF b/org.eclipse.swtbot.eclipse.ui.test/META-INF/MANIFEST.MF
index 62c51a76..9c75be5c 100644
--- a/org.eclipse.swtbot.eclipse.ui.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.swtbot.eclipse.ui.test/META-INF/MANIFEST.MF
@@ -2,10 +2,8 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWTBot Eclipse Ui Test Plug-in
Bundle-SymbolicName: org.eclipse.swtbot.eclipse.ui.test
-Bundle-Version: 2.0.0.qualifier
-Bundle-Vendor: Eclipse.org
+Bundle-Version: 2.0.5.qualifier
+Bundle-Vendor: Eclipse.org - SWTBot
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.eclipse.swtbot.eclipse.ui,
- org.eclipse.ui,
- org.junit4,
- org.hamcrest
+Fragment-Host: org.eclipse.swtbot.eclipse.ui
+Require-Bundle: org.eclipse.swtbot.go
diff --git a/org.eclipse.swtbot.eclipse.ui.test/build.properties b/org.eclipse.swtbot.eclipse.ui.test/build.properties
index a0607871..74d16252 100644
--- a/org.eclipse.swtbot.eclipse.ui.test/build.properties
+++ b/org.eclipse.swtbot.eclipse.ui.test/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008 Ketan Padegaonkar and others.
+# Copyright (c) 2008, 2010 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
@@ -8,7 +8,8 @@
# Contributors:
# Ketan Padegaonkar - initial API and implementation
###############################################################################
-source.. = src/
+source.. = src/,\
+ functional/
output.. = bin/
bin.includes = META-INF/,\
.
diff --git a/org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/methodargs/NullArgument.java b/org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/AllTests.java
index 444bb04f..c3212304 100644
--- a/org.eclipse.swtbot.swt.recorder/src/org/eclipse/swtbot/swt/recorder/methodargs/NullArgument.java
+++ b/org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 Ketan Padegaonkar and others.
+ * Copyright (c) 2010 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
@@ -8,18 +8,17 @@
* Contributors:
* Ketan Padegaonkar - initial API and implementation
*******************************************************************************/
-package org.eclipse.swtbot.swt.recorder.methodargs;
+package org.eclipse.swtbot.eclipse.ui.functional;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
/**
- * Represents a 'no arg' argument.
- *
* @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt;
- * @version $Id$
*/
-public class NullArgument extends AbstractSWTBotEventArguments {
-
- public String asString() {
- return ""; //$NON-NLS-1$
- }
+@RunWith(Suite.class)
+@SuiteClasses({ ProjectCreationWizardTest.class })
+public class AllTests {
}
diff --git a/org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/ProjectCreationWizardTest.java b/org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/ProjectCreationWizardTest.java
new file mode 100644
index 00000000..46663be4
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/ProjectCreationWizardTest.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.ui.functional;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
+import org.eclipse.swtbot.swt.finder.utils.FileUtils;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt;
+ */
+@RunWith(SWTBotJunit4ClassRunner.class)
+public class ProjectCreationWizardTest {
+
+ private static SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+ @Test
+ public void canCreateSWTBotProject() throws Exception {
+ new SWTBotProject().create("com.example");
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("com.example");
+ assertTrue(project.exists());
+
+ assertEquals("" +
+ "Manifest-Version: 1.0\n" +
+ "Bundle-ManifestVersion: 2\n" +
+ "Bundle-Name: com.example\n" +
+ "Bundle-SymbolicName: com.example;singleton:=true\n" +
+ "Bundle-Version: 1.0.0.qualifier\n" +
+ "Bundle-ActivationPolicy: lazy\n" +
+ "Bundle-Vendor: ACME Corp.\n" +
+ "Bundle-RequiredExecutionEnvironment: J2SE-1.5\n" +
+ "Require-Bundle: org.eclipse.swtbot.go\n" +
+ "", contentsOf(project, "META-INF/MANIFEST.MF"));
+
+ assertEquals("" +
+ "source.. = src/\n" +
+ "output.. = bin/\n" +
+ "bin.includes = META-INF/,\\\n" +
+ " .\n" +
+ "", contentsOf(project, "build.properties"));
+
+ assertEquals("" +
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<projectDescription>\n" +
+ " <name>com.example</name>\n" +
+ " <comment></comment>\n" +
+ " <projects>\n" +
+ " </projects>\n" +
+ " <buildSpec>\n" +
+ " <buildCommand>\n" +
+ " <name>org.eclipse.jdt.core.javabuilder</name>\n" +
+ " <arguments>\n" +
+ " </arguments>\n" +
+ " </buildCommand>\n" +
+ " <buildCommand>\n" +
+ " <name>org.eclipse.pde.ManifestBuilder</name>\n" +
+ " <arguments>\n" +
+ " </arguments>\n" +
+ " </buildCommand>\n" +
+ " <buildCommand>\n" +
+ " <name>org.eclipse.pde.SchemaBuilder</name>\n" +
+ " <arguments>\n" +
+ " </arguments>\n" +
+ " </buildCommand>\n" +
+ " </buildSpec>\n" +
+ " <natures>\n" +
+ " <nature>org.eclipse.pde.PluginNature</nature>\n" +
+ " <nature>org.eclipse.jdt.core.javanature</nature>\n" +
+ " </natures>\n" +
+ "</projectDescription>\n" +
+ "", contentsOf(project, ".project"));
+
+ assertEquals("" +
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
+ "<classpath>\n" +
+ " <classpathentry kind=\"con\" " +
+ "path=\"org.eclipse.jdt.launching.JRE_CONTAINER/" +
+ "org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5\"/>\n" +
+ " <classpathentry kind=\"con\" path=\"org.eclipse.pde.core.requiredPlugins\"/>\n" +
+ " <classpathentry kind=\"src\" path=\"src\"/>\n" +
+ " <classpathentry kind=\"output\" path=\"bin\"/>\n" +
+ "</classpath>\n" +
+ "", contentsOf(project, ".classpath"));
+
+ }
+
+ private String contentsOf(IProject project, String name) throws CoreException {
+ return FileUtils.read(project.getFile(name).getContents());
+ }
+
+ @BeforeClass
+ public static void oneTimeSetup() {
+ List<SWTBotView> views = bot.views();
+ for (SWTBotView view : views) {
+ if (view.getTitle().equals("Welcome"))
+ view.close();
+ }
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/SWTBotProject.java b/org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/SWTBotProject.java
new file mode 100644
index 00000000..aaf875d7
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui.test/functional/org/eclipse/swtbot/eclipse/ui/functional/SWTBotProject.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.ui.functional;
+
+import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellCloses;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+
+/**
+ * @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt;
+ */
+public class SWTBotProject {
+
+ private final SWTWorkbenchBot bot = new SWTWorkbenchBot();
+
+ public void create(String projectId) {
+ bot.menu("File").menu("New").menu("Project...").click();
+ SWTBotShell shell = bot.shell("New Project");
+ shell.activate();
+
+ bot.tree().expandNode("Other", "New SWTBot Test Plug-in").select();
+ bot.button("Next >").click();
+
+ bot.textWithLabel("Plug-in Name:").setText(projectId);
+ bot.textWithLabel("Plug-in id:").setText(projectId);
+ bot.textWithLabel("Provider:").setText("ACME Corp.");
+ bot.button("Finish").click();
+ bot.waitUntil(shellCloses(shell));
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.ui.test/pom.xml b/org.eclipse.swtbot.eclipse.ui.test/pom.xml
new file mode 100644
index 00000000..5534b2ad
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui.test/pom.xml
@@ -0,0 +1,80 @@
+<!-- Copyright (c) 2011 PetalsLink. 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 Authors: * Mickael Istria (PetalsLink) -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.test</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.ui.test</artifactId>
+ <packaging>eclipse-test-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <properties>
+ <!-- tycho.testArgLine repeated to re-use the configuration for argLine for jacoco agent -->
+ <uitest.vmparams>${tycho.testArgLine} -Xms64m -Xmx1024m -XX:MaxPermSize=128M</uitest.vmparams>
+ </properties>
+ <profiles>
+ <profile>
+ <id>skip-ui-tests</id>
+ <activation>
+ <property>
+ <name>skip-ui-tests</name>
+ </property>
+ </activation>
+ <properties>
+ <maven.test.skip>true</maven.test.skip>
+ </properties>
+ </profile>
+ <profile>
+ <id>macosx</id>
+ <activation>
+ <os>
+ <name>mac os x</name>
+ <family>mac</family>
+ </os>
+ </activation>
+ <properties>
+ <ui.test.vmargs>${uitest.vmparams} -XstartOnFirstThread</ui.test.vmargs>
+ </properties>
+ </profile>
+ <profile>
+ <id>other-os</id>
+ <activation>
+ <os>
+ <name>not-mac</name>
+ <family>!mac</family>
+ </os>
+ </activation>
+ <properties>
+ <ui.test.vmargs>${uitest.vmparams}</ui.test.vmargs>
+ </properties>
+ </profile>
+ </profiles>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho-version}</version>
+ <configuration>
+ <argLine>${ui.test.vmargs}</argLine>
+ <useUIHarness>true</useUIHarness>
+ <useUIThread>false</useUIThread>
+ <product>org.eclipse.sdk.ide</product>
+ <application>org.eclipse.ui.ide.workbench</application>
+ <testSuite>org.eclipse.swtbot.eclipse.ui.test</testSuite>
+ <testClass>org.eclipse.swtbot.eclipse.ui.functional.AllTests</testClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotJUnitTabGroupTest.java b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotJUnitTabGroupTest.java
new file mode 100644
index 00000000..3178adb1
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotJUnitTabGroupTest.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.ui.launcher;
+
+import org.junit.Test;
+
+public class SWTBotJUnitTabGroupTest {
+
+ @Test
+ public void theFirstTabIsTheSWTBotJUnitLaunchTab() throws Exception {
+ SWTBotJUnitTabGroup tabGroup = new SWTBotJUnitTabGroup();
+ tabGroup.createTabs(null, null);
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/project/ProjectCreatorTest.java b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/project/ProjectCreatorTest.java
new file mode 100644
index 00000000..4117c52e
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/project/ProjectCreatorTest.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.ui.project;
+
+import static org.junit.Assert.assertTrue;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.junit.Test;
+
+public class ProjectCreatorTest {
+
+ @Test
+ public void canCreateAProject() throws Exception {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ ProjectCreator creator = new ProjectCreator("org.eclipse.swtbot.testplugin", "test plugin", "1.2.3.4", "Eclipse.org", root);
+ creator.create();
+
+ IProject project = root.getProject("org.eclipse.swtbot.testplugin");
+ IFolder metaInf = project.getFolder("META-INF");
+ IFolder src = project.getFolder("src");
+
+ assertTrue(project.exists());
+ assertTrue(src.exists());
+ assertTrue(metaInf.exists());
+ }
+}
diff --git a/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/project/TemplatizerTest.java b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/project/TemplatizerTest.java
new file mode 100644
index 00000000..9dfe20c0
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/project/TemplatizerTest.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.ui.project;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class TemplatizerTest {
+
+ @Test
+ public void templatizesAllParams() throws Exception {
+ Templatizer templatizer = new Templatizer("org.eclipse.swtbot.example", "foo plugin", "1.2.3.4", "Eclipse.org");
+ String templatize = templatizer.templatize("" +
+ "Manifest-Version: 1.0\n" +
+ "Bundle-ManifestVersion: 2\n" +
+ "Bundle-Name: @PLUGIN_NAME@\n" +
+ "Bundle-SymbolicName: @PLUGIN_ID@;singleton:=true\n" +
+ "Bundle-Version: @PLUGIN_VERSION@\n" +
+ "Bundle-ActivationPolicy: lazy\n" +
+ "Bundle-Vendor: @PLUGIN_PROVIDER@\n" +
+ "Bundle-RequiredExecutionEnvironment: J2SE-1.5\n" +
+ "Require-Bundle: org.eclipse.swtbot.go\n" +
+ "");
+ assertEquals("" +
+ "Manifest-Version: 1.0\n" +
+ "Bundle-ManifestVersion: 2\n" +
+ "Bundle-Name: foo plugin\n" +
+ "Bundle-SymbolicName: org.eclipse.swtbot.example;singleton:=true\n" +
+ "Bundle-Version: 1.2.3.4\n" +
+ "Bundle-ActivationPolicy: lazy\n" +
+ "Bundle-Vendor: Eclipse.org\n" +
+ "Bundle-RequiredExecutionEnvironment: J2SE-1.5\n" +
+ "Require-Bundle: org.eclipse.swtbot.go\n" +
+ "", templatize);
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/test/AllTests.java b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/test/AllTests.java
index dfde10c1..8602e65b 100644
--- a/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/test/AllTests.java
+++ b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/test/AllTests.java
@@ -10,7 +10,11 @@
*******************************************************************************/
package org.eclipse.swtbot.eclipse.ui.test;
+import org.eclipse.swtbot.eclipse.ui.launcher.SWTBotJUnitTabGroupTest;
import org.eclipse.swtbot.eclipse.ui.preferences.PreferenceInitializerTest;
+import org.eclipse.swtbot.eclipse.ui.project.ProjectCreatorTest;
+import org.eclipse.swtbot.eclipse.ui.project.TemplatizerTest;
+import org.eclipse.swtbot.eclipse.ui.wizards.ProjectSettingValidatorTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;
@@ -20,7 +24,7 @@ import org.junit.runners.Suite.SuiteClasses;
* @version $Id$
*/
@RunWith(Suite.class)
-@SuiteClasses(PreferenceInitializerTest.class)
+@SuiteClasses({PreferenceInitializerTest.class, ProjectCreatorTest.class, TemplatizerTest.class, SWTBotJUnitTabGroupTest.class, ProjectSettingValidatorTest.class})
public class AllTests {
}
diff --git a/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/wizards/ProjectSettingValidatorTest.java b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/wizards/ProjectSettingValidatorTest.java
new file mode 100644
index 00000000..99300868
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui.test/src/org/eclipse/swtbot/eclipse/ui/wizards/ProjectSettingValidatorTest.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.ui.wizards;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+
+import org.junit.Test;
+
+public class ProjectSettingValidatorTest {
+
+ private static final class StubWizardSettings implements WizardPageSettings {
+ private boolean complete;
+ private String newMessage;
+
+ public void setPageComplete(boolean complete) {
+ this.complete = complete;
+ }
+
+ public void setErrorMessage(String newMessage) {
+ this.newMessage = newMessage;
+ }
+ }
+
+ @Test
+ public void canValidateWhenEverythingIsCorrect() throws Exception {
+ StubWizardSettings page = new StubWizardSettings();
+ ProjectSettingValidator validator = new ProjectSettingValidator("org.eclipse.plugin", "foo plugin", "1.0.0", new ArrayList<String>(), page);
+ validator.validate();
+ assertTrue(page.complete);
+ assertEquals(null, page.newMessage);
+ }
+
+ @Test
+ public void canValidateInValidPluginId() throws Exception {
+ StubWizardSettings page = new StubWizardSettings();
+ ProjectSettingValidator validator = new ProjectSettingValidator("org.eclipse.plugin*", "foo plugin", "1.0.0",
+ new ArrayList<String>(), page);
+ validator.validate();
+ assertFalse(page.complete);
+ assertEquals("Invalid plugin id! Legal characters are A-Z a-z 0-9 . _ -", page.newMessage);
+ }
+
+ @Test
+ public void canValidateInValidPluginVersion() throws Exception {
+ StubWizardSettings page = new StubWizardSettings();
+ ProjectSettingValidator validator = new ProjectSettingValidator("org.eclipse.plugin", "foo plugin", "-1.0.0",
+ new ArrayList<String>(), page);
+ validator.validate();
+ assertFalse(page.complete);
+ assertEquals("The specified version does not have the correct format (major.minor.micro.qualifier) or contains invalid characters!", page.newMessage);
+ }
+
+ @Test
+ public void canValidateInValidPluginName() throws Exception {
+ StubWizardSettings page = new StubWizardSettings();
+ ProjectSettingValidator validator = new ProjectSettingValidator("org.eclipse.plugin", "", "-1.0.0",
+ new ArrayList<String>(), page);
+ validator.validate();
+ assertFalse(page.complete);
+ assertEquals("Plugin name cannot be empty!", page.newMessage);
+ }
+
+ @Test
+ public void canValidateInValidProjectName() throws Exception {
+ StubWizardSettings page = new StubWizardSettings();
+ ArrayList<String> projects = new ArrayList<String>();
+ projects.add("foo plugin");
+ ProjectSettingValidator validator = new ProjectSettingValidator("org.eclipse.plugin", "foo plugin", "1.0.0",
+ projects, page);
+ validator.validate();
+ assertFalse(page.complete);
+ assertEquals("A project by that name already exists!", page.newMessage);
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_5 b/org.eclipse.swtbot.eclipse.ui/.classpath
index e2f3a559..41098a31 100644
--- a/org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_5
+++ b/org.eclipse.swtbot.eclipse.ui/.classpath
@@ -7,6 +7,5 @@
</accessrules>
</classpathentry>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src_eclipse_3.5"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_5 b/org.eclipse.swtbot.eclipse.ui/META-INF/MANIFEST.MF
index 0197d3a0..f112cebb 100644
--- a/org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_5
+++ b/org.eclipse.swtbot.eclipse.ui/META-INF/MANIFEST.MF
@@ -2,17 +2,22 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWTBot Eclipse UI Plug-in (incubation)
Bundle-SymbolicName: org.eclipse.swtbot.eclipse.ui;singleton:=true
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.0.5.qualifier
Bundle-Activator: org.eclipse.swtbot.eclipse.ui.Activator
Bundle-ActivationPolicy: lazy
-Bundle-Vendor: Eclipse.org
+Bundle-Vendor: Eclipse.org - SWTBot
Export-Package: org.eclipse.swtbot.eclipse.ui,
- org.eclipse.swtbot.eclipse.ui.preferences
+ org.eclipse.swtbot.eclipse.ui.launcher,
+ org.eclipse.swtbot.eclipse.ui.preferences,
+ org.eclipse.swtbot.eclipse.ui.project,
+ org.eclipse.swtbot.eclipse.ui.wizards
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Import-Package: org.eclipse.core.resources,
- org.eclipse.core.runtime;version="3.4.0",
- org.eclipse.core.runtime.preferences;version="3.2.0",
+ org.eclipse.core.runtime,
+ org.eclipse.core.runtime.jobs,
+ org.eclipse.core.runtime.preferences,
org.eclipse.debug.core,
+ org.eclipse.debug.ui,
org.eclipse.jdt.core,
org.eclipse.jdt.junit.launcher,
org.eclipse.jdt.launching,
@@ -20,22 +25,13 @@ Import-Package: org.eclipse.core.resources,
org.eclipse.jface.preference,
org.eclipse.jface.resource,
org.eclipse.jface.util,
- org.eclipse.osgi.util;version="1.1.0",
+ org.eclipse.jface.wizard,
+ org.eclipse.osgi.util,
org.eclipse.pde.core.plugin,
+ org.eclipse.pde.launching,
org.eclipse.pde.ui.launcher,
- org.eclipse.swtbot.eclipse.finder.matchers,
- org.eclipse.swtbot.eclipse.finder.waits,
- org.eclipse.swtbot.swt.finder,
- org.eclipse.swtbot.swt.finder.finders,
- org.eclipse.swtbot.swt.finder.matchers,
- org.eclipse.swtbot.swt.finder.utils,
- org.eclipse.swtbot.swt.finder.waits,
- org.eclipse.ui,
- org.eclipse.ui.plugin,
- org.hamcrest;version="1.1.0",
- org.junit;version="4.5.0",
- org.osgi.framework;version="1.4.0",
+ org.eclipse.swt.events,
+ org.eclipse.swt.layout,
org.eclipse.swt.widgets,
- org.eclipse.debug.ui,
- org.eclipse.core.runtime.jobs
-
+ org.osgi.framework
+Require-Bundle: org.eclipse.ui;bundle-version="3.6.0"
diff --git a/org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_4 b/org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_4
deleted file mode 100644
index d9cc2342..00000000
--- a/org.eclipse.swtbot.eclipse.ui/META-INF/_MANIFEST.MF_eclipse_3_4
+++ /dev/null
@@ -1,45 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: SWTBot Eclipse UI Plug-in (incubation)
-Bundle-SymbolicName: org.eclipse.swtbot.eclipse.ui;singleton:=true
-Bundle-Version: 2.0.0.qualifier
-Bundle-Activator: org.eclipse.swtbot.eclipse.ui.Activator
-Bundle-ActivationPolicy: lazy
-Bundle-Vendor: Eclipse.org
-Export-Package: org.eclipse.swtbot.eclipse.ui,
- org.eclipse.swtbot.eclipse.ui.preferences
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Import-Package: org.eclipse.core.resources,
- org.eclipse.core.runtime;version="3.4.0",
- org.eclipse.core.runtime.preferences;version="3.2.0",
- org.eclipse.debug.core,
- org.eclipse.jdt.core,
- org.eclipse.jdt.junit.launcher,
- org.eclipse.jdt.launching,
- org.eclipse.jdt.ui,
- org.eclipse.jface.preference,
- org.eclipse.jface.resource,
- org.eclipse.jface.util,
- org.eclipse.osgi.util;version="1.1.0",
- org.eclipse.pde.core.plugin,
- org.eclipse.pde.internal.core.util,
- org.eclipse.pde.internal.core,
- org.eclipse.pde.internal.ui,
- org.eclipse.pde.internal.ui.launcher,
- org.eclipse.pde.ui.launcher,
- org.eclipse.swtbot.eclipse.finder.matchers,
- org.eclipse.swtbot.eclipse.finder.waits,
- org.eclipse.swtbot.swt.finder,
- org.eclipse.swtbot.swt.finder.finders,
- org.eclipse.swtbot.swt.finder.matchers,
- org.eclipse.swtbot.swt.finder.utils,
- org.eclipse.swtbot.swt.finder.waits,
- org.eclipse.ui,
- org.eclipse.ui.plugin,
- org.hamcrest;version="1.1.0",
- org.junit;version="4.3.1",
- org.osgi.framework;version="1.4.0",
- org.eclipse.swt.widgets,
- org.eclipse.debug.ui,
- org.eclipse.core.runtime.jobs
-
diff --git a/org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_5 b/org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_5
deleted file mode 100644
index b141d663..00000000
--- a/org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_5
+++ /dev/null
@@ -1,40 +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
-###############################################################################
-source.. = src/,\
- src_eclipse_3.5/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- LICENSE.EPL,\
- about.html,\
- plugin.xml,\
- feature.gif,\
- src/,\
- intro/,\
- about.ini,\
- about.properties,\
- icons/,\
- src_eclipse_3.5/
-jars.compile.order = .
-src.includes = src/,\
- build.properties,\
- META-INF/,\
- .project,\
- .classpath,\
- LICENSE.EPL,\
- about.html,\
- plugin.xml,\
- intro/,\
- about.ini,\
- feature.gif,\
- .settings/,\
- about.properties,\
- icons/
diff --git a/org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_4 b/org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_4
deleted file mode 100644
index aaad475d..00000000
--- a/org.eclipse.swtbot.eclipse.ui/_classpath.eclipse_3_4
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
- <accessrules>
- <accessrule kind="accessible" pattern="**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="src_eclipse_3.4"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_4 b/org.eclipse.swtbot.eclipse.ui/build.properties
index 89571bc3..cf2cc54c 100644
--- a/org.eclipse.swtbot.eclipse.ui/_build.properties.eclipse_3_4
+++ b/org.eclipse.swtbot.eclipse.ui/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008 Ketan Padegaonkar and others.
+# Copyright (c) 2010 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
@@ -8,8 +8,7 @@
# Contributors:
# Ketan Padegaonkar - initial API and implementation
###############################################################################
-source.. = src/,\
- src_eclipse_3.4/
+source.. = src
output.. = bin/
bin.includes = META-INF/,\
.,\
@@ -21,20 +20,12 @@ bin.includes = META-INF/,\
intro/,\
about.ini,\
about.properties,\
- icons/,\
- src_eclipse_3.4/
+ icons/
jars.compile.order = .
-src.includes = src/,\
- build.properties,\
- META-INF/,\
- .project,\
- .classpath,\
- LICENSE.EPL,\
+src.includes = LICENSE.EPL,\
about.html,\
- plugin.xml,\
intro/,\
about.ini,\
feature.gif,\
- .settings/,\
about.properties,\
icons/
diff --git a/org.eclipse.swtbot.eclipse.ui/plugin.xml b/org.eclipse.swtbot.eclipse.ui/plugin.xml
index 9119802f..53f813ea 100644
--- a/org.eclipse.swtbot.eclipse.ui/plugin.xml
+++ b/org.eclipse.swtbot.eclipse.ui/plugin.xml
@@ -19,7 +19,7 @@
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
type="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig"
- class="org.eclipse.pde.ui.launcher.JUnitTabGroup"
+ class="org.eclipse.swtbot.eclipse.ui.launcher.SWTBotJUnitTabGroup"
id="org.eclipse.swtbot.eclipse.ui.launcher.JUnitTabGroup">
<launchMode
description="Create a configuration that will launch a SWTBot test in debug mode."
@@ -46,7 +46,7 @@
configTypeID="org.eclipse.swtbot.eclipse.ui.launcher.JunitLaunchConfig">
</launchConfigType>
</extension>
-
+
<extension
point="org.eclipse.ui.commands">
<command
@@ -61,7 +61,7 @@
categoryId="org.eclipse.debug.ui.category.run"
id="org.eclipse.swtbot.eclipse.ui.junitShortcut.debug">
</command>
- </extension>
+ </extension>
<extension
point="org.eclipse.ui.bindings">
<key
@@ -76,7 +76,7 @@
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
- class="org.eclipse.swtbot.eclipse.ui.SWTBotLaunchShortcut"
+ class="org.eclipse.swtbot.eclipse.ui.launcher.SWTBotLaunchShortcut"
description="Launch an SWTBot Test"
icon="icons/swtbot_runner.png"
id="org.eclipse.swtbot.eclipse.ui.junitShortcut"
@@ -126,4 +126,15 @@
content="intro/tutorialsExtensionContent.xml">
</configExtension>
</extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ class="org.eclipse.swtbot.eclipse.ui.wizards.NewSWTBotTestPluginWizard"
+ finalPerspective="org.eclipse.jdt.ui.JavaPerspective"
+ icon="icons/swtbot_runner.png"
+ id="org.eclipse.swtbot.eclipse.ui.wizards.NewSWTBotTestPluginWizard"
+ name="New SWTBot Test Plug-in"
+ project="true">
+ </wizard>
+ </extension>
</plugin>
diff --git a/org.eclipse.swtbot.eclipse.ui/pom.xml b/org.eclipse.swtbot.eclipse.ui/pom.xml
new file mode 100644
index 00000000..a281cf2b
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui/pom.xml
@@ -0,0 +1,25 @@
+<!-- Copyright (c) 2011 PetalsLink.
+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
+
+Authors:
+* Mickael Istria (PetalsLink)
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.eclipse.swtbot.plugins</groupId>
+ <artifactId>org.eclipse.swtbot.eclipse.ui</artifactId>
+ <packaging>eclipse-plugin</packaging>
+ <parent>
+ <groupId>org.eclipse.swtbot</groupId>
+ <artifactId>parent</artifactId>
+ <version>2.0.5-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+</project> \ No newline at end of file
diff --git a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/Activator.java b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/Activator.java
index 91304aeb..88a43710 100644
--- a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/Activator.java
+++ b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/Activator.java
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.swtbot.eclipse.ui;
-import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -60,14 +59,4 @@ public class Activator extends AbstractUIPlugin {
return plugin;
}
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- return imageDescriptorFromPlugin(PLUGIN_ID, path);
- }
}
diff --git a/org.eclipse.swtbot.eclipse.ui/src_eclipse_3.5/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchConfigurationDelegate.java b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchConfigurationDelegate.java
index 94260d92..94260d92 100644
--- a/org.eclipse.swtbot.eclipse.ui/src_eclipse_3.5/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchConfigurationDelegate.java
+++ b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchConfigurationDelegate.java
diff --git a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotJUnitTabGroup.java b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotJUnitTabGroup.java
new file mode 100644
index 00000000..f3ddc03f
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotJUnitTabGroup.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.ui.launcher;
+
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+import org.eclipse.jdt.junit.launcher.JUnitLaunchConfigurationTab;
+import org.eclipse.pde.ui.launcher.JUnitTabGroup;
+
+public class SWTBotJUnitTabGroup extends JUnitTabGroup {
+
+ // use the pde defaults, just change the first tab to use the junit
+ // config instead of the pde one.
+ // SWTBot uses its own IApplication, which takes care of threading.
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ super.createTabs(dialog, mode);
+ ILaunchConfigurationTab[] tabs = getTabs();
+ tabs[0] = new JUnitLaunchConfigurationTab();
+ }
+
+}
diff --git a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchShortcut.java b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotLaunchShortcut.java
index 202336b8..5a5adecd 100644
--- a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/SWTBotLaunchShortcut.java
+++ b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/launcher/SWTBotLaunchShortcut.java
@@ -8,9 +8,10 @@
* Contributors:
* Ketan Padegaonkar - initial API and implementation
*******************************************************************************/
-package org.eclipse.swtbot.eclipse.ui;
+package org.eclipse.swtbot.eclipse.ui.launcher;
import org.eclipse.pde.ui.launcher.JUnitWorkbenchLaunchShortcut;
+import org.eclipse.swtbot.eclipse.ui.SWTBotLaunchConfigurationDelegate;
/**
* Enhances the {@link JUnitWorkbenchLaunchShortcut} to launch SWTBot's launch configuration.
diff --git a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/Messages.java b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/Messages.java
deleted file mode 100644
index d2a8c05f..00000000
--- a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/Messages.java
+++ /dev/null
@@ -1,32 +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.eclipse.ui.preferences;
-
-import org.eclipse.osgi.util.NLS;
-
-/**
- *
- * @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt;
- * @version $Id$
- */
-@SuppressWarnings("all")
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.swtbot.eclipse.ui.preferences.messages"; //$NON-NLS-1$
- public static String Enable_Additional_Autocomplete_Options;
- public static String SWTBotPreferencePage_SWTBot_Preference_Dialog_Description;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/PreferenceInitializer.java b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/PreferenceInitializer.java
index 532eecb4..b8aabab5 100644
--- a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/PreferenceInitializer.java
+++ b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/PreferenceInitializer.java
@@ -11,6 +11,7 @@
package org.eclipse.swtbot.eclipse.ui.preferences;
import java.util.Arrays;
+import java.util.Collection;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Set;
@@ -20,20 +21,12 @@ import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory;
-import org.eclipse.swtbot.eclipse.finder.waits.Conditions;
import org.eclipse.swtbot.eclipse.ui.Activator;
-import org.eclipse.swtbot.swt.finder.SWTBotAssert;
-import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
-import org.eclipse.swtbot.swt.finder.utils.StringUtils;
import org.eclipse.ui.IStartup;
-import org.hamcrest.MatcherAssert;
-import org.hamcrest.Matchers;
-import org.junit.Assert;
/**
* Initializes the default preferences if none exist.
- *
+ *
* @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt;
* @version $Id$
*/
@@ -55,7 +48,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer impleme
/**
* Create a preference initializer with the two preference stores.
- *
+ *
* @param swtbotPreferenceStore used by swtbot.
* @param jdtPreferenceStore used by JDT.
*/
@@ -83,7 +76,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer impleme
if (imports.containsAll(getDefaultFavorites()))
imports.removeAll(getDefaultFavorites());
}
- String join = StringUtils.join(imports, SEMI_COLON);
+ String join = join(imports, SEMI_COLON);
jdtPreferenceStore.setValue(PreferenceConstants.CODEASSIST_FAVORITE_STATIC_MEMBERS, join);
}
@@ -101,23 +94,40 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer impleme
private LinkedHashSet<String> getDefaultFavorites() {
LinkedHashSet<String> orderedSet = new LinkedHashSet<String>();
- orderedSet.add(importStatement(org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.class));
- orderedSet.add(importStatement(Matchers.class));
- orderedSet.add(importStatement(MatcherAssert.class));
- orderedSet.add(importStatement(Assert.class));
- orderedSet.add(importStatement(WidgetMatcherFactory.class));
- orderedSet.add(importStatement(UIThreadRunnable.class));
- orderedSet.add(importStatement(SWTBotAssert.class));
- orderedSet.add(importStatement(Conditions.class));
- orderedSet.add(importStatement(org.eclipse.swtbot.swt.finder.waits.Conditions.class));
+ orderedSet.add(importStatement("org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory"));
+ orderedSet.add(importStatement("org.hamcrest.Matchers"));
+ orderedSet.add(importStatement("org.hamcrest.MatcherAssert"));
+ orderedSet.add(importStatement("org.junit.Assert"));
+ orderedSet.add(importStatement("org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory"));
+ orderedSet.add(importStatement("org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable"));
+ orderedSet.add(importStatement("org.eclipse.swtbot.swt.finder.SWTBotAssert"));
+ orderedSet.add(importStatement("org.eclipse.swtbot.swt.finder.SWTBotAssert"));
+ orderedSet.add(importStatement("org.eclipse.swtbot.eclipse.finder.waits.Conditions"));
+ orderedSet.add(importStatement("org.eclipse.swtbot.swt.finder.waits.Conditions"));
return orderedSet;
}
- private String importStatement(Class<?> clazz) {
- return clazz.getName() + ".*"; //$NON-NLS-1$
- }
-
public void propertyChange(PropertyChangeEvent event) {
initializeFavorites();
}
+
+ private String importStatement(String clazz) {
+ return clazz + ".*"; //$NON-NLS-1$;
+ }
+
+ private String join(Collection<?> toJoin, String delimiter) {
+ if ((toJoin == null) || (toJoin.size() == 0))
+ return "";
+ StringBuffer result = new StringBuffer();
+
+ for (Object object : toJoin) {
+ result.append(object);
+ result.append(delimiter);
+ }
+
+ result.lastIndexOf(delimiter);
+ result.replace(result.length() - delimiter.length(), result.length(), ""); //$NON-NLS-1$
+ return result.toString();
+ }
+
}
diff --git a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/SWTBotPreferencePage.java b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/SWTBotPreferencePage.java
index 7b401399..9c8fa5a4 100644
--- a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/SWTBotPreferencePage.java
+++ b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/SWTBotPreferencePage.java
@@ -17,15 +17,6 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
/**
- * This class represents a preference page that is contributed to the Preferences dialog. By subclassing
- * <samp>FieldEditorPreferencePage</samp>, we can use the field support built into JFace that allows us to create a page
- * that is small and knows how to save, restore and apply itself.
- * <p>
- * This page is used to modify preferences only. They are stored in the preference store that belongs to the main
- * plug-in class. That way, preferences can be accessed directly via the preference store.
- */
-
-/**
* Displays the preference page for SWTBot.
*
* @author Ketan Padegaonkar &lt;KetanPadegaonkar [at] gmail [dot] com&gt;
@@ -39,14 +30,13 @@ public class SWTBotPreferencePage extends FieldEditorPreferencePage implements I
public SWTBotPreferencePage() {
super(GRID);
setPreferenceStore(Activator.getDefault().getPreferenceStore());
- setDescription(Messages.SWTBotPreferencePage_SWTBot_Preference_Dialog_Description);
+ setDescription("SWTBot Preferences");
}
public void createFieldEditors() {
BooleanFieldEditor editor = new BooleanFieldEditor(PreferenceInitializer.ENABLE_ADDITIONAL_AUTOCOMPLETE_FAVOURTES,
- Messages.Enable_Additional_Autocomplete_Options, getFieldEditorParent());
+ "Enable additional autocomplete favourites for java editing", getFieldEditorParent());
addField(editor);
-
}
public void init(IWorkbench workbench) {
diff --git a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/messages.properties b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/messages.properties
deleted file mode 100644
index 7641a5b0..00000000
--- a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/preferences/messages.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-Enable_Additional_Autocomplete_Options=Enable additional autocomplete favourites for java editing
-SWTBotPreferencePage_SWTBot_Preference_Dialog_Description=SWTBot Preferences
diff --git a/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/project/ProjectCreator.java b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/project/ProjectCreator.java
new file mode 100644
index 00000000..8c3b2ecb
--- /dev/null
+++ b/org.eclipse.swtbot.eclipse.ui/src/org/eclipse/swtbot/eclipse/ui/project/ProjectCreator.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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.eclipse.ui.project;
+
+import java.io.ByteArrayInputStream;
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+
+public class ProjectCreator {
+
+ private final String pluginId;
+ private final String pluginProvider;
+ private final String pluginVersion;
+ private final String pluginName;
+ private final IWorkspaceRoot root;
+
+ public ProjectCreator(String pluginId, String pluginName, String pluginVersion, String pluginProvider, IWorkspaceRoot root) {