Skip to content

Commit

Permalink
Revert "try with org.eclipse.swtbot.e4.finder"
Browse files Browse the repository at this point in the history
This reverts commit ce52597.
  • Loading branch information
LorenzoBettini committed Nov 24, 2022
1 parent 7eadffa commit ca04ed8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 93 deletions.
22 changes: 2 additions & 20 deletions tests/org.eclipse.emf.parsley.tests.swtbot.e4/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,10 @@ Bundle-SymbolicName: org.eclipse.emf.parsley.tests.swtbot.e4;singleton:=true
Bundle-Version: 1.13.0.qualifier
Bundle-Vendor: Eclipse Modeling Project
Bundle-RequiredExecutionEnvironment: JavaSE-11
Require-Bundle: javax.inject,
org.eclipse.core.runtime,
org.eclipse.equinox.event,
org.eclipse.swt,
org.eclipse.e4.ui.model.workbench,
org.eclipse.jface,
org.eclipse.e4.ui.services,
org.eclipse.e4.ui.workbench,
org.eclipse.e4.core.di,
org.eclipse.e4.ui.di,
org.eclipse.e4.core.contexts,
org.eclipse.swtbot.junit4_x,
org.junit,
org.eclipse.swtbot.eclipse.core,
org.eclipse.swtbot.eclipse.finder,
org.eclipse.swtbot.e4.finder,
Require-Bundle: org.eclipse.swtbot.go;bundle-version="2.3.0",
org.eclipse.core.resources;bundle-version="3.5.0",
org.eclipse.emf.parsley,
org.eclipse.emf.parsley.views,
org.eclipse.emf.parsley.examples.eclipse4,
org.eclipse.emf.parsley.examples.eclipse4.parsleypart
Import-Package: javax.annotation;version="1.0.0",
org.osgi.framework;version="1.3.0"
Automatic-Module-Name: org.eclipse.emf.parsley.tests.swtbot.e4
Bundle-ActivationPolicy: lazy
Bundle-Activator: org.eclipse.emf.parsley.tests.swtbot.e4.Activator

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,12 @@
*******************************************************************************/
package org.eclipse.emf.parsley.tests.swtbot.e4;

import org.eclipse.e4.core.contexts.EclipseContextFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.ui.workbench.IWorkbench;
import org.eclipse.swtbot.e4.finder.widgets.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.osgi.framework.FrameworkUtil;

/**
* @author Lorenzo Bettini
Expand All @@ -28,11 +24,11 @@
@RunWith(SWTBotJunit4ClassRunner.class)
public class EmfParsleyEclipse4ExampleTest {

private SWTWorkbenchBot bot;
protected static SWTBot bot;

@Before
public void init() {
bot = new SWTWorkbenchBot(getEclipseContext());
@BeforeClass
public static void beforeClass() throws Exception {
bot = new SWTBot();
}

@Test
Expand All @@ -55,21 +51,4 @@ public void testExampleE4Part() {
bot.tree().getTreeItem("Trimmed Window").contextMenu("New Child").menu("Children Part");
}

/**
* IMPORTANT: for this to work and avoid a NullPointerException,
* we must have
* <pre>Bundle-ActivationPolicy: lazy</pre> in the
* <code>MANIFEST.MF</code>
*
* @return
*/
protected static IEclipseContext getEclipseContext() {
final IEclipseContext serviceContext =
EclipseContextFactory
.getServiceContext(
FrameworkUtil.getBundle(Activator.class)
.getBundleContext());
return serviceContext.get(IWorkbench.class)
.getApplication().getContext();
}
}

0 comments on commit ca04ed8

Please sign in to comment.