Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 42516 Details for
Bug 139148
Diagram generation should respect gmfgraph.Compartment properties, layout etc
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Fixes the subj
patch_139148.txt (text/plain), 99.50 KB, created by
Michael Golubev
on 2006-05-24 18:45:38 EDT
(
hide
)
Description:
Fixes the subj
Filename:
MIME Type:
Creator:
Michael Golubev
Created:
2006-05-24 18:45:38 EDT
Size:
99.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.codegen.edit >Index: src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java,v >retrieving revision 1.35 >diff -u -r1.35 GMFGenItemProviderAdapterFactory.java >--- src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java 24 May 2006 09:20:08 -0000 1.35 >+++ src/org/eclipse/gmf/codegen/gmfgen/provider/GMFGenItemProviderAdapterFactory.java 24 May 2006 22:47:15 -0000 >@@ -646,6 +646,28 @@ > } > > /** >+ * This keeps track of the one adapter used for all {@link org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes} instances. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ protected FigureAccessorAttributesItemProvider figureAccessorAttributesItemProvider; >+ >+ /** >+ * This creates an adapter for a {@link org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes}. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public Adapter createFigureAccessorAttributesAdapter() { >+ if (figureAccessorAttributesItemProvider == null) { >+ figureAccessorAttributesItemProvider = new FigureAccessorAttributesItemProvider(this); >+ } >+ >+ return figureAccessorAttributesItemProvider; >+ } >+ >+ /** > * This keeps track of the one adapter used for all {@link org.eclipse.gmf.codegen.gmfgen.FigureViewmap} instances. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -1317,6 +1339,7 @@ > if (resizeConstraintsItemProvider != null) resizeConstraintsItemProvider.dispose(); > if (defaultSizeAttributesItemProvider != null) defaultSizeAttributesItemProvider.dispose(); > if (labelOffsetAttributesItemProvider != null) labelOffsetAttributesItemProvider.dispose(); >+ if (figureAccessorAttributesItemProvider != null) figureAccessorAttributesItemProvider.dispose(); > if (figureViewmapItemProvider != null) figureViewmapItemProvider.dispose(); > if (snippetViewmapItemProvider != null) snippetViewmapItemProvider.dispose(); > if (innerClassViewmapItemProvider != null) innerClassViewmapItemProvider.dispose(); >Index: src/org/eclipse/gmf/codegen/gmfgen/provider/ViewmapItemProvider.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.edit/src/org/eclipse/gmf/codegen/gmfgen/provider/ViewmapItemProvider.java,v >retrieving revision 1.7 >diff -u -r1.7 ViewmapItemProvider.java >--- src/org/eclipse/gmf/codegen/gmfgen/provider/ViewmapItemProvider.java 17 May 2006 14:22:35 -0000 1.7 >+++ src/org/eclipse/gmf/codegen/gmfgen/provider/ViewmapItemProvider.java 24 May 2006 22:47:15 -0000 >@@ -194,6 +194,11 @@ > (createChildParameter > (GMFGenPackage.eINSTANCE.getViewmap_Attributes(), > GMFGenFactory.eINSTANCE.createLabelOffsetAttributes())); >+ >+ newChildDescriptors.add >+ (createChildParameter >+ (GMFGenPackage.eINSTANCE.getViewmap_Attributes(), >+ GMFGenFactory.eINSTANCE.createFigureAccessorAttributes())); > } > > /** >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen.edit/plugin.properties,v >retrieving revision 1.98 >diff -u -r1.98 plugin.properties >--- plugin.properties 24 May 2006 09:20:08 -0000 1.98 >+++ plugin.properties 24 May 2006 22:47:14 -0000 >@@ -437,4 +437,5 @@ > _UI_ParentAssignedViewmap_getterName_feature = Accesor to parent figure's chile > _UI_ParentAssignedViewmap_setterName_feature = Typed child.setFigure override > _UI_ParentAssignedViewmap_figureQualifiedClassName_feature = Figure Qualified Class Name >- >\ No newline at end of file >+ _UI_FigureAccessorAttributes_type = Figure Accessor Attributes >+_UI_FigureAccessorAttributes_figureGetterName_feature = Figure Getter Name >Index: src/org/eclipse/gmf/codegen/gmfgen/provider/FigureAccessorAttributesItemProvider.java >=================================================================== >RCS file: src/org/eclipse/gmf/codegen/gmfgen/provider/FigureAccessorAttributesItemProvider.java >diff -N src/org/eclipse/gmf/codegen/gmfgen/provider/FigureAccessorAttributesItemProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/codegen/gmfgen/provider/FigureAccessorAttributesItemProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,156 @@ >+/** >+ * <copyright> >+ * </copyright> >+ * >+ * $Id$ >+ */ >+package org.eclipse.gmf.codegen.gmfgen.provider; >+ >+ >+import java.util.Collection; >+import java.util.List; >+ >+import org.eclipse.emf.common.notify.AdapterFactory; >+import org.eclipse.emf.common.notify.Notification; >+ >+import org.eclipse.emf.common.util.ResourceLocator; >+ >+import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; >+import org.eclipse.emf.edit.provider.IEditingDomainItemProvider; >+import org.eclipse.emf.edit.provider.IItemLabelProvider; >+import org.eclipse.emf.edit.provider.IItemPropertySource; >+import org.eclipse.emf.edit.provider.IStructuredItemContentProvider; >+import org.eclipse.emf.edit.provider.ITreeItemContentProvider; >+import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; >+import org.eclipse.emf.edit.provider.ItemProviderAdapter; >+import org.eclipse.emf.edit.provider.ViewerNotification; >+ >+import org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes; >+import org.eclipse.gmf.codegen.gmfgen.GMFGenPackage; >+ >+import org.eclipse.gmf.codegen.gmfgen.presentation.EditorPlugin; >+ >+/** >+ * This is the item provider adapter for a {@link org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes} object. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+public class FigureAccessorAttributesItemProvider >+ extends ItemProviderAdapter >+ implements >+ IEditingDomainItemProvider, >+ IStructuredItemContentProvider, >+ ITreeItemContentProvider, >+ IItemLabelProvider, >+ IItemPropertySource { >+ /** >+ * This constructs an instance from a factory and a notifier. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public FigureAccessorAttributesItemProvider(AdapterFactory adapterFactory) { >+ super(adapterFactory); >+ } >+ >+ /** >+ * This returns the property descriptors for the adapted class. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public List getPropertyDescriptors(Object object) { >+ if (itemPropertyDescriptors == null) { >+ super.getPropertyDescriptors(object); >+ >+ addFigureGetterNamePropertyDescriptor(object); >+ } >+ return itemPropertyDescriptors; >+ } >+ >+ /** >+ * This adds a property descriptor for the Figure Getter Name feature. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ protected void addFigureGetterNamePropertyDescriptor(Object object) { >+ itemPropertyDescriptors.add >+ (createItemPropertyDescriptor >+ (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), >+ getResourceLocator(), >+ getString("_UI_FigureAccessorAttributes_figureGetterName_feature"), >+ getString("_UI_PropertyDescriptor_description", "_UI_FigureAccessorAttributes_figureGetterName_feature", "_UI_FigureAccessorAttributes_type"), >+ GMFGenPackage.eINSTANCE.getFigureAccessorAttributes_FigureGetterName(), >+ true, >+ false, >+ false, >+ ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, >+ null, >+ null)); >+ } >+ >+ /** >+ * This returns FigureAccessorAttributes.gif. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public Object getImage(Object object) { >+ return overlayImage(object, getResourceLocator().getImage("full/obj16/FigureAccessorAttributes")); >+ } >+ >+ /** >+ * This returns the label text for the adapted class. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public String getText(Object object) { >+ String label = ((FigureAccessorAttributes)object).getFigureGetterName(); >+ return label == null || label.length() == 0 ? >+ getString("_UI_FigureAccessorAttributes_type") : >+ getString("_UI_FigureAccessorAttributes_type") + " " + label; >+ } >+ >+ /** >+ * This handles model notifications by calling {@link #updateChildren} to update any cached >+ * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public void notifyChanged(Notification notification) { >+ updateChildren(notification); >+ >+ switch (notification.getFeatureID(FigureAccessorAttributes.class)) { >+ case GMFGenPackage.FIGURE_ACCESSOR_ATTRIBUTES__FIGURE_GETTER_NAME: >+ fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); >+ return; >+ } >+ super.notifyChanged(notification); >+ } >+ >+ /** >+ * This adds to the collection of {@link org.eclipse.emf.edit.command.CommandParameter}s >+ * describing all of the children that can be created under this object. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ protected void collectNewChildDescriptors(Collection newChildDescriptors, Object object) { >+ super.collectNewChildDescriptors(newChildDescriptors, object); >+ } >+ >+ /** >+ * Return the resource locator for this item provider's resources. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public ResourceLocator getResourceLocator() { >+ return EditorPlugin.INSTANCE; >+ } >+ >+} >#P org.eclipse.gmf.tests >Index: src/org/eclipse/gmf/tests/gen/ViewmapProducersTest.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gen/ViewmapProducersTest.java,v >retrieving revision 1.11 >diff -u -r1.11 ViewmapProducersTest.java >--- src/org/eclipse/gmf/tests/gen/ViewmapProducersTest.java 24 May 2006 18:05:31 -0000 1.11 >+++ src/org/eclipse/gmf/tests/gen/ViewmapProducersTest.java 24 May 2006 22:47:16 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.emf.codegen.util.CodeGenUtil; > import org.eclipse.gmf.bridge.genmodel.InnerClassViewmapProducer; > import org.eclipse.gmf.bridge.genmodel.ViewmapProducer; >+import org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes; > import org.eclipse.gmf.codegen.gmfgen.FigureViewmap; > import org.eclipse.gmf.codegen.gmfgen.InnerClassViewmap; > import org.eclipse.gmf.codegen.gmfgen.ParentAssignedViewmap; >@@ -45,6 +46,7 @@ > import org.eclipse.gmf.gmfgraph.Node; > import org.eclipse.gmf.gmfgraph.util.FigureQualifiedNameSwitch; > import org.eclipse.gmf.gmfgraph.util.RuntimeFQNSwitch; >+import org.eclipse.gmf.graphdef.codegen.NamingStrategy; > import org.eclipse.jdt.core.dom.AST; > import org.eclipse.jdt.core.dom.ASTNode; > import org.eclipse.jdt.core.dom.ASTParser; >@@ -252,6 +254,41 @@ > assertEquals(icv.getClassName(), innerClassGenName); > } > >+ public void testPinnedCompartment(){ >+ Node node = createNode("Root", GMFGraphFactory.eINSTANCE.createRectangle()); >+ Figure rootFigure = (Figure)node.getFigure(); >+ Figure compartmentPaneA = GMFGraphFactory.eINSTANCE.createRectangle(); >+ compartmentPaneA.setName("CompartmentA"); >+ rootFigure.getChildren().add(compartmentPaneA); >+ >+ Figure intermediate = GMFGraphFactory.eINSTANCE.createEllipse(); >+ rootFigure.getChildren().add(intermediate); >+ Figure compartmentPaneB = GMFGraphFactory.eINSTANCE.createRectangle(); >+ compartmentPaneB.setName("CompartmentB"); >+ intermediate.getChildren().add(compartmentPaneB); >+ >+ Compartment compartmentA = createCompartment("CompartmentA", compartmentPaneA); >+ Compartment compartmentB = createCompartment("CompartmentB", compartmentPaneB); >+ >+ FigureAccessorAttributes attributesA = (FigureAccessorAttributes) getProducer().create(compartmentA).find(FigureAccessorAttributes.class); >+ FigureAccessorAttributes attributesB = (FigureAccessorAttributes) getProducer().create(compartmentB).find(FigureAccessorAttributes.class); >+ >+ assertNotNull(attributesA); >+ assertNotNull(attributesB); >+ >+ assertEquals(attributesA.getFigureGetterName(), NamingStrategy.INSTANCE.getChildFigureGetterName(compartmentPaneA)); >+ assertEquals(attributesB.getFigureGetterName(), NamingStrategy.INSTANCE.getChildFigureGetterName(compartmentPaneB)); >+ } >+ >+ public void testFloatingCompartment(){ >+ Compartment compartment = createCompartment("Floating", GMFGraphFactory.eINSTANCE.createEllipse()); >+ assertNull(getProducer().create(compartment).find(FigureAccessorAttributes.class)); >+ >+ Compartment noFigure = createCompartment("NoFigure", GMFGraphFactory.eINSTANCE.createCustomFigure()); >+ noFigure.setFigure(null); >+ assertNull(getProducer().create(noFigure).find(FigureAccessorAttributes.class)); >+ } >+ > public void testResizeConstaintsSingleDiagonals(){ > Figure f = GMFGraphFactory.eINSTANCE.createRoundedRectangle(); > f.setName("Figure"); >@@ -348,6 +385,15 @@ > return createNode(name, figure, null); > } > >+ private Compartment createCompartment(String name, Figure figure){ >+ assertNotNull(name); >+ assertNotNull(figure); >+ Compartment result = GMFGraphFactory.eINSTANCE.createCompartment(); >+ result.setName(name); >+ result.setFigure(figure); >+ return result; >+ } >+ > private Node createNode(String name, Figure figure, Direction optionalConstaint){ > assertNotNull(name); > assertNotNull(figure); >#P org.eclipse.gmf.codegen >Index: src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java,v >retrieving revision 1.127 >diff -u -r1.127 GMFGenPackageImpl.java >--- src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java 24 May 2006 09:20:16 -0000 1.127 >+++ src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenPackageImpl.java 24 May 2006 22:47:22 -0000 >@@ -29,6 +29,7 @@ > import org.eclipse.gmf.codegen.gmfgen.FeatureLabelModelFacet; > import org.eclipse.gmf.codegen.gmfgen.FeatureLinkModelFacet; > import org.eclipse.gmf.codegen.gmfgen.FeatureModelFacet; >+import org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes; > import org.eclipse.gmf.codegen.gmfgen.FigureViewmap; > import org.eclipse.gmf.codegen.gmfgen.GMFGenFactory; > import org.eclipse.gmf.codegen.gmfgen.GMFGenPackage; >@@ -431,6 +432,13 @@ > * <!-- end-user-doc --> > * @generated > */ >+ private EClass figureAccessorAttributesEClass = null; >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ > private EClass figureViewmapEClass = null; > > /** >@@ -2691,6 +2699,24 @@ > * <!-- end-user-doc --> > * @generated > */ >+ public EClass getFigureAccessorAttributes() { >+ return figureAccessorAttributesEClass; >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public EAttribute getFigureAccessorAttributes_FigureGetterName() { >+ return (EAttribute)figureAccessorAttributesEClass.getEStructuralFeatures().get(0); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ > public EClass getFigureViewmap() { > return figureViewmapEClass; > } >@@ -3975,6 +4001,9 @@ > createEAttribute(labelOffsetAttributesEClass, LABEL_OFFSET_ATTRIBUTES__X); > createEAttribute(labelOffsetAttributesEClass, LABEL_OFFSET_ATTRIBUTES__Y); > >+ figureAccessorAttributesEClass = createEClass(FIGURE_ACCESSOR_ATTRIBUTES); >+ createEAttribute(figureAccessorAttributesEClass, FIGURE_ACCESSOR_ATTRIBUTES__FIGURE_GETTER_NAME); >+ > viewmapEClass = createEClass(VIEWMAP); > createEReference(viewmapEClass, VIEWMAP__ATTRIBUTES); > createEAttribute(viewmapEClass, VIEWMAP__REQUIRED_PLUGIN_IDS); >@@ -4197,6 +4226,7 @@ > resizeConstraintsEClass.getESuperTypes().add(this.getAttributes()); > defaultSizeAttributesEClass.getESuperTypes().add(this.getAttributes()); > labelOffsetAttributesEClass.getESuperTypes().add(this.getAttributes()); >+ figureAccessorAttributesEClass.getESuperTypes().add(this.getAttributes()); > figureViewmapEClass.getESuperTypes().add(this.getViewmap()); > snippetViewmapEClass.getESuperTypes().add(this.getViewmap()); > innerClassViewmapEClass.getESuperTypes().add(this.getViewmap()); >@@ -4637,6 +4667,9 @@ > initEAttribute(getLabelOffsetAttributes_X(), ecorePackage.getEInt(), "x", null, 0, 1, LabelOffsetAttributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > initEAttribute(getLabelOffsetAttributes_Y(), ecorePackage.getEInt(), "y", null, 0, 1, LabelOffsetAttributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > >+ initEClass(figureAccessorAttributesEClass, FigureAccessorAttributes.class, "FigureAccessorAttributes", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); >+ initEAttribute(getFigureAccessorAttributes_FigureGetterName(), ecorePackage.getEString(), "figureGetterName", null, 0, 1, FigureAccessorAttributes.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >+ > initEClass(viewmapEClass, Viewmap.class, "Viewmap", IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); > initEReference(getViewmap_Attributes(), this.getAttributes(), null, "attributes", null, 0, -1, Viewmap.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); > initEAttribute(getViewmap_RequiredPluginIDs(), ecorePackage.getEString(), "requiredPluginIDs", null, 0, -1, Viewmap.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); >Index: src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenFactoryImpl.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenFactoryImpl.java,v >retrieving revision 1.50 >diff -u -r1.50 GMFGenFactoryImpl.java >--- src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenFactoryImpl.java 24 May 2006 09:20:16 -0000 1.50 >+++ src/org/eclipse/gmf/codegen/gmfgen/impl/GMFGenFactoryImpl.java 24 May 2006 22:47:21 -0000 >@@ -137,6 +137,7 @@ > case GMFGenPackage.RESIZE_CONSTRAINTS: return createResizeConstraints(); > case GMFGenPackage.DEFAULT_SIZE_ATTRIBUTES: return createDefaultSizeAttributes(); > case GMFGenPackage.LABEL_OFFSET_ATTRIBUTES: return createLabelOffsetAttributes(); >+ case GMFGenPackage.FIGURE_ACCESSOR_ATTRIBUTES: return createFigureAccessorAttributes(); > case GMFGenPackage.FIGURE_VIEWMAP: return createFigureViewmap(); > case GMFGenPackage.SNIPPET_VIEWMAP: return createSnippetViewmap(); > case GMFGenPackage.INNER_CLASS_VIEWMAP: return createInnerClassViewmap(); >@@ -472,6 +473,16 @@ > * <!-- end-user-doc --> > * @generated > */ >+ public FigureAccessorAttributes createFigureAccessorAttributes() { >+ FigureAccessorAttributesImpl figureAccessorAttributes = new FigureAccessorAttributesImpl(); >+ return figureAccessorAttributes; >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ > public FigureViewmap createFigureViewmap() { > FigureViewmapImpl figureViewmap = new FigureViewmapImpl(); > return figureViewmap; >Index: src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java,v >retrieving revision 1.84 >diff -u -r1.84 NodeEditPartGenerator.java >--- src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java 24 May 2006 18:05:30 -0000 1.84 >+++ src-templates/org/eclipse/gmf/codegen/templates/parts/NodeEditPartGenerator.java 24 May 2006 22:47:18 -0000 >@@ -4,6 +4,7 @@ > import org.eclipse.emf.codegen.ecore.genmodel.*; > import org.eclipse.gmf.codegen.gmfgen.*; > import org.eclipse.gmf.common.codegen.*; >+import org.eclipse.gmf.codegen.gmfgen.util.*; > > public class NodeEditPartGenerator { > >@@ -98,62 +99,78 @@ > protected final String TEXT_79 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; > protected final String TEXT_80 = " getPrimaryShape() {" + NL + "\t\treturn ("; > protected final String TEXT_81 = ") primaryShape;" + NL + "\t}"; >- protected final String TEXT_82 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean addFixedChild(EditPart childEditPart) {"; >- protected final String TEXT_83 = NL + "\t\tif (childEditPart instanceof "; >- protected final String TEXT_84 = ") {" + NL + "\t\t\t(("; >- protected final String TEXT_85 = ") childEditPart)."; >- protected final String TEXT_86 = "(getPrimaryShape()."; >- protected final String TEXT_87 = "());" + NL + "\t\t\treturn true;" + NL + "\t\t}"; >- protected final String TEXT_88 = NL + "\t\treturn false;" + NL + "\t}"; >- protected final String TEXT_89 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; >- protected final String TEXT_90 = " createNodePlate() {"; >- protected final String TEXT_91 = NL + "\t\treturn new "; >- protected final String TEXT_92 = "(getMapMode().DPtoLP("; >- protected final String TEXT_93 = "), getMapMode().DPtoLP("; >- protected final String TEXT_94 = "));" + NL + "\t}"; >- protected final String TEXT_95 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EditPolicy getPrimaryDragEditPolicy() {" + NL + "\t\t"; >- protected final String TEXT_96 = " ep = ("; >- protected final String TEXT_97 = ") super.getPrimaryDragEditPolicy();" + NL + "\t\t"; >- protected final String TEXT_98 = NL + "\t\tep.setResizeDirections("; >- protected final String TEXT_99 = ".NONE);" + NL + "\t\t"; >- protected final String TEXT_100 = NL + "\t\tep.setResizeDirections("; >- protected final String TEXT_101 = "."; >- protected final String TEXT_102 = " | "; >- protected final String TEXT_103 = ");" + NL + "\t\t"; >- protected final String TEXT_104 = NL + "\t\treturn ep;" + NL + "\t}"; >- protected final String TEXT_105 = NL + "\t/**" + NL + "\t * Creates figure for this edit part." + NL + "\t * " + NL + "\t * Body of this method does not depend on settings in generation model" + NL + "\t * so you may safely remove <i>generated</i> tag and modify it." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; >- protected final String TEXT_106 = " createNodeFigure() {" + NL + "\t\t"; >- protected final String TEXT_107 = " figure = createNodePlate();" + NL + "\t\tfigure.setLayoutManager(new StackLayout());" + NL + "\t\tIFigure shape = createNodeShape();" + NL + "\t\tfigure.add(shape);" + NL + "\t\tcontentPane = setupContentPane(shape);" + NL + "\t\treturn figure;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Default implementation treats passed figure as content pane." + NL + "\t * Respects layout one may have set for generated figure." + NL + "\t * @param nodeShape instance of generated figure class" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IFigure setupContentPane(IFigure nodeShape) {" + NL + "\t\tif (nodeShape.getLayoutManager() == null) {"; >- protected final String TEXT_108 = NL + "\t\tnodeShape.setLayoutManager(new "; >- protected final String TEXT_109 = "() {" + NL + "" + NL + "\t\t\tpublic Object getConstraint(IFigure figure) {" + NL + "\t\t\t\tObject result = constraints.get(figure);" + NL + "\t\t\t\tif (result == null) {" + NL + "\t\t\t\t\tresult = new "; >- protected final String TEXT_110 = "(0, 0, -1, -1);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t});"; >- protected final String TEXT_111 = NL + "\t\t\t"; >- protected final String TEXT_112 = " layout = new "; >- protected final String TEXT_113 = "();" + NL + "\t\t\tlayout.setSpacing(getMapMode().DPtoLP(5));" + NL + "\t\t\tnodeShape.setLayoutManager(layout);"; >- protected final String TEXT_114 = NL + "\t\t}" + NL + "\t\treturn nodeShape; // use nodeShape itself as contentPane" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFigure getContentPane() {" + NL + "\t\tif (contentPane != null) {" + NL + "\t\t\treturn contentPane;" + NL + "\t\t}" + NL + "\t\treturn super.getContentPane();" + NL + "\t}"; >- protected final String TEXT_115 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; >- protected final String TEXT_116 = " getPrimaryChildEditPart() {" + NL + "\t\treturn getChildBySemanticHint("; >- protected final String TEXT_117 = ".getType("; >- protected final String TEXT_118 = ".VISUAL_ID));" + NL + "\t}"; >- protected final String TEXT_119 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual("; >- protected final String TEXT_120 = " childEditPart, int index) {" + NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\tIFigure labelFigure = (("; >- protected final String TEXT_121 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().add(labelFigure);" + NL + "\t\t} else {"; >- protected final String TEXT_122 = NL + "\t\t\tif (!addFixedChild(childEditPart)) {" + NL + "\t\t\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t\t\t}"; >- protected final String TEXT_123 = NL + "\t\t\tsuper.addChildVisual(childEditPart, -1);"; >- protected final String TEXT_124 = NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void removeChildVisual("; >- protected final String TEXT_125 = " childEditPart) {" + NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\tIFigure labelFigure = (("; >- protected final String TEXT_126 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().remove(labelFigure);" + NL + "\t\t} else {" + NL + "\t\t\tsuper.removeChildVisual(childEditPart);" + NL + "\t\t}" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isExternalLabel("; >- protected final String TEXT_127 = " childEditPart) {"; >- protected final String TEXT_128 = NL + "\t\tif (childEditPart instanceof "; >- protected final String TEXT_129 = ") {" + NL + "\t\t\treturn true;" + NL + "\t\t}"; >- protected final String TEXT_130 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IFigure getExternalLabelsContainer() {" + NL + "\t\t"; >- protected final String TEXT_131 = " root = ("; >- protected final String TEXT_132 = ") getRoot();" + NL + "\t\treturn root.getLayer("; >- protected final String TEXT_133 = ".EXTERNAL_NODE_LABELS_LAYER);" + NL + "\t}" + NL; >- protected final String TEXT_134 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual(EditPart childEditPart, int index) {" + NL + "\t\tif (!addFixedChild(childEditPart)) {" + NL + "\t\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t\t}" + NL + "\t}"; >- protected final String TEXT_135 = NL; >- protected final String TEXT_136 = NL + "}"; >- protected final String TEXT_137 = NL; >+ protected final String TEXT_82 = NL; >+ protected final String TEXT_83 = NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean addFixedChild(EditPart childEditPart) {"; >+ protected final String TEXT_84 = NL + "\t\tif (childEditPart instanceof "; >+ protected final String TEXT_85 = ") {" + NL + "\t\t\t(("; >+ protected final String TEXT_86 = ") childEditPart)."; >+ protected final String TEXT_87 = "(getPrimaryShape()."; >+ protected final String TEXT_88 = "());" + NL + "\t\t\treturn true;" + NL + "\t\t}"; >+ protected final String TEXT_89 = NL + "\t\tif (childEditPart instanceof "; >+ protected final String TEXT_90 = ") {" + NL + "\t\t\t"; >+ protected final String TEXT_91 = " pane = getPrimaryShape()."; >+ protected final String TEXT_92 = "();" + NL + "\t\t\tsetupContentPane(pane);" + NL + "\t\t\tpane.add((("; >+ protected final String TEXT_93 = ")childEditPart).getFigure());" + NL + "\t\t\treturn true;" + NL + "\t\t}\t"; >+ protected final String TEXT_94 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean removeFixedChild(EditPart childEditPart) {"; >+ protected final String TEXT_95 = "\t\t" + NL + "\t\tif (childEditPart instanceof "; >+ protected final String TEXT_96 = ") {" + NL + "\t\t\t"; >+ protected final String TEXT_97 = " pane = getPrimaryShape()."; >+ protected final String TEXT_98 = "();" + NL + "\t\t\tpane.remove((("; >+ protected final String TEXT_99 = ")childEditPart).getFigure());" + NL + "\t\t\treturn true;" + NL + "\t\t}\t"; >+ protected final String TEXT_100 = NL + "\t\treturn false;" + NL + "\t}"; >+ protected final String TEXT_101 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; >+ protected final String TEXT_102 = " createNodePlate() {"; >+ protected final String TEXT_103 = NL + "\t\treturn new "; >+ protected final String TEXT_104 = "(getMapMode().DPtoLP("; >+ protected final String TEXT_105 = "), getMapMode().DPtoLP("; >+ protected final String TEXT_106 = "));" + NL + "\t}"; >+ protected final String TEXT_107 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic EditPolicy getPrimaryDragEditPolicy() {" + NL + "\t\t"; >+ protected final String TEXT_108 = " ep = ("; >+ protected final String TEXT_109 = ") super.getPrimaryDragEditPolicy();" + NL + "\t\t"; >+ protected final String TEXT_110 = NL + "\t\tep.setResizeDirections("; >+ protected final String TEXT_111 = ".NONE);" + NL + "\t\t"; >+ protected final String TEXT_112 = NL + "\t\tep.setResizeDirections("; >+ protected final String TEXT_113 = "."; >+ protected final String TEXT_114 = " | "; >+ protected final String TEXT_115 = ");" + NL + "\t\t"; >+ protected final String TEXT_116 = NL + "\t\treturn ep;" + NL + "\t}"; >+ protected final String TEXT_117 = NL + "\t/**" + NL + "\t * Creates figure for this edit part." + NL + "\t * " + NL + "\t * Body of this method does not depend on settings in generation model" + NL + "\t * so you may safely remove <i>generated</i> tag and modify it." + NL + "\t * " + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected "; >+ protected final String TEXT_118 = " createNodeFigure() {" + NL + "\t\t"; >+ protected final String TEXT_119 = " figure = createNodePlate();" + NL + "\t\tfigure.setLayoutManager(new StackLayout());" + NL + "\t\tIFigure shape = createNodeShape();" + NL + "\t\tfigure.add(shape);" + NL + "\t\tcontentPane = setupContentPane(shape);" + NL + "\t\treturn figure;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * Default implementation treats passed figure as content pane." + NL + "\t * Respects layout one may have set for generated figure." + NL + "\t * @param nodeShape instance of generated figure class" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IFigure setupContentPane(IFigure nodeShape) {" + NL + "\t\tif (nodeShape.getLayoutManager() == null) {"; >+ protected final String TEXT_120 = NL + "\t\tnodeShape.setLayoutManager(new "; >+ protected final String TEXT_121 = "() {" + NL + "" + NL + "\t\t\tpublic Object getConstraint(IFigure figure) {" + NL + "\t\t\t\tObject result = constraints.get(figure);" + NL + "\t\t\t\tif (result == null) {" + NL + "\t\t\t\t\tresult = new "; >+ protected final String TEXT_122 = "(0, 0, -1, -1);" + NL + "\t\t\t\t}" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t});"; >+ protected final String TEXT_123 = NL + "\t\t\t"; >+ protected final String TEXT_124 = " layout = new "; >+ protected final String TEXT_125 = "();" + NL + "\t\t\tlayout.setSpacing(getMapMode().DPtoLP(5));" + NL + "\t\t\tnodeShape.setLayoutManager(layout);"; >+ protected final String TEXT_126 = NL + "\t\t}" + NL + "\t\treturn nodeShape; // use nodeShape itself as contentPane" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic IFigure getContentPane() {" + NL + "\t\tif (contentPane != null) {" + NL + "\t\t\treturn contentPane;" + NL + "\t\t}" + NL + "\t\treturn super.getContentPane();" + NL + "\t}"; >+ protected final String TEXT_127 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; >+ protected final String TEXT_128 = " getPrimaryChildEditPart() {" + NL + "\t\treturn getChildBySemanticHint("; >+ protected final String TEXT_129 = ".getType("; >+ protected final String TEXT_130 = ".VISUAL_ID));" + NL + "\t}"; >+ protected final String TEXT_131 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected boolean isExternalLabel("; >+ protected final String TEXT_132 = " childEditPart) {"; >+ protected final String TEXT_133 = NL + "\t\tif (childEditPart instanceof "; >+ protected final String TEXT_134 = ") {" + NL + "\t\t\treturn true;" + NL + "\t\t}"; >+ protected final String TEXT_135 = NL + "\t\treturn false;" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected IFigure getExternalLabelsContainer() {" + NL + "\t\t"; >+ protected final String TEXT_136 = " root = ("; >+ protected final String TEXT_137 = ") getRoot();" + NL + "\t\treturn root.getLayer("; >+ protected final String TEXT_138 = ".EXTERNAL_NODE_LABELS_LAYER);" + NL + "\t}" + NL; >+ protected final String TEXT_139 = NL + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void addChildVisual("; >+ protected final String TEXT_140 = " childEditPart, int index) {"; >+ protected final String TEXT_141 = NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\tIFigure labelFigure = (("; >+ protected final String TEXT_142 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().add(labelFigure);" + NL + "\t\t\treturn;" + NL + "\t\t} "; >+ protected final String TEXT_143 = "\t\t" + NL + "\t\tif (addFixedChild(childEditPart)) {" + NL + "\t\t\treturn;" + NL + "\t\t}"; >+ protected final String TEXT_144 = NL + "\t\tsuper.addChildVisual(childEditPart, -1);" + NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprotected void removeChildVisual("; >+ protected final String TEXT_145 = " childEditPart) {"; >+ protected final String TEXT_146 = NL + "\t\tif (isExternalLabel(childEditPart)) {" + NL + "\t\t\tIFigure labelFigure = (("; >+ protected final String TEXT_147 = ") childEditPart).getFigure();" + NL + "\t\t\tgetExternalLabelsContainer().remove(labelFigure);" + NL + "\t\t\treturn;" + NL + "\t\t} "; >+ protected final String TEXT_148 = NL + "\t\tif (removeFixedChild(childEditPart)){" + NL + "\t\t\treturn;" + NL + "\t\t}"; >+ protected final String TEXT_149 = NL + "\t\tsuper.removeChildVisual(childEditPart);" + NL + "\t}"; >+ protected final String TEXT_150 = "\t" + NL; >+ protected final String TEXT_151 = NL; >+ protected final String TEXT_152 = NL + "}"; >+ protected final String TEXT_153 = NL; > > protected final String getFeatureValueGetter(String containerName, GenFeature feature, boolean isContainerEObject, ImportAssistant importManager) { > StringBuffer result = new StringBuffer(); >@@ -260,6 +277,8 @@ > GenDiagram genDiagram = genNode.getDiagram(); > boolean isXYLayout = ViewmapLayoutType.XY_LAYOUT_LITERAL.equals(genNode.getLayoutType()); > >+final NodeEditPartHelper myHelper = new NodeEditPartHelper(genNode); >+ > stringBuffer.append(TEXT_1); > > String copyrightText = genDiagram.getEditorGen().getCopyrightText(); >@@ -300,17 +319,12 @@ > stringBuffer.append(genNode.getEditPartClassName()); > stringBuffer.append(TEXT_12); > >-boolean hasChildrenInListCompartments = false; >-for (Iterator compartments = genNode.getCompartments().iterator(); compartments.hasNext();) { >- GenCompartment compartment = (GenCompartment) compartments.next(); >- hasChildrenInListCompartments |= compartment.isListLayout() && !compartment.getChildNodes().isEmpty(); >-} >-if (!genNode.getChildNodes().isEmpty() || hasChildrenInListCompartments) { >+if (!genNode.getChildNodes().isEmpty() || myHelper.hasChildrenInListCompartments()) { > > stringBuffer.append(TEXT_13); > stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy")); > stringBuffer.append(TEXT_14); >- if (hasChildrenInListCompartments) { >+ if (myHelper.hasChildrenInListCompartments()) { > stringBuffer.append(TEXT_15); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.commands.Command")); > stringBuffer.append(TEXT_16); >@@ -435,7 +449,6 @@ > } //switch > stringBuffer.append(TEXT_66); > >-boolean hasFixedChildren = false; > String figureQualifiedClassName = null; > Viewmap viewmap = genNode.getViewmap(); > if (viewmap instanceof FigureViewmap) { >@@ -477,43 +490,75 @@ > stringBuffer.append(TEXT_80); > stringBuffer.append(figureQualifiedClassName); > stringBuffer.append(TEXT_81); >- >- List innerFixedLabels = new ArrayList(genNode.getLabels().size()); >- for (Iterator it = genNode.getLabels().iterator(); it.hasNext(); ) { >- GenNodeLabel genLabel = (GenNodeLabel) it.next(); >- if (!(genLabel instanceof GenExternalNodeLabel) && genLabel.getViewmap() instanceof ParentAssignedViewmap) { >- innerFixedLabels.add(genLabel); >- } >- } >- if (!innerFixedLabels.isEmpty()) { >- hasFixedChildren = true; >- >+ } > stringBuffer.append(TEXT_82); > >- for (Iterator it = innerFixedLabels.iterator(); it.hasNext(); ) { >- final GenNodeLabel genLabel = (GenNodeLabel) it.next(); >- final String labelEditPart = importManager.getImportedName(genLabel.getEditPartQualifiedClassName()); >- final ParentAssignedViewmap childViewmap = (ParentAssignedViewmap) genLabel.getViewmap(); >- final String childSetterName = childViewmap.getSetterName() == null ? "setLabel" : childViewmap.getSetterName(); >+if (myHelper.hasFixedChildren()) { > > stringBuffer.append(TEXT_83); >- stringBuffer.append(labelEditPart); >+ >+for (Iterator it = myHelper.getInnerFixedLabels(); it.hasNext(); ) { >+ GenNodeLabel genLabel = (GenNodeLabel) it.next(); >+ final String labelEditPart = importManager.getImportedName(genLabel.getEditPartQualifiedClassName()); >+ final ParentAssignedViewmap childViewmap = (ParentAssignedViewmap) genLabel.getViewmap(); >+ final String childSetterName = childViewmap.getSetterName() == null ? "setLabel" : childViewmap.getSetterName(); >+ > stringBuffer.append(TEXT_84); > stringBuffer.append(labelEditPart); > stringBuffer.append(TEXT_85); >- stringBuffer.append(childSetterName); >+ stringBuffer.append(labelEditPart); > stringBuffer.append(TEXT_86); >- stringBuffer.append(childViewmap.getGetterName()); >+ stringBuffer.append(childSetterName); > stringBuffer.append(TEXT_87); >- } >+ stringBuffer.append(childViewmap.getGetterName()); > stringBuffer.append(TEXT_88); > >- } > } > >+for (Iterator it = myHelper.getPinnedCompartments(); it.hasNext(); ) { >+ GenCompartment next = (GenCompartment)it.next(); >+ FigureAccessorAttributes placement = myHelper.getFigureAccessorAttributes(next); >+ String compartmentEditPartFQN = importManager.getImportedName(next.getEditPartQualifiedClassName()); >+ > stringBuffer.append(TEXT_89); >- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure")); >+ stringBuffer.append(compartmentEditPartFQN); > stringBuffer.append(TEXT_90); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); >+ stringBuffer.append(TEXT_91); >+ stringBuffer.append(placement.getFigureGetterName()); >+ stringBuffer.append(TEXT_92); >+ stringBuffer.append(compartmentEditPartFQN); >+ stringBuffer.append(TEXT_93); >+ >+} // for pinned compartments >+ >+ stringBuffer.append(TEXT_94); >+ >+//XXX: ignore labels assuming that they never may be removed >+for (Iterator it = myHelper.getPinnedCompartments(); it.hasNext(); ) { >+ GenCompartment next = (GenCompartment)it.next(); >+ FigureAccessorAttributes placement = myHelper.getFigureAccessorAttributes(next); >+ String compartmentEditPartFQN = importManager.getImportedName(next.getEditPartQualifiedClassName()); >+ >+ stringBuffer.append(TEXT_95); >+ stringBuffer.append(compartmentEditPartFQN); >+ stringBuffer.append(TEXT_96); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.IFigure")); >+ stringBuffer.append(TEXT_97); >+ stringBuffer.append(placement.getFigureGetterName()); >+ stringBuffer.append(TEXT_98); >+ stringBuffer.append(compartmentEditPartFQN); >+ stringBuffer.append(TEXT_99); >+ >+} // for pinned compartments >+ >+ stringBuffer.append(TEXT_100); >+ >+} // if myHelper.hasFixedChildren() >+ >+ stringBuffer.append(TEXT_101); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure")); >+ stringBuffer.append(TEXT_102); > > int width = 40; > int height = 40; >@@ -523,134 +568,151 @@ > height = defSizeAttrs.getHeight(); > } > >- stringBuffer.append(TEXT_91); >+ stringBuffer.append(TEXT_103); > stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure")); >- stringBuffer.append(TEXT_92); >+ stringBuffer.append(TEXT_104); > stringBuffer.append(width); >- stringBuffer.append(TEXT_93); >+ stringBuffer.append(TEXT_105); > stringBuffer.append(height); >- stringBuffer.append(TEXT_94); >+ stringBuffer.append(TEXT_106); > if (genNode.getViewmap().find(ResizeConstraints.class) != null) { > final ResizeConstraints rc = (ResizeConstraints) genNode.getViewmap().find(ResizeConstraints.class); > final String draw2dPC = importManager.getImportedName("org.eclipse.draw2d.PositionConstants"); >- stringBuffer.append(TEXT_95); >+ stringBuffer.append(TEXT_107); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy")); >- stringBuffer.append(TEXT_96); >+ stringBuffer.append(TEXT_108); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.editpolicies.ResizableEditPolicy")); >- stringBuffer.append(TEXT_97); >+ stringBuffer.append(TEXT_109); > if (rc.getResizeHandleNames().isEmpty()) { >- stringBuffer.append(TEXT_98); >+ stringBuffer.append(TEXT_110); > stringBuffer.append(draw2dPC); >- stringBuffer.append(TEXT_99); >+ stringBuffer.append(TEXT_111); > } else { >- stringBuffer.append(TEXT_100); >+ stringBuffer.append(TEXT_112); > for (Iterator rcNamesIter = rc.getResizeHandleNames().iterator(); rcNamesIter.hasNext();) { > String nextConstantName = (String) rcNamesIter.next(); > stringBuffer.append(draw2dPC); >- stringBuffer.append(TEXT_101); >+ stringBuffer.append(TEXT_113); > stringBuffer.append(nextConstantName); > if (rcNamesIter.hasNext()) { >- stringBuffer.append(TEXT_102); >+ stringBuffer.append(TEXT_114); > }} >- stringBuffer.append(TEXT_103); >+ stringBuffer.append(TEXT_115); > } >- stringBuffer.append(TEXT_104); >+ stringBuffer.append(TEXT_116); > } >- stringBuffer.append(TEXT_105); >+ stringBuffer.append(TEXT_117); > stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure")); >- stringBuffer.append(TEXT_106); >+ stringBuffer.append(TEXT_118); > stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure")); >- stringBuffer.append(TEXT_107); >+ stringBuffer.append(TEXT_119); > > if (isXYLayout) { > >- stringBuffer.append(TEXT_108); >+ stringBuffer.append(TEXT_120); > stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.FreeformLayout")); >- stringBuffer.append(TEXT_109); >+ stringBuffer.append(TEXT_121); > stringBuffer.append(importManager.getImportedName("org.eclipse.draw2d.geometry.Rectangle")); >- stringBuffer.append(TEXT_110); >+ stringBuffer.append(TEXT_122); > } else { > String layoutClassName = importManager.getImportedName("org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout"); > >- stringBuffer.append(TEXT_111); >+ stringBuffer.append(TEXT_123); > stringBuffer.append(layoutClassName); >- stringBuffer.append(TEXT_112); >+ stringBuffer.append(TEXT_124); > stringBuffer.append(layoutClassName); >- stringBuffer.append(TEXT_113); >+ stringBuffer.append(TEXT_125); > } >- stringBuffer.append(TEXT_114); >+ stringBuffer.append(TEXT_126); > >-if (!genNode.getLabels().isEmpty()) { >- GenNodeLabel primaryLabel = (GenNodeLabel) genNode.getLabels().get(0); >+if (myHelper.getPrimaryLabel() != null) { >+ GenNodeLabel primaryLabel = myHelper.getPrimaryLabel(); > >- stringBuffer.append(TEXT_115); >+ stringBuffer.append(TEXT_127); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); >- stringBuffer.append(TEXT_116); >+ stringBuffer.append(TEXT_128); > stringBuffer.append(importManager.getImportedName(genDiagram.getVisualIDRegistryQualifiedClassName())); >- stringBuffer.append(TEXT_117); >+ stringBuffer.append(TEXT_129); > stringBuffer.append(importManager.getImportedName(primaryLabel.getEditPartQualifiedClassName())); >- stringBuffer.append(TEXT_118); >+ stringBuffer.append(TEXT_130); > > } >-boolean hasExternalLabels = false; >-for (Iterator labels = genNode.getLabels().iterator(); labels.hasNext();) { >- GenNodeLabel label = (GenNodeLabel) labels.next(); >- if (label instanceof GenExternalNodeLabel) { >- hasExternalLabels = true; >- break; >+ >+if (myHelper.hasExternalLabels()){ >+ >+ stringBuffer.append(TEXT_131); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); >+ stringBuffer.append(TEXT_132); >+ >+ for (Iterator externalLabels = myHelper.getExternalLabels(); externalLabels.hasNext();) { >+ GenNodeLabel next = (GenNodeLabel) externalLabels.next(); >+ >+ stringBuffer.append(TEXT_133); >+ stringBuffer.append(importManager.getImportedName(next.getEditPartQualifiedClassName())); >+ stringBuffer.append(TEXT_134); >+ > } >+ >+ stringBuffer.append(TEXT_135); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart")); >+ stringBuffer.append(TEXT_136); >+ stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart")); >+ stringBuffer.append(TEXT_137); >+ stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName())); >+ stringBuffer.append(TEXT_138); >+ > } >-if (hasExternalLabels) { > >- stringBuffer.append(TEXT_119); >+if (myHelper.hasFixedChildren() || myHelper.hasExternalLabels()) { >+ >+ stringBuffer.append(TEXT_139); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); >- stringBuffer.append(TEXT_120); >+ stringBuffer.append(TEXT_140); >+ >+if (myHelper.hasExternalLabels()){ >+ >+ stringBuffer.append(TEXT_141); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")); >- stringBuffer.append(TEXT_121); >- if (hasFixedChildren) { >- stringBuffer.append(TEXT_122); >- } else { >- stringBuffer.append(TEXT_123); >- } >- stringBuffer.append(TEXT_124); >+ stringBuffer.append(TEXT_142); >+ >+} >+if (myHelper.hasFixedChildren()){ >+ >+ stringBuffer.append(TEXT_143); >+ >+} >+ >+ stringBuffer.append(TEXT_144); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); >- stringBuffer.append(TEXT_125); >+ stringBuffer.append(TEXT_145); >+ >+if (myHelper.hasExternalLabels()){ >+ >+ stringBuffer.append(TEXT_146); > stringBuffer.append(importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")); >- stringBuffer.append(TEXT_126); >- stringBuffer.append(importManager.getImportedName("org.eclipse.gef.EditPart")); >- stringBuffer.append(TEXT_127); >+ stringBuffer.append(TEXT_147); > >- for (Iterator labels = genNode.getLabels().iterator(); labels.hasNext();) { >- GenNodeLabel label = (GenNodeLabel) labels.next(); >- if (label instanceof GenExternalNodeLabel) { >+} >+if (myHelper.hasFixedChildren()){ > >- stringBuffer.append(TEXT_128); >- stringBuffer.append(importManager.getImportedName(label.getEditPartQualifiedClassName())); >- stringBuffer.append(TEXT_129); >+ stringBuffer.append(TEXT_148); > >- } >- } >+} > >- stringBuffer.append(TEXT_130); >- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart")); >- stringBuffer.append(TEXT_131); >- stringBuffer.append(importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramRootEditPart")); >- stringBuffer.append(TEXT_132); >- stringBuffer.append(importManager.getImportedName(genDiagram.getEditPartFactoryQualifiedClassName())); >- stringBuffer.append(TEXT_133); >+ stringBuffer.append(TEXT_149); > >-} else if (hasFixedChildren) { >- stringBuffer.append(TEXT_134); >+} // if hasFixedChildren || hasExternalLabels >+ >+ stringBuffer.append(TEXT_150); > >-} /*else if hasFixedChildren && !hasExternalLabels*/ > if (genNode.getViewmap() instanceof InnerClassViewmap) { > >- stringBuffer.append(TEXT_135); >+ stringBuffer.append(TEXT_151); > stringBuffer.append(((InnerClassViewmap) genNode.getViewmap()).getClassBody()); > } >- stringBuffer.append(TEXT_136); >+ stringBuffer.append(TEXT_152); > importManager.emitSortedImports(); >- stringBuffer.append(TEXT_137); >+ stringBuffer.append(TEXT_153); > return stringBuffer.toString(); > } > } >\ No newline at end of file >Index: src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenSwitch.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenSwitch.java,v >retrieving revision 1.47 >diff -u -r1.47 GMFGenSwitch.java >--- src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenSwitch.java 24 May 2006 09:20:16 -0000 1.47 >+++ src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenSwitch.java 24 May 2006 22:47:23 -0000 >@@ -493,6 +493,13 @@ > if (result == null) result = defaultCase(theEObject); > return result; > } >+ case GMFGenPackage.FIGURE_ACCESSOR_ATTRIBUTES: { >+ FigureAccessorAttributes figureAccessorAttributes = (FigureAccessorAttributes)theEObject; >+ Object result = caseFigureAccessorAttributes(figureAccessorAttributes); >+ if (result == null) result = caseAttributes(figureAccessorAttributes); >+ if (result == null) result = defaultCase(theEObject); >+ return result; >+ } > case GMFGenPackage.VIEWMAP: { > Viewmap viewmap = (Viewmap)theEObject; > Object result = caseViewmap(viewmap); >@@ -1416,6 +1423,21 @@ > } > > /** >+ * Returns the result of interpretting the object as an instance of '<em>Figure Accessor Attributes</em>'. >+ * <!-- begin-user-doc --> >+ * This implementation returns null; >+ * returning a non-null result will terminate the switch. >+ * <!-- end-user-doc --> >+ * @param object the target of the switch. >+ * @return the result of interpretting the object as an instance of '<em>Figure Accessor Attributes</em>'. >+ * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) >+ * @generated >+ */ >+ public Object caseFigureAccessorAttributes(FigureAccessorAttributes object) { >+ return null; >+ } >+ >+ /** > * Returns the result of interpretting the object as an instance of '<em>Figure Viewmap</em>'. > * <!-- begin-user-doc --> > * This implementation returns null; >Index: src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenAdapterFactory.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenAdapterFactory.java,v >retrieving revision 1.47 >diff -u -r1.47 GMFGenAdapterFactory.java >--- src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenAdapterFactory.java 24 May 2006 09:20:16 -0000 1.47 >+++ src/org/eclipse/gmf/codegen/gmfgen/util/GMFGenAdapterFactory.java 24 May 2006 22:47:22 -0000 >@@ -277,6 +277,9 @@ > public Object caseLabelOffsetAttributes(LabelOffsetAttributes object) { > return createLabelOffsetAttributesAdapter(); > } >+ public Object caseFigureAccessorAttributes(FigureAccessorAttributes object) { >+ return createFigureAccessorAttributesAdapter(); >+ } > public Object caseViewmap(Viewmap object) { > return createViewmapAdapter(); > } >@@ -1031,6 +1034,20 @@ > } > > /** >+ * Creates a new adapter for an object of class '{@link org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes <em>Figure Accessor Attributes</em>}'. >+ * <!-- begin-user-doc --> >+ * This default implementation returns null so that we can easily ignore cases; >+ * it's useful to ignore a case when inheritance will catch all the cases anyway. >+ * <!-- end-user-doc --> >+ * @return the new adapter. >+ * @see org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes >+ * @generated >+ */ >+ public Adapter createFigureAccessorAttributesAdapter() { >+ return null; >+ } >+ >+ /** > * Creates a new adapter for an object of class '{@link org.eclipse.gmf.codegen.gmfgen.FigureViewmap <em>Figure Viewmap</em>}'. > * <!-- begin-user-doc --> > * This default implementation returns null so that we can easily ignore cases; >Index: models/gmfgen.genmodel >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/models/gmfgen.genmodel,v >retrieving revision 1.112 >diff -u -r1.112 gmfgen.genmodel >--- models/gmfgen.genmodel 24 May 2006 09:20:16 -0000 1.112 >+++ models/gmfgen.genmodel 24 May 2006 22:47:18 -0000 >@@ -359,6 +359,9 @@ > <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//LabelOffsetAttributes/x"/> > <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//LabelOffsetAttributes/y"/> > </genClasses> >+ <genClasses ecoreClass="gmfgen.ecore#//FigureAccessorAttributes"> >+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//FigureAccessorAttributes/figureGetterName"/> >+ </genClasses> > <genClasses image="false" ecoreClass="gmfgen.ecore#//Viewmap"> > <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference gmfgen.ecore#//Viewmap/attributes"/> > <genFeatures createChild="false" ecoreFeature="ecore:EAttribute gmfgen.ecore#//Viewmap/requiredPluginIDs"/> >Index: models/gmfgen.ecore >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/models/gmfgen.ecore,v >retrieving revision 1.124 >diff -u -r1.124 gmfgen.ecore >--- models/gmfgen.ecore 24 May 2006 09:20:16 -0000 1.124 >+++ models/gmfgen.ecore 24 May 2006 22:47:18 -0000 >@@ -808,6 +808,9 @@ > <eStructuralFeatures xsi:type="ecore:EAttribute" name="x" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> > <eStructuralFeatures xsi:type="ecore:EAttribute" name="y" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> > </eClassifiers> >+ <eClassifiers xsi:type="ecore:EClass" name="FigureAccessorAttributes" eSuperTypes="#//Attributes"> >+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="figureGetterName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> >+ </eClassifiers> > <eClassifiers xsi:type="ecore:EClass" name="Viewmap" abstract="true"> > <eOperations name="find" eType="#//Attributes"> > <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel"> >Index: src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java,v >retrieving revision 1.106 >diff -u -r1.106 GMFGenPackage.java >--- src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java 24 May 2006 09:20:16 -0000 1.106 >+++ src/org/eclipse/gmf/codegen/gmfgen/GMFGenPackage.java 24 May 2006 22:47:20 -0000 >@@ -4141,7 +4141,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getViewmap() > * @generated > */ >- int VIEWMAP = 44; >+ int VIEWMAP = 45; > > /** > * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.Attributes <em>Attributes</em>}' class. >@@ -4311,6 +4311,34 @@ > int LABEL_OFFSET_ATTRIBUTES_FEATURE_COUNT = ATTRIBUTES_FEATURE_COUNT + 2; > > /** >+ * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.FigureAccessorAttributesImpl <em>Figure Accessor Attributes</em>}' class. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @see org.eclipse.gmf.codegen.gmfgen.impl.FigureAccessorAttributesImpl >+ * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getFigureAccessorAttributes() >+ * @generated >+ */ >+ int FIGURE_ACCESSOR_ATTRIBUTES = 44; >+ >+ /** >+ * The feature id for the '<em><b>Figure Getter Name</b></em>' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ * @ordered >+ */ >+ int FIGURE_ACCESSOR_ATTRIBUTES__FIGURE_GETTER_NAME = ATTRIBUTES_FEATURE_COUNT + 0; >+ >+ /** >+ * The number of structural features of the '<em>Figure Accessor Attributes</em>' class. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ * @ordered >+ */ >+ int FIGURE_ACCESSOR_ATTRIBUTES_FEATURE_COUNT = ATTRIBUTES_FEATURE_COUNT + 1; >+ >+ /** > * The feature id for the '<em><b>Attributes</b></em>' containment reference list. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >@@ -4354,7 +4382,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getFigureViewmap() > * @generated > */ >- int FIGURE_VIEWMAP = 45; >+ int FIGURE_VIEWMAP = 46; > > /** > * The feature id for the '<em><b>Attributes</b></em>' containment reference list. >@@ -4409,7 +4437,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getSnippetViewmap() > * @generated > */ >- int SNIPPET_VIEWMAP = 46; >+ int SNIPPET_VIEWMAP = 47; > > /** > * The feature id for the '<em><b>Attributes</b></em>' containment reference list. >@@ -4464,7 +4492,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getInnerClassViewmap() > * @generated > */ >- int INNER_CLASS_VIEWMAP = 47; >+ int INNER_CLASS_VIEWMAP = 48; > > /** > * The feature id for the '<em><b>Attributes</b></em>' containment reference list. >@@ -4528,7 +4556,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getParentAssignedViewmap() > * @generated > */ >- int PARENT_ASSIGNED_VIEWMAP = 48; >+ int PARENT_ASSIGNED_VIEWMAP = 49; > > /** > * The feature id for the '<em><b>Attributes</b></em>' containment reference list. >@@ -4601,7 +4629,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getPalette() > * @generated > */ >- int PALETTE = 51; >+ int PALETTE = 52; > > /** > * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.EntryBaseImpl <em>Entry Base</em>}' class. >@@ -4611,7 +4639,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getEntryBase() > * @generated > */ >- int ENTRY_BASE = 52; >+ int ENTRY_BASE = 53; > > /** > * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.ToolEntryImpl <em>Tool Entry</em>}' class. >@@ -4621,7 +4649,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getToolEntry() > * @generated > */ >- int TOOL_ENTRY = 53; >+ int TOOL_ENTRY = 54; > > /** > * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.ToolGroupImpl <em>Tool Group</em>}' class. >@@ -4631,7 +4659,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getToolGroup() > * @generated > */ >- int TOOL_GROUP = 56; >+ int TOOL_GROUP = 57; > > /** > * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.impl.ValueExpressionImpl <em>Value Expression</em>}' class. >@@ -4641,7 +4669,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getValueExpression() > * @generated > */ >- int VALUE_EXPRESSION = 49; >+ int VALUE_EXPRESSION = 50; > > /** > * The feature id for the '<em><b>Body</b></em>' attribute. >@@ -4678,7 +4706,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenConstraint() > * @generated > */ >- int GEN_CONSTRAINT = 50; >+ int GEN_CONSTRAINT = 51; > > /** > * The feature id for the '<em><b>Body</b></em>' attribute. >@@ -4931,7 +4959,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getToolGroupItem() > * @generated > */ >- int TOOL_GROUP_ITEM = 54; >+ int TOOL_GROUP_ITEM = 55; > > /** > * The number of structural features of the '<em>Tool Group Item</em>' class. >@@ -4950,7 +4978,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getSeparator() > * @generated > */ >- int SEPARATOR = 55; >+ int SEPARATOR = 56; > > /** > * The number of structural features of the '<em>Separator</em>' class. >@@ -5059,7 +5087,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenElementInitializer() > * @generated > */ >- int GEN_ELEMENT_INITIALIZER = 57; >+ int GEN_ELEMENT_INITIALIZER = 58; > > /** > * The feature id for the '<em><b>Type Model Facet</b></em>' container reference. >@@ -5087,7 +5115,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenFeatureSeqInitializer() > * @generated > */ >- int GEN_FEATURE_SEQ_INITIALIZER = 58; >+ int GEN_FEATURE_SEQ_INITIALIZER = 59; > > /** > * The feature id for the '<em><b>Type Model Facet</b></em>' container reference. >@@ -5124,7 +5152,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenFeatureValueSpec() > * @generated > */ >- int GEN_FEATURE_VALUE_SPEC = 59; >+ int GEN_FEATURE_VALUE_SPEC = 60; > > /** > * The feature id for the '<em><b>Body</b></em>' attribute. >@@ -5170,7 +5198,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenLinkConstraints() > * @generated > */ >- int GEN_LINK_CONSTRAINTS = 60; >+ int GEN_LINK_CONSTRAINTS = 61; > > /** > * The feature id for the '<em><b>Link</b></em>' container reference. >@@ -5216,7 +5244,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenRuleContainerBase() > * @generated > */ >- int GEN_RULE_CONTAINER_BASE = 61; >+ int GEN_RULE_CONTAINER_BASE = 62; > > /** > * The feature id for the '<em><b>Editor</b></em>' reference. >@@ -5244,7 +5272,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenAuditContainer() > * @generated > */ >- int GEN_AUDIT_CONTAINER = 62; >+ int GEN_AUDIT_CONTAINER = 63; > > /** > * The feature id for the '<em><b>Editor</b></em>' reference. >@@ -5326,7 +5354,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenRuleBase() > * @generated > */ >- int GEN_RULE_BASE = 63; >+ int GEN_RULE_BASE = 64; > > /** > * The feature id for the '<em><b>Name</b></em>' attribute. >@@ -5363,7 +5391,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenAuditRule() > * @generated > */ >- int GEN_AUDIT_RULE = 64; >+ int GEN_AUDIT_RULE = 65; > > /** > * The feature id for the '<em><b>Name</b></em>' attribute. >@@ -5463,7 +5491,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenRuleTarget() > * @generated > */ >- int GEN_RULE_TARGET = 65; >+ int GEN_RULE_TARGET = 66; > > /** > * The number of structural features of the '<em>Gen Rule Target</em>' class. >@@ -5482,7 +5510,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenAuditable() > * @generated > */ >- int GEN_AUDITABLE = 73; >+ int GEN_AUDITABLE = 74; > > /** > * The number of structural features of the '<em>Gen Auditable</em>' class. >@@ -5501,7 +5529,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenDomainElementTarget() > * @generated > */ >- int GEN_DOMAIN_ELEMENT_TARGET = 66; >+ int GEN_DOMAIN_ELEMENT_TARGET = 67; > > /** > * The feature id for the '<em><b>Element</b></em>' reference. >@@ -5529,7 +5557,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenDiagramElementTarget() > * @generated > */ >- int GEN_DIAGRAM_ELEMENT_TARGET = 67; >+ int GEN_DIAGRAM_ELEMENT_TARGET = 68; > > /** > * The feature id for the '<em><b>Element</b></em>' reference. >@@ -5557,7 +5585,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenDomainAttributeTarget() > * @generated > */ >- int GEN_DOMAIN_ATTRIBUTE_TARGET = 68; >+ int GEN_DOMAIN_ATTRIBUTE_TARGET = 69; > > /** > * The feature id for the '<em><b>Attribute</b></em>' reference. >@@ -5594,7 +5622,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenNotationElementTarget() > * @generated > */ >- int GEN_NOTATION_ELEMENT_TARGET = 69; >+ int GEN_NOTATION_ELEMENT_TARGET = 70; > > /** > * The feature id for the '<em><b>Element</b></em>' reference. >@@ -5622,7 +5650,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenMetricContainer() > * @generated > */ >- int GEN_METRIC_CONTAINER = 70; >+ int GEN_METRIC_CONTAINER = 71; > > /** > * The feature id for the '<em><b>Editor</b></em>' reference. >@@ -5659,7 +5687,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenMetricRule() > * @generated > */ >- int GEN_METRIC_RULE = 71; >+ int GEN_METRIC_RULE = 72; > > /** > * The feature id for the '<em><b>Name</b></em>' attribute. >@@ -5750,7 +5778,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenAuditedMetricTarget() > * @generated > */ >- int GEN_AUDITED_METRIC_TARGET = 72; >+ int GEN_AUDITED_METRIC_TARGET = 73; > > /** > * The feature id for the '<em><b>Metric</b></em>' reference. >@@ -5787,7 +5815,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenMeasurable() > * @generated > */ >- int GEN_MEASURABLE = 74; >+ int GEN_MEASURABLE = 75; > > /** > * The number of structural features of the '<em>Gen Measurable</em>' class. >@@ -5806,7 +5834,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenExpressionProviderContainer() > * @generated > */ >- int GEN_EXPRESSION_PROVIDER_CONTAINER = 75; >+ int GEN_EXPRESSION_PROVIDER_CONTAINER = 76; > > /** > * The feature id for the '<em><b>Expressions Package Name</b></em>' attribute. >@@ -5861,7 +5889,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenExpressionProviderBase() > * @generated > */ >- int GEN_EXPRESSION_PROVIDER_BASE = 76; >+ int GEN_EXPRESSION_PROVIDER_BASE = 77; > > /** > * The feature id for the '<em><b>Expressions</b></em>' reference list. >@@ -5898,7 +5926,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenJavaExpressionProvider() > * @generated > */ >- int GEN_JAVA_EXPRESSION_PROVIDER = 77; >+ int GEN_JAVA_EXPRESSION_PROVIDER = 78; > > /** > * The feature id for the '<em><b>Expressions</b></em>' reference list. >@@ -5935,7 +5963,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenExpressionInterpreter() > * @generated > */ >- int GEN_EXPRESSION_INTERPRETER = 78; >+ int GEN_EXPRESSION_INTERPRETER = 79; > > /** > * The feature id for the '<em><b>Expressions</b></em>' reference list. >@@ -5999,7 +6027,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getProviderPriority() > * @generated > */ >- int PROVIDER_PRIORITY = 79; >+ int PROVIDER_PRIORITY = 80; > > /** > * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.LinkLabelAlignment <em>Link Label Alignment</em>}' enum. >@@ -6009,7 +6037,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getLinkLabelAlignment() > * @generated > */ >- int LINK_LABEL_ALIGNMENT = 80; >+ int LINK_LABEL_ALIGNMENT = 81; > > /** > * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.ViewmapLayoutType <em>Viewmap Layout Type</em>}' enum. >@@ -6019,7 +6047,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getViewmapLayoutType() > * @generated > */ >- int VIEWMAP_LAYOUT_TYPE = 81; >+ int VIEWMAP_LAYOUT_TYPE = 82; > > /** > * The meta object id for the '{@link org.eclipse.gmf.codegen.gmfgen.GenSeverity <em>Gen Severity</em>}' enum. >@@ -6029,7 +6057,7 @@ > * @see org.eclipse.gmf.codegen.gmfgen.impl.GMFGenPackageImpl#getGenSeverity() > * @generated > */ >- int GEN_SEVERITY = 82; >+ int GEN_SEVERITY = 83; > > /** > * Returns the meta object for class '{@link org.eclipse.gmf.codegen.gmfgen.GenEditorGenerator <em>Gen Editor Generator</em>}'. >@@ -8330,6 +8358,27 @@ > EAttribute getLabelOffsetAttributes_Y(); > > /** >+ * Returns the meta object for class '{@link org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes <em>Figure Accessor Attributes</em>}'. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @return the meta object for class '<em>Figure Accessor Attributes</em>'. >+ * @see org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes >+ * @generated >+ */ >+ EClass getFigureAccessorAttributes(); >+ >+ /** >+ * Returns the meta object for the attribute '{@link org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes#getFigureGetterName <em>Figure Getter Name</em>}'. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @return the meta object for the attribute '<em>Figure Getter Name</em>'. >+ * @see org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes#getFigureGetterName() >+ * @see #getFigureAccessorAttributes() >+ * @generated >+ */ >+ EAttribute getFigureAccessorAttributes_FigureGetterName(); >+ >+ /** > * Returns the meta object for class '{@link org.eclipse.gmf.codegen.gmfgen.FigureViewmap <em>Figure Viewmap</em>}'. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >Index: src/org/eclipse/gmf/codegen/gmfgen/GMFGenFactory.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/src/org/eclipse/gmf/codegen/gmfgen/GMFGenFactory.java,v >retrieving revision 1.34 >diff -u -r1.34 GMFGenFactory.java >--- src/org/eclipse/gmf/codegen/gmfgen/GMFGenFactory.java 24 May 2006 09:20:16 -0000 1.34 >+++ src/org/eclipse/gmf/codegen/gmfgen/GMFGenFactory.java 24 May 2006 22:47:18 -0000 >@@ -260,6 +260,15 @@ > LabelOffsetAttributes createLabelOffsetAttributes(); > > /** >+ * Returns a new object of class '<em>Figure Accessor Attributes</em>'. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @return a new object of class '<em>Figure Accessor Attributes</em>'. >+ * @generated >+ */ >+ FigureAccessorAttributes createFigureAccessorAttributes(); >+ >+ /** > * Returns a new object of class '<em>Figure Viewmap</em>'. > * <!-- begin-user-doc --> > * <!-- end-user-doc --> >Index: templates/parts/NodeEditPart.javajet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.codegen/templates/parts/NodeEditPart.javajet,v >retrieving revision 1.76 >diff -u -r1.76 NodeEditPart.javajet >--- templates/parts/NodeEditPart.javajet 24 May 2006 18:05:30 -0000 1.76 >+++ templates/parts/NodeEditPart.javajet 24 May 2006 22:47:23 -0000 >@@ -1,11 +1,13 @@ > <%@ jet package="org.eclipse.gmf.codegen.templates.parts" class="NodeEditPartGenerator" >- imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.* org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.*" >+ imports="java.util.* org.eclipse.emf.codegen.ecore.genmodel.* org.eclipse.gmf.codegen.gmfgen.* org.eclipse.gmf.common.codegen.* org.eclipse.gmf.codegen.gmfgen.util.*" > skeleton="../common.skeleton"%> > <% > final GenNode genNode = (GenNode) ((Object[]) argument)[0]; > final ImportAssistant importManager = (ImportAssistant) ((Object[]) argument)[1]; > GenDiagram genDiagram = genNode.getDiagram(); > boolean isXYLayout = ViewmapLayoutType.XY_LAYOUT_LITERAL.equals(genNode.getLayoutType()); >+ >+final NodeEditPartHelper myHelper = new NodeEditPartHelper(genNode); > %> > <%@ include file="../copyright4java.jetinc"%> > <%importManager.emitPackageStatement(stringBuffer);%> >@@ -55,15 +57,10 @@ > */ > protected void createDefaultEditPolicies() { > <% >-boolean hasChildrenInListCompartments = false; >-for (Iterator compartments = genNode.getCompartments().iterator(); compartments.hasNext();) { >- GenCompartment compartment = (GenCompartment) compartments.next(); >- hasChildrenInListCompartments |= compartment.isListLayout() && !compartment.getChildNodes().isEmpty(); >-} >-if (!genNode.getChildNodes().isEmpty() || hasChildrenInListCompartments) { >+if (!genNode.getChildNodes().isEmpty() || myHelper.hasChildrenInListCompartments()) { > %> > installEditPolicy(EditPolicyRoles.CREATION_ROLE, new <%=importManager.getImportedName("org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy")%>() >-<% if (hasChildrenInListCompartments) {%> >+<% if (myHelper.hasChildrenInListCompartments()) {%> > { > > public <%=importManager.getImportedName("org.eclipse.gef.commands.Command")%> getCommand(<%=importManager.getImportedName("org.eclipse.gef.Request")%> request) { >@@ -188,7 +185,6 @@ > */ > protected IFigure createNodeShape() { > <% >-boolean hasFixedChildren = false; > String figureQualifiedClassName = null; > Viewmap viewmap = genNode.getViewmap(); > if (viewmap instanceof FigureViewmap) { >@@ -224,39 +220,69 @@ > public <%=figureQualifiedClassName%> getPrimaryShape() { > return (<%=figureQualifiedClassName%>) primaryShape; > } >+<%}%> >+ > <% >- List innerFixedLabels = new ArrayList(genNode.getLabels().size()); >- for (Iterator it = genNode.getLabels().iterator(); it.hasNext(); ) { >- GenNodeLabel genLabel = (GenNodeLabel) it.next(); >- if (!(genLabel instanceof GenExternalNodeLabel) && genLabel.getViewmap() instanceof ParentAssignedViewmap) { >- innerFixedLabels.add(genLabel); >- } >- } >- if (!innerFixedLabels.isEmpty()) { >- hasFixedChildren = true; >+if (myHelper.hasFixedChildren()) { > %> >- > /** > * @generated > */ > protected boolean addFixedChild(EditPart childEditPart) { > <% >- for (Iterator it = innerFixedLabels.iterator(); it.hasNext(); ) { >- final GenNodeLabel genLabel = (GenNodeLabel) it.next(); >- final String labelEditPart = importManager.getImportedName(genLabel.getEditPartQualifiedClassName()); >- final ParentAssignedViewmap childViewmap = (ParentAssignedViewmap) genLabel.getViewmap(); >- final String childSetterName = childViewmap.getSetterName() == null ? "setLabel" : childViewmap.getSetterName(); >+for (Iterator it = myHelper.getInnerFixedLabels(); it.hasNext(); ) { >+ GenNodeLabel genLabel = (GenNodeLabel) it.next(); >+ final String labelEditPart = importManager.getImportedName(genLabel.getEditPartQualifiedClassName()); >+ final ParentAssignedViewmap childViewmap = (ParentAssignedViewmap) genLabel.getViewmap(); >+ final String childSetterName = childViewmap.getSetterName() == null ? "setLabel" : childViewmap.getSetterName(); > %> > if (childEditPart instanceof <%=labelEditPart%>) { > ((<%=labelEditPart%>) childEditPart).<%=childSetterName%>(getPrimaryShape().<%=childViewmap.getGetterName()%>()); > return true; > } >-<% }%> >+<% >+} >+ >+for (Iterator it = myHelper.getPinnedCompartments(); it.hasNext(); ) { >+ GenCompartment next = (GenCompartment)it.next(); >+ FigureAccessorAttributes placement = myHelper.getFigureAccessorAttributes(next); >+ String compartmentEditPartFQN = importManager.getImportedName(next.getEditPartQualifiedClassName()); >+%> >+ if (childEditPart instanceof <%=compartmentEditPartFQN%>) { >+ <%=importManager.getImportedName("org.eclipse.draw2d.IFigure")%> pane = getPrimaryShape().<%=placement.getFigureGetterName()%>(); >+ setupContentPane(pane); >+ pane.add(((<%=compartmentEditPartFQN%>)childEditPart).getFigure()); >+ return true; >+ } >+<% >+} // for pinned compartments >+%> > return false; > } >+ >+ /** >+ * @generated >+ */ >+ protected boolean removeFixedChild(EditPart childEditPart) { > <% >+//XXX: ignore labels assuming that they never may be removed >+for (Iterator it = myHelper.getPinnedCompartments(); it.hasNext(); ) { >+ GenCompartment next = (GenCompartment)it.next(); >+ FigureAccessorAttributes placement = myHelper.getFigureAccessorAttributes(next); >+ String compartmentEditPartFQN = importManager.getImportedName(next.getEditPartQualifiedClassName()); >+%> >+ if (childEditPart instanceof <%=compartmentEditPartFQN%>) { >+ <%=importManager.getImportedName("org.eclipse.draw2d.IFigure")%> pane = getPrimaryShape().<%=placement.getFigureGetterName()%>(); >+ pane.remove(((<%=compartmentEditPartFQN%>)childEditPart).getFigure()); >+ return true; >+ } >+<% >+} // for pinned compartments >+%> >+ return false; > } >-} >+<% >+} // if myHelper.hasFixedChildren() > %> > > /** >@@ -351,8 +377,8 @@ > return super.getContentPane(); > } > <% >-if (!genNode.getLabels().isEmpty()) { >- GenNodeLabel primaryLabel = (GenNodeLabel) genNode.getLabels().get(0); >+if (myHelper.getPrimaryLabel() != null) { >+ GenNodeLabel primaryLabel = myHelper.getPrimaryLabel(); > %> > > /** >@@ -363,61 +389,22 @@ > } > <% > } >-boolean hasExternalLabels = false; >-for (Iterator labels = genNode.getLabels().iterator(); labels.hasNext();) { >- GenNodeLabel label = (GenNodeLabel) labels.next(); >- if (label instanceof GenExternalNodeLabel) { >- hasExternalLabels = true; >- break; >- } >-} >-if (hasExternalLabels) { >-%> > >- /** >- * @generated >- */ >- protected void addChildVisual(<%=importManager.getImportedName("org.eclipse.gef.EditPart")%> childEditPart, int index) { >- if (isExternalLabel(childEditPart)) { >- IFigure labelFigure = ((<%=importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")%>) childEditPart).getFigure(); >- getExternalLabelsContainer().add(labelFigure); >- } else { >-<% if (hasFixedChildren) {%> >- if (!addFixedChild(childEditPart)) { >- super.addChildVisual(childEditPart, -1); >- } >-<% } else {%> >- super.addChildVisual(childEditPart, -1); >-<% }%> >- } >- } >- >- /** >- * @generated >- */ >- protected void removeChildVisual(<%=importManager.getImportedName("org.eclipse.gef.EditPart")%> childEditPart) { >- if (isExternalLabel(childEditPart)) { >- IFigure labelFigure = ((<%=importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")%>) childEditPart).getFigure(); >- getExternalLabelsContainer().remove(labelFigure); >- } else { >- super.removeChildVisual(childEditPart); >- } >- } >+if (myHelper.hasExternalLabels()){ >+%> > > /** > * @generated > */ > protected boolean isExternalLabel(<%=importManager.getImportedName("org.eclipse.gef.EditPart")%> childEditPart) { > <% >- for (Iterator labels = genNode.getLabels().iterator(); labels.hasNext();) { >- GenNodeLabel label = (GenNodeLabel) labels.next(); >- if (label instanceof GenExternalNodeLabel) { >+ for (Iterator externalLabels = myHelper.getExternalLabels(); externalLabels.hasNext();) { >+ GenNodeLabel next = (GenNodeLabel) externalLabels.next(); > %> >- if (childEditPart instanceof <%=importManager.getImportedName(label.getEditPartQualifiedClassName())%>) { >+ if (childEditPart instanceof <%=importManager.getImportedName(next.getEditPartQualifiedClassName())%>) { > return true; > } > <% >- } > } > %> > return false; >@@ -432,18 +419,65 @@ > } > > <% >-} else if (hasFixedChildren) {%> >+} >+ >+if (myHelper.hasFixedChildren() || myHelper.hasExternalLabels()) { >+%> > > /** > * @generated > */ >- protected void addChildVisual(EditPart childEditPart, int index) { >- if (!addFixedChild(childEditPart)) { >- super.addChildVisual(childEditPart, -1); >+ protected void addChildVisual(<%=importManager.getImportedName("org.eclipse.gef.EditPart")%> childEditPart, int index) { >+<% >+if (myHelper.hasExternalLabels()){ >+%> >+ if (isExternalLabel(childEditPart)) { >+ IFigure labelFigure = ((<%=importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")%>) childEditPart).getFigure(); >+ getExternalLabelsContainer().add(labelFigure); >+ return; >+ } >+<% >+} >+if (myHelper.hasFixedChildren()){ >+%> >+ if (addFixedChild(childEditPart)) { >+ return; > } >+<% >+} >+%> >+ super.addChildVisual(childEditPart, -1); > } >+ >+ /** >+ * @generated >+ */ >+ protected void removeChildVisual(<%=importManager.getImportedName("org.eclipse.gef.EditPart")%> childEditPart) { >+<% >+if (myHelper.hasExternalLabels()){ >+%> >+ if (isExternalLabel(childEditPart)) { >+ IFigure labelFigure = ((<%=importManager.getImportedName("org.eclipse.gef.GraphicalEditPart")%>) childEditPart).getFigure(); >+ getExternalLabelsContainer().remove(labelFigure); >+ return; >+ } >+<% >+} >+if (myHelper.hasFixedChildren()){ >+%> >+ if (removeFixedChild(childEditPart)){ >+ return; >+ } >+<% >+} >+%> >+ super.removeChildVisual(childEditPart); >+ } >+<% >+} // if hasFixedChildren || hasExternalLabels >+%> >+ > <% >-} /*else if hasFixedChildren && !hasExternalLabels*/ > if (genNode.getViewmap() instanceof InnerClassViewmap) { > %> > <%=((InnerClassViewmap) genNode.getViewmap()).getClassBody()%> >Index: src/org/eclipse/gmf/codegen/gmfgen/impl/FigureAccessorAttributesImpl.java >=================================================================== >RCS file: src/org/eclipse/gmf/codegen/gmfgen/impl/FigureAccessorAttributesImpl.java >diff -N src/org/eclipse/gmf/codegen/gmfgen/impl/FigureAccessorAttributesImpl.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/codegen/gmfgen/impl/FigureAccessorAttributesImpl.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,161 @@ >+/** >+ * <copyright> >+ * </copyright> >+ * >+ * $Id$ >+ */ >+package org.eclipse.gmf.codegen.gmfgen.impl; >+ >+import org.eclipse.emf.common.notify.Notification; >+ >+import org.eclipse.emf.ecore.EClass; >+ >+import org.eclipse.emf.ecore.impl.ENotificationImpl; >+import org.eclipse.emf.ecore.impl.EObjectImpl; >+ >+import org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes; >+import org.eclipse.gmf.codegen.gmfgen.GMFGenPackage; >+ >+/** >+ * <!-- begin-user-doc --> >+ * An implementation of the model object '<em><b>Figure Accessor Attributes</b></em>'. >+ * <!-- end-user-doc --> >+ * <p> >+ * The following features are implemented: >+ * <ul> >+ * <li>{@link org.eclipse.gmf.codegen.gmfgen.impl.FigureAccessorAttributesImpl#getFigureGetterName <em>Figure Getter Name</em>}</li> >+ * </ul> >+ * </p> >+ * >+ * @generated >+ */ >+public class FigureAccessorAttributesImpl extends EObjectImpl implements FigureAccessorAttributes { >+ /** >+ * The default value of the '{@link #getFigureGetterName() <em>Figure Getter Name</em>}' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @see #getFigureGetterName() >+ * @generated >+ * @ordered >+ */ >+ protected static final String FIGURE_GETTER_NAME_EDEFAULT = null; >+ >+ /** >+ * The cached value of the '{@link #getFigureGetterName() <em>Figure Getter Name</em>}' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @see #getFigureGetterName() >+ * @generated >+ * @ordered >+ */ >+ protected String figureGetterName = FIGURE_GETTER_NAME_EDEFAULT; >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ protected FigureAccessorAttributesImpl() { >+ super(); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ protected EClass eStaticClass() { >+ return GMFGenPackage.eINSTANCE.getFigureAccessorAttributes(); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public String getFigureGetterName() { >+ return figureGetterName; >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public void setFigureGetterName(String newFigureGetterName) { >+ String oldFigureGetterName = figureGetterName; >+ figureGetterName = newFigureGetterName; >+ if (eNotificationRequired()) >+ eNotify(new ENotificationImpl(this, Notification.SET, GMFGenPackage.FIGURE_ACCESSOR_ATTRIBUTES__FIGURE_GETTER_NAME, oldFigureGetterName, figureGetterName)); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public Object eGet(int featureID, boolean resolve, boolean coreType) { >+ switch (featureID) { >+ case GMFGenPackage.FIGURE_ACCESSOR_ATTRIBUTES__FIGURE_GETTER_NAME: >+ return getFigureGetterName(); >+ } >+ return super.eGet(featureID, resolve, coreType); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public void eSet(int featureID, Object newValue) { >+ switch (featureID) { >+ case GMFGenPackage.FIGURE_ACCESSOR_ATTRIBUTES__FIGURE_GETTER_NAME: >+ setFigureGetterName((String)newValue); >+ return; >+ } >+ super.eSet(featureID, newValue); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public void eUnset(int featureID) { >+ switch (featureID) { >+ case GMFGenPackage.FIGURE_ACCESSOR_ATTRIBUTES__FIGURE_GETTER_NAME: >+ setFigureGetterName(FIGURE_GETTER_NAME_EDEFAULT); >+ return; >+ } >+ super.eUnset(featureID); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public boolean eIsSet(int featureID) { >+ switch (featureID) { >+ case GMFGenPackage.FIGURE_ACCESSOR_ATTRIBUTES__FIGURE_GETTER_NAME: >+ return FIGURE_GETTER_NAME_EDEFAULT == null ? figureGetterName != null : !FIGURE_GETTER_NAME_EDEFAULT.equals(figureGetterName); >+ } >+ return super.eIsSet(featureID); >+ } >+ >+ /** >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @generated >+ */ >+ public String toString() { >+ if (eIsProxy()) return super.toString(); >+ >+ StringBuffer result = new StringBuffer(super.toString()); >+ result.append(" (figureGetterName: "); >+ result.append(figureGetterName); >+ result.append(')'); >+ return result.toString(); >+ } >+ >+} //FigureAccessorAttributesImpl >Index: src/org/eclipse/gmf/codegen/gmfgen/util/NodeEditPartHelper.java >=================================================================== >RCS file: src/org/eclipse/gmf/codegen/gmfgen/util/NodeEditPartHelper.java >diff -N src/org/eclipse/gmf/codegen/gmfgen/util/NodeEditPartHelper.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/codegen/gmfgen/util/NodeEditPartHelper.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,107 @@ >+/* >+ * Copyright (c) 2006 Borland Software Corporation >+ * >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Michael Golubev (Borland) - initial API and implementation >+ */ >+ >+package org.eclipse.gmf.codegen.gmfgen.util; >+ >+import java.util.Iterator; >+import java.util.LinkedList; >+import java.util.List; >+ >+import org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes; >+import org.eclipse.gmf.codegen.gmfgen.GenCompartment; >+import org.eclipse.gmf.codegen.gmfgen.GenExternalNodeLabel; >+import org.eclipse.gmf.codegen.gmfgen.GenNode; >+import org.eclipse.gmf.codegen.gmfgen.GenNodeLabel; >+import org.eclipse.gmf.codegen.gmfgen.ParentAssignedViewmap; >+import org.eclipse.gmf.codegen.gmfgen.Viewmap; >+ >+public class NodeEditPartHelper { >+ private final List myInnerLabels = new LinkedList(); >+ private final List myExternalLabels = new LinkedList(); >+ private final List myPinnedCompartments = new LinkedList(); >+ private final List myFloatingCompartments = new LinkedList(); >+ private GenNodeLabel myPrimaryLabel; >+ private boolean myHasChildrenInListCompartments = false; >+ >+ public NodeEditPartHelper(GenNode genNode){ >+ myPrimaryLabel = null; >+ >+ for (Iterator labels = genNode.getLabels().iterator(); labels.hasNext();) { >+ GenNodeLabel next = (GenNodeLabel) labels.next(); >+ if (myPrimaryLabel == null){ >+ myPrimaryLabel = next; >+ } >+ if (next instanceof GenExternalNodeLabel) { >+ myExternalLabels.add(next); >+ } else if (next.getViewmap() instanceof ParentAssignedViewmap) { >+ myInnerLabels.add(next); >+ } >+ } >+ >+ for (Iterator compartments = genNode.getCompartments().iterator(); compartments.hasNext();){ >+ GenCompartment next = (GenCompartment) compartments.next(); >+ if (isPinnedCompartment(next)){ >+ myPinnedCompartments.add(next); >+ } else { >+ myFloatingCompartments.add(next); >+ } >+ >+ myHasChildrenInListCompartments |= next.isListLayout() && !next.getChildNodes().isEmpty(); >+ } >+ } >+ >+ public boolean hasChildrenInListCompartments(){ >+ return myHasChildrenInListCompartments; >+ } >+ >+ public boolean hasInnerFixedLabels(){ >+ return !myInnerLabels.isEmpty(); >+ } >+ >+ public boolean hasPinnedCompartments(){ >+ return !myPinnedCompartments.isEmpty(); >+ } >+ >+ public boolean hasFixedChildren(){ >+ return hasInnerFixedLabels() || hasPinnedCompartments(); >+ } >+ >+ public boolean hasExternalLabels(){ >+ return !myExternalLabels.isEmpty(); >+ } >+ >+ public GenNodeLabel getPrimaryLabel(){ >+ return myPrimaryLabel; >+ } >+ >+ public Iterator getInnerFixedLabels(){ >+ return myInnerLabels.iterator(); >+ } >+ >+ public Iterator getExternalLabels(){ >+ return myExternalLabels.iterator(); >+ } >+ >+ public Iterator getPinnedCompartments(){ >+ return myPinnedCompartments.iterator(); >+ } >+ >+ public boolean isPinnedCompartment(GenCompartment compartment){ >+ return getFigureAccessorAttributes(compartment) != null; >+ } >+ >+ public FigureAccessorAttributes getFigureAccessorAttributes(GenCompartment compartment){ >+ Viewmap viewmap = compartment.getViewmap(); >+ return (viewmap == null) ? null : (FigureAccessorAttributes)viewmap.find(FigureAccessorAttributes.class); >+ } >+ >+} >Index: src/org/eclipse/gmf/codegen/gmfgen/FigureAccessorAttributes.java >=================================================================== >RCS file: src/org/eclipse/gmf/codegen/gmfgen/FigureAccessorAttributes.java >diff -N src/org/eclipse/gmf/codegen/gmfgen/FigureAccessorAttributes.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/codegen/gmfgen/FigureAccessorAttributes.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+/** >+ * <copyright> >+ * </copyright> >+ * >+ * $Id$ >+ */ >+package org.eclipse.gmf.codegen.gmfgen; >+ >+ >+/** >+ * <!-- begin-user-doc --> >+ * A representation of the model object '<em><b>Figure Accessor Attributes</b></em>'. >+ * <!-- end-user-doc --> >+ * >+ * <p> >+ * The following features are supported: >+ * <ul> >+ * <li>{@link org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes#getFigureGetterName <em>Figure Getter Name</em>}</li> >+ * </ul> >+ * </p> >+ * >+ * @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getFigureAccessorAttributes() >+ * @model >+ * @generated >+ */ >+public interface FigureAccessorAttributes extends Attributes { >+ /** >+ * Returns the value of the '<em><b>Figure Getter Name</b></em>' attribute. >+ * <!-- begin-user-doc --> >+ * <p> >+ * If the meaning of the '<em>Figure Getter Name</em>' attribute isn't clear, >+ * there really should be more of a description here... >+ * </p> >+ * <!-- end-user-doc --> >+ * @return the value of the '<em>Figure Getter Name</em>' attribute. >+ * @see #setFigureGetterName(String) >+ * @see org.eclipse.gmf.codegen.gmfgen.GMFGenPackage#getFigureAccessorAttributes_FigureGetterName() >+ * @model >+ * @generated >+ */ >+ String getFigureGetterName(); >+ >+ /** >+ * Sets the value of the '{@link org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes#getFigureGetterName <em>Figure Getter Name</em>}' attribute. >+ * <!-- begin-user-doc --> >+ * <!-- end-user-doc --> >+ * @param value the new value of the '<em>Figure Getter Name</em>' attribute. >+ * @see #getFigureGetterName() >+ * @generated >+ */ >+ void setFigureGetterName(String value); >+ >+} // FigureAccessorAttributes >#P org.eclipse.gmf.graphdef.codegen >Index: src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java,v >retrieving revision 1.8 >diff -u -r1.8 FigureChildrenGenerator.java >--- src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java 2 May 2006 11:44:18 -0000 1.8 >+++ src/org/eclipse/gmf/graphdef/codegen/templates/FigureChildrenGenerator.java 24 May 2006 22:47:24 -0000 >@@ -33,7 +33,7 @@ > protected final String TEXT_12 = NL + "\t\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate "; > protected final String TEXT_13 = " f"; > protected final String TEXT_14 = "; " + NL + "" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic "; >- protected final String TEXT_15 = " getFigure"; >+ protected final String TEXT_15 = " "; > protected final String TEXT_16 = "() {" + NL + "\t\treturn f"; > protected final String TEXT_17 = ";" + NL + "\t}" + NL + "\t" + NL + "\t/**" + NL + "\t * @generated" + NL + "\t */" + NL + "\tprivate void setFigure"; > protected final String TEXT_18 = "("; >@@ -54,6 +54,7 @@ > final Stack/*GraphDefDispatcher.LayoutArgs*/ contextStack = new Stack/*GraphDefDispatcher.LayoutArgs*/(); > final LinkedList queue = new LinkedList(); > final Object marker = new Object(); >+final NamingStrategy namingStrategy = NamingStrategy.INSTANCE; > > class FieldSupport { > private final Figure myRoot; >@@ -132,7 +133,7 @@ > stringBuffer.append(TEXT_14); > stringBuffer.append(nextClassName); > stringBuffer.append(TEXT_15); >- stringBuffer.append(next.getName()); >+ stringBuffer.append(namingStrategy.getChildFigureGetterName(next)); > stringBuffer.append(TEXT_16); > stringBuffer.append(CodeGenUtil.capName(next.getName())); > stringBuffer.append(TEXT_17); >Index: templates/children/Figure.javajet >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.graphdef.codegen/templates/children/Figure.javajet,v >retrieving revision 1.7 >diff -u -r1.7 Figure.javajet >--- templates/children/Figure.javajet 2 May 2006 11:44:18 -0000 1.7 >+++ templates/children/Figure.javajet 24 May 2006 22:47:24 -0000 >@@ -10,6 +10,7 @@ > final Stack/*GraphDefDispatcher.LayoutArgs*/ contextStack = new Stack/*GraphDefDispatcher.LayoutArgs*/(); > final LinkedList queue = new LinkedList(); > final Object marker = new Object(); >+final NamingStrategy namingStrategy = NamingStrategy.INSTANCE; > > class FieldSupport { > private final Figure myRoot; >@@ -83,7 +84,7 @@ > /** > * @generated > */ >- public <%=nextClassName%> getFigure<%=next.getName()%>() { >+ public <%=nextClassName%> <%=namingStrategy.getChildFigureGetterName(next)%>() { > return f<%=CodeGenUtil.capName(next.getName())%>; > } > >Index: src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java >=================================================================== >RCS file: src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java >diff -N src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/gmf/graphdef/codegen/NamingStrategy.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+/* >+ * Copyright (c) 2006 Borland Software Corporation >+ * >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Michael Golubev (Borland) - initial API and implementation >+ */ >+ >+package org.eclipse.gmf.graphdef.codegen; >+ >+import org.eclipse.emf.codegen.util.CodeGenUtil; >+import org.eclipse.gmf.gmfgraph.Figure; >+ >+public class NamingStrategy { >+ public static NamingStrategy INSTANCE = new NamingStrategy(); >+ >+ public String getChildFigureGetterName(Figure childFigure){ >+ return "getFigure" + CodeGenUtil.capName(CodeGenUtil.validJavaIdentifier(childFigure.getName())); >+ } >+} >#P org.eclipse.gmf.bridge >Index: src/org/eclipse/gmf/bridge/genmodel/InnerClassViewmapProducer.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/plugins/org.eclipse.gmf.bridge/src/org/eclipse/gmf/bridge/genmodel/InnerClassViewmapProducer.java,v >retrieving revision 1.18 >diff -u -r1.18 InnerClassViewmapProducer.java >--- src/org/eclipse/gmf/bridge/genmodel/InnerClassViewmapProducer.java 24 May 2006 18:05:26 -0000 1.18 >+++ src/org/eclipse/gmf/bridge/genmodel/InnerClassViewmapProducer.java 24 May 2006 22:47:25 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.EStructuralFeature; > import org.eclipse.emf.ecore.util.EcoreUtil; >+import org.eclipse.gmf.codegen.gmfgen.FigureAccessorAttributes; > import org.eclipse.gmf.codegen.gmfgen.FigureViewmap; > import org.eclipse.gmf.codegen.gmfgen.GMFGenFactory; > import org.eclipse.gmf.codegen.gmfgen.InnerClassViewmap; >@@ -42,6 +43,7 @@ > import org.eclipse.gmf.gmfgraph.util.RuntimeFQNSwitch; > import org.eclipse.gmf.graphdef.codegen.FigureGenerator; > import org.eclipse.gmf.graphdef.codegen.MapModeCodeGenStrategy; >+import org.eclipse.gmf.graphdef.codegen.NamingStrategy; > import org.eclipse.gmf.internal.common.codegen.NullImportAssistant; > > /** >@@ -91,11 +93,37 @@ > > public Viewmap create(Compartment compartment) { > Viewmap result = super.create(compartment); >+ setupPinnedCompartment(result, compartment); > if (compartment.getFigure() instanceof Figure){ > setupPluginDependencies(result, (Figure) compartment.getFigure()); > } > return result; > } >+ >+ private void setupPinnedCompartment(Viewmap viewmap, Compartment compartment){ >+ FigureHandle handle = compartment.getFigure(); >+ if (handle == null){ >+ return; >+ } >+ if (handle instanceof FigureAccessor){ >+ FigureAccessor ghost = (FigureAccessor)handle; >+ FigureAccessorAttributes attributes = GMFGenFactory.eINSTANCE.createFigureAccessorAttributes(); >+ attributes.setFigureGetterName(ghost.getAccessor()); >+ viewmap.getAttributes().add(attributes); >+ } else if (handle instanceof Figure) { >+ Figure compartmentFigure = (Figure)handle; >+ Figure root = findRootFigure(compartmentFigure); >+ if (root != handle && !root.getReferencingElements().isEmpty()){ >+ FigureAccessorAttributes attributes = GMFGenFactory.eINSTANCE.createFigureAccessorAttributes(); >+ attributes.setFigureGetterName(NamingStrategy.INSTANCE.getChildFigureGetterName(compartmentFigure)); >+ viewmap.getAttributes().add(attributes); >+ } >+ } else { >+ throw new IllegalArgumentException("Unknown FigureHandle :" + handle); >+ } >+ } >+ >+ > > private Viewmap createViewmap(Figure figure) { > Viewmap result; >@@ -106,7 +134,7 @@ > ParentAssignedViewmap v = GMFGenFactory.eINSTANCE.createParentAssignedViewmap(); > // XXX yet another assumption - getter name > // FIXME introduce feedback to FigureGenerator to let us know exact names >- v.setGetterName("get" + CodeGenUtil.validJavaIdentifier(figure.getName())); >+ v.setGetterName(NamingStrategy.INSTANCE.getChildFigureGetterName(figure)); > v.setFigureQualifiedClassName(fqnSwitch.get(figure)); > result = v; > } else { >@@ -191,4 +219,20 @@ > } > return true; > } >+ >+ public static Figure findRootFigure(Figure figure){ >+ Figure current = figure; >+ while (true){ >+ EObject next = current.eContainer(); >+ if (next instanceof Figure){ >+ current = (Figure)next; >+ } else if (next == null || next instanceof FigureGallery){ >+ return current; >+ } else { >+ throw new IllegalStateException("Ancestor for figure: " + figure + " is not FigureGallery but :" + next); >+ } >+ } >+ } >+ >+ > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 139148
: 42516