Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorPierre-Charles David2016-04-18 12:49:33 +0000
committerPierre-Charles David2016-04-19 12:27:03 +0000
commitc67128ae4e8a3055ed3da96044a82aa44a7fdc56 (patch)
tree6d68a3a860ec4cda90a60a3ef4bbf85037d676c1 /tests
parent7e4d64ec215c0b13fcc0cea3ef91c21181d60d51 (diff)
downloadorg.eclipse.eef-c67128ae4e8a3055ed3da96044a82aa44a7fdc56.tar.gz
org.eclipse.eef-c67128ae4e8a3055ed3da96044a82aa44a7fdc56.tar.xz
org.eclipse.eef-c67128ae4e8a3055ed3da96044a82aa44a7fdc56.zip
Remove dependency to EMF Transaction
Introduce EditingContextAdapter interface to allow client code to provide the appropriate hooks for EEF to: 1. execute model-changing operations in an appropriate context; 2. detect when the model being displayed by EEF has been modified so that we can refresh our views. Bug: 490594 Change-Id: I3c3ffd62773107ddc59024e173c918d0eb6c53a4 Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/AbstractEEFControllerTests.java15
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFButtonControllerTests.java6
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFCheckboxControllerTests.java2
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFRadioControllerTests.java2
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java2
-rw-r--r--tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java2
6 files changed, 13 insertions, 16 deletions
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/AbstractEEFControllerTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/AbstractEEFControllerTests.java
index 2cba5bd06..8ce854aa7 100644
--- a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/AbstractEEFControllerTests.java
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/AbstractEEFControllerTests.java
@@ -20,6 +20,7 @@ import org.eclipse.eef.EEFViewDescription;
import org.eclipse.eef.EEFWidgetDescription;
import org.eclipse.eef.EefPackage;
import org.eclipse.eef.core.api.EEFExpressionUtils;
+import org.eclipse.eef.core.api.EditingContextAdapter;
import org.eclipse.eef.core.api.controllers.IEEFWidgetController;
import org.eclipse.eef.tests.internal.AQLInterpreter;
import org.eclipse.eef.tests.internal.EEFDataTests;
@@ -32,7 +33,6 @@ import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.xmi.impl.EcoreResourceFactoryImpl;
import org.eclipse.emf.ecore.xmi.impl.XMIResourceFactoryImpl;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
import org.eclipse.sirius.common.interpreter.api.IInterpreter;
import org.eclipse.sirius.common.interpreter.api.IVariableManager;
import org.eclipse.sirius.common.interpreter.api.VariableManagerFactory;
@@ -41,7 +41,6 @@ import org.junit.Before;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
-
import static org.junit.Assert.assertTrue;
/**
@@ -57,11 +56,6 @@ public abstract class AbstractEEFControllerTests {
public static final String DART_ECORE = "/data/dart.ecore"; //$NON-NLS-1$
/**
- * The editing domain.
- */
- protected TransactionalEditingDomainImpl editingDomain;
-
- /**
* The resource set.
*/
protected ResourceSetImpl resourceSet;
@@ -71,6 +65,11 @@ public abstract class AbstractEEFControllerTests {
*/
protected IInterpreter interpreter;
+ /**
+ * The editing context adapter.
+ */
+ protected EditingContextAdapter contextAdapter;
+
@Before
public void setUp() {
this.resourceSet = new ResourceSetImpl();
@@ -79,8 +78,6 @@ public abstract class AbstractEEFControllerTests {
this.resourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put("ecore", new EcoreResourceFactoryImpl()); //$NON-NLS-1$
AdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
- this.editingDomain = new TransactionalEditingDomainImpl(adapterFactory, this.resourceSet);
-
this.interpreter = new AQLInterpreter();
}
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFButtonControllerTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFButtonControllerTests.java
index b25e11725..8b9140872 100644
--- a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFButtonControllerTests.java
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFButtonControllerTests.java
@@ -39,7 +39,7 @@ public class EEFButtonControllerTests extends AbstractEEFControllerTests {
private IEEFButtonController buttonController(String modelPath) {
EClassifier eClassifier = this.ePackage(DART_ECORE, 0).getEClassifier(PROJECT_ECLASS_NAME);
EEFButtonDescription description = widget(group(page(modelPath, 0), 0), EEFButtonDescription.class, 0);
- return new EEFButtonController(description, newVariableManager(eClassifier), this.interpreter, this.editingDomain);
+ return new EEFButtonController(description, newVariableManager(eClassifier), this.interpreter, this.contextAdapter);
}
@Test
@@ -58,8 +58,8 @@ public class EEFButtonControllerTests extends AbstractEEFControllerTests {
IEEFButtonController controller = this.buttonController(EEFDataTests.EEFBUTTONCONTROLLERTESTS_BUTTONLABEL);
controller.onNewButtonLabel(label -> {
assertThat(label, is("OK")); //$NON-NLS-1$
- atomicBoolean.set(true);
- });
+ atomicBoolean.set(true);
+ });
controller.refresh();
assertTrue(atomicBoolean.get());
}
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFCheckboxControllerTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFCheckboxControllerTests.java
index f034e1dfa..88a0f8da2 100644
--- a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFCheckboxControllerTests.java
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFCheckboxControllerTests.java
@@ -39,7 +39,7 @@ public class EEFCheckboxControllerTests extends AbstractEEFControllerTests {
private IEEFCheckboxController checkboxController(String modelPath) {
EClassifier eClassifier = this.ePackage(DART_ECORE, 0).getEClassifier(PROJECT_ECLASS_NAME);
EEFCheckboxDescription description = widget(group(page(modelPath, 0), 0), EEFCheckboxDescription.class, 0);
- return new EEFCheckboxController(description, newVariableManager(eClassifier), this.interpreter, this.editingDomain);
+ return new EEFCheckboxController(description, newVariableManager(eClassifier), this.interpreter, this.contextAdapter);
}
@Test
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFRadioControllerTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFRadioControllerTests.java
index 7d17c5aa1..215ae7fe4 100644
--- a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFRadioControllerTests.java
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFRadioControllerTests.java
@@ -39,7 +39,7 @@ public class EEFRadioControllerTests extends AbstractEEFControllerTests {
private IEEFRadioController radioController(String modelPath) {
EClassifier eClassifier = this.ePackage(DART_ECORE, 0).getEClassifier(PROJECT_ECLASS_NAME);
EEFRadioDescription description = widget(group(page(modelPath, 0), 0), EEFRadioDescription.class, 0);
- return new EEFRadioController(description, newVariableManager(eClassifier), this.interpreter, this.editingDomain);
+ return new EEFRadioController(description, newVariableManager(eClassifier), this.interpreter, this.contextAdapter);
}
@Test
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java
index a9c09963c..78e0a22bf 100644
--- a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFSelectControllerTests.java
@@ -39,7 +39,7 @@ public class EEFSelectControllerTests extends AbstractEEFControllerTests {
private IEEFSelectController selectController(String modelPath) {
EClassifier eClassifier = this.ePackage(DART_ECORE, 0).getEClassifier(PROJECT_ECLASS_NAME);
EEFSelectDescription description = widget(group(page(modelPath, 0), 0), EEFSelectDescription.class, 0);
- return new EEFSelectController(description, newVariableManager(eClassifier), this.interpreter, this.editingDomain);
+ return new EEFSelectController(description, newVariableManager(eClassifier), this.interpreter, this.contextAdapter);
}
@Test
diff --git a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java
index 0c032b046..68dbf56ba 100644
--- a/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java
+++ b/tests/org.eclipse.eef.tests/src/org/eclipse/eef/tests/internal/controllers/EEFTextControllerTests.java
@@ -40,7 +40,7 @@ public class EEFTextControllerTests extends AbstractEEFControllerTests {
private IEEFTextController textController(String modelPath) {
EClassifier eClassifier = this.ePackage(DART_ECORE, 0).getEClassifier(PROJECT_ECLASS_NAME);
EEFTextDescription description = widget(group(page(modelPath, 0), 0), EEFTextDescription.class, 0);
- return new EEFTextController(description, newVariableManager(eClassifier), this.interpreter, this.editingDomain);
+ return new EEFTextController(description, newVariableManager(eClassifier), this.interpreter, this.contextAdapter);
}
@Test

Back to the top