Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-06-02 11:17:14 -0400
committerptessier2014-06-02 11:17:14 -0400
commitd656360c8b79591ea7684c79fa204a28bb2afa55 (patch)
tree45b6e819c26e6f637015426245dc9927dcad0ad9
parent198bf0fb4be47844f6641b0c674f0e3ad4153844 (diff)
downloadorg.eclipse.papyrus-d656360c8b79591ea7684c79fa204a28bb2afa55.tar.gz
org.eclipse.papyrus-d656360c8b79591ea7684c79fa204a28bb2afa55.tar.xz
org.eclipse.papyrus-d656360c8b79591ea7684c79fa204a28bb2afa55.zip
386296: [Class Diagram] Containment links (Nested classifiers) do no
work https://bugs.eclipse.org/bugs/show_bug.cgi?id=386296 Change-Id: I52f423d80d5293747324eb596d8ce2f5ebe48298
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java21
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java18
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java1
-rw-r--r--tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkWithParent.java1
4 files changed, 41 insertions, 0 deletions
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java
index 95142b272f7..aff63f87e3a 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/AbstractTestNode.java
@@ -22,6 +22,8 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.IHandler;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
@@ -54,7 +56,11 @@ import org.eclipse.papyrus.infra.gmfdiag.common.editpolicies.IMaskManagedLabelEd
import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
import org.eclipse.papyrus.uml.diagram.common.editparts.UMLCompartmentEditPart;
import org.eclipse.papyrus.uml.diagram.common.figure.node.NodeNamedElementFigure;
+import org.eclipse.papyrus.uml.diagram.common.handlers.DeleteFromModelCommandHandler;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.internal.e4.compatibility.SelectionService;
import org.eclipse.uml2.uml.Element;
import org.junit.Assert;
import org.junit.Before;
@@ -269,6 +275,7 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute());
+ testEnableForDeleteFromModel();
executeOnUIThread(command);
assertEquals(DESTROY_DELETION + TEST_THE_EXECUTION, expectedGraphicalChildren - removedGraphicalChildren,getRootView().getChildren().size());
if(testSemantic) {
@@ -287,6 +294,20 @@ public abstract class AbstractTestNode extends org.eclipse.papyrus.diagram.tests
}
/**
+ * test id the handler delete from model is enable
+ */
+ protected void testEnableForDeleteFromModel() {
+ ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ org.eclipse.core.commands.Command cmd = commandService.getCommand("org.eclipse.ui.edit.delete");
+ IHandler handler = cmd.getHandler();
+ if(handler instanceof AbstractHandler) {
+ ((AbstractHandler)handler).setEnabled("org.eclipse.ui.edit.delete");
+ }
+ boolean res = handler.isEnabled();
+ assertTrue("Delete from model handler must be enable",res);
+ }
+
+ /**
* Test drop.
*
* @param type
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java
index 7ac17d434e2..02bbd7a8904 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLink.java
@@ -20,6 +20,8 @@ import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Iterator;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.IHandler;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.gef.ConnectionEditPart;
@@ -51,6 +53,8 @@ import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.uml.diagram.common.Activator;
import org.eclipse.papyrus.uml.diagram.common.editparts.NamedElementEditPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
import org.eclipse.uml2.uml.Element;
import org.junit.Assert;
@@ -140,6 +144,7 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ testEnableForDeleteFromModel();
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == 0);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
@@ -508,4 +513,17 @@ public abstract class TestLink extends AbstractPapyrusTestCase {
assertTrue(CREATION + TEST_THE_REDO, getRootSemanticModel().getOwnedElements().size() == 6);
}
}
+ /**
+ * test id the handler delete from model is enable
+ */
+ protected void testEnableForDeleteFromModel() {
+ ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+ org.eclipse.core.commands.Command cmd = commandService.getCommand("org.eclipse.ui.edit.delete");
+ IHandler handler = cmd.getHandler();
+ if(handler instanceof AbstractHandler) {
+ ((AbstractHandler)handler).setEnabled("org.eclipse.ui.edit.delete");
+ }
+ boolean res = handler.isEnabled();
+ assertTrue("Delete from model handler must be enable",res);
+ }
}
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java
index b2c8ada3464..a37c77b04eb 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkOwnedBySource.java
@@ -86,6 +86,7 @@ public abstract class TestLinkOwnedBySource extends TestLink {
assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ testEnableForDeleteFromModel();
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == 0);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, getRootSemanticModel().getOwnedElements().size() == 4);
diff --git a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkWithParent.java b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkWithParent.java
index 6a508b7e442..5750189f9f7 100644
--- a/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkWithParent.java
+++ b/tests/junit/plugins/uml/diagram/org.eclipse.papyrus.diagram.tests/src/org/eclipse/papyrus/diagram/tests/canonical/TestLinkWithParent.java
@@ -236,6 +236,7 @@ public abstract class TestLinkWithParent extends TestLink {
assertNotNull(DESTROY_DELETION + COMMAND_NULL, command);
assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_IS_CREATED, command != UnexecutableCommand.INSTANCE);
assertTrue(DESTROY_DELETION + TEST_IF_THE_COMMAND_CAN_BE_EXECUTED, command.canExecute() == true);
+ testEnableForDeleteFromModel();
diagramEditor.getDiagramEditDomain().getDiagramCommandStack().execute(command);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, ((Diagram)getRootView()).getEdges().size() == beginRootEdgeSize);
assertTrue(DESTROY_DELETION + TEST_THE_EXECUTION, source.getSourceConnections().size() == beginSourceConnectionsSize);

Back to the top