Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 45181 Details for
Bug 146009
Lite Generator: Changes in the underlying domain model should be automatically reflected in the notational model
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Also reroute notational edges when a node is replaced with a node of different visualID
146009_2.patch (text/plain), 9.03 KB, created by
Boris Blajer
on 2006-06-23 11:24:30 EDT
(
hide
)
Description:
Also reroute notational edges when a node is replaced with a node of different visualID
Filename:
MIME Type:
Creator:
Boris Blajer
Created:
2006-06-23 11:24:30 EDT
Size:
9.03 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.codegen.lite >Index: templates/commands/ReplaceNotationalElementCommand.javajet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/templates/commands/ReplaceNotationalElementCommand.javajet,v >retrieving revision 1.1 >diff -u -r1.1 ReplaceNotationalElementCommand.javajet >--- templates/commands/ReplaceNotationalElementCommand.javajet 19 Jun 2006 19:14:13 -0000 1.1 >+++ templates/commands/ReplaceNotationalElementCommand.javajet 23 Jun 2006 15:24:20 -0000 >@@ -57,6 +57,8 @@ > createCommand.execute(); > removeCommand.execute(); > <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> createdView = createCommand.getCreatedView(); >+ createdView.getSourceEdges().addAll(obsoleteView.getSourceEdges()); >+ createdView.getTargetEdges().addAll(obsoleteView.getTargetEdges()); > if (createdView == null || obsoleteView == null || !createdView.eClass().equals(obsoleteView.eClass())) { > return; > } >@@ -86,6 +88,9 @@ > * @generated > */ > public void undo() { >+ <%=importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")%> createdView = createCommand.getCreatedView(); >+ obsoleteView.getSourceEdges().addAll(createdView.getSourceEdges()); >+ obsoleteView.getTargetEdges().addAll(createdView.getTargetEdges()); > removeCommand.undo(); > createCommand.undo(); > } >Index: src-templates/org/eclipse/gmf/codegen/templates/lite/commands/ReplaceNotationalElementCommandGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.lite/src-templates/org/eclipse/gmf/codegen/templates/lite/commands/ReplaceNotationalElementCommandGenerator.java,v >retrieving revision 1.1 >diff -u -r1.1 ReplaceNotationalElementCommandGenerator.java >--- src-templates/org/eclipse/gmf/codegen/templates/lite/commands/ReplaceNotationalElementCommandGenerator.java 19 Jun 2006 19:14:13 -0000 1.1 >+++ src-templates/org/eclipse/gmf/codegen/templates/lite/commands/ReplaceNotationalElementCommandGenerator.java 23 Jun 2006 15:24:20 -0000 >@@ -21,7 +21,7 @@ > protected final String TEXT_5 = " obsoleteView;" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ReplaceNotationalElementCommand("; > protected final String TEXT_6 = " parentView, CreateNotationalElementCommand createCommand, "; > protected final String TEXT_7 = " obsoleteView) {" + NL + "\t\tthis.createCommand = createCommand;" + NL + "\t\tthis.obsoleteView = obsoleteView;" + NL + "\t\tthis.removeCommand = new RemoveNotationalElementCommand(parentView, obsoleteView);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean canExecute() {" + NL + "\t\treturn createCommand != null && createCommand.canExecute() && removeCommand != null && removeCommand.canExecute();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic boolean canUndo() {" + NL + "\t\treturn createCommand != null && createCommand.canUndo() && removeCommand != null && removeCommand.canUndo();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void execute() {" + NL + "\t\tcreateCommand.execute();" + NL + "\t\tremoveCommand.execute();" + NL + "\t\t"; >- protected final String TEXT_8 = " createdView = createCommand.getCreatedView();" + NL + "\t\tif (createdView == null || obsoleteView == null || !createdView.eClass().equals(obsoleteView.eClass())) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif ("; >+ protected final String TEXT_8 = " createdView = createCommand.getCreatedView();" + NL + "\t\tcreatedView.getSourceEdges().addAll(obsoleteView.getSourceEdges());" + NL + "\t\tcreatedView.getTargetEdges().addAll(obsoleteView.getTargetEdges());" + NL + "\t\tif (createdView == null || obsoleteView == null || !createdView.eClass().equals(obsoleteView.eClass())) {" + NL + "\t\t\treturn;" + NL + "\t\t}" + NL + "\t\tif ("; > protected final String TEXT_9 = ".eINSTANCE.getNode().equals(createdView.eClass())) {" + NL + "\t\t\tcopy(obsoleteView, createdView, "; > protected final String TEXT_10 = ".eINSTANCE.getNode_LayoutConstraint());" + NL + "\t\t} else if ("; > protected final String TEXT_11 = ".eINSTANCE.getEdge().equals(createdView.eClass())) {" + NL + "\t\t\tcopy(obsoleteView, createdView, "; >@@ -32,8 +32,9 @@ > protected final String TEXT_16 = " oldValue = ("; > protected final String TEXT_17 = ") source.eGet(feature);" + NL + "\t\tif (oldValue == null) {" + NL + "\t\t\treturn;\t//nothing to copy" + NL + "\t\t}" + NL + "\t\t"; > protected final String TEXT_18 = " newValue = ("; >- protected final String TEXT_19 = ") target.eGet(feature);" + NL + "\t\tif (newValue != null && !newValue.eClass().equals(oldValue.eClass())) {" + NL + "\t\t\treturn;\t//incompatible instances." + NL + "\t\t}" + NL + "\t\ttarget.eSet(feature, oldValue);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void undo() {" + NL + "\t\tremoveCommand.undo();" + NL + "\t\tcreateCommand.undo();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void redo() {" + NL + "\t\texecute();" + NL + "\t}" + NL + "}"; >- protected final String TEXT_20 = NL; >+ protected final String TEXT_19 = ") target.eGet(feature);" + NL + "\t\tif (newValue != null && !newValue.eClass().equals(oldValue.eClass())) {" + NL + "\t\t\treturn;\t//incompatible instances." + NL + "\t\t}" + NL + "\t\ttarget.eSet(feature, oldValue);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void undo() {" + NL + "\t\t"; >+ protected final String TEXT_20 = " createdView = createCommand.getCreatedView();" + NL + "\t\tobsoleteView.getSourceEdges().addAll(createdView.getSourceEdges());" + NL + "\t\tobsoleteView.getTargetEdges().addAll(createdView.getTargetEdges());" + NL + "\t\tremoveCommand.undo();" + NL + "\t\tcreateCommand.undo();" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic void redo() {" + NL + "\t\texecute();" + NL + "\t}" + NL + "}"; >+ protected final String TEXT_21 = NL; > > public String generate(Object argument) > { >@@ -80,8 +81,10 @@ > stringBuffer.append(TEXT_18); > stringBuffer.append(importManager.getImportedName("org.eclipse.emf.ecore.EObject")); > stringBuffer.append(TEXT_19); >- importManager.emitSortedImports(); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.notation.View")); > stringBuffer.append(TEXT_20); >+ importManager.emitSortedImports(); >+ stringBuffer.append(TEXT_21); > return stringBuffer.toString(); > } > } >#P org.eclipse.gmf.tests.lite >Index: src/org/eclipse/gmf/tests/lite/gef/NotationRefreshTest.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/NotationRefreshTest.java,v >retrieving revision 1.1 >diff -u -r1.1 NotationRefreshTest.java >--- src/org/eclipse/gmf/tests/lite/gef/NotationRefreshTest.java 19 Jun 2006 19:14:11 -0000 1.1 >+++ src/org/eclipse/gmf/tests/lite/gef/NotationRefreshTest.java 23 Jun 2006 15:24:21 -0000 >@@ -28,6 +28,7 @@ > import org.eclipse.gef.EditPart; > import org.eclipse.gmf.runtime.notation.Bounds; > import org.eclipse.gmf.runtime.notation.Diagram; >+import org.eclipse.gmf.runtime.notation.Edge; > import org.eclipse.gmf.runtime.notation.Node; > import org.eclipse.gmf.runtime.notation.View; > import org.eclipse.gmf.tests.rt.RuntimeDiagramTestBase; >@@ -86,6 +87,14 @@ > assertEquals("Unexpected visual ID of the element", getGenModel().getNodeB().getVisualID(), getType(nodeB)); > EObject elementB = nodeB.getElement(); > EditPart editPartB = findEditPart(nodeB); >+ Edge edge1 = getCanvasInstance().getLinkByClass(); >+ Edge edge2 = getCanvasInstance().getLinkByRef(); >+ checkLinkEnd(edge1, nodeB); >+ checkLinkEnd(edge2, nodeB); >+ EditPart edge1EP = findEditPart(edge1); >+ EditPart edge2EP = findEditPart(edge2); >+ assertTrue(edge1EP.isActive()); >+ assertTrue(edge2EP.isActive()); > EClass elementBClass = elementB.eClass(); > EStructuralFeature feature = elementBClass.getEStructuralFeature("pages"); //$NON-NLS-1$ > assertNotNull("Failed to find the feature that affects selector", feature); >@@ -106,6 +115,14 @@ > Bounds newBounds = (Bounds) newNodeB.getLayoutConstraint(); > Rectangle newRectangle = new Rectangle(newBounds.getX(), newBounds.getY(), newBounds.getWidth(), newBounds.getHeight()); > assertEquals("Notational refresh failed to position the new node where the old one was", rectangle, newRectangle); >+ assertTrue(edge1EP.isActive()); >+ assertTrue(edge2EP.isActive()); >+ checkLinkEnd(edge1, newNodeB); >+ checkLinkEnd(edge2, newNodeB); >+ } >+ >+ private void checkLinkEnd(Edge edge, Node node) { >+ assertTrue(node.equals(edge.getSource()) || node.equals(edge.getTarget())); > } > > private int getType(View view) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 146009
:
44834
|
44835
| 45181 |
47139
|
47140