Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'tests/junit/plugins/editor')
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java19
-rw-r--r--tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java28
2 files changed, 35 insertions, 12 deletions
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java b/tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java
index 79f6099c62b..ebfd7b5d3aa 100644
--- a/tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/ModelSetTests.java
@@ -15,15 +15,17 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.editor.integration.tests.Activator;
+import org.eclipse.papyrus.infra.architecture.commands.IModelCreationCommand;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
import org.eclipse.papyrus.infra.core.services.ExtensionServicesRegistry;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.infra.core.utils.DiResourceSet;
-import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand;
import org.eclipse.papyrus.junit.utils.EditorUtils;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.UmlClassDiagramForMultiEditor;
@@ -59,7 +61,7 @@ public class ModelSetTests extends AbstractEditorIntegrationTest {
@Test
public void testCreateModelWithSpecialChars() throws Exception {
- ModelSet modelSet = new DiResourceSet();
+ final ModelSet modelSet = new DiResourceSet();
IProject emptyModelCreationProject = ResourcesPlugin.getWorkspace().getRoot().getProject("diagramCreationWithSpecialChars");
emptyModelCreationProject.create(new NullProgressMonitor());
emptyModelCreationProject.open(new NullProgressMonitor());
@@ -81,10 +83,17 @@ public class ModelSetTests extends AbstractEditorIntegrationTest {
//Ignore
}
- IModelCreationCommand creationCommand = new CreateUMLModelCommand();
- creationCommand.createModel(modelSet);
+ // create the UML model
+ TransactionalEditingDomain ted = modelSet.getTransactionalEditingDomain();
+ ted.getCommandStack().execute(new RecordingCommand(ted) {
+ @Override
+ protected void doExecute() {
+ IModelCreationCommand creationCommand = new CreateUMLModelCommand();
+ creationCommand.createModel(modelSet);
+ }
+ });
- //Create the root UML Model
+ //get the root UML Model
UmlModel umlModel = (UmlModel)modelSet.getModel(UmlModel.MODEL_ID);
Model model = (Model)umlModel.lookupRoot();
diff --git a/tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java b/tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java
index 4bbcfb5f3c1..fb5fc9c013d 100644
--- a/tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java
+++ b/tests/junit/plugins/editor/org.eclipse.papyrus.editor.integration.tests/src/org/eclipse/papyrus/editor/integration/tests/tests/PageManagerTests.java
@@ -38,6 +38,7 @@ import org.eclipse.papyrus.commands.DestroyElementPapyrusCommand;
import org.eclipse.papyrus.commands.ICreationCommand;
import org.eclipse.papyrus.commands.OpenDiagramCommand;
import org.eclipse.papyrus.editor.integration.tests.Activator;
+import org.eclipse.papyrus.infra.architecture.commands.IModelCreationCommand;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.sasheditor.editor.IPage;
import org.eclipse.papyrus.infra.core.sasheditor.editor.ISashWindowsContainer;
@@ -50,7 +51,6 @@ import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper;
import org.eclipse.papyrus.infra.gmfdiag.common.model.NotationUtils;
import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.infra.ui.extension.commands.IModelCreationCommand;
import org.eclipse.papyrus.junit.utils.EditorUtils;
import org.eclipse.papyrus.uml.diagram.clazz.CreateClassDiagramCommand;
import org.eclipse.papyrus.uml.diagram.clazz.UmlClassDiagramForMultiEditor;
@@ -81,7 +81,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
@Test
public void testModelWithDiagramCreation() throws Exception {
- ModelSet modelSet = new DiResourceSet();
+ final ModelSet modelSet = new DiResourceSet();
IProject emptyModelCreationProject = ResourcesPlugin.getWorkspace().getRoot().getProject("diagramModelCreation");
emptyModelCreationProject.create(new NullProgressMonitor());
emptyModelCreationProject.open(new NullProgressMonitor());
@@ -101,8 +101,14 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
// Ignore
}
- IModelCreationCommand creationCommand = new CreateUMLModelCommand();
- creationCommand.createModel(modelSet);
+ TransactionalEditingDomain ted = modelSet.getTransactionalEditingDomain();
+ ted.getCommandStack().execute(new RecordingCommand(ted) {
+ @Override
+ protected void doExecute() {
+ IModelCreationCommand creationCommand = new CreateUMLModelCommand();
+ creationCommand.createModel(modelSet);
+ }
+ });
// Create the root UML Model
UmlModel umlModel = (UmlModel) modelSet.getModel(UmlModel.MODEL_ID);
@@ -162,7 +168,7 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
}
private IFile createEmptyModel() throws Exception {
- ModelSet modelSet = new DiResourceSet();
+ final ModelSet modelSet = new DiResourceSet();
IProject emptyModelCreationProject = ResourcesPlugin.getWorkspace().getRoot().getProject("emptyModelCreation");
emptyModelCreationProject.create(new NullProgressMonitor());
emptyModelCreationProject.open(new NullProgressMonitor());
@@ -171,8 +177,16 @@ public class PageManagerTests extends AbstractEditorIntegrationTest {
modelSet.createsModels(emptyModelDi);
- IModelCreationCommand creationCommand = new CreateUMLModelCommand();
- creationCommand.createModel(modelSet);
+ // create the UML model
+ TransactionalEditingDomain ted = modelSet.getTransactionalEditingDomain();
+ ted.getCommandStack().execute(new RecordingCommand(ted) {
+ @Override
+ protected void doExecute() {
+ IModelCreationCommand creationCommand = new CreateUMLModelCommand();
+ creationCommand.createModel(modelSet);
+ }
+ });
+
modelSet.save(new NullProgressMonitor());

Back to the top