Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Pascual2014-10-10 14:27:50 +0000
committerGabriel Pascual2014-10-17 07:15:04 +0000
commite9b00f28edc9969d536a557fe5298328e94cec65 (patch)
tree9669a8e6667e148967c639b27eb44e5632710e62 /tests/junit/plugins/junit
parentd55dd64cdf5dc5a3261c8bcb4f93e4ddc4ad876b (diff)
downloadorg.eclipse.papyrus-e9b00f28edc9969d536a557fe5298328e94cec65.tar.gz
org.eclipse.papyrus-e9b00f28edc9969d536a557fe5298328e94cec65.tar.xz
org.eclipse.papyrus-e9b00f28edc9969d536a557fe5298328e94cec65.zip
446668: [BDD] Redirecting Associations does not move association end
properties owned by block https://bugs.eclipse.org/bugs/show_bug.cgi?id=446668 - Add correct behavior to reorient association between two blocks - Add unit tests - Fix NPE issue in Association helper Change-Id: I2844f95816b488f244bcbb525bd2a923223993d7 Signed-off-by: Gabriel Pascual <gabriel.pascual@all4tec.net>
Diffstat (limited to 'tests/junit/plugins/junit')
-rw-r--r--tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/DiagramUtils.java34
1 files changed, 33 insertions, 1 deletions
diff --git a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/DiagramUtils.java b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/DiagramUtils.java
index 3d69d785068..c50389d043b 100644
--- a/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/DiagramUtils.java
+++ b/tests/junit/plugins/junit/org.eclipse.papyrus.junit.utils/src/org/eclipse/papyrus/junit/utils/DiagramUtils.java
@@ -19,6 +19,7 @@ import org.eclipse.gef.EditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Shape;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
@@ -69,10 +70,41 @@ public class DiagramUtils {
}
}
+
// Assert.fail("Cannot find the view associated to " + elementName);
return null;
}
+
+
+ /**
+ * Search and returns the first view in the specified container view with the given name
+ *
+ * @param container
+ * the container
+ * @param elementName
+ * the element name
+ * @return the edge
+ */
+ public static Edge findEdge(View container, String elementName) {
+ for (Object viewObject : container.eContents()) {
+ if (viewObject instanceof View) {
+ View view = (View) viewObject;
+ if (view instanceof Edge && view.getElement() instanceof NamedElement) {
+ NamedElement element = (NamedElement) view.getElement();
+ if (elementName.equals(element.getName())) {
+ return (Edge) view;
+ }
+ }
+ }
+ }
+
+
+ // Assert.fail("Cannot find the view associated to " + elementName);
+ return null;
+ }
+
+
/**
* Returns the int corresponding to the given tuple
*
@@ -91,7 +123,7 @@ public class DiagramUtils {
int red = (value >> 16) & 255;
return new RGB(red, green, blue);
}
-
+
public static String integerToRGBString(int value) {
RGB rgb = integerToRGB(value);
return rgb.toString();

Back to the top