View | Details | Raw Unified | Return to bug 139139 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/gmf/tests/gen/LabelSupportTest.java (-2 / +42 lines)
Lines 17-29 Link Here
17
import org.eclipse.draw2d.IFigure;
17
import org.eclipse.draw2d.IFigure;
18
import org.eclipse.draw2d.RectangleFigure;
18
import org.eclipse.draw2d.RectangleFigure;
19
import org.eclipse.emf.codegen.util.CodeGenUtil;
19
import org.eclipse.emf.codegen.util.CodeGenUtil;
20
import org.eclipse.gmf.gmfgraph.Alignment;
21
import org.eclipse.gmf.gmfgraph.BorderLayout;
22
import org.eclipse.gmf.gmfgraph.BorderLayoutData;
20
import org.eclipse.gmf.gmfgraph.CustomFigure;
23
import org.eclipse.gmf.gmfgraph.CustomFigure;
21
import org.eclipse.gmf.gmfgraph.Dimension;
24
import org.eclipse.gmf.gmfgraph.Dimension;
22
import org.eclipse.gmf.gmfgraph.Figure;
25
import org.eclipse.gmf.gmfgraph.Figure;
23
import org.eclipse.gmf.gmfgraph.GMFGraphFactory;
26
import org.eclipse.gmf.gmfgraph.GMFGraphFactory;
24
import org.eclipse.gmf.gmfgraph.Label;
27
import org.eclipse.gmf.gmfgraph.Label;
25
import org.eclipse.gmf.gmfgraph.LabeledContainer;
28
import org.eclipse.gmf.gmfgraph.LabeledContainer;
29
import org.eclipse.gmf.gmfgraph.Node;
26
import org.eclipse.gmf.gmfgraph.Rectangle;
30
import org.eclipse.gmf.gmfgraph.Rectangle;
31
import org.eclipse.gmf.gmfgraph.RoundedRectangle;
27
32
28
public class LabelSupportTest extends FigureCodegenTestBase {
33
public class LabelSupportTest extends FigureCodegenTestBase {
29
	private static final String LABEL_NAME = "Typename";
34
	private static final String LABEL_NAME = "Typename";
Lines 50-55 Link Here
50
		performChecks(labeledContainer, "LabeledContainerAlreadyHasLabel_DoesItNeedOneMore", LABEL_NAME);
55
		performChecks(labeledContainer, "LabeledContainerAlreadyHasLabel_DoesItNeedOneMore", LABEL_NAME);
51
	}
56
	}
52
	
57
	
58
	public void testDeepLabelGraphdefOnly(){
59
		Rectangle root = GMFGraphFactory.eINSTANCE.createRectangle();
60
		root.setName("Root");
61
		BorderLayout layout = GMFGraphFactory.eINSTANCE.createBorderLayout();
62
		root.setLayout(layout);
63
		
64
		RoundedRectangle padding = GMFGraphFactory.eINSTANCE.createRoundedRectangle();
65
		padding.setName("Padding");
66
		BorderLayoutData paddingData = GMFGraphFactory.eINSTANCE.createBorderLayoutData();
67
		paddingData.setAlignment(Alignment.FILL_LITERAL);
68
		padding.setLayoutData(paddingData);
69
		
70
		Rectangle intermediateLabelContainer = GMFGraphFactory.eINSTANCE.createRectangle();
71
		intermediateLabelContainer.setName("intermediateLabelContainer");
72
		BorderLayoutData labelData = GMFGraphFactory.eINSTANCE.createBorderLayoutData();
73
		labelData.setAlignment(Alignment.BEGINNING_LITERAL);
74
		labelData.setVertical(true);
75
		intermediateLabelContainer.setLayoutData(labelData);
76
		
77
		addLabel(intermediateLabelContainer, LABEL_NAME);
78
79
		root.getChildren().add(intermediateLabelContainer);
80
		root.getChildren().add(padding);
81
		
82
		performTests(root, combineChecks(new GenericFigureCheck(root), new LabelAccessorCheck(LABEL_NAME)));		
83
	}
84
	
53
	private void performChecks(Figure parent, String parentName, String labelName){
85
	private void performChecks(Figure parent, String parentName, String labelName){
54
		parent.setName(parentName);
86
		parent.setName(parentName);
55
		
87
		
Lines 58-69 Link Here
58
		prefSize.setDy(60);
90
		prefSize.setDy(60);
59
		parent.setPreferredSize(prefSize);
91
		parent.setPreferredSize(prefSize);
60
		
92
		
93
		addLabel(parent, labelName);
94
		
95
		performTests(parent, combineChecks(new GenericFigureCheck(parent), new LabelAccessorCheck(LABEL_NAME)));
96
	}
97
98
	private void addLabel(Figure parent, String labelName) {
61
		Label label = GMFGraphFactory.eINSTANCE.createLabel();
99
		Label label = GMFGraphFactory.eINSTANCE.createLabel();
62
		label.setName(labelName);
100
		label.setName(labelName);
63
		
101
		
64
		parent.getChildren().add(label);
102
		Node labelNode = GMFGraphFactory.eINSTANCE.createNode();
103
		labelNode.setName("LabelNode");
104
		labelNode.setFigure(label);
65
		
105
		
66
		performTests(parent, combineChecks(new GenericFigureCheck(parent), new LabelAccessorCheck(LABEL_NAME)));
106
		parent.getChildren().add(label);
67
	}
107
	}
68
	
108
	
69
	private static class LabelAccessorCheck extends FigureCheck {
109
	private static class LabelAccessorCheck extends FigureCheck {
(-)src/org/eclipse/gmf/gmfgraph/impl/LabeledContainerImpl.java (+40 lines)
Lines 16-24 Link Here
16
import org.eclipse.emf.ecore.impl.ENotificationImpl;
16
import org.eclipse.emf.ecore.impl.ENotificationImpl;
17
import org.eclipse.emf.ecore.impl.EObjectImpl;
17
import org.eclipse.emf.ecore.impl.EObjectImpl;
18
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
18
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
19
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
19
import org.eclipse.emf.ecore.util.InternalEList;
20
import org.eclipse.emf.ecore.util.InternalEList;
20
import org.eclipse.gmf.gmfgraph.Border;
21
import org.eclipse.gmf.gmfgraph.Border;
21
import org.eclipse.gmf.gmfgraph.Color;
22
import org.eclipse.gmf.gmfgraph.Color;
23
import org.eclipse.gmf.gmfgraph.DiagramElement;
22
import org.eclipse.gmf.gmfgraph.Dimension;
24
import org.eclipse.gmf.gmfgraph.Dimension;
23
import org.eclipse.gmf.gmfgraph.Figure;
25
import org.eclipse.gmf.gmfgraph.Figure;
24
import org.eclipse.gmf.gmfgraph.FigureMarker;
26
import org.eclipse.gmf.gmfgraph.FigureMarker;
Lines 53-58 Link Here
53
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabeledContainerImpl#getBorder <em>Border</em>}</li>
55
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabeledContainerImpl#getBorder <em>Border</em>}</li>
54
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabeledContainerImpl#getLocation <em>Location</em>}</li>
56
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabeledContainerImpl#getLocation <em>Location</em>}</li>
55
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabeledContainerImpl#getSize <em>Size</em>}</li>
57
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabeledContainerImpl#getSize <em>Size</em>}</li>
58
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabeledContainerImpl#getReferencingElements <em>Referencing Elements</em>}</li>
56
 * </ul>
59
 * </ul>
57
 * </p>
60
 * </p>
58
 *
61
 *
Lines 210-215 Link Here
210
	protected Point size = null;
213
	protected Point size = null;
211
214
212
	/**
215
	/**
216
	 * The cached value of the '{@link #getReferencingElements() <em>Referencing Elements</em>}' reference list.
217
	 * <!-- begin-user-doc -->
218
	 * <!-- end-user-doc -->
219
	 * @see #getReferencingElements()
220
	 * @generated
221
	 * @ordered
222
	 */
223
	protected EList referencingElements = null;
224
225
	/**
213
	 * <!-- begin-user-doc -->
226
	 * <!-- begin-user-doc -->
214
	 * <!-- end-user-doc -->
227
	 * <!-- end-user-doc -->
215
	 * @generated
228
	 * @generated
Lines 791-796 Link Here
791
	 * <!-- end-user-doc -->
804
	 * <!-- end-user-doc -->
792
	 * @generated
805
	 * @generated
793
	 */
806
	 */
807
	public EList getReferencingElements() {
808
		if (referencingElements == null) {
809
			referencingElements = new EObjectWithInverseResolvingEList(DiagramElement.class, this, GMFGraphPackage.LABELED_CONTAINER__REFERENCING_ELEMENTS, GMFGraphPackage.DIAGRAM_ELEMENT__FIGURE);
810
		}
811
		return referencingElements;
812
	}
813
814
	/**
815
	 * <!-- begin-user-doc -->
816
	 * <!-- end-user-doc -->
817
	 * @generated
818
	 */
794
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
819
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
795
		switch (featureID) {
820
		switch (featureID) {
796
			case GMFGraphPackage.LABELED_CONTAINER__LAYOUT_DATA:
821
			case GMFGraphPackage.LABELED_CONTAINER__LAYOUT_DATA:
Lines 803-808 Link Here
803
				return eBasicSetContainer(otherEnd, GMFGraphPackage.LABELED_CONTAINER__PARENT, msgs);
828
				return eBasicSetContainer(otherEnd, GMFGraphPackage.LABELED_CONTAINER__PARENT, msgs);
804
			case GMFGraphPackage.LABELED_CONTAINER__CHILDREN:
829
			case GMFGraphPackage.LABELED_CONTAINER__CHILDREN:
805
				return ((InternalEList)getChildren()).basicAdd(otherEnd, msgs);
830
				return ((InternalEList)getChildren()).basicAdd(otherEnd, msgs);
831
			case GMFGraphPackage.LABELED_CONTAINER__REFERENCING_ELEMENTS:
832
				return ((InternalEList)getReferencingElements()).basicAdd(otherEnd, msgs);
806
		}
833
		}
807
		return super.eInverseAdd(otherEnd, featureID, msgs);
834
		return super.eInverseAdd(otherEnd, featureID, msgs);
808
	}
835
	}
Lines 842-847 Link Here
842
				return basicSetLocation(null, msgs);
869
				return basicSetLocation(null, msgs);
843
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
870
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
844
				return basicSetSize(null, msgs);
871
				return basicSetSize(null, msgs);
872
			case GMFGraphPackage.LABELED_CONTAINER__REFERENCING_ELEMENTS:
873
				return ((InternalEList)getReferencingElements()).basicRemove(otherEnd, msgs);
845
		}
874
		}
846
		return super.eInverseRemove(otherEnd, featureID, msgs);
875
		return super.eInverseRemove(otherEnd, featureID, msgs);
847
	}
876
	}
Lines 896-901 Link Here
896
				return getLocation();
925
				return getLocation();
897
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
926
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
898
				return getSize();
927
				return getSize();
928
			case GMFGraphPackage.LABELED_CONTAINER__REFERENCING_ELEMENTS:
929
				return getReferencingElements();
899
		}
930
		}
900
		return super.eGet(featureID, resolve, coreType);
931
		return super.eGet(featureID, resolve, coreType);
901
	}
932
	}
Lines 950-955 Link Here
950
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
981
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
951
				setSize((Point)newValue);
982
				setSize((Point)newValue);
952
				return;
983
				return;
984
			case GMFGraphPackage.LABELED_CONTAINER__REFERENCING_ELEMENTS:
985
				getReferencingElements().clear();
986
				getReferencingElements().addAll((Collection)newValue);
987
				return;
953
		}
988
		}
954
		super.eSet(featureID, newValue);
989
		super.eSet(featureID, newValue);
955
	}
990
	}
Lines 1003-1008 Link Here
1003
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
1038
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
1004
				setSize((Point)null);
1039
				setSize((Point)null);
1005
				return;
1040
				return;
1041
			case GMFGraphPackage.LABELED_CONTAINER__REFERENCING_ELEMENTS:
1042
				getReferencingElements().clear();
1043
				return;
1006
		}
1044
		}
1007
		super.eUnset(featureID);
1045
		super.eUnset(featureID);
1008
	}
1046
	}
Lines 1044-1049 Link Here
1044
				return location != null;
1082
				return location != null;
1045
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
1083
			case GMFGraphPackage.LABELED_CONTAINER__SIZE:
1046
				return size != null;
1084
				return size != null;
1085
			case GMFGraphPackage.LABELED_CONTAINER__REFERENCING_ELEMENTS:
1086
				return referencingElements != null && !referencingElements.isEmpty();
1047
		}
1087
		}
1048
		return super.eIsSet(featureID);
1088
		return super.eIsSet(featureID);
1049
	}
1089
	}
(-)src/org/eclipse/gmf/gmfgraph/impl/CustomFigureImpl.java (+40 lines)
Lines 17-28 Link Here
17
import org.eclipse.emf.ecore.impl.EObjectImpl;
17
import org.eclipse.emf.ecore.impl.EObjectImpl;
18
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
18
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
19
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
19
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
20
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
20
import org.eclipse.emf.ecore.util.InternalEList;
21
import org.eclipse.emf.ecore.util.InternalEList;
21
import org.eclipse.gmf.gmfgraph.Border;
22
import org.eclipse.gmf.gmfgraph.Border;
22
import org.eclipse.gmf.gmfgraph.Color;
23
import org.eclipse.gmf.gmfgraph.Color;
23
import org.eclipse.gmf.gmfgraph.CustomAttribute;
24
import org.eclipse.gmf.gmfgraph.CustomAttribute;
24
import org.eclipse.gmf.gmfgraph.CustomClass;
25
import org.eclipse.gmf.gmfgraph.CustomClass;
25
import org.eclipse.gmf.gmfgraph.CustomFigure;
26
import org.eclipse.gmf.gmfgraph.CustomFigure;
27
import org.eclipse.gmf.gmfgraph.DiagramElement;
26
import org.eclipse.gmf.gmfgraph.Dimension;
28
import org.eclipse.gmf.gmfgraph.Dimension;
27
import org.eclipse.gmf.gmfgraph.Figure;
29
import org.eclipse.gmf.gmfgraph.Figure;
28
import org.eclipse.gmf.gmfgraph.FigureMarker;
30
import org.eclipse.gmf.gmfgraph.FigureMarker;
Lines 56-61 Link Here
56
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getBorder <em>Border</em>}</li>
58
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getBorder <em>Border</em>}</li>
57
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getLocation <em>Location</em>}</li>
59
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getLocation <em>Location</em>}</li>
58
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getSize <em>Size</em>}</li>
60
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getSize <em>Size</em>}</li>
61
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getReferencingElements <em>Referencing Elements</em>}</li>
59
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getQualifiedClassName <em>Qualified Class Name</em>}</li>
62
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getQualifiedClassName <em>Qualified Class Name</em>}</li>
60
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getBundleName <em>Bundle Name</em>}</li>
63
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getBundleName <em>Bundle Name</em>}</li>
61
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getAttributes <em>Attributes</em>}</li>
64
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.CustomFigureImpl#getAttributes <em>Attributes</em>}</li>
Lines 216-221 Link Here
216
	protected Point size = null;
219
	protected Point size = null;
217
220
218
	/**
221
	/**
222
	 * The cached value of the '{@link #getReferencingElements() <em>Referencing Elements</em>}' reference list.
223
	 * <!-- begin-user-doc -->
224
	 * <!-- end-user-doc -->
225
	 * @see #getReferencingElements()
226
	 * @generated
227
	 * @ordered
228
	 */
229
	protected EList referencingElements = null;
230
231
	/**
219
	 * The default value of the '{@link #getQualifiedClassName() <em>Qualified Class Name</em>}' attribute.
232
	 * The default value of the '{@link #getQualifiedClassName() <em>Qualified Class Name</em>}' attribute.
220
	 * <!-- begin-user-doc -->
233
	 * <!-- begin-user-doc -->
221
	 * <!-- end-user-doc -->
234
	 * <!-- end-user-doc -->
Lines 847-852 Link Here
847
	 * <!-- end-user-doc -->
860
	 * <!-- end-user-doc -->
848
	 * @generated
861
	 * @generated
849
	 */
862
	 */
863
	public EList getReferencingElements() {
864
		if (referencingElements == null) {
865
			referencingElements = new EObjectWithInverseResolvingEList(DiagramElement.class, this, GMFGraphPackage.CUSTOM_FIGURE__REFERENCING_ELEMENTS, GMFGraphPackage.DIAGRAM_ELEMENT__FIGURE);
866
		}
867
		return referencingElements;
868
	}
869
870
	/**
871
	 * <!-- begin-user-doc -->
872
	 * <!-- end-user-doc -->
873
	 * @generated
874
	 */
850
	public String getQualifiedClassName() {
875
	public String getQualifiedClassName() {
851
		return qualifiedClassName;
876
		return qualifiedClassName;
852
	}
877
	}
Lines 913-918 Link Here
913
				return eBasicSetContainer(otherEnd, GMFGraphPackage.CUSTOM_FIGURE__PARENT, msgs);
938
				return eBasicSetContainer(otherEnd, GMFGraphPackage.CUSTOM_FIGURE__PARENT, msgs);
914
			case GMFGraphPackage.CUSTOM_FIGURE__CHILDREN:
939
			case GMFGraphPackage.CUSTOM_FIGURE__CHILDREN:
915
				return ((InternalEList)getChildren()).basicAdd(otherEnd, msgs);
940
				return ((InternalEList)getChildren()).basicAdd(otherEnd, msgs);
941
			case GMFGraphPackage.CUSTOM_FIGURE__REFERENCING_ELEMENTS:
942
				return ((InternalEList)getReferencingElements()).basicAdd(otherEnd, msgs);
916
		}
943
		}
917
		return super.eInverseAdd(otherEnd, featureID, msgs);
944
		return super.eInverseAdd(otherEnd, featureID, msgs);
918
	}
945
	}
Lines 952-957 Link Here
952
				return basicSetLocation(null, msgs);
979
				return basicSetLocation(null, msgs);
953
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
980
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
954
				return basicSetSize(null, msgs);
981
				return basicSetSize(null, msgs);
982
			case GMFGraphPackage.CUSTOM_FIGURE__REFERENCING_ELEMENTS:
983
				return ((InternalEList)getReferencingElements()).basicRemove(otherEnd, msgs);
955
			case GMFGraphPackage.CUSTOM_FIGURE__ATTRIBUTES:
984
			case GMFGraphPackage.CUSTOM_FIGURE__ATTRIBUTES:
956
				return ((InternalEList)getAttributes()).basicRemove(otherEnd, msgs);
985
				return ((InternalEList)getAttributes()).basicRemove(otherEnd, msgs);
957
		}
986
		}
Lines 1008-1013 Link Here
1008
				return getLocation();
1037
				return getLocation();
1009
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
1038
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
1010
				return getSize();
1039
				return getSize();
1040
			case GMFGraphPackage.CUSTOM_FIGURE__REFERENCING_ELEMENTS:
1041
				return getReferencingElements();
1011
			case GMFGraphPackage.CUSTOM_FIGURE__QUALIFIED_CLASS_NAME:
1042
			case GMFGraphPackage.CUSTOM_FIGURE__QUALIFIED_CLASS_NAME:
1012
				return getQualifiedClassName();
1043
				return getQualifiedClassName();
1013
			case GMFGraphPackage.CUSTOM_FIGURE__BUNDLE_NAME:
1044
			case GMFGraphPackage.CUSTOM_FIGURE__BUNDLE_NAME:
Lines 1068-1073 Link Here
1068
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
1099
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
1069
				setSize((Point)newValue);
1100
				setSize((Point)newValue);
1070
				return;
1101
				return;
1102
			case GMFGraphPackage.CUSTOM_FIGURE__REFERENCING_ELEMENTS:
1103
				getReferencingElements().clear();
1104
				getReferencingElements().addAll((Collection)newValue);
1105
				return;
1071
			case GMFGraphPackage.CUSTOM_FIGURE__QUALIFIED_CLASS_NAME:
1106
			case GMFGraphPackage.CUSTOM_FIGURE__QUALIFIED_CLASS_NAME:
1072
				setQualifiedClassName((String)newValue);
1107
				setQualifiedClassName((String)newValue);
1073
				return;
1108
				return;
Lines 1131-1136 Link Here
1131
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
1166
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
1132
				setSize((Point)null);
1167
				setSize((Point)null);
1133
				return;
1168
				return;
1169
			case GMFGraphPackage.CUSTOM_FIGURE__REFERENCING_ELEMENTS:
1170
				getReferencingElements().clear();
1171
				return;
1134
			case GMFGraphPackage.CUSTOM_FIGURE__QUALIFIED_CLASS_NAME:
1172
			case GMFGraphPackage.CUSTOM_FIGURE__QUALIFIED_CLASS_NAME:
1135
				setQualifiedClassName(QUALIFIED_CLASS_NAME_EDEFAULT);
1173
				setQualifiedClassName(QUALIFIED_CLASS_NAME_EDEFAULT);
1136
				return;
1174
				return;
Lines 1181-1186 Link Here
1181
				return location != null;
1219
				return location != null;
1182
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
1220
			case GMFGraphPackage.CUSTOM_FIGURE__SIZE:
1183
				return size != null;
1221
				return size != null;
1222
			case GMFGraphPackage.CUSTOM_FIGURE__REFERENCING_ELEMENTS:
1223
				return referencingElements != null && !referencingElements.isEmpty();
1184
			case GMFGraphPackage.CUSTOM_FIGURE__QUALIFIED_CLASS_NAME:
1224
			case GMFGraphPackage.CUSTOM_FIGURE__QUALIFIED_CLASS_NAME:
1185
				return QUALIFIED_CLASS_NAME_EDEFAULT == null ? qualifiedClassName != null : !QUALIFIED_CLASS_NAME_EDEFAULT.equals(qualifiedClassName);
1225
				return QUALIFIED_CLASS_NAME_EDEFAULT == null ? qualifiedClassName != null : !QUALIFIED_CLASS_NAME_EDEFAULT.equals(qualifiedClassName);
1186
			case GMFGraphPackage.CUSTOM_FIGURE__BUNDLE_NAME:
1226
			case GMFGraphPackage.CUSTOM_FIGURE__BUNDLE_NAME:
(-)src/org/eclipse/gmf/gmfgraph/impl/GMFGraphPackageImpl.java (-1 / +12 lines)
Lines 1057-1062 Link Here
1057
	 * <!-- end-user-doc -->
1057
	 * <!-- end-user-doc -->
1058
	 * @generated
1058
	 * @generated
1059
	 */
1059
	 */
1060
	public EReference getFigure_ReferencingElements() {
1061
		return (EReference)figureEClass.getEStructuralFeatures().get(11);
1062
	}
1063
1064
	/**
1065
	 * <!-- begin-user-doc -->
1066
	 * <!-- end-user-doc -->
1067
	 * @generated
1068
	 */
1060
	public EClass getFigureRef() {
1069
	public EClass getFigureRef() {
1061
		return figureRefEClass;
1070
		return figureRefEClass;
1062
	}
1071
	}
Lines 2205-2210 Link Here
2205
		createEReference(figureEClass, FIGURE__BORDER);
2214
		createEReference(figureEClass, FIGURE__BORDER);
2206
		createEReference(figureEClass, FIGURE__LOCATION);
2215
		createEReference(figureEClass, FIGURE__LOCATION);
2207
		createEReference(figureEClass, FIGURE__SIZE);
2216
		createEReference(figureEClass, FIGURE__SIZE);
2217
		createEReference(figureEClass, FIGURE__REFERENCING_ELEMENTS);
2208
2218
2209
		figureRefEClass = createEClass(FIGURE_REF);
2219
		figureRefEClass = createEClass(FIGURE_REF);
2210
		createEReference(figureRefEClass, FIGURE_REF__FIGURE);
2220
		createEReference(figureRefEClass, FIGURE_REF__FIGURE);
Lines 2472-2478 Link Here
2472
		initEAttribute(getIdentity_Name(), ecorePackage.getEString(), "name", null, 1, 1, Identity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2482
		initEAttribute(getIdentity_Name(), ecorePackage.getEString(), "name", null, 1, 1, Identity.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2473
2483
2474
		initEClass(diagramElementEClass, DiagramElement.class, "DiagramElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
2484
		initEClass(diagramElementEClass, DiagramElement.class, "DiagramElement", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
2475
		initEReference(getDiagramElement_Figure(), this.getFigure(), null, "figure", null, 1, 1, DiagramElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2485
		initEReference(getDiagramElement_Figure(), this.getFigure(), this.getFigure_ReferencingElements(), "figure", null, 1, 1, DiagramElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2476
		initEReference(getDiagramElement_Facets(), this.getVisualFacet(), null, "facets", null, 0, -1, DiagramElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2486
		initEReference(getDiagramElement_Facets(), this.getVisualFacet(), null, "facets", null, 0, -1, DiagramElement.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2477
2487
2478
		EOperation op = addEOperation(diagramElementEClass, this.getVisualFacet(), "find", 0, 1);
2488
		EOperation op = addEOperation(diagramElementEClass, this.getVisualFacet(), "find", 0, 1);
Lines 2522-2527 Link Here
2522
		initEReference(getFigure_Border(), this.getBorder(), null, "border", null, 0, 1, Figure.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2532
		initEReference(getFigure_Border(), this.getBorder(), null, "border", null, 0, 1, Figure.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2523
		initEReference(getFigure_Location(), this.getPoint(), null, "location", null, 0, 1, Figure.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2533
		initEReference(getFigure_Location(), this.getPoint(), null, "location", null, 0, 1, Figure.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2524
		initEReference(getFigure_Size(), this.getPoint(), null, "size", null, 0, 1, Figure.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2534
		initEReference(getFigure_Size(), this.getPoint(), null, "size", null, 0, 1, Figure.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2535
		initEReference(getFigure_ReferencingElements(), this.getDiagramElement(), this.getDiagramElement_Figure(), "referencingElements", null, 0, -1, Figure.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2525
2536
2526
		initEClass(figureRefEClass, FigureRef.class, "FigureRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
2537
		initEClass(figureRefEClass, FigureRef.class, "FigureRef", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
2527
		initEReference(getFigureRef_Figure(), this.getFigure(), null, "figure", null, 1, 1, FigureRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
2538
		initEReference(getFigureRef_Figure(), this.getFigure(), null, "figure", null, 1, 1, FigureRef.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
(-)src/org/eclipse/gmf/gmfgraph/impl/ShapeImpl.java (+40 lines)
Lines 19-27 Link Here
19
import org.eclipse.emf.ecore.impl.ENotificationImpl;
19
import org.eclipse.emf.ecore.impl.ENotificationImpl;
20
import org.eclipse.emf.ecore.impl.EObjectImpl;
20
import org.eclipse.emf.ecore.impl.EObjectImpl;
21
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
21
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
22
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
22
import org.eclipse.emf.ecore.util.InternalEList;
23
import org.eclipse.emf.ecore.util.InternalEList;
23
import org.eclipse.gmf.gmfgraph.Border;
24
import org.eclipse.gmf.gmfgraph.Border;
24
import org.eclipse.gmf.gmfgraph.Color;
25
import org.eclipse.gmf.gmfgraph.Color;
26
import org.eclipse.gmf.gmfgraph.DiagramElement;
25
import org.eclipse.gmf.gmfgraph.Dimension;
27
import org.eclipse.gmf.gmfgraph.Dimension;
26
import org.eclipse.gmf.gmfgraph.Figure;
28
import org.eclipse.gmf.gmfgraph.Figure;
27
import org.eclipse.gmf.gmfgraph.FigureMarker;
29
import org.eclipse.gmf.gmfgraph.FigureMarker;
Lines 58-63 Link Here
58
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#getBorder <em>Border</em>}</li>
60
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#getBorder <em>Border</em>}</li>
59
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#getLocation <em>Location</em>}</li>
61
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#getLocation <em>Location</em>}</li>
60
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#getSize <em>Size</em>}</li>
62
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#getSize <em>Size</em>}</li>
63
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#getReferencingElements <em>Referencing Elements</em>}</li>
61
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#isOutline <em>Outline</em>}</li>
64
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#isOutline <em>Outline</em>}</li>
62
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#isFill <em>Fill</em>}</li>
65
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#isFill <em>Fill</em>}</li>
63
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#getLineWidth <em>Line Width</em>}</li>
66
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.ShapeImpl#getLineWidth <em>Line Width</em>}</li>
Lines 222-227 Link Here
222
	protected Point size = null;
225
	protected Point size = null;
223
226
224
	/**
227
	/**
228
	 * The cached value of the '{@link #getReferencingElements() <em>Referencing Elements</em>}' reference list.
229
	 * <!-- begin-user-doc -->
230
	 * <!-- end-user-doc -->
231
	 * @see #getReferencingElements()
232
	 * @generated
233
	 * @ordered
234
	 */
235
	protected EList referencingElements = null;
236
237
	/**
225
	 * The default value of the '{@link #isOutline() <em>Outline</em>}' attribute.
238
	 * The default value of the '{@link #isOutline() <em>Outline</em>}' attribute.
226
	 * <!-- begin-user-doc -->
239
	 * <!-- begin-user-doc -->
227
	 * <!-- end-user-doc -->
240
	 * <!-- end-user-doc -->
Lines 921-926 Link Here
921
	/**
934
	/**
922
	 * <!-- begin-user-doc -->
935
	 * <!-- begin-user-doc -->
923
	 * <!-- end-user-doc -->
936
	 * <!-- end-user-doc -->
937
	 * @generated
938
	 */
939
	public EList getReferencingElements() {
940
		if (referencingElements == null) {
941
			referencingElements = new EObjectWithInverseResolvingEList(DiagramElement.class, this, GMFGraphPackage.SHAPE__REFERENCING_ELEMENTS, GMFGraphPackage.DIAGRAM_ELEMENT__FIGURE);
942
		}
943
		return referencingElements;
944
	}
945
946
	/**
947
	 * <!-- begin-user-doc -->
948
	 * <!-- end-user-doc -->
924
	 * @generated NOT
949
	 * @generated NOT
925
	 */
950
	 */
926
	public EList getResolvedChildren() {
951
	public EList getResolvedChildren() {
Lines 954-959 Link Here
954
				return eBasicSetContainer(otherEnd, GMFGraphPackage.SHAPE__PARENT, msgs);
979
				return eBasicSetContainer(otherEnd, GMFGraphPackage.SHAPE__PARENT, msgs);
955
			case GMFGraphPackage.SHAPE__CHILDREN:
980
			case GMFGraphPackage.SHAPE__CHILDREN:
956
				return ((InternalEList)getChildren()).basicAdd(otherEnd, msgs);
981
				return ((InternalEList)getChildren()).basicAdd(otherEnd, msgs);
982
			case GMFGraphPackage.SHAPE__REFERENCING_ELEMENTS:
983
				return ((InternalEList)getReferencingElements()).basicAdd(otherEnd, msgs);
957
		}
984
		}
958
		return super.eInverseAdd(otherEnd, featureID, msgs);
985
		return super.eInverseAdd(otherEnd, featureID, msgs);
959
	}
986
	}
Lines 993-998 Link Here
993
				return basicSetLocation(null, msgs);
1020
				return basicSetLocation(null, msgs);
994
			case GMFGraphPackage.SHAPE__SIZE:
1021
			case GMFGraphPackage.SHAPE__SIZE:
995
				return basicSetSize(null, msgs);
1022
				return basicSetSize(null, msgs);
1023
			case GMFGraphPackage.SHAPE__REFERENCING_ELEMENTS:
1024
				return ((InternalEList)getReferencingElements()).basicRemove(otherEnd, msgs);
996
		}
1025
		}
997
		return super.eInverseRemove(otherEnd, featureID, msgs);
1026
		return super.eInverseRemove(otherEnd, featureID, msgs);
998
	}
1027
	}
Lines 1047-1052 Link Here
1047
				return getLocation();
1076
				return getLocation();
1048
			case GMFGraphPackage.SHAPE__SIZE:
1077
			case GMFGraphPackage.SHAPE__SIZE:
1049
				return getSize();
1078
				return getSize();
1079
			case GMFGraphPackage.SHAPE__REFERENCING_ELEMENTS:
1080
				return getReferencingElements();
1050
			case GMFGraphPackage.SHAPE__OUTLINE:
1081
			case GMFGraphPackage.SHAPE__OUTLINE:
1051
				return isOutline() ? Boolean.TRUE : Boolean.FALSE;
1082
				return isOutline() ? Boolean.TRUE : Boolean.FALSE;
1052
			case GMFGraphPackage.SHAPE__FILL:
1083
			case GMFGraphPackage.SHAPE__FILL:
Lines 1115-1120 Link Here
1115
			case GMFGraphPackage.SHAPE__SIZE:
1146
			case GMFGraphPackage.SHAPE__SIZE:
1116
				setSize((Point)newValue);
1147
				setSize((Point)newValue);
1117
				return;
1148
				return;
1149
			case GMFGraphPackage.SHAPE__REFERENCING_ELEMENTS:
1150
				getReferencingElements().clear();
1151
				getReferencingElements().addAll((Collection)newValue);
1152
				return;
1118
			case GMFGraphPackage.SHAPE__OUTLINE:
1153
			case GMFGraphPackage.SHAPE__OUTLINE:
1119
				setOutline(((Boolean)newValue).booleanValue());
1154
				setOutline(((Boolean)newValue).booleanValue());
1120
				return;
1155
				return;
Lines 1186-1191 Link Here
1186
			case GMFGraphPackage.SHAPE__SIZE:
1221
			case GMFGraphPackage.SHAPE__SIZE:
1187
				setSize((Point)null);
1222
				setSize((Point)null);
1188
				return;
1223
				return;
1224
			case GMFGraphPackage.SHAPE__REFERENCING_ELEMENTS:
1225
				getReferencingElements().clear();
1226
				return;
1189
			case GMFGraphPackage.SHAPE__OUTLINE:
1227
			case GMFGraphPackage.SHAPE__OUTLINE:
1190
				setOutline(OUTLINE_EDEFAULT);
1228
				setOutline(OUTLINE_EDEFAULT);
1191
				return;
1229
				return;
Lines 1245-1250 Link Here
1245
				return location != null;
1283
				return location != null;
1246
			case GMFGraphPackage.SHAPE__SIZE:
1284
			case GMFGraphPackage.SHAPE__SIZE:
1247
				return size != null;
1285
				return size != null;
1286
			case GMFGraphPackage.SHAPE__REFERENCING_ELEMENTS:
1287
				return referencingElements != null && !referencingElements.isEmpty();
1248
			case GMFGraphPackage.SHAPE__OUTLINE:
1288
			case GMFGraphPackage.SHAPE__OUTLINE:
1249
				return outline != OUTLINE_EDEFAULT;
1289
				return outline != OUTLINE_EDEFAULT;
1250
			case GMFGraphPackage.SHAPE__FILL:
1290
			case GMFGraphPackage.SHAPE__FILL:
(-)src/org/eclipse/gmf/gmfgraph/impl/LabelImpl.java (+40 lines)
Lines 16-24 Link Here
16
import org.eclipse.emf.ecore.impl.ENotificationImpl;
16
import org.eclipse.emf.ecore.impl.ENotificationImpl;
17
import org.eclipse.emf.ecore.impl.EObjectImpl;
17
import org.eclipse.emf.ecore.impl.EObjectImpl;
18
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
18
import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
19
import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
19
import org.eclipse.emf.ecore.util.InternalEList;
20
import org.eclipse.emf.ecore.util.InternalEList;
20
import org.eclipse.gmf.gmfgraph.Border;
21
import org.eclipse.gmf.gmfgraph.Border;
21
import org.eclipse.gmf.gmfgraph.Color;
22
import org.eclipse.gmf.gmfgraph.Color;
23
import org.eclipse.gmf.gmfgraph.DiagramElement;
22
import org.eclipse.gmf.gmfgraph.Dimension;
24
import org.eclipse.gmf.gmfgraph.Dimension;
23
import org.eclipse.gmf.gmfgraph.Figure;
25
import org.eclipse.gmf.gmfgraph.Figure;
24
import org.eclipse.gmf.gmfgraph.FigureMarker;
26
import org.eclipse.gmf.gmfgraph.FigureMarker;
Lines 53-58 Link Here
53
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabelImpl#getBorder <em>Border</em>}</li>
55
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabelImpl#getBorder <em>Border</em>}</li>
54
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabelImpl#getLocation <em>Location</em>}</li>
56
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabelImpl#getLocation <em>Location</em>}</li>
55
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabelImpl#getSize <em>Size</em>}</li>
57
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabelImpl#getSize <em>Size</em>}</li>
58
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabelImpl#getReferencingElements <em>Referencing Elements</em>}</li>
56
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabelImpl#getText <em>Text</em>}</li>
59
 *   <li>{@link org.eclipse.gmf.gmfgraph.impl.LabelImpl#getText <em>Text</em>}</li>
57
 * </ul>
60
 * </ul>
58
 * </p>
61
 * </p>
Lines 211-216 Link Here
211
	protected Point size = null;
214
	protected Point size = null;
212
215
213
	/**
216
	/**
217
	 * The cached value of the '{@link #getReferencingElements() <em>Referencing Elements</em>}' reference list.
218
	 * <!-- begin-user-doc -->
219
	 * <!-- end-user-doc -->
220
	 * @see #getReferencingElements()
221
	 * @generated
222
	 * @ordered
223
	 */
224
	protected EList referencingElements = null;
225
226
	/**
214
	 * The default value of the '{@link #getText() <em>Text</em>}' attribute.
227
	 * The default value of the '{@link #getText() <em>Text</em>}' attribute.
215
	 * <!-- begin-user-doc -->
228
	 * <!-- begin-user-doc -->
216
	 * <!-- end-user-doc -->
229
	 * <!-- end-user-doc -->
Lines 812-817 Link Here
812
	 * <!-- end-user-doc -->
825
	 * <!-- end-user-doc -->
813
	 * @generated
826
	 * @generated
814
	 */
827
	 */
828
	public EList getReferencingElements() {
829
		if (referencingElements == null) {
830
			referencingElements = new EObjectWithInverseResolvingEList(DiagramElement.class, this, GMFGraphPackage.LABEL__REFERENCING_ELEMENTS, GMFGraphPackage.DIAGRAM_ELEMENT__FIGURE);
831
		}
832
		return referencingElements;
833
	}
834
835
	/**
836
	 * <!-- begin-user-doc -->
837
	 * <!-- end-user-doc -->
838
	 * @generated
839
	 */
815
	public String getText() {
840
	public String getText() {
816
		return text;
841
		return text;
817
	}
842
	}
Lines 845-850 Link Here
845
				return eBasicSetContainer(otherEnd, GMFGraphPackage.LABEL__PARENT, msgs);
870
				return eBasicSetContainer(otherEnd, GMFGraphPackage.LABEL__PARENT, msgs);
846
			case GMFGraphPackage.LABEL__CHILDREN:
871
			case GMFGraphPackage.LABEL__CHILDREN:
847
				return ((InternalEList)getChildren()).basicAdd(otherEnd, msgs);
872
				return ((InternalEList)getChildren()).basicAdd(otherEnd, msgs);
873
			case GMFGraphPackage.LABEL__REFERENCING_ELEMENTS:
874
				return ((InternalEList)getReferencingElements()).basicAdd(otherEnd, msgs);
848
		}
875
		}
849
		return super.eInverseAdd(otherEnd, featureID, msgs);
876
		return super.eInverseAdd(otherEnd, featureID, msgs);
850
	}
877
	}
Lines 884-889 Link Here
884
				return basicSetLocation(null, msgs);
911
				return basicSetLocation(null, msgs);
885
			case GMFGraphPackage.LABEL__SIZE:
912
			case GMFGraphPackage.LABEL__SIZE:
886
				return basicSetSize(null, msgs);
913
				return basicSetSize(null, msgs);
914
			case GMFGraphPackage.LABEL__REFERENCING_ELEMENTS:
915
				return ((InternalEList)getReferencingElements()).basicRemove(otherEnd, msgs);
887
		}
916
		}
888
		return super.eInverseRemove(otherEnd, featureID, msgs);
917
		return super.eInverseRemove(otherEnd, featureID, msgs);
889
	}
918
	}
Lines 938-943 Link Here
938
				return getLocation();
967
				return getLocation();
939
			case GMFGraphPackage.LABEL__SIZE:
968
			case GMFGraphPackage.LABEL__SIZE:
940
				return getSize();
969
				return getSize();
970
			case GMFGraphPackage.LABEL__REFERENCING_ELEMENTS:
971
				return getReferencingElements();
941
			case GMFGraphPackage.LABEL__TEXT:
972
			case GMFGraphPackage.LABEL__TEXT:
942
				return getText();
973
				return getText();
943
		}
974
		}
Lines 994-999 Link Here
994
			case GMFGraphPackage.LABEL__SIZE:
1025
			case GMFGraphPackage.LABEL__SIZE:
995
				setSize((Point)newValue);
1026
				setSize((Point)newValue);
996
				return;
1027
				return;
1028
			case GMFGraphPackage.LABEL__REFERENCING_ELEMENTS:
1029
				getReferencingElements().clear();
1030
				getReferencingElements().addAll((Collection)newValue);
1031
				return;
997
			case GMFGraphPackage.LABEL__TEXT:
1032
			case GMFGraphPackage.LABEL__TEXT:
998
				setText((String)newValue);
1033
				setText((String)newValue);
999
				return;
1034
				return;
Lines 1050-1055 Link Here
1050
			case GMFGraphPackage.LABEL__SIZE:
1085
			case GMFGraphPackage.LABEL__SIZE:
1051
				setSize((Point)null);
1086
				setSize((Point)null);
1052
				return;
1087
				return;
1088
			case GMFGraphPackage.LABEL__REFERENCING_ELEMENTS:
1089
				getReferencingElements().clear();
1090
				return;
1053
			case GMFGraphPackage.LABEL__TEXT:
1091
			case GMFGraphPackage.LABEL__TEXT:
1054
				setText(TEXT_EDEFAULT);
1092
				setText(TEXT_EDEFAULT);
1055
				return;
1093
				return;
Lines 1094-1099 Link Here
1094
				return location != null;
1132
				return location != null;
1095
			case GMFGraphPackage.LABEL__SIZE:
1133
			case GMFGraphPackage.LABEL__SIZE:
1096
				return size != null;
1134
				return size != null;
1135
			case GMFGraphPackage.LABEL__REFERENCING_ELEMENTS:
1136
				return referencingElements != null && !referencingElements.isEmpty();
1097
			case GMFGraphPackage.LABEL__TEXT:
1137
			case GMFGraphPackage.LABEL__TEXT:
1098
				return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text);
1138
				return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text);
1099
		}
1139
		}
(-)src/org/eclipse/gmf/gmfgraph/impl/DiagramElementImpl.java (-3 / +42 lines)
Lines 149-159 Link Here
149
	 * <!-- end-user-doc -->
149
	 * <!-- end-user-doc -->
150
	 * @generated
150
	 * @generated
151
	 */
151
	 */
152
	public void setFigure(Figure newFigure) {
152
	public NotificationChain basicSetFigure(Figure newFigure, NotificationChain msgs) {
153
		Figure oldFigure = figure;
153
		Figure oldFigure = figure;
154
		figure = newFigure;
154
		figure = newFigure;
155
		if (eNotificationRequired())
155
		if (eNotificationRequired()) {
156
			eNotify(new ENotificationImpl(this, Notification.SET, GMFGraphPackage.DIAGRAM_ELEMENT__FIGURE, oldFigure, figure));
156
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GMFGraphPackage.DIAGRAM_ELEMENT__FIGURE, oldFigure, newFigure);
157
			if (msgs == null) msgs = notification; else msgs.add(notification);
158
		}
159
		return msgs;
160
	}
161
162
	/**
163
	 * <!-- begin-user-doc -->
164
	 * <!-- end-user-doc -->
165
	 * @generated
166
	 */
167
	public void setFigure(Figure newFigure) {
168
		if (newFigure != figure) {
169
			NotificationChain msgs = null;
170
			if (figure != null)
171
				msgs = ((InternalEObject)figure).eInverseRemove(this, GMFGraphPackage.FIGURE__REFERENCING_ELEMENTS, Figure.class, msgs);
172
			if (newFigure != null)
173
				msgs = ((InternalEObject)newFigure).eInverseAdd(this, GMFGraphPackage.FIGURE__REFERENCING_ELEMENTS, Figure.class, msgs);
174
			msgs = basicSetFigure(newFigure, msgs);
175
			if (msgs != null) msgs.dispatch();
176
		}
177
		else if (eNotificationRequired())
178
			eNotify(new ENotificationImpl(this, Notification.SET, GMFGraphPackage.DIAGRAM_ELEMENT__FIGURE, newFigure, newFigure));
157
	}
179
	}
158
180
159
	/**
181
	/**
Lines 194-201 Link Here
194
	 * <!-- end-user-doc -->
216
	 * <!-- end-user-doc -->
195
	 * @generated
217
	 * @generated
196
	 */
218
	 */
219
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
220
		switch (featureID) {
221
			case GMFGraphPackage.DIAGRAM_ELEMENT__FIGURE:
222
				if (figure != null)
223
					msgs = ((InternalEObject)figure).eInverseRemove(this, GMFGraphPackage.FIGURE__REFERENCING_ELEMENTS, Figure.class, msgs);
224
				return basicSetFigure((Figure)otherEnd, msgs);
225
		}
226
		return super.eInverseAdd(otherEnd, featureID, msgs);
227
	}
228
229
	/**
230
	 * <!-- begin-user-doc -->
231
	 * <!-- end-user-doc -->
232
	 * @generated
233
	 */
197
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
234
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
198
		switch (featureID) {
235
		switch (featureID) {
236
			case GMFGraphPackage.DIAGRAM_ELEMENT__FIGURE:
237
				return basicSetFigure(null, msgs);
199
			case GMFGraphPackage.DIAGRAM_ELEMENT__FACETS:
238
			case GMFGraphPackage.DIAGRAM_ELEMENT__FACETS:
200
				return ((InternalEList)getFacets()).basicRemove(otherEnd, msgs);
239
				return ((InternalEList)getFacets()).basicRemove(otherEnd, msgs);
201
		}
240
		}
(-)models/gmfgraph.ecore (-1 / +3 lines)
Lines 44-50 Link Here
44
      <eParameters name="facetClass" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass"/>
44
      <eParameters name="facetClass" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaClass"/>
45
    </eOperations>
45
    </eOperations>
46
    <eStructuralFeatures xsi:type="ecore:EReference" name="figure" lowerBound="1"
46
    <eStructuralFeatures xsi:type="ecore:EReference" name="figure" lowerBound="1"
47
        eType="#//Figure"/>
47
        eType="#//Figure" eOpposite="#//Figure/referencingElements"/>
48
    <eStructuralFeatures xsi:type="ecore:EReference" name="facets" upperBound="-1"
48
    <eStructuralFeatures xsi:type="ecore:EReference" name="facets" upperBound="-1"
49
        eType="#//VisualFacet" containment="true">
49
        eType="#//VisualFacet" containment="true">
50
      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
50
      <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
Lines 117-122 Link Here
117
        containment="true"/>
117
        containment="true"/>
118
    <eStructuralFeatures xsi:type="ecore:EReference" name="size" eType="#//Point"
118
    <eStructuralFeatures xsi:type="ecore:EReference" name="size" eType="#//Point"
119
        containment="true"/>
119
        containment="true"/>
120
    <eStructuralFeatures xsi:type="ecore:EReference" name="referencingElements" upperBound="-1"
121
        eType="#//DiagramElement" eOpposite="#//DiagramElement/figure"/>
120
  </eClassifiers>
122
  </eClassifiers>
121
  <eClassifiers xsi:type="ecore:EClass" name="FigureRef" eSuperTypes="#//FigureMarker">
123
  <eClassifiers xsi:type="ecore:EClass" name="FigureRef" eSuperTypes="#//FigureMarker">
122
    <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
124
    <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
(-)models/gmfgraph.genmodel (+1 lines)
Lines 119-124 Link Here
119
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgraph.ecore#//Figure/border"/>
119
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgraph.ecore#//Figure/border"/>
120
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgraph.ecore#//Figure/location"/>
120
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgraph.ecore#//Figure/location"/>
121
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgraph.ecore#//Figure/size"/>
121
      <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgraph.ecore#//Figure/size"/>
122
      <genFeatures property="None" notify="false" createChild="false" ecoreFeature="ecore:EReference gmfgraph.ecore#//Figure/referencingElements"/>
122
    </genClasses>
123
    </genClasses>
123
    <genClasses ecoreClass="gmfgraph.ecore#//FigureRef">
124
    <genClasses ecoreClass="gmfgraph.ecore#//FigureRef">
124
      <genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference gmfgraph.ecore#//FigureRef/figure"/>
125
      <genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference gmfgraph.ecore#//FigureRef/figure"/>
(-)src/org/eclipse/gmf/gmfgraph/DiagramElement.java (-1 / +3 lines)
Lines 28-33 Link Here
28
public interface DiagramElement extends Identity {
28
public interface DiagramElement extends Identity {
29
	/**
29
	/**
30
	 * Returns the value of the '<em><b>Figure</b></em>' reference.
30
	 * Returns the value of the '<em><b>Figure</b></em>' reference.
31
	 * It is bidirectional and its opposite is '{@link org.eclipse.gmf.gmfgraph.Figure#getReferencingElements <em>Referencing Elements</em>}'.
31
	 * <!-- begin-user-doc -->
32
	 * <!-- begin-user-doc -->
32
	 * <p>
33
	 * <p>
33
	 * If the meaning of the '<em>Figure</em>' reference isn't clear,
34
	 * If the meaning of the '<em>Figure</em>' reference isn't clear,
Lines 37-43 Link Here
37
	 * @return the value of the '<em>Figure</em>' reference.
38
	 * @return the value of the '<em>Figure</em>' reference.
38
	 * @see #setFigure(Figure)
39
	 * @see #setFigure(Figure)
39
	 * @see org.eclipse.gmf.gmfgraph.GMFGraphPackage#getDiagramElement_Figure()
40
	 * @see org.eclipse.gmf.gmfgraph.GMFGraphPackage#getDiagramElement_Figure()
40
	 * @model required="true"
41
	 * @see org.eclipse.gmf.gmfgraph.Figure#getReferencingElements
42
	 * @model opposite="referencingElements" required="true"
41
	 * @generated
43
	 * @generated
42
	 */
44
	 */
43
	Figure getFigure();
45
	Figure getFigure();
(-)src/org/eclipse/gmf/gmfgraph/Figure.java (+19 lines)
Lines 31-36 Link Here
31
 *   <li>{@link org.eclipse.gmf.gmfgraph.Figure#getBorder <em>Border</em>}</li>
31
 *   <li>{@link org.eclipse.gmf.gmfgraph.Figure#getBorder <em>Border</em>}</li>
32
 *   <li>{@link org.eclipse.gmf.gmfgraph.Figure#getLocation <em>Location</em>}</li>
32
 *   <li>{@link org.eclipse.gmf.gmfgraph.Figure#getLocation <em>Location</em>}</li>
33
 *   <li>{@link org.eclipse.gmf.gmfgraph.Figure#getSize <em>Size</em>}</li>
33
 *   <li>{@link org.eclipse.gmf.gmfgraph.Figure#getSize <em>Size</em>}</li>
34
 *   <li>{@link org.eclipse.gmf.gmfgraph.Figure#getReferencingElements <em>Referencing Elements</em>}</li>
34
 * </ul>
35
 * </ul>
35
 * </p>
36
 * </p>
36
 *
37
 *
Lines 317-320 Link Here
317
	 */
318
	 */
318
	void setSize(Point value);
319
	void setSize(Point value);
319
320
321
	/**
322
	 * Returns the value of the '<em><b>Referencing Elements</b></em>' reference list.
323
	 * The list contents are of type {@link org.eclipse.gmf.gmfgraph.DiagramElement}.
324
	 * It is bidirectional and its opposite is '{@link org.eclipse.gmf.gmfgraph.DiagramElement#getFigure <em>Figure</em>}'.
325
	 * <!-- begin-user-doc -->
326
	 * <p>
327
	 * If the meaning of the '<em>Referencing Elements</em>' reference list isn't clear,
328
	 * there really should be more of a description here...
329
	 * </p>
330
	 * <!-- end-user-doc -->
331
	 * @return the value of the '<em>Referencing Elements</em>' reference list.
332
	 * @see org.eclipse.gmf.gmfgraph.GMFGraphPackage#getFigure_ReferencingElements()
333
	 * @see org.eclipse.gmf.gmfgraph.DiagramElement#getFigure
334
	 * @model type="org.eclipse.gmf.gmfgraph.DiagramElement" opposite="figure"
335
	 * @generated
336
	 */
337
	EList getReferencingElements();
338
320
} // Figure
339
} // Figure
(-)src/org/eclipse/gmf/gmfgraph/GMFGraphPackage.java (-1 / +165 lines)
Lines 897-909 Link Here
897
	int FIGURE__SIZE = FIGURE_MARKER_FEATURE_COUNT + 11;
897
	int FIGURE__SIZE = FIGURE_MARKER_FEATURE_COUNT + 11;
898
898
899
	/**
899
	/**
900
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
901
	 * <!-- begin-user-doc -->
902
	 * <!-- end-user-doc -->
903
	 * @generated
904
	 * @ordered
905
	 */
906
	int FIGURE__REFERENCING_ELEMENTS = FIGURE_MARKER_FEATURE_COUNT + 12;
907
908
	/**
900
	 * The number of structural features of the '<em>Figure</em>' class.
909
	 * The number of structural features of the '<em>Figure</em>' class.
901
	 * <!-- begin-user-doc -->
910
	 * <!-- begin-user-doc -->
902
	 * <!-- end-user-doc -->
911
	 * <!-- end-user-doc -->
903
	 * @generated
912
	 * @generated
904
	 * @ordered
913
	 * @ordered
905
	 */
914
	 */
906
	int FIGURE_FEATURE_COUNT = FIGURE_MARKER_FEATURE_COUNT + 12;
915
	int FIGURE_FEATURE_COUNT = FIGURE_MARKER_FEATURE_COUNT + 13;
907
916
908
	/**
917
	/**
909
	 * The meta object id for the '{@link org.eclipse.gmf.gmfgraph.impl.FigureRefImpl <em>Figure Ref</em>}' class.
918
	 * The meta object id for the '{@link org.eclipse.gmf.gmfgraph.impl.FigureRefImpl <em>Figure Ref</em>}' class.
Lines 1106-1111 Link Here
1106
	int CONNECTION_FIGURE__SIZE = FIGURE__SIZE;
1115
	int CONNECTION_FIGURE__SIZE = FIGURE__SIZE;
1107
1116
1108
	/**
1117
	/**
1118
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
1119
	 * <!-- begin-user-doc -->
1120
	 * <!-- end-user-doc -->
1121
	 * @generated
1122
	 * @ordered
1123
	 */
1124
	int CONNECTION_FIGURE__REFERENCING_ELEMENTS = FIGURE__REFERENCING_ELEMENTS;
1125
1126
	/**
1109
	 * The number of structural features of the '<em>Connection Figure</em>' class.
1127
	 * The number of structural features of the '<em>Connection Figure</em>' class.
1110
	 * <!-- begin-user-doc -->
1128
	 * <!-- begin-user-doc -->
1111
	 * <!-- end-user-doc -->
1129
	 * <!-- end-user-doc -->
Lines 1260-1265 Link Here
1260
	int DECORATION_FIGURE__SIZE = FIGURE__SIZE;
1278
	int DECORATION_FIGURE__SIZE = FIGURE__SIZE;
1261
1279
1262
	/**
1280
	/**
1281
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
1282
	 * <!-- begin-user-doc -->
1283
	 * <!-- end-user-doc -->
1284
	 * @generated
1285
	 * @ordered
1286
	 */
1287
	int DECORATION_FIGURE__REFERENCING_ELEMENTS = FIGURE__REFERENCING_ELEMENTS;
1288
1289
	/**
1263
	 * The number of structural features of the '<em>Decoration Figure</em>' class.
1290
	 * The number of structural features of the '<em>Decoration Figure</em>' class.
1264
	 * <!-- begin-user-doc -->
1291
	 * <!-- begin-user-doc -->
1265
	 * <!-- end-user-doc -->
1292
	 * <!-- end-user-doc -->
Lines 1414-1419 Link Here
1414
	int SHAPE__SIZE = FIGURE__SIZE;
1441
	int SHAPE__SIZE = FIGURE__SIZE;
1415
1442
1416
	/**
1443
	/**
1444
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
1445
	 * <!-- begin-user-doc -->
1446
	 * <!-- end-user-doc -->
1447
	 * @generated
1448
	 * @ordered
1449
	 */
1450
	int SHAPE__REFERENCING_ELEMENTS = FIGURE__REFERENCING_ELEMENTS;
1451
1452
	/**
1417
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
1453
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
1418
	 * <!-- begin-user-doc -->
1454
	 * <!-- begin-user-doc -->
1419
	 * <!-- end-user-doc -->
1455
	 * <!-- end-user-doc -->
Lines 1631-1636 Link Here
1631
	int LABEL__SIZE = FIGURE__SIZE;
1667
	int LABEL__SIZE = FIGURE__SIZE;
1632
1668
1633
	/**
1669
	/**
1670
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
1671
	 * <!-- begin-user-doc -->
1672
	 * <!-- end-user-doc -->
1673
	 * @generated
1674
	 * @ordered
1675
	 */
1676
	int LABEL__REFERENCING_ELEMENTS = FIGURE__REFERENCING_ELEMENTS;
1677
1678
	/**
1634
	 * The feature id for the '<em><b>Text</b></em>' attribute.
1679
	 * The feature id for the '<em><b>Text</b></em>' attribute.
1635
	 * <!-- begin-user-doc -->
1680
	 * <!-- begin-user-doc -->
1636
	 * <!-- end-user-doc -->
1681
	 * <!-- end-user-doc -->
Lines 1794-1799 Link Here
1794
	int LABELED_CONTAINER__SIZE = FIGURE__SIZE;
1839
	int LABELED_CONTAINER__SIZE = FIGURE__SIZE;
1795
1840
1796
	/**
1841
	/**
1842
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
1843
	 * <!-- begin-user-doc -->
1844
	 * <!-- end-user-doc -->
1845
	 * @generated
1846
	 * @ordered
1847
	 */
1848
	int LABELED_CONTAINER__REFERENCING_ELEMENTS = FIGURE__REFERENCING_ELEMENTS;
1849
1850
	/**
1797
	 * The number of structural features of the '<em>Labeled Container</em>' class.
1851
	 * The number of structural features of the '<em>Labeled Container</em>' class.
1798
	 * <!-- begin-user-doc -->
1852
	 * <!-- begin-user-doc -->
1799
	 * <!-- end-user-doc -->
1853
	 * <!-- end-user-doc -->
Lines 1948-1953 Link Here
1948
	int RECTANGLE__SIZE = SHAPE__SIZE;
2002
	int RECTANGLE__SIZE = SHAPE__SIZE;
1949
2003
1950
	/**
2004
	/**
2005
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
2006
	 * <!-- begin-user-doc -->
2007
	 * <!-- end-user-doc -->
2008
	 * @generated
2009
	 * @ordered
2010
	 */
2011
	int RECTANGLE__REFERENCING_ELEMENTS = SHAPE__REFERENCING_ELEMENTS;
2012
2013
	/**
1951
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
2014
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
1952
	 * <!-- begin-user-doc -->
2015
	 * <!-- begin-user-doc -->
1953
	 * <!-- end-user-doc -->
2016
	 * <!-- end-user-doc -->
Lines 2165-2170 Link Here
2165
	int ROUNDED_RECTANGLE__SIZE = SHAPE__SIZE;
2228
	int ROUNDED_RECTANGLE__SIZE = SHAPE__SIZE;
2166
2229
2167
	/**
2230
	/**
2231
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
2232
	 * <!-- begin-user-doc -->
2233
	 * <!-- end-user-doc -->
2234
	 * @generated
2235
	 * @ordered
2236
	 */
2237
	int ROUNDED_RECTANGLE__REFERENCING_ELEMENTS = SHAPE__REFERENCING_ELEMENTS;
2238
2239
	/**
2168
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
2240
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
2169
	 * <!-- begin-user-doc -->
2241
	 * <!-- begin-user-doc -->
2170
	 * <!-- end-user-doc -->
2242
	 * <!-- end-user-doc -->
Lines 2400-2405 Link Here
2400
	int ELLIPSE__SIZE = SHAPE__SIZE;
2472
	int ELLIPSE__SIZE = SHAPE__SIZE;
2401
2473
2402
	/**
2474
	/**
2475
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
2476
	 * <!-- begin-user-doc -->
2477
	 * <!-- end-user-doc -->
2478
	 * @generated
2479
	 * @ordered
2480
	 */
2481
	int ELLIPSE__REFERENCING_ELEMENTS = SHAPE__REFERENCING_ELEMENTS;
2482
2483
	/**
2403
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
2484
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
2404
	 * <!-- begin-user-doc -->
2485
	 * <!-- begin-user-doc -->
2405
	 * <!-- end-user-doc -->
2486
	 * <!-- end-user-doc -->
Lines 2617-2622 Link Here
2617
	int POLYLINE__SIZE = SHAPE__SIZE;
2698
	int POLYLINE__SIZE = SHAPE__SIZE;
2618
2699
2619
	/**
2700
	/**
2701
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
2702
	 * <!-- begin-user-doc -->
2703
	 * <!-- end-user-doc -->
2704
	 * @generated
2705
	 * @ordered
2706
	 */
2707
	int POLYLINE__REFERENCING_ELEMENTS = SHAPE__REFERENCING_ELEMENTS;
2708
2709
	/**
2620
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
2710
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
2621
	 * <!-- begin-user-doc -->
2711
	 * <!-- begin-user-doc -->
2622
	 * <!-- end-user-doc -->
2712
	 * <!-- end-user-doc -->
Lines 2843-2848 Link Here
2843
	int POLYGON__SIZE = POLYLINE__SIZE;
2933
	int POLYGON__SIZE = POLYLINE__SIZE;
2844
2934
2845
	/**
2935
	/**
2936
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
2937
	 * <!-- begin-user-doc -->
2938
	 * <!-- end-user-doc -->
2939
	 * @generated
2940
	 * @ordered
2941
	 */
2942
	int POLYGON__REFERENCING_ELEMENTS = POLYLINE__REFERENCING_ELEMENTS;
2943
2944
	/**
2846
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
2945
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
2847
	 * <!-- begin-user-doc -->
2946
	 * <!-- begin-user-doc -->
2848
	 * <!-- end-user-doc -->
2947
	 * <!-- end-user-doc -->
Lines 3069-3074 Link Here
3069
	int POLYLINE_CONNECTION__SIZE = POLYLINE__SIZE;
3168
	int POLYLINE_CONNECTION__SIZE = POLYLINE__SIZE;
3070
3169
3071
	/**
3170
	/**
3171
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
3172
	 * <!-- begin-user-doc -->
3173
	 * <!-- end-user-doc -->
3174
	 * @generated
3175
	 * @ordered
3176
	 */
3177
	int POLYLINE_CONNECTION__REFERENCING_ELEMENTS = POLYLINE__REFERENCING_ELEMENTS;
3178
3179
	/**
3072
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
3180
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
3073
	 * <!-- begin-user-doc -->
3181
	 * <!-- begin-user-doc -->
3074
	 * <!-- end-user-doc -->
3182
	 * <!-- end-user-doc -->
Lines 3313-3318 Link Here
3313
	int POLYLINE_DECORATION__SIZE = POLYLINE__SIZE;
3421
	int POLYLINE_DECORATION__SIZE = POLYLINE__SIZE;
3314
3422
3315
	/**
3423
	/**
3424
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
3425
	 * <!-- begin-user-doc -->
3426
	 * <!-- end-user-doc -->
3427
	 * @generated
3428
	 * @ordered
3429
	 */
3430
	int POLYLINE_DECORATION__REFERENCING_ELEMENTS = POLYLINE__REFERENCING_ELEMENTS;
3431
3432
	/**
3316
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
3433
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
3317
	 * <!-- begin-user-doc -->
3434
	 * <!-- begin-user-doc -->
3318
	 * <!-- end-user-doc -->
3435
	 * <!-- end-user-doc -->
Lines 3539-3544 Link Here
3539
	int POLYGON_DECORATION__SIZE = POLYGON__SIZE;
3656
	int POLYGON_DECORATION__SIZE = POLYGON__SIZE;
3540
3657
3541
	/**
3658
	/**
3659
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
3660
	 * <!-- begin-user-doc -->
3661
	 * <!-- end-user-doc -->
3662
	 * @generated
3663
	 * @ordered
3664
	 */
3665
	int POLYGON_DECORATION__REFERENCING_ELEMENTS = POLYGON__REFERENCING_ELEMENTS;
3666
3667
	/**
3542
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
3668
	 * The feature id for the '<em><b>Outline</b></em>' attribute.
3543
	 * <!-- begin-user-doc -->
3669
	 * <!-- begin-user-doc -->
3544
	 * <!-- end-user-doc -->
3670
	 * <!-- end-user-doc -->
Lines 3811-3816 Link Here
3811
	int CUSTOM_FIGURE__SIZE = FIGURE__SIZE;
3937
	int CUSTOM_FIGURE__SIZE = FIGURE__SIZE;
3812
3938
3813
	/**
3939
	/**
3940
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
3941
	 * <!-- begin-user-doc -->
3942
	 * <!-- end-user-doc -->
3943
	 * @generated
3944
	 * @ordered
3945
	 */
3946
	int CUSTOM_FIGURE__REFERENCING_ELEMENTS = FIGURE__REFERENCING_ELEMENTS;
3947
3948
	/**
3814
	 * The feature id for the '<em><b>Qualified Class Name</b></em>' attribute.
3949
	 * The feature id for the '<em><b>Qualified Class Name</b></em>' attribute.
3815
	 * <!-- begin-user-doc -->
3950
	 * <!-- begin-user-doc -->
3816
	 * <!-- end-user-doc -->
3951
	 * <!-- end-user-doc -->
Lines 3992-3997 Link Here
3992
	int CUSTOM_DECORATION__SIZE = CUSTOM_FIGURE__SIZE;
4127
	int CUSTOM_DECORATION__SIZE = CUSTOM_FIGURE__SIZE;
3993
4128
3994
	/**
4129
	/**
4130
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
4131
	 * <!-- begin-user-doc -->
4132
	 * <!-- end-user-doc -->
4133
	 * @generated
4134
	 * @ordered
4135
	 */
4136
	int CUSTOM_DECORATION__REFERENCING_ELEMENTS = CUSTOM_FIGURE__REFERENCING_ELEMENTS;
4137
4138
	/**
3995
	 * The feature id for the '<em><b>Qualified Class Name</b></em>' attribute.
4139
	 * The feature id for the '<em><b>Qualified Class Name</b></em>' attribute.
3996
	 * <!-- begin-user-doc -->
4140
	 * <!-- begin-user-doc -->
3997
	 * <!-- end-user-doc -->
4141
	 * <!-- end-user-doc -->
Lines 4173-4178 Link Here
4173
	int CUSTOM_CONNECTION__SIZE = CUSTOM_FIGURE__SIZE;
4317
	int CUSTOM_CONNECTION__SIZE = CUSTOM_FIGURE__SIZE;
4174
4318
4175
	/**
4319
	/**
4320
	 * The feature id for the '<em><b>Referencing Elements</b></em>' reference list.
4321
	 * <!-- begin-user-doc -->
4322
	 * <!-- end-user-doc -->
4323
	 * @generated
4324
	 * @ordered
4325
	 */
4326
	int CUSTOM_CONNECTION__REFERENCING_ELEMENTS = CUSTOM_FIGURE__REFERENCING_ELEMENTS;
4327
4328
	/**
4176
	 * The feature id for the '<em><b>Qualified Class Name</b></em>' attribute.
4329
	 * The feature id for the '<em><b>Qualified Class Name</b></em>' attribute.
4177
	 * <!-- begin-user-doc -->
4330
	 * <!-- begin-user-doc -->
4178
	 * <!-- end-user-doc -->
4331
	 * <!-- end-user-doc -->
Lines 5825-5830 Link Here
5825
	EReference getFigure_Size();
5978
	EReference getFigure_Size();
5826
5979
5827
	/**
5980
	/**
5981
	 * Returns the meta object for the reference list '{@link org.eclipse.gmf.gmfgraph.Figure#getReferencingElements <em>Referencing Elements</em>}'.
5982
	 * <!-- begin-user-doc -->
5983
	 * <!-- end-user-doc -->
5984
	 * @return the meta object for the reference list '<em>Referencing Elements</em>'.
5985
	 * @see org.eclipse.gmf.gmfgraph.Figure#getReferencingElements()
5986
	 * @see #getFigure()
5987
	 * @generated
5988
	 */
5989
	EReference getFigure_ReferencingElements();
5990
5991
	/**
5828
	 * Returns the meta object for class '{@link org.eclipse.gmf.gmfgraph.FigureRef <em>Figure Ref</em>}'.
5992
	 * Returns the meta object for class '{@link org.eclipse.gmf.gmfgraph.FigureRef <em>Figure Ref</em>}'.
5829
	 * <!-- begin-user-doc -->
5993
	 * <!-- begin-user-doc -->
5830
	 * <!-- end-user-doc -->
5994
	 * <!-- end-user-doc -->
(-)templates/layoutData/BorderLayoutData.javajet (-1 / +1 lines)
Lines 36-40 Link Here
36
		throw new IllegalArgumentException("Unknown Alignment: " + gmfLayoutData.getAlignment());
36
		throw new IllegalArgumentException("Unknown Alignment: " + gmfLayoutData.getAlignment());
37
}
37
}
38
%>
38
%>
39
		<%=argsBundle.getManagerVariableName()%>.setConstraint(<%=figureVarName%>, <%=dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout")%>.<%=constantName%>);
39
	Object <%=argsBundle.getConstraintVariableName()%> = <%=dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout")%>.<%=constantName%>;
40
40
(-)templates/layoutData/XYLayoutData.javajet (-1 lines)
Lines 30-33 Link Here
30
<%
30
<%
31
}
31
}
32
%>
32
%>
33
			<%=layoutManagerVarName%>.setConstraint(<%=figureVarName%>, <%=layoutConstraintVarName%>);
(-)templates/layoutData/GridLayoutData.javajet (-1 lines)
Lines 28-32 Link Here
28
			<%=layoutConstraintVarName%>.verticalSpan = <%=gmfLayoutData.getVerticalSpan()%>;
28
			<%=layoutConstraintVarName%>.verticalSpan = <%=gmfLayoutData.getVerticalSpan()%>;
29
			<%=layoutConstraintVarName%>.grabExcessHorizontalSpace = <%=gmfLayoutData.isGrabExcessHorizontalSpace()%>;
29
			<%=layoutConstraintVarName%>.grabExcessHorizontalSpace = <%=gmfLayoutData.isGrabExcessHorizontalSpace()%>;
30
			<%=layoutConstraintVarName%>.grabExcessVerticalSpace = <%=gmfLayoutData.isGrabExcessVerticalSpace()%>;
30
			<%=layoutConstraintVarName%>.grabExcessVerticalSpace = <%=gmfLayoutData.isGrabExcessVerticalSpace()%>;
31
			<%=layoutManagerVarName%>.setConstraint(<%=figureVarName%>, <%=layoutConstraintVarName%>);
32
31
(-)templates/layoutData/CustomLayoutData.javajet (-1 / +1 lines)
Lines 8-11 Link Here
8
%>
8
%>
9
<%=layoutImplClassName%> <%=args.getConstraintVariableName()%> = new <%=layoutImplClassName%>();
9
<%=layoutImplClassName%> <%=args.getConstraintVariableName()%> = new <%=layoutImplClassName%>();
10
<%=dispatcher.dispatch("customAttributes", new Object[] {layoutData, dispatcher, args.getConstraintVariableName()})%>
10
<%=dispatcher.dispatch("customAttributes", new Object[] {layoutData, dispatcher, args.getConstraintVariableName()})%>
11
<%=args.getManagerVariableName()%>.setConstraint(<%=args.getVariableName()%>, <%=args.getConstraintVariableName()%>);
11
(-)src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java (-11 / +2 lines)
Lines 38-48 Link Here
38
  protected final String TEXT_21 = ".grabExcessHorizontalSpace = ";
38
  protected final String TEXT_21 = ".grabExcessHorizontalSpace = ";
39
  protected final String TEXT_22 = ";" + NL + "\t\t\t";
39
  protected final String TEXT_22 = ";" + NL + "\t\t\t";
40
  protected final String TEXT_23 = ".grabExcessVerticalSpace = ";
40
  protected final String TEXT_23 = ".grabExcessVerticalSpace = ";
41
  protected final String TEXT_24 = ";" + NL + "\t\t\t";
41
  protected final String TEXT_24 = ";" + NL;
42
  protected final String TEXT_25 = ".setConstraint(";
42
  protected final String TEXT_25 = NL;
43
  protected final String TEXT_26 = ", ";
44
  protected final String TEXT_27 = ");" + NL;
45
  protected final String TEXT_28 = NL;
46
43
47
  public String generate(Object argument)
44
  public String generate(Object argument)
48
  {
45
  {
Lines 109-121 Link Here
109
    stringBuffer.append(TEXT_23);
106
    stringBuffer.append(TEXT_23);
110
    stringBuffer.append(gmfLayoutData.isGrabExcessVerticalSpace());
107
    stringBuffer.append(gmfLayoutData.isGrabExcessVerticalSpace());
111
    stringBuffer.append(TEXT_24);
108
    stringBuffer.append(TEXT_24);
112
    stringBuffer.append(layoutManagerVarName);
113
    stringBuffer.append(TEXT_25);
109
    stringBuffer.append(TEXT_25);
114
    stringBuffer.append(figureVarName);
115
    stringBuffer.append(TEXT_26);
116
    stringBuffer.append(layoutConstraintVarName);
117
    stringBuffer.append(TEXT_27);
118
    stringBuffer.append(TEXT_28);
119
    return stringBuffer.toString();
110
    return stringBuffer.toString();
120
  }
111
  }
121
}
112
}
(-)src/org/eclipse/gmf/graphdef/codegen/templates/InitCustomLayoutDataGenerator.java (-10 / +1 lines)
Lines 21-30 Link Here
21
  protected final String TEXT_4 = "();";
21
  protected final String TEXT_4 = "();";
22
  protected final String TEXT_5 = NL;
22
  protected final String TEXT_5 = NL;
23
  protected final String TEXT_6 = NL;
23
  protected final String TEXT_6 = NL;
24
  protected final String TEXT_7 = ".setConstraint(";
24
  protected final String TEXT_7 = NL;
25
  protected final String TEXT_8 = ", ";
26
  protected final String TEXT_9 = ");";
27
  protected final String TEXT_10 = NL;
28
25
29
  public String generate(Object argument)
26
  public String generate(Object argument)
30
  {
27
  {
Lines 45-57 Link Here
45
    stringBuffer.append(TEXT_5);
42
    stringBuffer.append(TEXT_5);
46
    stringBuffer.append(dispatcher.dispatch("customAttributes", new Object[] {layoutData, dispatcher, args.getConstraintVariableName()}));
43
    stringBuffer.append(dispatcher.dispatch("customAttributes", new Object[] {layoutData, dispatcher, args.getConstraintVariableName()}));
47
    stringBuffer.append(TEXT_6);
44
    stringBuffer.append(TEXT_6);
48
    stringBuffer.append(args.getManagerVariableName());
49
    stringBuffer.append(TEXT_7);
45
    stringBuffer.append(TEXT_7);
50
    stringBuffer.append(args.getVariableName());
51
    stringBuffer.append(TEXT_8);
52
    stringBuffer.append(args.getConstraintVariableName());
53
    stringBuffer.append(TEXT_9);
54
    stringBuffer.append(TEXT_10);
55
    return stringBuffer.toString();
46
    return stringBuffer.toString();
56
  }
47
  }
57
}
48
}
(-)src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java (-34 / +103 lines)
Lines 2-7 Link Here
2
2
3
import org.eclipse.gmf.gmfgraph.*;
3
import org.eclipse.gmf.gmfgraph.*;
4
import org.eclipse.gmf.graphdef.codegen.*;
4
import org.eclipse.gmf.graphdef.codegen.*;
5
import org.eclipse.gmf.common.codegen.*;
6
import org.eclipse.gmf.gmfgraph.util.*;
7
import org.eclipse.emf.codegen.util.CodeGenUtil;
5
import java.util.*;
8
import java.util.*;
6
9
7
public class FigureChildrenGenerator
10
public class FigureChildrenGenerator
Lines 16-78 Link Here
16
  }
19
  }
17
20
18
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
21
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
19
  protected final String TEXT_1 = "";
22
  protected final String TEXT_1 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void createContents(){";
20
  protected final String TEXT_2 = NL + "\t\t";
23
  protected final String TEXT_2 = NL + "\t\t";
21
  protected final String TEXT_3 = NL + "\t\t";
24
  protected final String TEXT_3 = NL + "\t\tsetFigure";
22
  protected final String TEXT_4 = ".add(";
25
  protected final String TEXT_4 = "(";
23
  protected final String TEXT_5 = ");" + NL + "\t\t";
26
  protected final String TEXT_5 = ");";
24
  protected final String TEXT_6 = NL;
27
  protected final String TEXT_6 = NL + "\t\t";
28
  protected final String TEXT_7 = NL + "\t\t";
29
  protected final String TEXT_8 = ".add(";
30
  protected final String TEXT_9 = ", ";
31
  protected final String TEXT_10 = ");";
32
  protected final String TEXT_11 = NL + "\t}" + NL + "\t";
33
  protected final String TEXT_12 = NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
34
  protected final String TEXT_13 = " f";
35
  protected final String TEXT_14 = "; " + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
36
  protected final String TEXT_15 = " getFigure";
37
  protected final String TEXT_16 = "() {" + NL + "\t\treturn f";
38
  protected final String TEXT_17 = ";" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setFigure";
39
  protected final String TEXT_18 = "(";
40
  protected final String TEXT_19 = " fig){" + NL + "\t\tf";
41
  protected final String TEXT_20 = " = fig;" + NL + "\t}" + NL;
25
42
26
  public String generate(Object argument)
43
  public String generate(Object argument)
27
  {
44
  {
28
    final StringBuffer stringBuffer = new StringBuffer();
45
    final StringBuffer stringBuffer = new StringBuffer();
29
    
46
    
30
Object[] args = (Object[]) argument;
47
GraphDefDispatcher.LayoutArgs parentArgs = (GraphDefDispatcher.LayoutArgs) argument;
31
List/*<Figure>*/ figureChildren = (List) args[0];
48
final Figure root = parentArgs.getFigure();
32
final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[1];
49
final GraphDefDispatcher dispatcher = parentArgs.getDispatcher();
33
GraphDefDispatcher.LayoutArgs parentArgs = (GraphDefDispatcher.LayoutArgs) args[2];
50
final ImportAssistant importManager = dispatcher.getImportManager();
51
52
final List/*<Figure>*/ fieldsRequired = new LinkedList/*<Figure>*/();
53
final Stack/*GraphDefDispatcher.LayoutArgs*/ contextStack = new Stack/*GraphDefDispatcher.LayoutArgs*/();
54
final LinkedList queue = new LinkedList();
55
final Object marker = new Object();
56
57
class FieldSupport {
58
	private final Figure myRoot;
59
60
	public FieldSupport(Figure root){
61
		myRoot = root;
62
	}
63
	
64
	public boolean isFieldRequired(Figure descendant){
65
		return myRoot.equals(descendant.getParent()) || !descendant.getReferencingElements().isEmpty();
66
	}
67
}
68
final FieldSupport fieldSupport = new FieldSupport(root);
69
34
70
35
    stringBuffer.append(TEXT_1);
71
    stringBuffer.append(TEXT_1);
36
    
72
    
37
LinkedList l = new LinkedList();
73
queue.addAll(root.getChildren());
38
l.addAll(figureChildren);
39
final Object marker = new Object();
40
Stack figureVarNamesStack = new Stack();
41
int figureCount = 0;
74
int figureCount = 0;
42
while (!l.isEmpty()) {
75
while (!queue.isEmpty()){
43
	Object _nxt = l.removeFirst();
76
	Object _nxt = queue.removeFirst();
44
	if (_nxt == marker) {
77
	if (_nxt == marker){
45
		parentArgs = (GraphDefDispatcher.LayoutArgs) figureVarNamesStack.pop();
78
		parentArgs = (GraphDefDispatcher.LayoutArgs)contextStack.pop();
46
		continue;
79
		continue;
47
	}
80
	}
48
	final FigureMarker figureMarker = (FigureMarker) _nxt;
81
	if (_nxt instanceof FigureRef) {
49
	if (figureMarker instanceof FigureRef) {
50
		throw new IllegalStateException("FIXME: sorry, don't support FigureRef for a while");
82
		throw new IllegalStateException("FIXME: sorry, don't support FigureRef for a while");
51
	}
83
	}
52
	final String figureVarName = "fig_" + figureCount;
84
	final Figure nextChild = (Figure) _nxt;	
53
	final String layoutManagerVarName = "layouter" + figureCount;
85
	final String childVarName = "fig_" + figureCount;
54
	final String layoutDataVarName = "layData" + figureCount;
86
	final String childLayoutManager = "layouter" + figureCount;
87
	final String childConstraint = "layData" + figureCount;
55
	figureCount++;
88
	figureCount++;
56
		// FIXME instantiate - FigureRef - dispatch to 'instantiate' template?
89
	
57
		GraphDefDispatcher.LayoutArgs nextLevelArgs = dispatcher.createLayoutArgs((Figure) figureMarker, figureVarName, layoutManagerVarName, layoutDataVarName);
90
	// FIXME instantiate - FigureRef - dispatch to 'instantiate' template?
91
	GraphDefDispatcher.LayoutArgs nextLevelArgs = dispatcher.createLayoutArgs(nextChild, childVarName, childLayoutManager, childConstraint);
58
    stringBuffer.append(TEXT_2);
92
    stringBuffer.append(TEXT_2);
59
    stringBuffer.append(dispatcher.dispatch("instantiate", nextLevelArgs));
93
    stringBuffer.append(dispatcher.dispatch("instantiate", nextLevelArgs));
94
    
95
if (fieldSupport.isFieldRequired(nextChild)){
96
	fieldsRequired.add(nextChild); 
60
    stringBuffer.append(TEXT_3);
97
    stringBuffer.append(TEXT_3);
61
    stringBuffer.append(parentArgs.getVariableName());
98
    stringBuffer.append(nextChild.getName());
62
    stringBuffer.append(TEXT_4);
99
    stringBuffer.append(TEXT_4);
63
    stringBuffer.append(figureVarName);
100
    stringBuffer.append(childVarName);
64
    stringBuffer.append(TEXT_5);
101
    stringBuffer.append(TEXT_5);
65
    stringBuffer.append(dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(nextLevelArgs, parentArgs.getManagerVariableName(), layoutDataVarName)));
102
    }
103
    stringBuffer.append(TEXT_6);
104
    stringBuffer.append(dispatcher.dispatch("createLayoutData", nextLevelArgs));
105
    stringBuffer.append(TEXT_7);
106
    stringBuffer.append(parentArgs.getVariableName());
107
    stringBuffer.append(TEXT_8);
108
    stringBuffer.append(childVarName);
109
    stringBuffer.append(TEXT_9);
110
    stringBuffer.append(childConstraint);
111
    stringBuffer.append(TEXT_10);
66
    
112
    
67
if (_nxt instanceof Figure && !((Figure) _nxt).getChildren().isEmpty()) {
113
	if (!nextChild.getChildren().isEmpty()) {
68
	l.addFirst(marker);
114
		queue.addFirst(marker);
69
	l.addAll(0, ((Figure) _nxt).getChildren());
115
		queue.addAll(0, nextChild.getChildren());
70
	figureVarNamesStack.push(parentArgs);
116
		contextStack.push(parentArgs);
71
	parentArgs = nextLevelArgs; // go on processing children of new parentFigure
117
		parentArgs = nextLevelArgs; // go on processing children of new parentFigure
72
} // if
118
	} 
73
} // while
119
} // while
74
120
75
    stringBuffer.append(TEXT_6);
121
    stringBuffer.append(TEXT_11);
122
    
123
	final FigureQualifiedNameSwitch fqnSwitch = dispatcher.getFQNSwitch();
124
	for (Iterator fieldFigures = fieldsRequired.iterator(); fieldFigures.hasNext();){
125
		Figure next = (Figure)fieldFigures.next(); 
126
		final String nextClassName = fqnSwitch.get(next, importManager);
127
    stringBuffer.append(TEXT_12);
128
    stringBuffer.append(nextClassName);
129
    stringBuffer.append(TEXT_13);
130
    stringBuffer.append(CodeGenUtil.capName(next.getName()));
131
    stringBuffer.append(TEXT_14);
132
    stringBuffer.append(nextClassName);
133
    stringBuffer.append(TEXT_15);
134
    stringBuffer.append(next.getName());
135
    stringBuffer.append(TEXT_16);
136
    stringBuffer.append(CodeGenUtil.capName(next.getName()));
137
    stringBuffer.append(TEXT_17);
138
    stringBuffer.append(next.getName());
139
    stringBuffer.append(TEXT_18);
140
    stringBuffer.append(nextClassName);
141
    stringBuffer.append(TEXT_19);
142
    stringBuffer.append(CodeGenUtil.capName(next.getName()));
143
    stringBuffer.append(TEXT_20);
144
    	}
76
    return stringBuffer.toString();
145
    return stringBuffer.toString();
77
  }
146
  }
78
}
147
}
(-)src/org/eclipse/gmf/graphdef/codegen/templates/InitXYLayoutDataGenerator.java (-12 / +1 lines)
Lines 29-39 Link Here
29
  protected final String TEXT_12 = ";" + NL + "\t\t\t";
29
  protected final String TEXT_12 = ";" + NL + "\t\t\t";
30
  protected final String TEXT_13 = ".height = ";
30
  protected final String TEXT_13 = ".height = ";
31
  protected final String TEXT_14 = ";";
31
  protected final String TEXT_14 = ";";
32
  protected final String TEXT_15 = NL + "\t\t\t";
32
  protected final String TEXT_15 = NL;
33
  protected final String TEXT_16 = ".setConstraint(";
34
  protected final String TEXT_17 = ", ";
35
  protected final String TEXT_18 = ");";
36
  protected final String TEXT_19 = NL;
37
33
38
  public String generate(Object argument)
34
  public String generate(Object argument)
39
  {
35
  {
Lines 88-100 Link Here
88
}
84
}
89
85
90
    stringBuffer.append(TEXT_15);
86
    stringBuffer.append(TEXT_15);
91
    stringBuffer.append(layoutManagerVarName);
92
    stringBuffer.append(TEXT_16);
93
    stringBuffer.append(figureVarName);
94
    stringBuffer.append(TEXT_17);
95
    stringBuffer.append(layoutConstraintVarName);
96
    stringBuffer.append(TEXT_18);
97
    stringBuffer.append(TEXT_19);
98
    return stringBuffer.toString();
87
    return stringBuffer.toString();
99
  }
88
  }
100
}
89
}
(-)src/org/eclipse/gmf/graphdef/codegen/templates/TopFigureGenerator.java (-89 / +14 lines)
Lines 25-60 Link Here
25
  protected final String TEXT_5 = "() {";
25
  protected final String TEXT_5 = "() {";
26
  protected final String TEXT_6 = "\t" + NL + "\t\t";
26
  protected final String TEXT_6 = "\t" + NL + "\t\t";
27
  protected final String TEXT_7 = NL + "\t\t";
27
  protected final String TEXT_7 = NL + "\t\t";
28
  protected final String TEXT_8 = NL + "\t\t" + NL + "\t\t";
28
  protected final String TEXT_8 = NL + "\t\tcreateContents();" + NL + "\t}" + NL;
29
  protected final String TEXT_9 = " ";
29
  protected final String TEXT_9 = NL;
30
  protected final String TEXT_10 = " = createFigure";
30
  protected final String TEXT_10 = NL;
31
  protected final String TEXT_11 = "();" + NL + "\t\tsetFigure";
31
  protected final String TEXT_11 = NL;
32
  protected final String TEXT_12 = "(";
32
  protected final String TEXT_12 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myUseLocalCoordinates = ";
33
  protected final String TEXT_13 = ");" + NL + "\t\tadd(";
33
  protected final String TEXT_13 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean useLocalCoordinates() {" + NL + "\t\treturn myUseLocalCoordinates;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setUseLocalCoordinates(boolean useLocalCoordinates) {" + NL + "\t\tmyUseLocalCoordinates = useLocalCoordinates;" + NL + "\t}" + NL + "\t";
34
  protected final String TEXT_14 = ");" + NL + "\t\t";
34
  protected final String TEXT_14 = NL + "}";
35
  protected final String TEXT_15 = "\t\t";
35
  protected final String TEXT_15 = NL;
36
  protected final String TEXT_16 = NL + "\t}" + NL;
37
  protected final String TEXT_17 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
38
  protected final String TEXT_18 = " f";
39
  protected final String TEXT_19 = "; " + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
40
  protected final String TEXT_20 = " getFigure";
41
  protected final String TEXT_21 = "() {" + NL + "\t\treturn f";
42
  protected final String TEXT_22 = ";" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setFigure";
43
  protected final String TEXT_23 = "(";
44
  protected final String TEXT_24 = " figure) {" + NL + "\t\tf";
45
  protected final String TEXT_25 = " = figure;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate ";
46
  protected final String TEXT_26 = " createFigure";
47
  protected final String TEXT_27 = "() {";
48
  protected final String TEXT_28 = NL;
49
  protected final String TEXT_29 = NL;
50
  protected final String TEXT_30 = NL + "\t\treturn ";
51
  protected final String TEXT_31 = ";" + NL + "\t}" + NL;
52
  protected final String TEXT_32 = NL;
53
  protected final String TEXT_33 = NL;
54
  protected final String TEXT_34 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate boolean myUseLocalCoordinates = ";
55
  protected final String TEXT_35 = ";" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean useLocalCoordinates() {" + NL + "\t\treturn myUseLocalCoordinates;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void setUseLocalCoordinates(boolean useLocalCoordinates) {" + NL + "\t\tmyUseLocalCoordinates = useLocalCoordinates;" + NL + "\t}" + NL + "\t";
56
  protected final String TEXT_36 = NL + "}";
57
  protected final String TEXT_37 = NL;
58
36
59
  public String generate(Object argument)
37
  public String generate(Object argument)
60
  {
38
  {
Lines 82-146 Link Here
82
    stringBuffer.append(dispatcher.dispatch("createLayout", dispatcherArgs));
60
    stringBuffer.append(dispatcher.dispatch("createLayout", dispatcherArgs));
83
    stringBuffer.append(TEXT_7);
61
    stringBuffer.append(TEXT_7);
84
    stringBuffer.append(dispatcher.dispatch(figure, dispatcherArgs));
62
    stringBuffer.append(dispatcher.dispatch(figure, dispatcherArgs));
85
    
86
for (Iterator it = figure.getChildren().iterator(); it.hasNext();) {
87
		Figure next = (Figure) it.next();
88
		final String childVarName = "child" + next.getName();
89
    stringBuffer.append(TEXT_8);
63
    stringBuffer.append(TEXT_8);
90
    stringBuffer.append(fqnSwitch.get(next, importManager));
91
    stringBuffer.append(TEXT_9);
64
    stringBuffer.append(TEXT_9);
92
    stringBuffer.append(childVarName);
65
    stringBuffer.append(dispatcher.dispatch("Children", dispatcherArgs));
93
    stringBuffer.append(TEXT_10);
66
    stringBuffer.append(TEXT_10);
94
    stringBuffer.append(next.getName());
95
    stringBuffer.append(TEXT_11);
96
    stringBuffer.append(next.getName());
97
    stringBuffer.append(TEXT_12);
98
    stringBuffer.append(childVarName);
99
    stringBuffer.append(TEXT_13);
100
    stringBuffer.append(childVarName);
101
    stringBuffer.append(TEXT_14);
102
    stringBuffer.append(dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(next, childVarName, dispatcherArgs.getManagerVariableName(), "layoutData" + next.getName())));
103
    stringBuffer.append(TEXT_15);
104
    }
105
    stringBuffer.append(TEXT_16);
106
    
107
int fc = 0;
108
for (Iterator it = figure.getChildren().iterator(); it.hasNext(); fc++) {
109
	Figure next = (Figure) it.next();
110
	final String nextClassName = fqnSwitch.get(next, importManager);
111
    stringBuffer.append(TEXT_17);
112
    stringBuffer.append(nextClassName);
113
    stringBuffer.append(TEXT_18);
114
    stringBuffer.append(next.getName());
115
    stringBuffer.append(TEXT_19);
116
    stringBuffer.append(nextClassName);
117
    stringBuffer.append(TEXT_20);
118
    stringBuffer.append(next.getName());
119
    stringBuffer.append(TEXT_21);
120
    stringBuffer.append(next.getName());
121
    stringBuffer.append(TEXT_22);
122
    stringBuffer.append(next.getName());
123
    stringBuffer.append(TEXT_23);
124
    stringBuffer.append(nextClassName);
125
    stringBuffer.append(TEXT_24);
126
    stringBuffer.append(next.getName());
127
    stringBuffer.append(TEXT_25);
128
    stringBuffer.append(nextClassName);
129
    stringBuffer.append(TEXT_26);
130
    stringBuffer.append(next.getName());
131
    stringBuffer.append(TEXT_27);
132
     GraphDefDispatcher.LayoutArgs childFigureArgs = dispatcher.createLayoutArgs(next, next.getName(), "layoutManager" + next.getName(), null);
133
    stringBuffer.append(TEXT_28);
134
    stringBuffer.append(dispatcher.dispatch("instantiate", childFigureArgs));
135
    stringBuffer.append(TEXT_29);
136
    stringBuffer.append(dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, childFigureArgs}));
137
    stringBuffer.append(TEXT_30);
138
    stringBuffer.append(next.getName());
139
    stringBuffer.append(TEXT_31);
140
    }
141
    stringBuffer.append(TEXT_32);
142
    if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/
67
    if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/
143
    stringBuffer.append(TEXT_33);
68
    stringBuffer.append(TEXT_11);
144
    
69
    
145
// simple heuristic to detect need for local coordinates
70
// simple heuristic to detect need for local coordinates
146
boolean useLocalDefaultValue = false;
71
boolean useLocalDefaultValue = false;
Lines 151-163 Link Here
151
	}
76
	}
152
}
77
}
153
78
154
    stringBuffer.append(TEXT_34);
79
    stringBuffer.append(TEXT_12);
155
    stringBuffer.append(useLocalDefaultValue);
80
    stringBuffer.append(useLocalDefaultValue);
156
    stringBuffer.append(TEXT_35);
81
    stringBuffer.append(TEXT_13);
157
    }
82
    }
158
    stringBuffer.append(TEXT_36);
83
    stringBuffer.append(TEXT_14);
159
    importManager.emitSortedImports();
84
    importManager.emitSortedImports();
160
    stringBuffer.append(TEXT_37);
85
    stringBuffer.append(TEXT_15);
161
    return stringBuffer.toString();
86
    return stringBuffer.toString();
162
  }
87
  }
163
}
88
}
(-)src/org/eclipse/gmf/graphdef/codegen/templates/InitBorderLayoutDataGenerator.java (-11 / +8 lines)
Lines 16-27 Link Here
16
16
17
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
17
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18
  protected final String TEXT_1 = "";
18
  protected final String TEXT_1 = "";
19
  protected final String TEXT_2 = NL + "\t\t";
19
  protected final String TEXT_2 = NL + "\tObject ";
20
  protected final String TEXT_3 = ".setConstraint(";
20
  protected final String TEXT_3 = " = ";
21
  protected final String TEXT_4 = ", ";
21
  protected final String TEXT_4 = ".";
22
  protected final String TEXT_5 = ".";
22
  protected final String TEXT_5 = ";" + NL;
23
  protected final String TEXT_6 = ");" + NL;
23
  protected final String TEXT_6 = NL;
24
  protected final String TEXT_7 = NL;
25
24
26
  public String generate(Object argument)
25
  public String generate(Object argument)
27
  {
26
  {
Lines 63-77 Link Here
63
}
62
}
64
63
65
    stringBuffer.append(TEXT_2);
64
    stringBuffer.append(TEXT_2);
66
    stringBuffer.append(argsBundle.getManagerVariableName());
65
    stringBuffer.append(argsBundle.getConstraintVariableName());
67
    stringBuffer.append(TEXT_3);
66
    stringBuffer.append(TEXT_3);
68
    stringBuffer.append(figureVarName);
69
    stringBuffer.append(TEXT_4);
70
    stringBuffer.append(dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout"));
67
    stringBuffer.append(dispatcher.getImportManager().getImportedName("org.eclipse.draw2d.BorderLayout"));
71
    stringBuffer.append(TEXT_5);
68
    stringBuffer.append(TEXT_4);
72
    stringBuffer.append(constantName);
69
    stringBuffer.append(constantName);
70
    stringBuffer.append(TEXT_5);
73
    stringBuffer.append(TEXT_6);
71
    stringBuffer.append(TEXT_6);
74
    stringBuffer.append(TEXT_7);
75
    return stringBuffer.toString();
72
    return stringBuffer.toString();
76
  }
73
  }
77
}
74
}
(-)src/org/eclipse/gmf/graphdef/codegen/templates/NewLayoutDataGenerator.java (-2 / +8 lines)
Lines 17-23 Link Here
17
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
17
  protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl;
18
  protected final String TEXT_1 = "";
18
  protected final String TEXT_1 = "";
19
  protected final String TEXT_2 = "\t\t\t";
19
  protected final String TEXT_2 = "\t\t\t";
20
  protected final String TEXT_3 = NL;
20
  protected final String TEXT_3 = NL + "\t\tObject ";
21
  protected final String TEXT_4 = " = null;";
22
  protected final String TEXT_5 = NL;
21
23
22
  public String generate(Object argument)
24
  public String generate(Object argument)
23
  {
25
  {
Lines 37-44 Link Here
37
    stringBuffer.append(TEXT_1);
39
    stringBuffer.append(TEXT_1);
38
    stringBuffer.append(dispatcher.dispatch(gmfLayoutData, argsBundle));
40
    stringBuffer.append(dispatcher.dispatch(gmfLayoutData, argsBundle));
39
    stringBuffer.append(TEXT_2);
41
    stringBuffer.append(TEXT_2);
40
    }
42
    } else {
41
    stringBuffer.append(TEXT_3);
43
    stringBuffer.append(TEXT_3);
44
    stringBuffer.append(argsBundle.getConstraintVariableName());
45
    stringBuffer.append(TEXT_4);
46
    }
47
    stringBuffer.append(TEXT_5);
42
    return stringBuffer.toString();
48
    return stringBuffer.toString();
43
  }
49
  }
44
}
50
}
(-)templates/new/LayoutData.javajet (+2 lines)
Lines 13-16 Link Here
13
13
14
if (gmfLayoutData != null && figureInstance.eContainer() instanceof Figure && ((Figure) figureInstance.eContainer()).getLayout() != null) {%>
14
if (gmfLayoutData != null && figureInstance.eContainer() instanceof Figure && ((Figure) figureInstance.eContainer()).getLayout() != null) {%>
15
<%=dispatcher.dispatch(gmfLayoutData, argsBundle)%>			
15
<%=dispatcher.dispatch(gmfLayoutData, argsBundle)%>			
16
<%} else {%>
17
		Object <%=argsBundle.getConstraintVariableName()%> = null;
16
<%}%>
18
<%}%>
(-)templates/top/Figure.javajet (-46 / +2 lines)
Lines 24-77 Link Here
24
%>	
24
%>	
25
		<%=dispatcher.dispatch("createLayout", dispatcherArgs)%>
25
		<%=dispatcher.dispatch("createLayout", dispatcherArgs)%>
26
		<%=dispatcher.dispatch(figure, dispatcherArgs)%>
26
		<%=dispatcher.dispatch(figure, dispatcherArgs)%>
27
<%
27
		createContents();
28
for (Iterator it = figure.getChildren().iterator(); it.hasNext();) {
29
		Figure next = (Figure) it.next();
30
		final String childVarName = "child" + next.getName();%>
31
		
32
		<%=fqnSwitch.get(next, importManager)%> <%=childVarName%> = createFigure<%=next.getName()%>();
33
		setFigure<%=next.getName()%>(<%=childVarName%>);
34
		add(<%=childVarName%>);
35
		<%=dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(next, childVarName, dispatcherArgs.getManagerVariableName(), "layoutData" + next.getName()))%>		
36
<%}%>
37
	}
38
39
<%
40
int fc = 0;
41
for (Iterator it = figure.getChildren().iterator(); it.hasNext(); fc++) {
42
	Figure next = (Figure) it.next();
43
	final String nextClassName = fqnSwitch.get(next, importManager);%>
44
45
	/**
46
	 * @generated
47
	 */
48
	private <%=nextClassName%> f<%=next.getName()%>; 
49
50
	/**
51
	 * @generated
52
	 */
53
	public <%=nextClassName%> getFigure<%=next.getName()%>() {
54
		return f<%=next.getName()%>;
55
	}
28
	}
56
29
57
	/**
30
<%=dispatcher.dispatch("Children", dispatcherArgs)%>
58
	 * @generated
59
	 */
60
	protected void setFigure<%=next.getName()%>(<%=nextClassName%> figure) {
61
		f<%=next.getName()%> = figure;
62
	}
63
64
	/**
65
	 * @generated
66
	 */
67
	private <%=nextClassName%> createFigure<%=next.getName()%>() {
68
<% GraphDefDispatcher.LayoutArgs childFigureArgs = dispatcher.createLayoutArgs(next, next.getName(), "layoutManager" + next.getName(), null);%>
69
<%=dispatcher.dispatch("instantiate", childFigureArgs)%>
70
<%=dispatcher.dispatch("Children", new Object[] {next.getChildren(), dispatcher, childFigureArgs})%>
71
		return <%=next.getName()%>;
72
	}
73
74
<%}%>
75
31
76
<%if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/%>
32
<%if (false == figure instanceof Polyline) {/*no much sense to define useLocalCoordinates for polyline and its descendants*/%>
77
<%@ include file="localCoordinates.jetinc"%>
33
<%@ include file="localCoordinates.jetinc"%>
(-)templates/children/Figure.javajet (-28 / +82 lines)
Lines 1-43 Link Here
1
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="FigureChildrenGenerator"
1
<%@ jet package="org.eclipse.gmf.graphdef.codegen.templates" class="FigureChildrenGenerator"
2
	imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.* java.util.*"%>
2
	imports="org.eclipse.gmf.gmfgraph.* org.eclipse.gmf.graphdef.codegen.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.gmfgraph.util.* org.eclipse.emf.codegen.util.CodeGenUtil java.util.*"%>
3
<%
3
<%
4
Object[] args = (Object[]) argument;
4
GraphDefDispatcher.LayoutArgs parentArgs = (GraphDefDispatcher.LayoutArgs) argument;
5
List/*<Figure>*/ figureChildren = (List) args[0];
5
final Figure root = parentArgs.getFigure();
6
final GraphDefDispatcher dispatcher = (GraphDefDispatcher) args[1];
6
final GraphDefDispatcher dispatcher = parentArgs.getDispatcher();
7
GraphDefDispatcher.LayoutArgs parentArgs = (GraphDefDispatcher.LayoutArgs) args[2];
7
final ImportAssistant importManager = dispatcher.getImportManager();
8
9
final List/*<Figure>*/ fieldsRequired = new LinkedList/*<Figure>*/();
10
final Stack/*GraphDefDispatcher.LayoutArgs*/ contextStack = new Stack/*GraphDefDispatcher.LayoutArgs*/();
11
final LinkedList queue = new LinkedList();
12
final Object marker = new Object();
13
14
class FieldSupport {
15
	private final Figure myRoot;
16
17
	public FieldSupport(Figure root){
18
		myRoot = root;
19
	}
20
	
21
	public boolean isFieldRequired(Figure descendant){
22
		return myRoot.equals(descendant.getParent()) || !descendant.getReferencingElements().isEmpty();
23
	}
24
}
25
final FieldSupport fieldSupport = new FieldSupport(root);
26
8
%>
27
%>
9
28
29
	/**
30
	 * @generated
31
	 */
32
	private void createContents(){
10
<%
33
<%
11
LinkedList l = new LinkedList();
34
queue.addAll(root.getChildren());
12
l.addAll(figureChildren);
13
final Object marker = new Object();
14
Stack figureVarNamesStack = new Stack();
15
int figureCount = 0;
35
int figureCount = 0;
16
while (!l.isEmpty()) {
36
while (!queue.isEmpty()){
17
	Object _nxt = l.removeFirst();
37
	Object _nxt = queue.removeFirst();
18
	if (_nxt == marker) {
38
	if (_nxt == marker){
19
		parentArgs = (GraphDefDispatcher.LayoutArgs) figureVarNamesStack.pop();
39
		parentArgs = (GraphDefDispatcher.LayoutArgs)contextStack.pop();
20
		continue;
40
		continue;
21
	}
41
	}
22
	final FigureMarker figureMarker = (FigureMarker) _nxt;
42
	if (_nxt instanceof FigureRef) {
23
	if (figureMarker instanceof FigureRef) {
24
		throw new IllegalStateException("FIXME: sorry, don't support FigureRef for a while");
43
		throw new IllegalStateException("FIXME: sorry, don't support FigureRef for a while");
25
	}
44
	}
26
	final String figureVarName = "fig_" + figureCount;
45
	final Figure nextChild = (Figure) _nxt;	
27
	final String layoutManagerVarName = "layouter" + figureCount;
46
	final String childVarName = "fig_" + figureCount;
28
	final String layoutDataVarName = "layData" + figureCount;
47
	final String childLayoutManager = "layouter" + figureCount;
48
	final String childConstraint = "layData" + figureCount;
29
	figureCount++;
49
	figureCount++;
30
		// FIXME instantiate - FigureRef - dispatch to 'instantiate' template?
50
	
31
		GraphDefDispatcher.LayoutArgs nextLevelArgs = dispatcher.createLayoutArgs((Figure) figureMarker, figureVarName, layoutManagerVarName, layoutDataVarName);%>
51
	// FIXME instantiate - FigureRef - dispatch to 'instantiate' template?
52
	GraphDefDispatcher.LayoutArgs nextLevelArgs = dispatcher.createLayoutArgs(nextChild, childVarName, childLayoutManager, childConstraint);%>
32
		<%=dispatcher.dispatch("instantiate", nextLevelArgs)%>
53
		<%=dispatcher.dispatch("instantiate", nextLevelArgs)%>
33
		<%=parentArgs.getVariableName()%>.add(<%=figureVarName%>);
34
		<%=dispatcher.dispatch("createLayoutData", dispatcher.createLayoutArgs(nextLevelArgs, parentArgs.getManagerVariableName(), layoutDataVarName))%>
35
<%
54
<%
36
if (_nxt instanceof Figure && !((Figure) _nxt).getChildren().isEmpty()) {
55
if (fieldSupport.isFieldRequired(nextChild)){
37
	l.addFirst(marker);
56
	fieldsRequired.add(nextChild); %>
38
	l.addAll(0, ((Figure) _nxt).getChildren());
57
		setFigure<%=nextChild.getName()%>(<%=childVarName%>);
39
	figureVarNamesStack.push(parentArgs);
58
<%}%>
40
	parentArgs = nextLevelArgs; // go on processing children of new parentFigure
59
		<%=dispatcher.dispatch("createLayoutData", nextLevelArgs)%>
41
} // if
60
		<%=parentArgs.getVariableName()%>.add(<%=childVarName%>, <%=childConstraint%>);
61
<%
62
	if (!nextChild.getChildren().isEmpty()) {
63
		queue.addFirst(marker);
64
		queue.addAll(0, nextChild.getChildren());
65
		contextStack.push(parentArgs);
66
		parentArgs = nextLevelArgs; // go on processing children of new parentFigure
67
	} 
42
} // while
68
} // while
43
%>
69
%>
70
	}
71
	
72
<%
73
	final FigureQualifiedNameSwitch fqnSwitch = dispatcher.getFQNSwitch();
74
	for (Iterator fieldFigures = fieldsRequired.iterator(); fieldFigures.hasNext();){
75
		Figure next = (Figure)fieldFigures.next(); 
76
		final String nextClassName = fqnSwitch.get(next, importManager);%>
77
		
78
	/**
79
	 * @generated
80
	 */
81
	private <%=nextClassName%> f<%=CodeGenUtil.capName(next.getName())%>; 
82
83
	/**
84
	 * @generated
85
	 */
86
	public <%=nextClassName%> getFigure<%=next.getName()%>() {
87
		return f<%=CodeGenUtil.capName(next.getName())%>;
88
	}
89
	
90
	/**
91
	 * @generated
92
	 */
93
	private void setFigure<%=next.getName()%>(<%=nextClassName%> fig){
94
		f<%=CodeGenUtil.capName(next.getName())%> = fig;
95
	}
96
97
<%	}%>
(-)src/org/eclipse/gmf/graphdef/codegen/FieldSupport.java (+28 lines)
Added Link Here
1
/*
2
 * Copyright (c) 2006 Borland Software Corporation
3
 * 
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 *
9
 * Contributors:
10
 *    Michael Golubev (Borland) - initial API and implementation
11
 */
12
13
package org.eclipse.gmf.graphdef.codegen;
14
15
import org.eclipse.gmf.gmfgraph.Figure;
16
17
public class FieldSupport {
18
	private final Figure myRoot;
19
20
	public FieldSupport(Figure root){
21
		myRoot = root;
22
	}
23
	
24
	public boolean isFieldRequired(Figure descendant){
25
		return myRoot.equals(descendant.getParent()) || !descendant.getReferencingElements().isEmpty();
26
	}
27
28
}
(-)plugin.properties (-1 / +2 lines)
Lines 240-249 Link Here
240
_UI_Wizard_initial_object_description = Select a model object to create
240
_UI_Wizard_initial_object_description = Select a model object to create
241
_UI_FileConflict_label = File Conflict
241
_UI_FileConflict_label = File Conflict
242
_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor.  Do you wish to discard this editor's changes?
242
_WARN_FileConflict = There are unsaved changes that conflict with changes made outside the editor.  Do you wish to discard this editor's changes?
243
243
244
_UI_Direction_NORTH_SOUTH_literal = NORTH_SOUTH
244
_UI_Direction_NORTH_SOUTH_literal = NORTH_SOUTH
245
_UI_Direction_EAST_WEST_literal = EAST_WEST
245
_UI_Direction_EAST_WEST_literal = EAST_WEST
246
_UI_Direction_NSEW_literal = NSEW
246
_UI_Direction_NSEW_literal = NSEW
247
_UI_LabelOffsetFacet_type = Label Offset Facet
247
_UI_LabelOffsetFacet_type = Label Offset Facet
248
_UI_LabelOffsetFacet_x_feature = X
248
_UI_LabelOffsetFacet_x_feature = X
249
_UI_LabelOffsetFacet_y_feature = Y
249
_UI_LabelOffsetFacet_y_feature = Y
250
_UI_Figure_referencingElements_feature = Referencing Elements

Return to bug 139139