Binary file carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/META-INF/ECLIPSEF.RSA has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/META-INF/ECLIPSEF.SF Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,1037 @@
+Signature-Version: 1.0
+SHA1-Digest-Manifest: xuCfYnJKSpIWoDGvzZQa1v7oqXo=
+Created-By: 1.6.0 (IBM Corporation)
+SHA1-Digest-Manifest-Main-Attributes: bGrBkNm196vKaxRGhrfXR4UR3rA=
+
+Name: codegen.lite.templates/xpt/diagram/policies/ConnectionEndpointEd
+ itPolicy.xpt
+SHA1-Digest: UaMuYuNyUYGiWGpoyex411qy6PI=
+
+Name: codegen.templates/xpt/providers/extensions.xpt
+SHA1-Digest: 6M0RwFOrRa7aetrz8Yk1KsS5N5Q=
+
+Name: about.ini
+SHA1-Digest: gVRQg+K250UBanfZOJGfGOsoncw=
+
+Name: codegen.lite.templates/xpt/providers/DomainElementInitializer.xp
+ t
+SHA1-Digest: 1OegNzCHawAO3bR96EjOnaVYcos=
+
+Name: codegen.templates/xpt/diagram/commands/CreateNodeCommand.xpt
+SHA1-Digest: d7yJ1WjO+XppQwYeMUl9SgJeRp0=
+
+Name: codegen.templates/xpt/parsers/RegexpParser.xpt
+SHA1-Digest: i/ggy5ffcBeuVDR3/9zi49Qb3A4=
+
+Name: codegen.templates/xpt/editor/DeleteElementAction.xpt
+SHA1-Digest: lJzhNWQoAHRSk7+RKloenJBBLK8=
+
+Name: codegen.templates/diagram/editparts/NodeLabelEditPart.xpt
+SHA1-Digest: 62jY2cJmtA0K/5kg/X/kFj33S1Q=
+
+Name: codegen.templates/xpt/diagram/views/LinkViewFactory.xpt
+SHA1-Digest: 95MZvXjcApGtdn4HAXnmy8nonzA=
+
+Name: graphdef.codegen.templates/rt_mm/MapModeUtil.ext
+SHA1-Digest: EZKnGgxnqsPKMxQAZ+GppWFeiaQ=
+
+Name: codegen.lite.templates/xpt/providers/extensions.xpt
+SHA1-Digest: RopwFkgKqtATx1VhEBSf3MnSMPA=
+
+Name: codegen.templates/xpt/diagram/commands/ReorientLinkCommand.xpt
+SHA1-Digest: JkTuD6a67Qessk3Ol4Ixp2gKWzw=
+
+Name: codegen.templates/emf-merge.xml
+SHA1-Digest: fH4bie5x1ARqvZ8XFP9BhfZ5tJc=
+
+Name: codegen.lite.templates/xpt/viewfactories/BehaviourUtils.ext
+SHA1-Digest: 8DxCkk7RYGhFQ4e2SvyoRhjzJjU=
+
+Name: codegen.lite.templates/xpt/diagram/PhantomUtils.ext
+SHA1-Digest: iP48uqUtZNUU6D6WSAltXUan3XE=
+
+Name: codegen.templates/xpt/GenAuditRoot.ext
+SHA1-Digest: HL2jO1QWWnaC/5yOhEwHVAk5HSY=
+
+Name: codegen.templates/xpt/expressions/getExpression.xpt
+SHA1-Digest: S5w02aE/v1dUdfthz0JmhsgHadY=
+
+Name: codegen.templates/xpt/editor/CreationWizardPage.xpt
+SHA1-Digest: msH+yodCVYIUV7l5CBOMHkAxGDY=
+
+Name: graphdef.codegen.templates/MapMode.xpt
+SHA1-Digest: 4JhXmvsClocZpWxFagPaj9l9QQw=
+
+Name: graphdef.codegen.templates/Attrs.xpt
+SHA1-Digest: VftZ4vvbpN+BcfFZO3iIEZobz3I=
+
+Name: codegen.templates/xpt/diagram/preferences/GeneralPreferencePage.
+ xpt
+SHA1-Digest: rbThHTe43Vw6pbzPMeuLJ28coLM=
+
+Name: codegen.lite.templates/xpt/editor/CreationWizard.xpt
+SHA1-Digest: yKU6Iq/FdpuI+zcXTs782SA+Fzo=
+
+Name: codegen.templates/xpt/parsers/AbstractParser.xpt
+SHA1-Digest: LHubfZwabTtMfLHjKjBdry4OUCQ=
+
+Name: graphdef.codegen.templates/plugin/Activator.xpt
+SHA1-Digest: 0MLpYcrbt8/9kbpXDZYmIoJyCxU=
+
+Name: codegen.lite.templates/xpt/application/extensions.xpt
+SHA1-Digest: vLO5mbRzoRLdKAX3KizA5ixWijo=
+
+Name: codegen.lite.templates/xpt/properties.xpt
+SHA1-Digest: F6HNlm9NDETjMdwbIpBCrVjyTtY=
+
+Name: codegen.templates/xpt/navigator/NavigatorGroup.xpt
+SHA1-Digest: lOmZixZfLOGKhYvYMQWHSKI5GIQ=
+
+Name: codegen.templates/xpt/editor/ResourceSetModificationListener.xpt
+SHA1-Digest: W1mInaJzKN3uAertlvXFTSpASlI=
+
+Name: graphdef.codegen.templates/Children.xpt
+SHA1-Digest: SchrbasFbrmcGY9cVwU+91V2bvM=
+
+Name: codegen.templates/xpt/application/Application.xpt
+SHA1-Digest: 3HgTkKPnrNDe3cjMRRkmF7eUi7w=
+
+Name: codegen.templates/xpt/providers/ElementTypes.xpt
+SHA1-Digest: S4z8yaJQUD7osAvKgnUHebOA6sQ=
+
+Name: codegen.templates/xpt/diagram/views/Utils.xpt
+SHA1-Digest: V32cxxqv6RLfuBPuw0B3UXc3kHo=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LinkNotationModelRefres
+ her.xpt
+SHA1-Digest: EXwQ8lurqIUDr+Z9luEK698804U=
+
+Name: codegen.templates/xpt/diagram/commands/CreateLinkUtils.xpt
+SHA1-Digest: 9fRbKiOhvZCHB4UZ/jP+HF5Ls8c=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/extensions.xpt
+SHA1-Digest: ncWoDKebv2CIF8nKg5Zi6HCXCh0=
+
+Name: graphdef.codegen.templates/xtras/ScalablePolygon.xpt
+SHA1-Digest: KOYl6xR+MvT8zw5KTB3S1gAzNWM=
+
+Name: codegen.templates/xpt/diagram/preferences/PrintingPreferencePage
+ .xpt
+SHA1-Digest: HGMTESX7BENiCKNixrUYwZ3JFAQ=
+
+Name: about.properties
+SHA1-Digest: 4XDlu3bXTz77YILCy7JJF9tj6UQ=
+
+Name: codegen.templates/xpt/diagram/Utils.ext
+SHA1-Digest: fecT0nCb0yj2BU7s4ZkHsnOy9mI=
+
+Name: codegen.templates/xpt/diagram/editpolicies/linkCommands.xpt
+SHA1-Digest: k36nKOq/50wZiZ3zrA7y3Mn+t1E=
+
+Name: codegen.templates/MetaModel.ext
+SHA1-Digest: 2SqgBmtzhkX4IM4SBDTRSZNV+No=
+
+Name: codegen.templates/xpt/diagram/commands/ReorientLinkUtils.xpt
+SHA1-Digest: jpAemLyW8t/ETIvCBtXZTKbHys0=
+
+Name: codegen.lite.templates/xpt/diagram/policies/GraphicalNodeEditPol
+ icy.xpt
+SHA1-Digest: 0Liu89CgeZr1n+K2S4fFAYKUW2Q=
+
+Name: codegen.templates/xpt/diagram/editpolicies/GraphicalNodeEditPoli
+ cy.xpt
+SHA1-Digest: 9+Cd6ni2DCeTyQ0flfjsnYH+Ikk=
+
+Name: codegen.templates/xpt/providers/ElementInitializers.ext
+SHA1-Digest: brLpfPvc095ibwUpF5xKsp1MUH8=
+
+Name: codegen.lite.templates/xpt/diagram/policies/ClassNames.ext
+SHA1-Digest: bxkFETOwNZMlGJcjNK+g5Kuv5gk=
+
+Name: graphdef.codegen.templates/plugin/BuildProperties.xpt
+SHA1-Digest: EXWHbkzyDyD+kjdPpqs7xFZF3JY=
+
+Name: codegen.lite.templates/xpt/editor/CreationWizardPage.xpt
+SHA1-Digest: xZPP0RX7EHho3gEq+/rAPPhzLeo=
+
+Name: codegen.templates/xpt/diagram/updater/LinkDescriptor.xpt
+SHA1-Digest: 6cV5tZ53LDtjQ8aJchpKzTMczS8=
+
+Name: graphdef.codegen.templates/Util.ext
+SHA1-Digest: DQzTFgO3nTuhTEScW6SmVcSymQI=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LinkEditPart.xpt
+SHA1-Digest: 6Wznnmwk/H4+YMCqrW1NJg+N47E=
+
+Name: graphdef.codegen.templates/Runtime.xpt
+SHA1-Digest: zyQm3WtZOHYMj0mg2WVLF3ihbOw=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/GeneralPreference
+ Page.xpt
+SHA1-Digest: stemt9EHwZ2jkJdU8KCxzA22DC8=
+
+Name: graphdef.codegen.templates/attr/CustomClass.xpt
+SHA1-Digest: nmLJqfivqRFABuwvde+FcjuGgt0=
+
+Name: codegen.templates/xpt/diagram/views/LabelViewFactory.xpt
+SHA1-Digest: H31U7emNqYSIJyCBbebAr65U8kw=
+
+Name: codegen.templates/xpt/diagram/views/DiagramViewFactory.xpt
+SHA1-Digest: f2kA5ckyX2FvYSwpYlbmjgjq6Qc=
+
+Name: codegen.templates/xpt/editor/DomainModelElementTester.xpt
+SHA1-Digest: P7DL34qx5Us+wmqNXvwdylu+mpo=
+
+Name: codegen.templates/xpt/diagram/updater/NodeDescriptor.xpt
+SHA1-Digest: YsRN3Fi+xoH5yIf0l8J60xk8fM4=
+
+Name: codegen.templates/xpt/parsers/PrintfParser.xpt
+SHA1-Digest: wY6O+fKkf9Wk5DTzI7sqQ2zK1tw=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NodeEditPart.xpt
+SHA1-Digest: 3xSc2aXZrRO1w4dcpFzwpWOmLoA=
+
+Name: codegen.lite.templates/xpt/diagram/policies/i18n.ext
+SHA1-Digest: O73vsxmGn2OKcaLIuA63PP8M4KM=
+
+Name: graphdef.codegen.templates/Decoration.xpt
+SHA1-Digest: bjk0RlTm5/oTxkv4JxiogpTfmE0=
+
+Name: codegen.templates/xpt/providers/IconProvider.xpt
+SHA1-Digest: MuAfFbN+N8qRAbe+SjiKtAXOJnk=
+
+Name: codegen.templates/diagram/editparts/LinkEditPart.xpt
+SHA1-Digest: mKTTT8WQX6mTpRz7xm4HymFmT94=
+
+Name: codegen.lite.templates/xpt/editor/Common.xpt
+SHA1-Digest: WV4U8szjmp3luy5HUOWHI+TVjUs=
+
+Name: codegen.templates/xpt/ConstraintProviders.xpt
+SHA1-Digest: n0tox2dqAK5F7NDLdRov625iX5U=
+
+Name: codegen.lite.templates/xpt/diagram/parts/refresh.xpt
+SHA1-Digest: gvpMtqvOkWiaoMPTaWpoX+yF7fo=
+
+Name: codegen.templates/xpt/navigator/NavigatorActionProvider.xpt
+SHA1-Digest: 67e3gWS8rbR3bTgNOukB7trmDhs=
+
+Name: codegen.templates/diagram/editparts/NodeEditPart.xpt
+SHA1-Digest: qL6ZQ5NNikk2nUJucwzZoXXrgPs=
+
+Name: codegen.templates/xpt/diagram/edithelpers/EditHelper.xpt
+SHA1-Digest: 8RzbuK8MopxbXLH0QopY9F1S/Ek=
+
+Name: codegen.templates/xpt/Externalizer.xpt
+SHA1-Digest: kjyNlcMjrFgKunfiA0A1oQ4hdH0=
+
+Name: codegen.lite.templates/aspects/xpt/navigator/NavigatorContentPro
+ vider.xpt
+SHA1-Digest: sCDImEBheLcYYU9jMEcP1IL7K4c=
+
+Name: codegen.templates/xpt/Common.xpt
+SHA1-Digest: RgZo2jwW+mzoXoELVFZr0ytAFrM=
+
+Name: codegen.templates/xpt/diagram/updater/Utils.ext
+SHA1-Digest: gwZc44EpHPOpvLNqvz98NdzDhBc=
+
+Name: codegen.templates/xpt/providers/ShortcutsDecoratorProvider.xpt
+SHA1-Digest: ksHII3mLunL7WsgukNZzCFRveV8=
+
+Name: codegen.templates/xpt/diagram/editpolicies/DiagramItemSemanticEd
+ itPolicy.xpt
+SHA1-Digest: 2w/E87ZRsXpUHAzstaeLmVCXt+4=
+
+Name: codegen.templates/xpt/diagram/editpolicies/OpenDiagram.xpt
+SHA1-Digest: QL+42zzpUE0q011qF3NJeki7Shw=
+
+Name: codegen.templates/xpt/diagram/views/CompartmentViewFactory.xpt
+SHA1-Digest: 8yxfoGrOW4zOOFp5DlauxxbKKwY=
+
+Name: codegen.lite.templates/xpt/diagram/parts/CompartmentEditPart.xpt
+SHA1-Digest: RcOoHLAMRUU48eHGEijmmBBzOyM=
+
+Name: codegen.templates/xpt/editor/CreateShortcutAction.xpt
+SHA1-Digest: V0BV+i3WHZJKlOSP44St9SueFD4=
+
+Name: codegen.templates/xpt/expressions/ValueExpression.ext
+SHA1-Digest: uj5yEvrJjuE/4umTbq2mkQvzaGY=
+
+Name: codegen.templates/xpt/plugin/build.xpt
+SHA1-Digest: 3vDu0XtZY8ILVJ33q1Ol2CRWZzU=
+
+Name: codegen.templates/xpt/diagram/views/FloatingLabelViewFactory.xpt
+SHA1-Digest: rXYa+QRGw2sGweuEscruXL6yJys=
+
+Name: codegen.templates/xpt/editor/Utils.ext
+SHA1-Digest: 5rYYSj4mn3bgfq2hMMZMBpLOnMw=
+
+Name: graphdef.codegen.templates/attr/Figure.xpt
+SHA1-Digest: SZCHuxKSoibN/N6VK69pvnay1P8=
+
+Name: codegen.templates/xpt/diagram/editparts/Utils.ext
+SHA1-Digest: IVywanHynhOdQgUK44gJWKvpQJM=
+
+Name: codegen.templates/impl/diagram/editparts/DiagramEditPart.xpt
+SHA1-Digest: 84/ceIUsWDRhgLPop2JOUbXnv9g=
+
+Name: codegen.templates/xpt/editor/DiagramContentInitializer.xpt
+SHA1-Digest: yuDE9crxu9F09Xwqv40hAD5H5Bc=
+
+Name: codegen.templates/xpt/providers/EditPartProvider.xpt
+SHA1-Digest: as4ERIfwkq/5EWUR5KXj5sy/u/U=
+
+Name: codegen.lite.templates/xpt/commands/ReconnectLinkTargetCommand.x
+ pt
+SHA1-Digest: 4S9vqxSEfA8qnYMIManBpKiyo/A=
+
+Name: codegen.lite.templates/xpt/editor/DiagramInitializer.xpt
+SHA1-Digest: zGL7t7dP2c+CRwJhtheuVKLa3pk=
+
+Name: codegen.templates/xpt/diagram/edithelpers/EditHelperAdvice.xpt
+SHA1-Digest: CBYy5S6YNluSJ2K1nKPVjhsmeFw=
+
+Name: codegen.templates/xpt/providers/ViewProvider.xpt
+SHA1-Digest: xJXMiR2uTjJAMVaYwUdFOabbFOw=
+
+Name: codegen.templates/xpt/ExternalizerUtils.ext
+SHA1-Digest: ZUVa6003MBQ7z2dkq7CM55tXPWg=
+
+Name: codegen.templates/impl/diagram/editparts/LinkEditPart.xpt
+SHA1-Digest: tcBDThwMQd6AXYmM7Ban9hzx5n0=
+
+Name: graphdef.codegen.templates/Extras.xpt
+SHA1-Digest: 8PX+M5rIhDbo/LZb73a9kerb9n8=
+
+Name: codegen.lite.templates/xpt/editor/ActionBarContributor.xpt
+SHA1-Digest: 3FiPFgjACub07xlZbZubap+1Otc=
+
+Name: codegen.templates/impl/diagram/editparts/NodeEditPart.xpt
+SHA1-Digest: gapPcbfPGvBLb89DoEnZbYbe/5I=
+
+Name: codegen.templates/MetaModel.xpt
+SHA1-Digest: 3aUvXN2yLHmgSyLfdfVL7cUFen8=
+
+Name: codegen.lite.templates/xpt/diagram/parts/EditPartFactory.xpt
+SHA1-Digest: 3fXYu0gkYMVwXB/IBZ63lomnEDE=
+
+Name: codegen.templates/xpt/diagram/editparts/EditPartFactory.xpt
+SHA1-Digest: jWnxoh5WKkWqdSBvCNO3rFQPR4U=
+
+Name: codegen.templates/xpt/application/extensions.xpt
+SHA1-Digest: /8+3QuvoQxOFj+bY3vv4Ow9cwPQ=
+
+Name: codegen.templates/xpt/editor/ShortcutPropertyTester.xpt
+SHA1-Digest: IxJH62zSjW83N4l7z0KDXreFLVk=
+
+Name: codegen.templates-dynmodel/Facility.ext
+SHA1-Digest: nMh5GNxz2IlqXs/5XGwRmUjMcrs=
+
+Name: codegen.templates/xpt/providers/ElementInitializers.xpt
+SHA1-Digest: UhK5TDVfillkVmv0imcgq/inYF4=
+
+Name: codegen.lite.templates/xpt/diagram/parts/semanticChildLinks.xpt
+SHA1-Digest: j4E+yWwPZP7LO7sZSSCUQLD5pB4=
+
+Name: codegen.templates/xpt/application/WizardNewFileCreationPage.xpt
+SHA1-Digest: ZbeUUUTcXgsfPV7Ilvog90CXEmU=
+
+Name: codegen.lite.templates/xpt/diagram/Helper.ext
+SHA1-Digest: qUal1weJxr1r4XYrRuhnIBfzxlM=
+
+Name: codegen.lite.templates/xpt/manifest.xpt
+SHA1-Digest: ihKnJpd9dQGP54yd6yohPhouLTA=
+
+Name: codegen.templates/xpt/providers/ContributionItemProvider.xpt
+SHA1-Digest: NaVdg5SXkw+Cy77Wt34nTW9x54U=
+
+Name: META-INF/eclipse.inf
+SHA1-Digest: SAqY+5ITAL0mkdYeijlSRhyIaZk=
+
+Name: codegen.templates/xpt/plugin/options.xpt
+SHA1-Digest: icPUvXwfXZoAVAd0k+GoDyuK/fk=
+
+Name: about.mappings
+SHA1-Digest: +Wi1zpUYWBeWFwKQ05mLmTCG6/w=
+
+Name: codegen.lite.templates/xpt/diagram/policies/ComponentEditPolicy.
+ ext
+SHA1-Digest: kFs/pIUwulRyed82H/akwKieTUQ=
+
+Name: codegen.templates/xpt/navigator/NavigatorLabelProvider.xpt
+SHA1-Digest: k5X1+vlFBVzqlZzU75L8xYFG5+M=
+
+Name: codegen.templates/xpt/diagram/preferences/extensions.xpt
+SHA1-Digest: /FYQ0VkadshGTKq8v07ewn0k7n4=
+
+Name: codegen.templates/xpt/diagram/commands/ReorientLinkViewCommand.x
+ pt
+SHA1-Digest: um33vK0qtQO2bU+IGywHZhNEwT8=
+
+Name: codegen.templates/xpt/propsheet/LabelProvider.xpt
+SHA1-Digest: vzxIkNSBWj8Z3iN75fpkClx1Q/I=
+
+Name: codegen.lite.templates/xpt/providers/ShortcutProvider.xpt
+SHA1-Digest: SQNEnCmMk97MaP4Z8N8Faf6g24o=
+
+Name: codegen.templates/xpt/editor/NewDiagramFileWizard.xpt
+SHA1-Digest: Fpa11y1LzA13omknFgra/sF8TkM=
+
+Name: codegen.lite.templates/aspects/xpt/editor/VisualIDRegistry.xpt
+SHA1-Digest: a/Fp7kjyvgbHtZ0ao5ihMb9v4o0=
+
+Name: codegen.lite.templates/xpt/commands/CreateLinkStartCommand.xpt
+SHA1-Digest: /KhwOGh1sKGf4flQCzpPSurtOXo=
+
+Name: codegen.templates/xpt/GenModelUtils.ext
+SHA1-Digest: 45qa+LaADX4pci8ylGlV+75f2qA=
+
+Name: codegen.templates/xpt/diagram/updater/extensions.xpt
+SHA1-Digest: rTu8mmCBf9OAX0bLhjpWLFNDyUs=
+
+Name: codegen.lite.templates/xpt/diagram/parts/requests.xpt
+SHA1-Digest: +7mTITKwtz6EOrcZzxfmsTaQSg0=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NotationModelRefresher.
+ ext
+SHA1-Digest: laRwWAhUdcKN2pq4DGn5bsrYOEA=
+
+Name: codegen.templates/xpt/providers/ParserProvider.xpt
+SHA1-Digest: 5uFIXblJmAbTbwntFLUIoZLU4T8=
+
+Name: codegen.templates/xpt/diagram/commands/CreateRefLinkCommand.xpt
+SHA1-Digest: yP6wHNFlIncmkqAe//nkEwE+GPg=
+
+Name: graphdef.codegen.templates/plugin/Manifest.xpt
+SHA1-Digest: fLMSR0NHPa+P7aAFpB1W5DDCwI8=
+
+Name: codegen.templates/xpt/diagram/preferences/ConnectionsPreferenceP
+ age.xpt
+SHA1-Digest: Dom+LwerFjFOQoXxf6OBe9Dhjkw=
+
+Name: codegen.templates/xpt/plugin/properties.xpt
+SHA1-Digest: dv1ZHYJx9di44OnhLJ6FYyaahRg=
+
+Name: codegen.templates/xpt/plugin/plugin.xpt
+SHA1-Digest: Zxd57tuUmxB08WHqXCUw153bL0Y=
+
+Name: plugin.properties
+SHA1-Digest: NG/Q3klSz1j1l6MwvZmzR6GwvHg=
+
+Name: codegen.templates/xpt/providers/MarkerNavigationProvider.xpt
+SHA1-Digest: urF04TNqq8lqaOAcfuE4frHXaQ4=
+
+Name: codegen.templates/xpt/providers/MetricProvider.xpt
+SHA1-Digest: nde7d4Wxd+vo/fKhh47vFFvsbRM=
+
+Name: codegen.lite.templates/aspects/xpt/application/WorkbenchWindowAd
+ visor.xpt
+SHA1-Digest: pk1k03FUNgO8sKwQJrJlGie8bcg=
+
+Name: codegen.templates/xpt/diagram/editpolicies/childContainerCreateC
+ ommand.xpt
+SHA1-Digest: lUJS32lr/kvvr57Y2RS0HDZ7vx4=
+
+Name: codegen.lite.templates/aspects/xpt/application/Perspective.xpt
+SHA1-Digest: khrhhQyldlVkU7j+IjB/bNtY4HU=
+
+Name: codegen.lite.templates/xpt/expressions/OCLExpressionFactory.xpt
+SHA1-Digest: U3aGpQ/sbmD75x2MApS7P71zNyY=
+
+Name: codegen.templates/xpt/editor/diagram.gif
+SHA1-Digest: 2QbgEPT7M69ftc4rONoVNyB9TmA=
+
+Name: plugin.xml
+SHA1-Digest: X4NPt2YuHN5eZW6TPhyhCpWWazk=
+
+Name: codegen.templates/xpt/parsers/MessageFormatParser.xpt
+SHA1-Digest: pipf3eHqzMSQ44SLlEuNqLorpRw=
+
+Name: codegen.lite.templates/xpt/diagram/policies/Common.xpt
+SHA1-Digest: yHdtia0T506pDoCI9wZOteLA5OQ=
+
+Name: codegen.lite.templates/xpt/editor/Editor.xpt
+SHA1-Digest: YjcVROXNgcju16TFZpyqy480pEM=
+
+Name: codegen.lite.templates/xpt/commands/CreateLinkCompleteCommand.xp
+ t
+SHA1-Digest: YyZWyJ9GzJtLtaUG7pzzw8jCF1Y=
+
+Name: codegen.templates/xpt/editor/DiagramEditorUtil.xpt
+SHA1-Digest: hk7rCgEGlBlPZjyzVNh56he8COA=
+
+Name: codegen.templates/xpt/application/WorkbenchAdvisor.xpt
+SHA1-Digest: 5nMyhKfsVGwVtq3lpWczpxamtYs=
+
+Name: codegen.templates/xpt/editor/CreationWizard.xpt
+SHA1-Digest: tkIrFYwo25+MmVeNBEpj/oAerNo=
+
+Name: codegen.templates/xpt/diagram/ViewmapAttributesUtils.ext
+SHA1-Digest: IkuSeUGf6f5WFk6pMswgkVJnfHo=
+
+Name: codegen.templates/xpt/navigator/AbstractNavigatorItem.xpt
+SHA1-Digest: GwRdVyRnCLR0KZkRicTcHEgdjF0=
+
+Name: codegen.templates/xpt/navigator/NavigatorItem.xpt
+SHA1-Digest: cZVJ1F6b6lPVA4gmwtGmb4sqLz4=
+
+Name: codegen.templates-dynmodel/Facility.xpt
+SHA1-Digest: cDpsfey7Hy5XxtbhiD3rywV0pqs=
+
+Name: codegen.templates/xpt/providers/MetricsResultView.xpt
+SHA1-Digest: bQaiGzvYgxA5ufL2gjBUTO+P55U=
+
+Name: codegen.templates/xpt/editor/VisualIDRegistry.xpt
+SHA1-Digest: JO8b+yg9iIVZQ/Vy/vMokf0Mnic=
+
+Name: codegen.templates/xpt/diagram/editpolicies/ChildContainerCanonic
+ alEditPolicy.xpt
+SHA1-Digest: sprGhPt9DlXy6RSLeGAVcx5fntU=
+
+Name: codegen.templates/xpt/editor/InitDiagramFileAction.xpt
+SHA1-Digest: b+ow0XaKLz4aHk2POZHgen8s7xI=
+
+Name: codegen.lite.templates/xpt/diagram/parts/DiagramEditPart.xpt
+SHA1-Digest: mO+zhDq4f9WKgPPyHqJ2q7p2ax4=
+
+Name: codegen.lite.templates/xpt/editor/palette/LinkToolEntry.xpt
+SHA1-Digest: 0ypmkvC5mt0u5MbvYwPqJZ+covY=
+
+Name: codegen.templates/impl/diagram/editparts/CompartmentEditPart.xpt
+SHA1-Digest: XjerqmGZhWQgSBjbKefm7dhvioI=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LinkLabelEditPart.xpt
+SHA1-Digest: dRzunK0i6su9Z1leygpyI8OCpRA=
+
+Name: codegen.lite.templates/xpt/providers/i18n.ext
+SHA1-Digest: BIRDevQbTQgsVWr9omfkJTtliGs=
+
+Name: codegen.templates/diagram/editparts/ExternalNodeLabelEditPart.xp
+ t
+SHA1-Digest: LFcFpbjyqWwpBYUN8xU2DnBemLQ=
+
+Name: codegen.lite.templates/xpt/editor/InitDiagramFileAction.xpt
+SHA1-Digest: fY1w9EaNk2n1zl50OVuBfvWv9GY=
+
+Name: codegen.templates/xpt/diagram/views/NodeViewFactory.xpt
+SHA1-Digest: +U/EankCP0tkMj78l997pRYMgs4=
+
+Name: codegen.lite.templates/xpt/editor/ShortcutCreationWizard.xpt
+SHA1-Digest: Agpu7MjZuQbaHdDGqq0S6y6rqGU=
+
+Name: codegen.lite.templates/xpt/diagram/policies/ComponentEditPolicy.
+ xpt
+SHA1-Digest: cH5fvQ9AOZVZPrjPBW40LDgLOvk=
+
+Name: codegen.templates/impl/diagram/editparts/LinkLabelEditPart.xpt
+SHA1-Digest: 009cH4qUIiL0uDTugZGr3c3fkTQ=
+
+Name: codegen.templates/xpt/diagram/preferences/AppearancePreferencePa
+ ge.xpt
+SHA1-Digest: sh14jzPRhC2BNhv2sxXVKavm91M=
+
+Name: codegen.templates/xpt/editor/ModelElementSelectionPage.xpt
+SHA1-Digest: alaP9U0J4VX+ypkDKhc25Z1PrWY=
+
+Name: codegen.lite.templates/xpt/viewfactories/ViewFactory.xpt
+SHA1-Digest: i4A6LdIGUv/xvoGcFS0MWEiGVGg=
+
+Name: codegen.templates/xpt/diagram/commands/CreateLinkCommand.xpt
+SHA1-Digest: y37gU92q3fwt7V1pSk02rigHY0I=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/AppearancePrefere
+ ncePage.xpt
+SHA1-Digest: /di23xrE0DeO4djpdet2ASpQouA=
+
+Name: codegen.templates/diagram/editparts/LinkLabelEditPart.xpt
+SHA1-Digest: GMHAXrxaaugBqEzjyBV9ENBOvvo=
+
+Name: codegen.templates/xpt/expressions/AbstractExpression.xpt
+SHA1-Digest: a/L1Hr4/7dI7B1s5rKXRXjmIVQw=
+
+Name: codegen.lite.templates/xpt/editor/ElementChooser.xpt
+SHA1-Digest: rJAwftkuArobey+ybCTqy0iYlV8=
+
+Name: codegen.lite.templates/xpt/commands/CreateShortcutEdgeCommand.xp
+ t
+SHA1-Digest: wmQJkusjnP9/LYQKQ6h6jpwENkI=
+
+Name: codegen.templates/xpt/application/Perspective.xpt
+SHA1-Digest: ACqPQ5DBTcOAm0yRStbX83uZX08=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NotationModelRefresher.
+ xpt
+SHA1-Digest: mx3kmLlO0xd8Q2HmlpzjlnzWaC4=
+
+Name: codegen.templates/xpt/GenEditorGenerator.ext
+SHA1-Digest: +7vLK9hxmrAVqSkaG6w/KFRp+ck=
+
+Name: codegen.lite.templates/xpt/plugin.xpt
+SHA1-Digest: EnIXy2QRqZ4Zv8fS1WrvBXLvYvc=
+
+Name: codegen.templates/xpt/parsers/i18n.ext
+SHA1-Digest: X1a2De96njjpRS4qxi0zYr1bWCw=
+
+Name: codegen.lite.templates/xpt/diagram/parts/ChildNodeEditPart.xpt
+SHA1-Digest: fcifWwzOAbWkp+UM8QGDdP11tQ0=
+
+Name: codegen.templates/impl/diagram/editparts/ChildNodeLabelEditPart.
+ xpt
+SHA1-Digest: W6oCW5oYK476sxynEgI7MzOXa7U=
+
+Name: codegen.templates/xpt/editor/LoadResourceAction.xpt
+SHA1-Digest: ciSuaQiBZRu9LcYK+8xbpgtalpg=
+
+Name: codegen.lite.templates/aspects/xpt/navigator/NavigatorLabelProvi
+ der.xpt
+SHA1-Digest: iy/ybBDc5QcbNEoUkkoXzUjLaHU=
+
+Name: codegen.lite.templates/xpt/editor/CreateShortcutAction.xpt
+SHA1-Digest: 1A1e/xnTwloGV8VPm/RC+F4a9bQ=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/Common.xpt
+SHA1-Digest: T7jQQX7Ta4ZLx5wV9didnkAS+B0=
+
+Name: codegen.templates/xpt/expressions/RegexpExpressionFactory.xpt
+SHA1-Digest: 0GkW2VXSd/KxUe4Uof9Tcyf3u/g=
+
+Name: codegen.lite.templates/xpt/commands/createNotationalElementComma
+ nd.xpt
+SHA1-Digest: YKy4K2bQtUO1oic5y1Ry3OX3dOI=
+
+Name: codegen.templates/xpt/diagram/preferences/RulersAndGridPreferenc
+ ePage.xpt
+SHA1-Digest: TLaYyhsVheqNt+JOhyruz9j5+Rs=
+
+Name: codegen.lite.templates/xpt/buildProperties.xpt
+SHA1-Digest: 17yFAqZ0btTt2WoMgSRKmfOi9mM=
+
+Name: codegen.lite.templates/xpt/editor/OpenDiagramInViewAction.xpt
+SHA1-Digest: fVItyEOHdX+ZZzIHTKrB9bH6k8A=
+
+Name: codegen.templates/diagram/editparts/ChildNodeLabelEditPart.xpt
+SHA1-Digest: rDdYWyRDyahGr9cUIKrS2sdirM4=
+
+Name: codegen.templates/xpt/propsheet/PropertySection.xpt
+SHA1-Digest: pAIEAXgR8UON/GS6gctmcuSLIAw=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LabelController.ext
+SHA1-Digest: rgcT1bDFgzIwdZ1hlfpvZ3bhWdg=
+
+Name: codegen.templates/xpt/diagram/updater/DiagramUpdater.xpt
+SHA1-Digest: Xq7kiCZWce/ThsiRaLPysLydq54=
+
+Name: codegen.templates/xpt/diagram/commands/ReorientRefLinkCommand.xp
+ t
+SHA1-Digest: mvlW0Z9Bb+MEnpktw9z56gfGUU8=
+
+Name: codegen.templates/xpt/editor/DiagramEditorContextMenuProvider.xp
+ t
+SHA1-Digest: hDolA0rev/b/yvt4EwIkpclEZ/k=
+
+Name: codegen.lite.templates/xpt/providers/ValidationUtils.ext
+SHA1-Digest: /S7UiWYAO6fjFiDo1blmykQKCqs=
+
+Name: codegen.templates/xpt/navigator/getEditorInput.xpt
+SHA1-Digest: 0AApU8fiwbEupR5aK31FR69Bx4c=
+
+Name: codegen.lite.templates/xpt/editor/URISelectorPage.xpt
+SHA1-Digest: ZzZSLlsKSQzg4C9BRFLAsRTpnoE=
+
+Name: codegen.templates/xpt/editor/GenDiagram.ext
+SHA1-Digest: 3yGvMixhXkQ0TY8kOoQUOWaAOAk=
+
+Name: graphdef.codegen.templates/attr/Decoration.xpt
+SHA1-Digest: Tdy2kOITOCyUQJ1K56rIm3+qdfs=
+
+Name: codegen.templates/xpt/navigator/navigatorGroup.gif
+SHA1-Digest: fwnIQ7dhdcIUIMQGyYT5rmJdkA4=
+
+Name: codegen.templates/xpt/navigator/DomainNavigatorContentProvider.x
+ pt
+SHA1-Digest: Y52oPYsvKbFkhLy41HjS31oAZ7g=
+
+Name: codegen.lite.templates/xpt/providers/MarkerNavigationProvider.xp
+ t
+SHA1-Digest: s1MULAbl07AqGIZ8FY8LW3m7Wxs=
+
+Name: codegen.lite.templates/xpt/diagram/parts/semanticChildren.xpt
+SHA1-Digest: wbmyYlx0ablh0qIefQQMbA48vv4=
+
+Name: codegen.lite.templates/xpt/editor/LoadResourceAction.xpt
+SHA1-Digest: 5ZxOnkvwy81x6wQ3LLi9gyhm5jI=
+
+Name: codegen.templates/xpt/editor/palette/PaletteFactory.xpt
+SHA1-Digest: hl3yG7TW2ObisuWHRX+sBs8V9KY=
+
+Name: codegen.templates/xpt/navigator/NavigatorLinkHelper.xpt
+SHA1-Digest: 4xoNZWAMJGiO9qFv7uHmrWnFf9A=
+
+Name: codegen.lite.templates/aspects/xpt/application/ActionBarAdvisor.
+ xpt
+SHA1-Digest: 0Xnw7dFN+GycJRGKxynTB4Vyykc=
+
+Name: codegen.templates/xpt/editor/ResourceSetInfo.xpt
+SHA1-Digest: EapbHGHypZa9MrHK0JUxw1sBGqI=
+
+Name: codegen.lite.templates/xpt/diagram/parts/Common.ext
+SHA1-Digest: /ML3SvT4+F2VhcbM34imqD7ucUM=
+
+Name: codegen.templates/xpt/editor/DocumentProvider.xpt
+SHA1-Digest: RdBHjvC8SkPq14rpQvv8O6f3e9c=
+
+Name: about.html
+SHA1-Digest: ndvVw5+urNOEMhFEsasUKrpQYII=
+
+Name: codegen.lite.templates/xpt/editor/NewDiagramFileWizard.xpt
+SHA1-Digest: C2t6s/XQmN07B/FL61Cto/ezmUk=
+
+Name: codegen.lite.templates/xpt/propsheet/PropertySection.xpt
+SHA1-Digest: O2Net36+ZoMhvRNhX0GWceKWM9I=
+
+Name: codegen.templates/xpt/navigator/NavigatorContentProvider.xpt
+SHA1-Digest: 1U8A/zoz3t/8rOb0Fp8YB2AAtVc=
+
+Name: codegen.lite.templates/xpt/diagram/policies/OpenDiagramEditPolic
+ y.xpt
+SHA1-Digest: E9RDdnIzOsWQPSTgdtsavoWec1Q=
+
+Name: codegen.templates/xpt/diagram/views/LabelNodeViewFactory.xpt
+SHA1-Digest: GdVNPJDtq9qx07rtIrtuI6hEuKw=
+
+Name: codegen.templates-dynmodel/MetaModel.xpt
+SHA1-Digest: AProeDl0oqqfzKwjzKYEsj/5M0Y=
+
+Name: codegen.templates/xpt/providers/i18n.ext
+SHA1-Digest: tgykSc9pQExK7uFgfKmNd9ISM38=
+
+Name: modeling32.png
+SHA1-Digest: HNz2oYHVqQEUObJQL6sh+Ik2jak=
+
+Name: codegen.lite.templates/xpt/commands/domainModelRemoveCommand.xpt
+SHA1-Digest: 4kSEs+DU/FlVGU0jmBHLJhKtLx4=
+
+Name: codegen.lite.templates/xpt/diagram/parts/domainModelRefresher.xp
+ t
+SHA1-Digest: 4o0F1EYfs7IkdW4y4XjolO8uCrk=
+
+Name: codegen.templates/xpt/plugin/Activator.xpt
+SHA1-Digest: jZQVXHksATPZTNymCiCs53y4ioU=
+
+Name: codegen.lite.templates/xpt/providers/MetricsAction.xpt
+SHA1-Digest: /Pz958flKdtodMfKxaq7O/15hIE=
+
+Name: codegen.templates/xpt/providers/ValidationDecoratorProvider.xpt
+SHA1-Digest: VoW0TVYts7m/0Sr/txcoBhbM2ow=
+
+Name: codegen.lite.templates/xpt/commands/CommandUtils.ext
+SHA1-Digest: WhbUNXcOp+zTUrppCqVE0CaMTuU=
+
+Name: codegen.lite.templates/xpt/editor/MatchingStrategy.xpt
+SHA1-Digest: 3Tf41o+m/9vbKl8TbEqkU9mbKvc=
+
+Name: codegen.lite.templates/xpt/editor/Wizard.ext
+SHA1-Digest: kaxUw8moULsUzq12KXSmdr+W5Uw=
+
+Name: codegen.lite.templates/xpt/commands/CloneNodeCommand.xpt
+SHA1-Digest: XcixjUDxOxu3/tzsaXXBQW365Ho=
+
+Name: codegen.templates/xpt/application/i18n.ext
+SHA1-Digest: 5plOUbcZmxj8o6qd4gZ57WtpSCk=
+
+Name: graphdef.codegen.templates/top/Figure.xpt
+SHA1-Digest: +Ym/JETFLaKaD7I9k15RRQg6AdA=
+
+Name: codegen.templates/xpt/diagram/editpolicies/TextFeedback.xpt
+SHA1-Digest: mJUz1HfafGomrdTNDFmka8QC8S4=
+
+Name: codegen.templates/xpt/diagram/editpolicies/LinkUtils.ext
+SHA1-Digest: 2jg//o3E6LV4HJO+5FaM/sP31Vs=
+
+Name: codegen.lite.templates/xpt/providers/ValidateAction.xpt
+SHA1-Digest: DjzD/D8fsRI+zsqYIJg5CQON4q0=
+
+Name: codegen.lite.templates/xpt/propsheet/SheetLabelProvider.xpt
+SHA1-Digest: qurs80OhghYyVBHfybjZgv5QnqQ=
+
+Name: codegen.lite.templates/aspects/xpt/editor/ModelElementSelectionP
+ age.xpt
+SHA1-Digest: op5DBgVRWhugtD/jG3AWvKPZnhE=
+
+Name: codegen.templates/xpt/navigator/DomainNavigatorItem.xpt
+SHA1-Digest: imP6YcABbLhlxNnDo0DQU3gDN1c=
+
+Name: codegen.templates/xpt/propsheet/extensions.xpt
+SHA1-Digest: HCFZ5KrFGpfAWqE7WOu/pRM2iXw=
+
+Name: codegen.templates/xpt/editor/wizban.gif
+SHA1-Digest: aBM6/dTK5KwAL43twrClu0hGBdk=
+
+Name: codegen.templates/xpt/navigator/DomainNavigatorLabelProvider.xpt
+SHA1-Digest: MoyWlxIdErcqz+TSz6zUSfkXf50=
+
+Name: codegen.templates/xpt/diagram/preferences/PreferenceInitializer.
+ xpt
+SHA1-Digest: glQRI/UIJHR6nQGbbZKs53+kgqA=
+
+Name: graphdef.codegen.templates/top/Descriptor.xpt
+SHA1-Digest: 95/ZEEOiWnx72yPm5ycuyECroD8=
+
+Name: codegen.templates/xpt/diagram/editpolicies/DiagramCanonicalEditP
+ olicy.xpt
+SHA1-Digest: X1Nk9T4xylHJOd61GBXxYBmoAis=
+
+Name: codegen.lite.templates/xpt/propsheet/extensions.xpt
+SHA1-Digest: jQjc6U45SAtLjDr+Kaq0rB31JN0=
+
+Name: codegen.templates/xpt/parsers/NativeParser.xpt
+SHA1-Digest: YotpZBZzUR/mypjZlA0QAQCrFi4=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LabelController.xpt
+SHA1-Digest: dndgQbKzRTBOMyoHbP1F8OcAtMs=
+
+Name: codegen.lite.templates/xpt/editor/i18n.ext
+SHA1-Digest: aBBpMgR8ErSFxQ0jqLX5GrZsJvU=
+
+Name: codegen.templates/xpt/providers/Metrics.ext
+SHA1-Digest: RSNqW+643tsiM75enjt6xO1E21A=
+
+Name: codegen.lite.templates/xpt/diagram/parts/TreeEditPart.ext
+SHA1-Digest: 8yqPnS5fDI3TsFemKn0gzxlbDf8=
+
+Name: codegen.templates/xpt/providers/ValidationProvider.xpt
+SHA1-Digest: e/5zHtY5AE7OMQpwSH+L8fPF8n0=
+
+Name: graphdef.codegen.templates/LayoutData.xpt
+SHA1-Digest: bgiRjc15RJBL5VI8J6VHWnmK7z0=
+
+Name: codegen.templates/xpt/diagram/edithelpers/BaseEditHelper.xpt
+SHA1-Digest: u2RDDVINdRdZ+KVCKN5Vki4wVSs=
+
+Name: codegen.lite.templates/aspects/xpt/diagram/editpolicies/BaseItem
+ SemanticEditPolicy.xpt
+SHA1-Digest: LETlHH/9K/LG+BfFIEzK8XN8bAI=
+
+Name: codegen.lite.templates/aspects/xpt/editor/palette/PaletteFactory
+ .xpt
+SHA1-Digest: 9OX1GPanUA0AKCYw/6oxjnQ5ux8=
+
+Name: codegen.lite.templates/aspects/xpt/navigator/NavigatorActionProv
+ ider.xpt
+SHA1-Digest: tBbnl47nWXIlnkXynmyVxVHPCSo=
+
+Name: codegen.lite.templates/xpt/providers/ValidationProvider.xpt
+SHA1-Digest: SEvH/38v3JN8EMc/UtrPJD9oBmo=
+
+Name: codegen.lite.templates/aspects/xpt/navigator/NavigatorLinkHelper
+ .xpt
+SHA1-Digest: l/O70q2DuBO3kUoDVGRajAEqF+Q=
+
+Name: codegen.templates/xpt/providers/ParserUtils.ext
+SHA1-Digest: opAie1GxOmnDlh9hPFPFJ0LeifU=
+
+Name: codegen.lite.templates/xpt/editor/Plugin.xpt
+SHA1-Digest: p+NJMDSNEY2/ZLu3VxJohbXQCx0=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/Util.ext
+SHA1-Digest: sh+kF7aJtxSKLgEvzPpbaaTc260=
+
+Name: codegen.lite.templates/xpt/providers/MetricsResultView.xpt
+SHA1-Digest: 9wDqq0HDESTrWPq3rH1Kh+oqXMg=
+
+Name: codegen.templates/xpt/editor/ValidateAction.xpt
+SHA1-Digest: r/MU6MhmXcmTdhDeH7C2Nx1dY9I=
+
+Name: codegen.templates/xpt/editor/Editor.xpt
+SHA1-Digest: Fj6XaJ7VRfkOXMNxlqReHCbhKag=
+
+Name: codegen.templates/xpt/editor/shortcut.gif
+SHA1-Digest: ZQ7+VxtmROk24bhNUo7rdlAtRX0=
+
+Name: codegen.lite.templates/xpt/commands/CreateShortcutNodeCommand.xp
+ t
+SHA1-Digest: ugdLGrE9K6AnvP0pqV19nPkcdTo=
+
+Name: codegen.templates/xpt/editor/UriEditorInputTester.xpt
+SHA1-Digest: sOnoDtyrExVTJzzv2c5VMTpy5WY=
+
+Name: codegen.lite.templates/xpt/diagram/LinkFinder.ext
+SHA1-Digest: NqvEa+W5ufqX2fXbTvFdwDVzwAE=
+
+Name: codegen.templates/xpt/navigator/extensions.xpt
+SHA1-Digest: +NOKZAlIXRuCF+26nKcMcud6kZ0=
+
+Name: codegen.templates/xpt/diagram/editpolicies/CompartmentItemSemant
+ icEditPolicy.xpt
+SHA1-Digest: UGTgC/QaeFDlexkbEmQRYV9PvFE=
+
+Name: codegen.templates/xpt/editor/extensions.xpt
+SHA1-Digest: udIr9Ak2ILveQV87Xh5t1kKcVy4=
+
+Name: codegen.lite.templates/xpt/Util.ext
+SHA1-Digest: SyiU5T+a+njFBS0mc1AkDJdkHw4=
+
+Name: codegen.lite.templates/xpt/providers/ElementTypes.xpt
+SHA1-Digest: fmHQ7HQMrw/M0l+1s7kl58a79t8=
+
+Name: codegen.lite.templates/xpt/commands/ReconnectLinkSourceCommand.x
+ pt
+SHA1-Digest: uf8utmD1JGlMMPjqNe4eoCCThCg=
+
+Name: codegen.lite.templates/xpt/navigator/extensions.xpt
+SHA1-Digest: jWddAOqgkAmtotBz+iafsj2E28A=
+
+Name: codegen.templates/xpt/navigator/Utils.ext
+SHA1-Digest: ouQinFNrUk+sd1Q6fn3BnS+BEdE=
+
+Name: codegen.templates/xpt/EMFUtils.ext
+SHA1-Digest: WXLvbVhWi1R/9iO/VudSVcBu/O0=
+
+Name: codegen.templates/xpt/diagram/editpolicies/LinkItemSemanticEditP
+ olicy.xpt
+SHA1-Digest: YNcS8rO5jRTlXsz4qaUElk8BBqQ=
+
+Name: codegen.templates/xpt/diagram/editparts/Common.xpt
+SHA1-Digest: um1xKYaru0hEyxMvWPGrRxmb6S8=
+
+Name: codegen.lite.templates/xpt/diagram/parts/Common.xpt
+SHA1-Digest: awnFWXxcnc+tv+3158PTAZMbynw=
+
+Name: codegen.templates/xpt/providers/ModelingAssistantProvider.xpt
+SHA1-Digest: WjPYE1Wn/XX2ZvqFHYSNj+cDBho=
+
+Name: graphdef.codegen.templates/rt_mm/MapMode.xpt
+SHA1-Digest: 0EG+AmCLwRteEuYkOkT6BXjSnVY=
+
+Name: codegen.templates/xpt/parsers/CompositeParser.xpt
+SHA1-Digest: 3zG3k5PXvKL3QNMNrbFO4zR6idI=
+
+Name: codegen.templates/xpt/plugin/manifest.xpt
+SHA1-Digest: PqWbGVRm1G6PlMZ0LXRdJqf0Enw=
+
+Name: codegen.templates/diagram/editparts/CompartmentEditPart.xpt
+SHA1-Digest: Ln41XtAqRWn+0rLeEKW0tEzwP8o=
+
+Name: codegen.templates/diagram/editparts/DiagramEditPart.xpt
+SHA1-Digest: obt9LO11WAnIImKMgBS2NFkG9co=
+
+Name: codegen.lite.templates/xpt/diagram/parts/decorations.xpt
+SHA1-Digest: EV7v53LypppSQ0iQ9YRe9ClQAss=
+
+Name: codegen.templates/xpt/diagram/editpolicies/NodeItemSemanticEditP
+ olicy.xpt
+SHA1-Digest: laV6TsxmITxnlJ00hiYV8x0VKUw=
+
+Name: codegen.templates/xpt/editor/MatchingStrategy.xpt
+SHA1-Digest: e6Qgc9Z0yOfNEbKy9eh8OpJMYmA=
+
+Name: codegen.templates/xpt/editor/ShortcutCreationWizard.xpt
+SHA1-Digest: cCdrO7zP3vnoeunvhaMGYQVvObc=
+
+Name: codegen.templates/xpt/diagram/commands/CreateShortcutDecorations
+ Command.xpt
+SHA1-Digest: nuGwBvhquqzcxEtq/55b6VjK7wA=
+
+Name: codegen.templates/xpt/editor/ValidationMarker.xpt
+SHA1-Digest: vHNC1zV2LFdTVC5w1UY27lG01s4=
+
+Name: codegen.templates/xpt/expressions/OCLExpressionFactory.xpt
+SHA1-Digest: NoF4cO7bc6UM2tzzpw1Yl5FdGus=
+
+Name: graphdef.codegen.templates/Layout.xpt
+SHA1-Digest: 6IXo6X62aw26S0THhM1lXlHjYB4=
+
+Name: codegen.templates/xpt/application/WorkbenchWindowAdvisor.xpt
+SHA1-Digest: 3EAbQkw/eOa502EdrwlSV+hzidk=
+
+Name: codegen.lite.templates/xpt/commands/CreateNodeCommand.xpt
+SHA1-Digest: hpq9w6J94+1sz/kuRwBrupSQqnw=
+
+Name: graphdef.codegen.templates/Border.xpt
+SHA1-Digest: BPLvJdiA5jlyT1/GP68ZSKdSZrw=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LinkNotationModelRefres
+ her.ext
+SHA1-Digest: p/D8uE0C2KQFAw38aprCl6z+Sak=
+
+Name: graphdef.codegen.templates/plugin/PluginProperties.xpt
+SHA1-Digest: nmM5RRD+QwW/LfsP6Wz7XiGBxBs=
+
+Name: codegen.templates/xpt/diagram/editpolicies/BaseItemSemanticEditP
+ olicy.xpt
+SHA1-Digest: R03sYqaga5oTUlXSjzDD14opLLg=
+
+Name: codegen.lite.templates/xpt/diagram/policies/LayoutEditPolicy.xpt
+SHA1-Digest: GFjpYz/Akub23q4XDkMIsr0B6R4=
+
+Name: codegen.lite.templates/xpt/providers/MetricProvider.xpt
+SHA1-Digest: ld9mwHBHQdsj2wh1Mv6HXh8yoBY=
+
+Name: codegen.templates/xpt/diagram/updater/UpdateCommand.xpt
+SHA1-Digest: lEdZ5uCfNCXlmRwwq0R5oHRVX4U=
+
+Name: codegen.templates/xpt/editor/ActionBarContributor.xpt
+SHA1-Digest: 3lQ7SQdx2duq3S+hNH7xc7QKKNo=
+
+Name: codegen.templates/xpt/editor/ElementChooser.xpt
+SHA1-Digest: 5Wm9Y0uCCqx7R0u5lpT38Vd9fCA=
+
+Name: codegen.templates/impl/diagram/editparts/TextAware.xpt
+SHA1-Digest: i6r9ryA0fUetIC+4sf8CyMsZgD4=
+
+Name: codegen.templates/xpt/diagram/editpolicies/Utils.ext
+SHA1-Digest: INnu2HWxosdPn3zTmMD8JkjaKCI=
+
+Name: codegen.lite.templates/xpt/commands/Common.xpt
+SHA1-Digest: fSzeoK1U8RzIhfq/BddJ7NofTEI=
+
+Name: codegen.templates/xpt/editor/palette/Utils.ext
+SHA1-Digest: wflRXStYEplTLoLGyOH7d031SHo=
+
+Name: codegen.templates/xpt/application/ActionBarAdvisor.xpt
+SHA1-Digest: blxlJ+jBsHT6zsEuMSfyqfhGLA8=
+
+Name: codegen.templates/xpt/navigator/NavigatorSorter.xpt
+SHA1-Digest: HYycyoCdY8l3SH6u7fzuiIvwhtA=
+
+Name: codegen.lite.templates/xpt/expressions/RegexpExpressionFactory.x
+ pt
+SHA1-Digest: cKNzmSnSlIptCrFhQLDa34CjWCM=
+
+Name: codegen.lite.templates/xpt/editor/extensions.xpt
+SHA1-Digest: BpWeSlmUVbLykf+eUt5nxPWMrVQ=
+
+Name: codegen.templates/xpt/diagram/updater/containerBaseCanonicalMeth
+ ods.xpt
+SHA1-Digest: B0pbC6DYw8XeHhAG58R44sSZkng=
+
+Name: codegen.lite.templates/aspects/xpt/Externalizer.xpt
+SHA1-Digest: 0Og3fAL3lH3qEU/Y2Mx3t0nL7H0=
+
+Name: graphdef.codegen.templates/attr/Shape.xpt
+SHA1-Digest: SynuIIGi8XBAhn8BR7kj3F4+y8A=
+
+Name: codegen.lite.templates/xpt/editor/DiagramEditorUtil.xpt
+SHA1-Digest: AfiySG9CLFJGFlBdAsbzF1XCCYA=
+
+Name: codegen.lite.templates/xpt/editor/palette/NodeToolEntry.xpt
+SHA1-Digest: 2u99nveEh7exIu275uRqKINvNsk=
+
+Name: codegen.templates/impl/diagram/editparts/ExternalNodeLabelEditPa
+ rt.xpt
+SHA1-Digest: ZBbYk5pgeTlKW2ypR77F8HNgSLI=
+
+Name: codegen.lite.templates/xpt/diagram/parts/TreeEditPart.xpt
+SHA1-Digest: tpSi3iIvcROFHiX017ZqmpQXazs=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NodeLabelEditPart.xpt
+SHA1-Digest: 9c9E4q0hbCIYxtEqTaiLPoxRmcY=
+
+Name: codegen.templates/impl/diagram/editparts/NodeLabelEditPart.xpt
+SHA1-Digest: McZLVRIyS5Dh6Dalr+fQy10dSvE=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NodeEditPart.ext
+SHA1-Digest: M8JhVfqmcKr8CGSic8Q/Fq9/ORk=
+
+Name: codegen.lite.templates/xpt/commands/AddNodeCommand.xpt
+SHA1-Digest: Q4fhygoZe+7ZhRX7BHMaUdYmfjw=
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/META-INF/MANIFEST.MF Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,1039 @@
+Manifest-Version: 1.0
+Bundle-Vendor: %providerName
+Bundle-Name: %pluginName
+Bundle-SymbolicName: org.eclipse.gmf.templates.legacy;singleton:=true
+Bundle-Version: 1.0.0.v20090614-0839
+Bundle-ManifestVersion: 2
+
+Name: codegen.lite.templates/xpt/diagram/policies/ConnectionEndpointEd
+ itPolicy.xpt
+SHA1-Digest: B11ZbsPqipMUHfcSDSuSNLIxVCM=
+
+Name: codegen.templates/xpt/providers/extensions.xpt
+SHA1-Digest: MnYlvSmfnbVt/2EdRHlLMh1lGk0=
+
+Name: about.ini
+SHA1-Digest: t0FfqhXQ1DOntXUimIG6MWb0U1g=
+
+Name: codegen.lite.templates/xpt/providers/DomainElementInitializer.xp
+ t
+SHA1-Digest: WL/mRAnTfy4qIsLHUEMxij8E3tk=
+
+Name: codegen.templates/xpt/diagram/commands/CreateNodeCommand.xpt
+SHA1-Digest: qt73ZtV8EOEdHcjp8le/2GX49Ok=
+
+Name: codegen.templates/xpt/parsers/RegexpParser.xpt
+SHA1-Digest: 2XkiPi1IkZEsNexu0jLlj8xE7u4=
+
+Name: codegen.templates/xpt/editor/DeleteElementAction.xpt
+SHA1-Digest: HZaNVH//FEPdV6tDGzicHKOS31A=
+
+Name: codegen.templates/diagram/editparts/NodeLabelEditPart.xpt
+SHA1-Digest: iQMEKdNL3PPrMvYMPAM1si7yfhQ=
+
+Name: codegen.templates/xpt/diagram/views/LinkViewFactory.xpt
+SHA1-Digest: T+0SF300we+VSPxqQD890egrUiU=
+
+Name: graphdef.codegen.templates/rt_mm/MapModeUtil.ext
+SHA1-Digest: wBrlsXIq+fDTChQ81GkQ/fcGkoI=
+
+Name: codegen.lite.templates/xpt/providers/extensions.xpt
+SHA1-Digest: 8mpFbgszHoHPhlv+gLiaPAHrXw4=
+
+Name: codegen.templates/xpt/diagram/commands/ReorientLinkCommand.xpt
+SHA1-Digest: mi4DZcCJXOrQ6YTWJJqwGmVo7GE=
+
+Name: codegen.lite.templates/xpt/diagram/PhantomUtils.ext
+SHA1-Digest: H9ewT2P+VSAqAtACFiBaxGWvnHE=
+
+Name: codegen.lite.templates/xpt/viewfactories/BehaviourUtils.ext
+SHA1-Digest: XPz+wHJ4KeyAO5SzJzw/TpJ7MSk=
+
+Name: codegen.templates/emf-merge.xml
+SHA1-Digest: 3TJrfRrodgzaruu8ir8gDDm3H/U=
+
+Name: codegen.templates/xpt/expressions/getExpression.xpt
+SHA1-Digest: TENmfyN2nb22sfusQgtj1CNGzjE=
+
+Name: codegen.templates/xpt/GenAuditRoot.ext
+SHA1-Digest: wGdUzeWwbY0dRbSUfAOOSUnkd/k=
+
+Name: graphdef.codegen.templates/MapMode.xpt
+SHA1-Digest: +tWJ00DplF26IYCc5KvvHGuqe9w=
+
+Name: codegen.templates/xpt/editor/CreationWizardPage.xpt
+SHA1-Digest: mKDnrIHWPldT6nlSy0k/ua9RDGw=
+
+Name: graphdef.codegen.templates/Attrs.xpt
+SHA1-Digest: 0Q3AoIjJ3zY2ezC8+nKLM1vQsiU=
+
+Name: codegen.templates/xpt/diagram/preferences/GeneralPreferencePage.
+ xpt
+SHA1-Digest: UsxjI1hHydtC7OdQfIH+BQbw0l4=
+
+Name: codegen.lite.templates/xpt/editor/CreationWizard.xpt
+SHA1-Digest: hGIUaTiEGeaYhKX/8OtUchGjxw8=
+
+Name: codegen.templates/xpt/parsers/AbstractParser.xpt
+SHA1-Digest: zYYsdoFmu106X70GAntpHf0HEpA=
+
+Name: graphdef.codegen.templates/plugin/Activator.xpt
+SHA1-Digest: hLWpakCuXo1Z+haD6rps/3KjmEI=
+
+Name: codegen.lite.templates/xpt/application/extensions.xpt
+SHA1-Digest: Arb0ISaq+359Y18W5z3xyXV6LT4=
+
+Name: codegen.lite.templates/xpt/properties.xpt
+SHA1-Digest: JuXBo7gbzKozuiaffRXilAWD8Tw=
+
+Name: codegen.templates/xpt/navigator/NavigatorGroup.xpt
+SHA1-Digest: IKq4pPa5MlYXonKqJasSRHAHPdo=
+
+Name: codegen.templates/xpt/editor/ResourceSetModificationListener.xpt
+SHA1-Digest: PXaUCFNtcBUbd2cnggsCsZO/9fA=
+
+Name: graphdef.codegen.templates/Children.xpt
+SHA1-Digest: 2ncTVz1CQTiQh9rbn7UBvkPqQXY=
+
+Name: codegen.templates/xpt/application/Application.xpt
+SHA1-Digest: wa6q+EzqgLjY5ovqx1/nmrweUXE=
+
+Name: codegen.templates/xpt/providers/ElementTypes.xpt
+SHA1-Digest: y2yndhpLsAQMiNdOKjgg3K16LSc=
+
+Name: codegen.templates/xpt/diagram/views/Utils.xpt
+SHA1-Digest: xxofOtEU37R9FApMpJI3GO+k870=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LinkNotationModelRefres
+ her.xpt
+SHA1-Digest: seLOI32ctsMTJkljYsUyLccmR6M=
+
+Name: codegen.templates/xpt/diagram/commands/CreateLinkUtils.xpt
+SHA1-Digest: 52dUehd/wEEhhHi9lqH0eDTexOw=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/extensions.xpt
+SHA1-Digest: gvBz5GI1faqPA0kxbIYH9EQxfWg=
+
+Name: graphdef.codegen.templates/xtras/ScalablePolygon.xpt
+SHA1-Digest: FI+AapDAts2YgbgltQW3cV74EUo=
+
+Name: codegen.templates/xpt/diagram/preferences/PrintingPreferencePage
+ .xpt
+SHA1-Digest: L3CNZNf7O5ZQkQWDLAvAgQLLNkg=
+
+Name: about.properties
+SHA1-Digest: 4N5IHqYm66vzBOCSYoKPtpfBX6s=
+
+Name: codegen.templates/xpt/diagram/Utils.ext
+SHA1-Digest: Aux9BQuHBfVoNk0Ai0rVHzSEH3I=
+
+Name: codegen.templates/xpt/diagram/editpolicies/linkCommands.xpt
+SHA1-Digest: TIi5i+0P5HZOJXVv1XPEEMaAczo=
+
+Name: codegen.templates/MetaModel.ext
+SHA1-Digest: gI4d2dk/kTkhUmy1bCutSygpV3s=
+
+Name: codegen.templates/xpt/diagram/commands/ReorientLinkUtils.xpt
+SHA1-Digest: 2dFEL5U6XnUy/s355LzsfjIkCoE=
+
+Name: codegen.lite.templates/xpt/diagram/policies/GraphicalNodeEditPol
+ icy.xpt
+SHA1-Digest: 3XNkuY4lyLIaWUtTMC0qeLaalVE=
+
+Name: codegen.templates/xpt/diagram/editpolicies/GraphicalNodeEditPoli
+ cy.xpt
+SHA1-Digest: 3kn7y4ZFHafzccCV6vvYHvEqwrM=
+
+Name: codegen.templates/xpt/providers/ElementInitializers.ext
+SHA1-Digest: gIuBlFYVsIkXLShRszrI5lsllOo=
+
+Name: codegen.lite.templates/xpt/diagram/policies/ClassNames.ext
+SHA1-Digest: /g8iDkUcqcNRbUkD7A6ioWFJ7pU=
+
+Name: graphdef.codegen.templates/plugin/BuildProperties.xpt
+SHA1-Digest: JCJW5USI529RNGDHFceJIIF1qxQ=
+
+Name: codegen.lite.templates/xpt/editor/CreationWizardPage.xpt
+SHA1-Digest: 5JoyVrpf1m63acOqyv/p2fDHBj8=
+
+Name: graphdef.codegen.templates/Util.ext
+SHA1-Digest: 2wTsqzh6wKXPMire9zyj7Xfl5B4=
+
+Name: codegen.templates/xpt/diagram/updater/LinkDescriptor.xpt
+SHA1-Digest: UDszDAr0rySHtjJ+pj+R2c0y1cw=
+
+Name: graphdef.codegen.templates/Runtime.xpt
+SHA1-Digest: CDOgPsOzSw6mUFCcWSee+TkVQYU=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LinkEditPart.xpt
+SHA1-Digest: OQtcplqAUxtUp6Tm2482fQ1ff/E=
+
+Name: graphdef.codegen.templates/attr/CustomClass.xpt
+SHA1-Digest: uQJ+ApkYjm0ea/9Nxm/orYMjkes=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/GeneralPreference
+ Page.xpt
+SHA1-Digest: GUscmvqpD9ks0ZfnKl1TMB5+TP0=
+
+Name: codegen.templates/xpt/diagram/views/LabelViewFactory.xpt
+SHA1-Digest: ex3W+ELV3pVXbNsfcO6Cg96/cuI=
+
+Name: codegen.templates/xpt/diagram/views/DiagramViewFactory.xpt
+SHA1-Digest: QLAB+s1gdJYmuyjNqCQ7S90mX2Y=
+
+Name: codegen.templates/xpt/editor/DomainModelElementTester.xpt
+SHA1-Digest: JR3ZfCvhmtxWp8YZjuIHJkRWOWs=
+
+Name: codegen.templates/xpt/parsers/PrintfParser.xpt
+SHA1-Digest: +RV5iC9Y/VBPfCYxffaO1Wgxl50=
+
+Name: codegen.templates/xpt/diagram/updater/NodeDescriptor.xpt
+SHA1-Digest: mHSBBjcXHilA+PfMjxHNq98bwVY=
+
+Name: graphdef.codegen.templates/Decoration.xpt
+SHA1-Digest: Y3dFET7U89ALKsZfHuoYeoELxXk=
+
+Name: codegen.lite.templates/xpt/diagram/policies/i18n.ext
+SHA1-Digest: oL12u/Uy4fOzwHCTPRUS4YSz770=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NodeEditPart.xpt
+SHA1-Digest: cj8UoTFkJ20vwNnU7d5VXrDl3vo=
+
+Name: codegen.templates/xpt/providers/IconProvider.xpt
+SHA1-Digest: YMbyxEOoheGUTFfpqSA2UU1cGbY=
+
+Name: codegen.templates/diagram/editparts/LinkEditPart.xpt
+SHA1-Digest: UK6kJLJ2s06CQCMEnllB+tOO0FM=
+
+Name: codegen.lite.templates/xpt/editor/Common.xpt
+SHA1-Digest: ccUZVhEciXqLv7G0XmzBqcXg7RM=
+
+Name: codegen.templates/xpt/ConstraintProviders.xpt
+SHA1-Digest: Qa2RuCo4n4NQQtoqACjro+eU3OE=
+
+Name: codegen.templates/xpt/navigator/NavigatorActionProvider.xpt
+SHA1-Digest: kdsxlHMRm6u4PP1rVdCqGTj+AIg=
+
+Name: codegen.lite.templates/xpt/diagram/parts/refresh.xpt
+SHA1-Digest: /76IXW75M5N5CjWmdVILXf6m0hw=
+
+Name: codegen.templates/diagram/editparts/NodeEditPart.xpt
+SHA1-Digest: uKECv/7ViCqU2W0Jyf5TCSkzzjA=
+
+Name: codegen.templates/xpt/diagram/edithelpers/EditHelper.xpt
+SHA1-Digest: yHHXINldXUa6TUGerrjjszNWklU=
+
+Name: codegen.lite.templates/aspects/xpt/navigator/NavigatorContentPro
+ vider.xpt
+SHA1-Digest: nSwhsAqBaw6TOscvVXMMnqMlMHY=
+
+Name: codegen.templates/xpt/Externalizer.xpt
+SHA1-Digest: HiEfu6WwUSNgQ/GHfUPsi7qJAtU=
+
+Name: codegen.templates/xpt/Common.xpt
+SHA1-Digest: BwsbHwHJI9jtn/F89YvweY77n8Q=
+
+Name: codegen.templates/xpt/providers/ShortcutsDecoratorProvider.xpt
+SHA1-Digest: EtxGGx3cSCo8CfbV0HY9ZM4MIlQ=
+
+Name: codegen.templates/xpt/diagram/updater/Utils.ext
+SHA1-Digest: owkDnwtEPBGC/106qPPLnp9h7eA=
+
+Name: codegen.templates/xpt/diagram/editpolicies/DiagramItemSemanticEd
+ itPolicy.xpt
+SHA1-Digest: LVMjNcENRJ0SSfR0hdj7mqHhU+s=
+
+Name: codegen.templates/xpt/diagram/views/CompartmentViewFactory.xpt
+SHA1-Digest: anVXpg0FhB3ycPTN+y8bvktFqD4=
+
+Name: codegen.templates/xpt/diagram/editpolicies/OpenDiagram.xpt
+SHA1-Digest: ScAINpOC2zYK3dHyia8RAgANBQ0=
+
+Name: codegen.templates/xpt/plugin/build.xpt
+SHA1-Digest: y49i1bNEDjFi7NCozF5FIdmcO+I=
+
+Name: codegen.templates/xpt/expressions/ValueExpression.ext
+SHA1-Digest: rkYxqdImLCgYJ8eUx5rvbqT+h/4=
+
+Name: codegen.templates/xpt/editor/CreateShortcutAction.xpt
+SHA1-Digest: e5mphieqnbfQDOSFbuK3Bz3JrWw=
+
+Name: codegen.lite.templates/xpt/diagram/parts/CompartmentEditPart.xpt
+SHA1-Digest: l1s0zbLI/tJXF08BofIXDyFZn2k=
+
+Name: codegen.templates/xpt/editor/Utils.ext
+SHA1-Digest: a+FWzMSE19dsZhsB/jecQG8ZCk8=
+
+Name: codegen.templates/xpt/diagram/views/FloatingLabelViewFactory.xpt
+SHA1-Digest: pYf39m+xyVrOG1SjkeJwmtHx1kU=
+
+Name: graphdef.codegen.templates/attr/Figure.xpt
+SHA1-Digest: yo8F87eRLtdA9025OFs0W2MjRd0=
+
+Name: codegen.templates/impl/diagram/editparts/DiagramEditPart.xpt
+SHA1-Digest: 1wX7LQVRTdWTmKI3+WZbNc7IdBA=
+
+Name: codegen.templates/xpt/diagram/editparts/Utils.ext
+SHA1-Digest: YzB+R0mtiHYpAY1JmAlyqw47m3M=
+
+Name: codegen.templates/xpt/editor/DiagramContentInitializer.xpt
+SHA1-Digest: 99LhwFc13426Tx7izSlGOWD+mcA=
+
+Name: codegen.templates/xpt/providers/EditPartProvider.xpt
+SHA1-Digest: 2xpZtgqjQMqpwahwurha+R+Zzw8=
+
+Name: codegen.lite.templates/xpt/commands/ReconnectLinkTargetCommand.x
+ pt
+SHA1-Digest: iD7tM6V9WibgiWWr692WYt4XYpk=
+
+Name: codegen.lite.templates/xpt/editor/DiagramInitializer.xpt
+SHA1-Digest: PAW05Rra04clAjG0+nt0MW0lzqY=
+
+Name: codegen.templates/xpt/diagram/edithelpers/EditHelperAdvice.xpt
+SHA1-Digest: kXz82txuS7cVzW6UT/HbqHhblQA=
+
+Name: codegen.templates/xpt/providers/ViewProvider.xpt
+SHA1-Digest: PoWijoHUygbxokAfpI0Lt3+YXis=
+
+Name: codegen.templates/xpt/ExternalizerUtils.ext
+SHA1-Digest: KcXy6idzmQy0UpTizsZzr3nIPMg=
+
+Name: codegen.templates/impl/diagram/editparts/LinkEditPart.xpt
+SHA1-Digest: HPxpAA1WjZ/fkAbmGf0vjhNgK2c=
+
+Name: graphdef.codegen.templates/Extras.xpt
+SHA1-Digest: mI7IIZ8kJJVq85bqHf0PaFRytTg=
+
+Name: codegen.lite.templates/xpt/editor/ActionBarContributor.xpt
+SHA1-Digest: a+s11b281mwSfJp3UaM6rCMNfRA=
+
+Name: codegen.templates/impl/diagram/editparts/NodeEditPart.xpt
+SHA1-Digest: tpMlkFFec2BI+q5jHj4U/zvOLWA=
+
+Name: codegen.templates/MetaModel.xpt
+SHA1-Digest: iP+q+AKDMbiCLbDn+VSi9/z4agQ=
+
+Name: codegen.lite.templates/xpt/diagram/parts/EditPartFactory.xpt
+SHA1-Digest: ioEwXHxCRGgo3yWRchnnxKeUZRo=
+
+Name: codegen.templates/xpt/diagram/editparts/EditPartFactory.xpt
+SHA1-Digest: JQJxVVDafDSP5xUfqBTfL476A0c=
+
+Name: codegen.templates/xpt/application/extensions.xpt
+SHA1-Digest: 8k7Wao2hEnLZfCGklStWsii7J+0=
+
+Name: codegen.templates/xpt/editor/ShortcutPropertyTester.xpt
+SHA1-Digest: ZpKgLnMs72gk3ZZCweLEJdrioac=
+
+Name: codegen.templates-dynmodel/Facility.ext
+SHA1-Digest: QJN7KAwbefwpRfKJiIDbKCfHYMA=
+
+Name: codegen.templates/xpt/providers/ElementInitializers.xpt
+SHA1-Digest: 5j852GLAYLvU2jw7Qexx1wHq2dM=
+
+Name: codegen.lite.templates/xpt/diagram/parts/semanticChildLinks.xpt
+SHA1-Digest: rLnfCwOfKQOGNG9MwywHyMEHaLg=
+
+Name: codegen.templates/xpt/application/WizardNewFileCreationPage.xpt
+SHA1-Digest: Y79h0frTlaaeZZWrHzxUdzi6wyU=
+
+Name: codegen.lite.templates/xpt/diagram/Helper.ext
+SHA1-Digest: SWaBS6lOWaAOYVkL87xIBXShyUU=
+
+Name: codegen.lite.templates/xpt/manifest.xpt
+SHA1-Digest: CTghj1JmaiBhSgwAajsKRSTMPVY=
+
+Name: codegen.templates/xpt/providers/ContributionItemProvider.xpt
+SHA1-Digest: xQfOGujwU6YWTIthQXptUpKYVZs=
+
+Name: META-INF/eclipse.inf
+SHA1-Digest: KyT9FF7C7t86NoBoa2kZT3ZJBfw=
+
+Name: codegen.templates/xpt/plugin/options.xpt
+SHA1-Digest: Vg/89k0feGoQVVqwNbRN9M9/oXk=
+
+Name: about.mappings
+SHA1-Digest: hwRDXMTPH6/bhOPQMvX12HhakMA=
+
+Name: codegen.lite.templates/xpt/diagram/policies/ComponentEditPolicy.
+ ext
+SHA1-Digest: dJrMtbyIIwRiozDAI+MSAFvUryE=
+
+Name: codegen.templates/xpt/navigator/NavigatorLabelProvider.xpt
+SHA1-Digest: W4g3HhjljjnFs2I4vYEXFjG81pc=
+
+Name: codegen.templates/xpt/diagram/preferences/extensions.xpt
+SHA1-Digest: CxiiiL8otJYqcEK9bNRPwmNZ3LY=
+
+Name: codegen.templates/xpt/diagram/commands/ReorientLinkViewCommand.x
+ pt
+SHA1-Digest: NiURh7jq5j4KgVNttOSZG3gdy3g=
+
+Name: codegen.templates/xpt/propsheet/LabelProvider.xpt
+SHA1-Digest: yfcI95gpw1sJyNGj5WPI4HFIPFg=
+
+Name: codegen.lite.templates/xpt/providers/ShortcutProvider.xpt
+SHA1-Digest: n4V3yPzhuQijcBBvUjTDy76v3AM=
+
+Name: codegen.templates/xpt/editor/NewDiagramFileWizard.xpt
+SHA1-Digest: Bps5RjRfAYZfTqUP7y1Wa2lLDOE=
+
+Name: codegen.lite.templates/aspects/xpt/editor/VisualIDRegistry.xpt
+SHA1-Digest: 43p8QvEFipQJKCdZz5Ox8N5MZHc=
+
+Name: codegen.lite.templates/xpt/commands/CreateLinkStartCommand.xpt
+SHA1-Digest: I9bdjshIgr/oZ3EmqaMTCM2giHU=
+
+Name: codegen.templates/xpt/GenModelUtils.ext
+SHA1-Digest: WIna1DuTifg5Gj9lAevqutKS1c0=
+
+Name: codegen.templates/xpt/diagram/updater/extensions.xpt
+SHA1-Digest: 0oljOFJhoiUld6DEJrnZY5Athbk=
+
+Name: codegen.lite.templates/xpt/diagram/parts/requests.xpt
+SHA1-Digest: Uu3Kwts8X1nX6gHQ255Sc1NmO8w=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NotationModelRefresher.
+ ext
+SHA1-Digest: j49kFa893MJbXYQEvEJ7Lr6kdaw=
+
+Name: codegen.templates/xpt/providers/ParserProvider.xpt
+SHA1-Digest: OvmDN8u1PUlqWQp6gheAM5vFRjY=
+
+Name: codegen.templates/xpt/diagram/commands/CreateRefLinkCommand.xpt
+SHA1-Digest: mXtT8rTfreNOL2mj+JTPESptf/k=
+
+Name: graphdef.codegen.templates/plugin/Manifest.xpt
+SHA1-Digest: aaQDwfaZdBlzBZQXf5r3YylN2Uo=
+
+Name: codegen.templates/xpt/diagram/preferences/ConnectionsPreferenceP
+ age.xpt
+SHA1-Digest: wW6ATtp6i+kO8lERM+AAEZ0hqtA=
+
+Name: codegen.templates/xpt/plugin/properties.xpt
+SHA1-Digest: 3Re6OYOlmXBCLpvbtZV+WtUwgEA=
+
+Name: codegen.templates/xpt/plugin/plugin.xpt
+SHA1-Digest: AZafwSpnBtbrT6vlcDN9nJFmAzc=
+
+Name: plugin.properties
+SHA1-Digest: WVQ43iHCvJ/O+XeRE0zfcarhTg0=
+
+Name: codegen.templates/xpt/providers/MarkerNavigationProvider.xpt
+SHA1-Digest: P16FrvPRbAvTJD9cwFiscLy5EtM=
+
+Name: codegen.templates/xpt/providers/MetricProvider.xpt
+SHA1-Digest: I7inFkksKJfBsiVQU+/Nbj5wMo4=
+
+Name: codegen.lite.templates/aspects/xpt/application/WorkbenchWindowAd
+ visor.xpt
+SHA1-Digest: SmEjgH4QuwC8UlmnXJ26XcLQ52A=
+
+Name: codegen.templates/xpt/diagram/editpolicies/childContainerCreateC
+ ommand.xpt
+SHA1-Digest: w++kB0x/a4lxq20SYTfCUed1vuc=
+
+Name: codegen.lite.templates/aspects/xpt/application/Perspective.xpt
+SHA1-Digest: oSqcMp8Hy+L4fA+ReCi+GGlIe3s=
+
+Name: codegen.lite.templates/xpt/expressions/OCLExpressionFactory.xpt
+SHA1-Digest: /AgraSnxIn+WLVtJd8XWXut3efw=
+
+Name: codegen.templates/xpt/editor/diagram.gif
+SHA1-Digest: UXP0Pr9uuBtoLbP/DZ6zl2adwNc=
+
+Name: plugin.xml
+SHA1-Digest: nddfEHr95aOOAemjssX9UBkE7uI=
+
+Name: codegen.templates/xpt/parsers/MessageFormatParser.xpt
+SHA1-Digest: Vicp0axYpjRHi/Rr/OqsRKGzEUA=
+
+Name: codegen.lite.templates/xpt/diagram/policies/Common.xpt
+SHA1-Digest: a/Dp6jPaAKpNZU111vqticOWlfI=
+
+Name: codegen.lite.templates/xpt/editor/Editor.xpt
+SHA1-Digest: xYA1IZiN6RSulBnee0eBIQzcR+Q=
+
+Name: codegen.lite.templates/xpt/commands/CreateLinkCompleteCommand.xp
+ t
+SHA1-Digest: ePuwTDqlJW9IC4cNJp2w7cUdutM=
+
+Name: codegen.templates/xpt/editor/DiagramEditorUtil.xpt
+SHA1-Digest: 3nH/znWf1lZJPXMcjbJDbbriVdw=
+
+Name: codegen.templates/xpt/application/WorkbenchAdvisor.xpt
+SHA1-Digest: CI/TAr0lhCCsCj3Ssf9MqZgkQtc=
+
+Name: codegen.templates/xpt/editor/CreationWizard.xpt
+SHA1-Digest: gH6G1WK+DgTRIJc+wnbHPYfe39E=
+
+Name: codegen.templates/xpt/diagram/ViewmapAttributesUtils.ext
+SHA1-Digest: YzG0VHcYDp731/AmVtDYVIeSuEc=
+
+Name: codegen.templates/xpt/navigator/AbstractNavigatorItem.xpt
+SHA1-Digest: TOuVNX3kVwIJ1a+aKlXEmiGFTgE=
+
+Name: codegen.templates/xpt/navigator/NavigatorItem.xpt
+SHA1-Digest: qkDvnumPuCqbLXRJtBVY6h0N1Ww=
+
+Name: codegen.templates-dynmodel/Facility.xpt
+SHA1-Digest: rsI6QVGZP5DpY3BXwBVkzOuBhpg=
+
+Name: codegen.templates/xpt/providers/MetricsResultView.xpt
+SHA1-Digest: yn2/V4bOyVmchmVq9BuAOIcVnB4=
+
+Name: codegen.templates/xpt/editor/VisualIDRegistry.xpt
+SHA1-Digest: 10ANYLLsxGu/BdXVxJxr57PoW2c=
+
+Name: codegen.templates/xpt/diagram/editpolicies/ChildContainerCanonic
+ alEditPolicy.xpt
+SHA1-Digest: 2rfKqEfzJjTEoHE8eOaDBVpPA/4=
+
+Name: codegen.templates/xpt/editor/InitDiagramFileAction.xpt
+SHA1-Digest: cyQmcWV2ykFQC3xmH3vqTmXkWXY=
+
+Name: codegen.lite.templates/xpt/diagram/parts/DiagramEditPart.xpt
+SHA1-Digest: wPdHBWPpD66h2Z1IdyLZbLm7pAY=
+
+Name: codegen.lite.templates/xpt/editor/palette/LinkToolEntry.xpt
+SHA1-Digest: 0q2fYr9N78B+0F1MyPhNbh49h1Q=
+
+Name: codegen.templates/impl/diagram/editparts/CompartmentEditPart.xpt
+SHA1-Digest: iLBLVFzqlD0BpvhimGsnEBdKEMg=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LinkLabelEditPart.xpt
+SHA1-Digest: W7hhTLbEi3lwKpid9UgkfAOCuFI=
+
+Name: codegen.lite.templates/xpt/providers/i18n.ext
+SHA1-Digest: fHuxU/2mdDSCFX4e8M3NaVyyRew=
+
+Name: codegen.templates/diagram/editparts/ExternalNodeLabelEditPart.xp
+ t
+SHA1-Digest: efBHDCkvQpiwWPXwrbrmfLbUJtM=
+
+Name: codegen.lite.templates/xpt/editor/InitDiagramFileAction.xpt
+SHA1-Digest: Dqob8Wym2Rmd7yb0ZSj9OySK/ww=
+
+Name: codegen.templates/xpt/diagram/views/NodeViewFactory.xpt
+SHA1-Digest: CKip2HZH4SGqn0SkZ3yTCI6d1bw=
+
+Name: codegen.lite.templates/xpt/editor/ShortcutCreationWizard.xpt
+SHA1-Digest: cXdT/9kt24jgsmGQ7T7HIsTVPt0=
+
+Name: codegen.lite.templates/xpt/diagram/policies/ComponentEditPolicy.
+ xpt
+SHA1-Digest: eZFy//A73t+cukZeGN/QxohAxMk=
+
+Name: codegen.templates/impl/diagram/editparts/LinkLabelEditPart.xpt
+SHA1-Digest: Tig3iWn6bBJ3EJVbvQXKkTxpxeo=
+
+Name: codegen.templates/xpt/diagram/preferences/AppearancePreferencePa
+ ge.xpt
+SHA1-Digest: N0iQ38A6uTWhBcg1nPjCbHJwLYU=
+
+Name: codegen.templates/xpt/editor/ModelElementSelectionPage.xpt
+SHA1-Digest: svzDUJ846F5VK9E4yS9h+46I0M8=
+
+Name: codegen.lite.templates/xpt/viewfactories/ViewFactory.xpt
+SHA1-Digest: etWD3oKmZUP4YQNXHQ3xLFByl0Y=
+
+Name: codegen.templates/xpt/diagram/commands/CreateLinkCommand.xpt
+SHA1-Digest: aRDD6+D1ysdSer55Q3ytvXHLKns=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/AppearancePrefere
+ ncePage.xpt
+SHA1-Digest: HiG+p+WJpBEoNdM5sAsINi/LWHw=
+
+Name: codegen.templates/diagram/editparts/LinkLabelEditPart.xpt
+SHA1-Digest: xwBSGzC9vsWaaxZTENpP296xwSo=
+
+Name: codegen.templates/xpt/expressions/AbstractExpression.xpt
+SHA1-Digest: jZ17uC6l6WnOtJH1yUnPRcNeG6k=
+
+Name: codegen.lite.templates/xpt/editor/ElementChooser.xpt
+SHA1-Digest: +v5/Px1UBAcL5Ua5zXFmBoAIB6Y=
+
+Name: codegen.lite.templates/xpt/commands/CreateShortcutEdgeCommand.xp
+ t
+SHA1-Digest: Vbv7lTJsia+DM1Q6E8ntVVn3nas=
+
+Name: codegen.templates/xpt/application/Perspective.xpt
+SHA1-Digest: 29daPG1W2Y1NP9Rc3DyKrEaJqaw=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NotationModelRefresher.
+ xpt
+SHA1-Digest: AQFEOV0jfct9vSAaJwu4vcWRRDo=
+
+Name: codegen.templates/xpt/GenEditorGenerator.ext
+SHA1-Digest: Ut9CpPdtdcBEuFKWAEwNbIs/F/g=
+
+Name: codegen.lite.templates/xpt/plugin.xpt
+SHA1-Digest: 1ETQ13fmBb9qmOlX5ik5oAHEq8E=
+
+Name: codegen.templates/xpt/parsers/i18n.ext
+SHA1-Digest: iYIzDxyiF+sqKQjJdeSu/wzUN2w=
+
+Name: codegen.lite.templates/xpt/diagram/parts/ChildNodeEditPart.xpt
+SHA1-Digest: 4/CyW09dY4k9HXCmI2LCusy2+pI=
+
+Name: codegen.templates/impl/diagram/editparts/ChildNodeLabelEditPart.
+ xpt
+SHA1-Digest: RkxpPvyXv8fHjPTdNY6+Ex6TB7o=
+
+Name: codegen.templates/xpt/editor/LoadResourceAction.xpt
+SHA1-Digest: oV+8civN1jdTLL3v/SuKCF/pI9A=
+
+Name: codegen.lite.templates/aspects/xpt/navigator/NavigatorLabelProvi
+ der.xpt
+SHA1-Digest: cA1eHUCtFHhe6nDdUrCQ1Z9F4yI=
+
+Name: codegen.lite.templates/xpt/editor/CreateShortcutAction.xpt
+SHA1-Digest: slSm1e0YGHKx5BtRwMMWKABmxNs=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/Common.xpt
+SHA1-Digest: mUYs9qZ3VOIY4SKUvXhJzHDPwEg=
+
+Name: codegen.templates/xpt/expressions/RegexpExpressionFactory.xpt
+SHA1-Digest: BI832mcVAMuDkVUjLfRErJFMjFI=
+
+Name: codegen.lite.templates/xpt/commands/createNotationalElementComma
+ nd.xpt
+SHA1-Digest: 3eBBS6YRoOtnqa/BfQeWhdIOKE0=
+
+Name: codegen.templates/xpt/diagram/preferences/RulersAndGridPreferenc
+ ePage.xpt
+SHA1-Digest: e8lcDGoycE41NBpZ7fv2UeREqAo=
+
+Name: codegen.lite.templates/xpt/buildProperties.xpt
+SHA1-Digest: 71wbDEtH9tcK0ReM32jHzPoOTzw=
+
+Name: codegen.lite.templates/xpt/editor/OpenDiagramInViewAction.xpt
+SHA1-Digest: AWNyRvskTDO9Rm/oAit3U0K4LkE=
+
+Name: codegen.templates/xpt/propsheet/PropertySection.xpt
+SHA1-Digest: 1swVEg4f0liCyaNoDUz5NC5DWGo=
+
+Name: codegen.templates/diagram/editparts/ChildNodeLabelEditPart.xpt
+SHA1-Digest: G6Eb4fbdKQJ9KqXRkpbOnhIJTHw=
+
+Name: codegen.templates/xpt/diagram/updater/DiagramUpdater.xpt
+SHA1-Digest: 2D/quXvwB4RYVlVBqf/H/QDxY5w=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LabelController.ext
+SHA1-Digest: Ab3oOEYAM1mJt86hSVAfx/TYwXI=
+
+Name: codegen.templates/xpt/editor/DiagramEditorContextMenuProvider.xp
+ t
+SHA1-Digest: RZ5QhmjPegbrIQsiSIMPvKNd/f8=
+
+Name: codegen.templates/xpt/diagram/commands/ReorientRefLinkCommand.xp
+ t
+SHA1-Digest: RuJYTBagz8M+o3Q36YzXEO25UZc=
+
+Name: codegen.lite.templates/xpt/providers/ValidationUtils.ext
+SHA1-Digest: Sah95Fb4IVkhfxk0sfGBxo3DQNA=
+
+Name: codegen.templates/xpt/navigator/getEditorInput.xpt
+SHA1-Digest: Ub/aCdLperaQX06ROUfM7GHJ1XU=
+
+Name: graphdef.codegen.templates/attr/Decoration.xpt
+SHA1-Digest: jACMNXoRXlW7p54jAek9uD4yImQ=
+
+Name: codegen.templates/xpt/editor/GenDiagram.ext
+SHA1-Digest: S/l2wQtT2zMK+7JJQWAbarBaFUk=
+
+Name: codegen.lite.templates/xpt/editor/URISelectorPage.xpt
+SHA1-Digest: 1eGxUr2WJkDRYIpyFvUhciIIRHs=
+
+Name: codegen.templates/xpt/navigator/navigatorGroup.gif
+SHA1-Digest: lUwMuDmTEvmiqtkgC+kWyrYAkVk=
+
+Name: codegen.templates/xpt/navigator/DomainNavigatorContentProvider.x
+ pt
+SHA1-Digest: 31oeVCpZ5frWzBNTfEkkxArW9EY=
+
+Name: codegen.lite.templates/xpt/providers/MarkerNavigationProvider.xp
+ t
+SHA1-Digest: MbpNuLPiSnTF/ORHGzbaLOKjjO8=
+
+Name: codegen.lite.templates/xpt/editor/LoadResourceAction.xpt
+SHA1-Digest: 6f5+NzUJlHdGm7x5drl7t8NReRY=
+
+Name: codegen.lite.templates/xpt/diagram/parts/semanticChildren.xpt
+SHA1-Digest: OA2qdIF38cGR/4hVB1fMSYKZaDg=
+
+Name: codegen.templates/xpt/editor/palette/PaletteFactory.xpt
+SHA1-Digest: uK3XGBcAHBuFpRiXtpcIB7Af3cc=
+
+Name: codegen.templates/xpt/navigator/NavigatorLinkHelper.xpt
+SHA1-Digest: 8ea9pJTkqWyJ/sK0tW5sJ+9u3xg=
+
+Name: codegen.templates/xpt/editor/ResourceSetInfo.xpt
+SHA1-Digest: zQxzFhwY+U8BDdGzqUYBPA1fp4w=
+
+Name: codegen.lite.templates/aspects/xpt/application/ActionBarAdvisor.
+ xpt
+SHA1-Digest: xZxGl+NmqKIMzKVlDKFzbhnz1Os=
+
+Name: codegen.lite.templates/xpt/diagram/parts/Common.ext
+SHA1-Digest: oxIrCPYzhmX8T0DbHmJzzcBgJus=
+
+Name: codegen.templates/xpt/editor/DocumentProvider.xpt
+SHA1-Digest: XCwagL4DODIOWvZMDOwhDMzMkEw=
+
+Name: codegen.lite.templates/xpt/editor/NewDiagramFileWizard.xpt
+SHA1-Digest: Jscm123TTcffPjZd4K/8JpT7m2o=
+
+Name: about.html
+SHA1-Digest: m//+sZd+LYcO5OY/bjEiZVm0dk0=
+
+Name: codegen.templates/xpt/navigator/NavigatorContentProvider.xpt
+SHA1-Digest: KsW064lqXGddoLR4LH6eLpKEfD4=
+
+Name: codegen.lite.templates/xpt/propsheet/PropertySection.xpt
+SHA1-Digest: 1atvkSmrh1t4CV5rKwXJ84e8iCw=
+
+Name: codegen.templates/xpt/diagram/views/LabelNodeViewFactory.xpt
+SHA1-Digest: mjTAa1nA/orJS+Yc0ydS1UxeJjo=
+
+Name: codegen.lite.templates/xpt/diagram/policies/OpenDiagramEditPolic
+ y.xpt
+SHA1-Digest: IP0bN/G5+swy1OswiSjImRZ+Uzo=
+
+Name: codegen.templates/xpt/providers/i18n.ext
+SHA1-Digest: fwU3MP/quThWQ13Y/EXuxQmzDUI=
+
+Name: codegen.templates-dynmodel/MetaModel.xpt
+SHA1-Digest: 2MQTSoeVQCSl57fP5owscv3Nv2s=
+
+Name: modeling32.png
+SHA1-Digest: ADlLWFV0eQ74YnLvHnPFkYLeLrs=
+
+Name: codegen.lite.templates/xpt/commands/domainModelRemoveCommand.xpt
+SHA1-Digest: hTg25CW5XnTTBhoDkQcTsQxpry8=
+
+Name: codegen.lite.templates/xpt/diagram/parts/domainModelRefresher.xp
+ t
+SHA1-Digest: ZPNyAEcAiGzhRugUUuzbGZL3CBA=
+
+Name: codegen.templates/xpt/plugin/Activator.xpt
+SHA1-Digest: o62Ex1q3TnMZ7x0v/7eHZrMDqLU=
+
+Name: codegen.lite.templates/xpt/providers/MetricsAction.xpt
+SHA1-Digest: FKfKpSV2BhUKKNc9dZcQoBf3o8E=
+
+Name: codegen.templates/xpt/providers/ValidationDecoratorProvider.xpt
+SHA1-Digest: 74FEHyHU9TurDFt7QX65uYZHNcg=
+
+Name: codegen.lite.templates/xpt/editor/Wizard.ext
+SHA1-Digest: M+Ja970YML8D467tH/qJDUxuVW4=
+
+Name: codegen.lite.templates/xpt/editor/MatchingStrategy.xpt
+SHA1-Digest: QB21CjoAyKXPzy0jX480QG+3l2I=
+
+Name: codegen.lite.templates/xpt/commands/CommandUtils.ext
+SHA1-Digest: bqpzqqBpy/DnhgdNb0S3akUWL7s=
+
+Name: codegen.lite.templates/xpt/commands/CloneNodeCommand.xpt
+SHA1-Digest: LYxC4QJcruHBdB48GjAv5uV+P54=
+
+Name: graphdef.codegen.templates/top/Figure.xpt
+SHA1-Digest: FZEINLIBBH0x5pFM8irIbLQuo/0=
+
+Name: codegen.templates/xpt/application/i18n.ext
+SHA1-Digest: deiCs5a37Y/maLwbMrcYNvV2UhA=
+
+Name: codegen.lite.templates/xpt/propsheet/SheetLabelProvider.xpt
+SHA1-Digest: TmQddQ6JnQEbFWktx9/br+yX5OI=
+
+Name: codegen.lite.templates/xpt/providers/ValidateAction.xpt
+SHA1-Digest: 1IMYBqs+p1+PYtR2ItzmyyNFK+w=
+
+Name: codegen.templates/xpt/diagram/editpolicies/LinkUtils.ext
+SHA1-Digest: WKOpY+GzgsP4uj4OR+NU2Z40STg=
+
+Name: codegen.templates/xpt/diagram/editpolicies/TextFeedback.xpt
+SHA1-Digest: p87D3JAQnEzmfvpnXBfoA9u/6iI=
+
+Name: codegen.lite.templates/aspects/xpt/editor/ModelElementSelectionP
+ age.xpt
+SHA1-Digest: WpUFVit4cBpNbvB10iPe+N6GwtY=
+
+Name: codegen.templates/xpt/navigator/DomainNavigatorItem.xpt
+SHA1-Digest: A/foPgubzZFcbVprCUugtBATOBw=
+
+Name: codegen.templates/xpt/propsheet/extensions.xpt
+SHA1-Digest: XzkAnU1QbXha34bIzT+HjCInFwI=
+
+Name: codegen.templates/xpt/editor/wizban.gif
+SHA1-Digest: rdbF/SlXJHZ9dpqmFS/IZjMmSaM=
+
+Name: codegen.templates/xpt/navigator/DomainNavigatorLabelProvider.xpt
+SHA1-Digest: 0FGN8zkP/mg3ZKVNEXNZKXfvhs4=
+
+Name: codegen.templates/xpt/diagram/preferences/PreferenceInitializer.
+ xpt
+SHA1-Digest: uheKm7IzseXkEprMQem4BjGPtBo=
+
+Name: graphdef.codegen.templates/top/Descriptor.xpt
+SHA1-Digest: WW5fgNwjLJVk1HgE+Q7fMPw/rDE=
+
+Name: codegen.templates/xpt/diagram/editpolicies/DiagramCanonicalEditP
+ olicy.xpt
+SHA1-Digest: VpdSR2l2E6JhBieTGuonONJy8nc=
+
+Name: codegen.templates/xpt/parsers/NativeParser.xpt
+SHA1-Digest: m+TbNKb4oN6KUpNsaVff2/hwfww=
+
+Name: codegen.lite.templates/xpt/propsheet/extensions.xpt
+SHA1-Digest: 4INkpWQ/JryPnlbKn+m8VTF9ce0=
+
+Name: codegen.templates/xpt/providers/Metrics.ext
+SHA1-Digest: JRis6NqvFfP9mINSV7iYdqymRoU=
+
+Name: codegen.lite.templates/xpt/editor/i18n.ext
+SHA1-Digest: NVQQgpT63phCT9nP3gP6OJHTtv0=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LabelController.xpt
+SHA1-Digest: d85EBdmnm1K36vS34aRBYrwrzvQ=
+
+Name: codegen.lite.templates/xpt/diagram/parts/TreeEditPart.ext
+SHA1-Digest: kati5k5FZUn7Ab4qHn8Mnxx8Zb4=
+
+Name: codegen.templates/xpt/providers/ValidationProvider.xpt
+SHA1-Digest: AJuBlmR6jFGzJ2zwSa2l2wDcduo=
+
+Name: graphdef.codegen.templates/LayoutData.xpt
+SHA1-Digest: wgp0G9ShYJIRH5My/iQErwV3YNc=
+
+Name: codegen.lite.templates/aspects/xpt/diagram/editpolicies/BaseItem
+ SemanticEditPolicy.xpt
+SHA1-Digest: atpLz6gQ+OOVCvyWnsMtV9EI9EQ=
+
+Name: codegen.templates/xpt/diagram/edithelpers/BaseEditHelper.xpt
+SHA1-Digest: CYb9s37fAvaasAXsK2vceNZ14Qk=
+
+Name: codegen.lite.templates/aspects/xpt/editor/palette/PaletteFactory
+ .xpt
+SHA1-Digest: Qc4MdvseLfoWXjUslJYpuClZj6E=
+
+Name: codegen.lite.templates/aspects/xpt/navigator/NavigatorActionProv
+ ider.xpt
+SHA1-Digest: zS6GN/ZwTfeSShR02uH5CIbB/TA=
+
+Name: codegen.lite.templates/aspects/xpt/navigator/NavigatorLinkHelper
+ .xpt
+SHA1-Digest: XPaKqkooEpKTU9msFJb3yVwSVeE=
+
+Name: codegen.lite.templates/xpt/providers/ValidationProvider.xpt
+SHA1-Digest: SwYNtGGOtrHlbgeWwRy39I/iwWE=
+
+Name: codegen.templates/xpt/providers/ParserUtils.ext
+SHA1-Digest: /GpLzmToLiQkSGtl3b9j3e8/8Uc=
+
+Name: codegen.lite.templates/xpt/editor/Plugin.xpt
+SHA1-Digest: aY4hQ2HSE6Q6E+/AeoBLnW8jlaA=
+
+Name: codegen.lite.templates/xpt/diagram/preferences/Util.ext
+SHA1-Digest: Tn1JA7+zsZotNOoDXIopxI3o6ok=
+
+Name: codegen.templates/xpt/editor/ValidateAction.xpt
+SHA1-Digest: Kyf38gOK1UoIBanMMm1k2zncHrk=
+
+Name: codegen.lite.templates/xpt/providers/MetricsResultView.xpt
+SHA1-Digest: P+QdI0tXlKEm88Snzj7fF1hO9Nw=
+
+Name: codegen.templates/xpt/editor/Editor.xpt
+SHA1-Digest: Kepr35WVfrjey9ncqivB3z9l1js=
+
+Name: codegen.templates/xpt/editor/shortcut.gif
+SHA1-Digest: beQtr7R8KTRHiy1Yp1sYd+I4CKY=
+
+Name: codegen.templates/xpt/editor/UriEditorInputTester.xpt
+SHA1-Digest: TZDC7/f9fz5N1XG3ph8pew87mmg=
+
+Name: codegen.lite.templates/xpt/commands/CreateShortcutNodeCommand.xp
+ t
+SHA1-Digest: tlzWyYq11BCCb0zvjz//p01fo9o=
+
+Name: codegen.lite.templates/xpt/diagram/LinkFinder.ext
+SHA1-Digest: gFDKhmX6HvNQuLbFC62TSwvTRQI=
+
+Name: codegen.templates/xpt/navigator/extensions.xpt
+SHA1-Digest: p7MYLWN4pkUBoC+Tdj0Fn4hMwjI=
+
+Name: codegen.templates/xpt/editor/extensions.xpt
+SHA1-Digest: Lwy0ySX7IXiTlCQTe9VDWhTmx5M=
+
+Name: codegen.templates/xpt/diagram/editpolicies/CompartmentItemSemant
+ icEditPolicy.xpt
+SHA1-Digest: meid5srNr/MxsHfMws7IPt2Oqe4=
+
+Name: codegen.lite.templates/xpt/Util.ext
+SHA1-Digest: ShoKwQ/8BhrckS2SFe0kEobvcjM=
+
+Name: codegen.lite.templates/xpt/commands/ReconnectLinkSourceCommand.x
+ pt
+SHA1-Digest: yLuvNvUtUwK0e3MPiXw2KnfYPEY=
+
+Name: codegen.lite.templates/xpt/providers/ElementTypes.xpt
+SHA1-Digest: m9K+b8ajBEXkranfx5uv/jBAPa0=
+
+Name: codegen.templates/xpt/navigator/Utils.ext
+SHA1-Digest: wvEIJ7XF04FnieRWqV4/7dpf/mQ=
+
+Name: codegen.lite.templates/xpt/navigator/extensions.xpt
+SHA1-Digest: SUDB6q0BHCn46ppYuKlK8OqA+Vc=
+
+Name: codegen.templates/xpt/EMFUtils.ext
+SHA1-Digest: 71nbG2qFOcIiZSHu+4RsaRvTOh8=
+
+Name: codegen.lite.templates/xpt/diagram/parts/Common.xpt
+SHA1-Digest: bmO8s9scyPYJ9qrcSxmRYztcUAU=
+
+Name: codegen.templates/xpt/diagram/editparts/Common.xpt
+SHA1-Digest: 5wcanF9p0cj78oK8qF92352Nm3w=
+
+Name: codegen.templates/xpt/diagram/editpolicies/LinkItemSemanticEditP
+ olicy.xpt
+SHA1-Digest: NwvQAcOmPcMOtrqz2JIE9gFyj1w=
+
+Name: graphdef.codegen.templates/rt_mm/MapMode.xpt
+SHA1-Digest: 5ZerJy7x9GebEb7O4zZJQlBqmno=
+
+Name: codegen.templates/xpt/providers/ModelingAssistantProvider.xpt
+SHA1-Digest: BIKLgAy27xuN76Kh52JPY8PSuRo=
+
+Name: codegen.templates/xpt/plugin/manifest.xpt
+SHA1-Digest: F66PDckOL/uUjvEIJ8T6j7DRZIw=
+
+Name: codegen.templates/xpt/parsers/CompositeParser.xpt
+SHA1-Digest: a7YSlunuvXwawLeuWkxBrVAVn90=
+
+Name: codegen.templates/diagram/editparts/CompartmentEditPart.xpt
+SHA1-Digest: YlUoqZSxW30j5Ce/UhIFaLbcVoY=
+
+Name: codegen.lite.templates/xpt/diagram/parts/decorations.xpt
+SHA1-Digest: klXbV5KaVowXET2yCMFoCxb9mRQ=
+
+Name: codegen.templates/diagram/editparts/DiagramEditPart.xpt
+SHA1-Digest: bzzemLkZTYgsxa/U1wojTQMTOBE=
+
+Name: codegen.templates/xpt/diagram/editpolicies/NodeItemSemanticEditP
+ olicy.xpt
+SHA1-Digest: zz4QPgAYaIf+ZbigYVbVJ4h0A14=
+
+Name: codegen.templates/xpt/editor/ShortcutCreationWizard.xpt
+SHA1-Digest: 8DJURKituG4/WqlWTDij4D2bzLQ=
+
+Name: codegen.templates/xpt/editor/MatchingStrategy.xpt
+SHA1-Digest: NJgGx6P1z8pVtHAh0T4UaMmKqKs=
+
+Name: codegen.templates/xpt/editor/ValidationMarker.xpt
+SHA1-Digest: wop8hhJ265bN6M8cbk16/njzsuU=
+
+Name: codegen.templates/xpt/diagram/commands/CreateShortcutDecorations
+ Command.xpt
+SHA1-Digest: zvVOLSpiD5I4r5pwyNpzn79OUA8=
+
+Name: graphdef.codegen.templates/Layout.xpt
+SHA1-Digest: l2v6pbVHivcCz7u0TnqFRndqgQg=
+
+Name: codegen.templates/xpt/expressions/OCLExpressionFactory.xpt
+SHA1-Digest: /rxa041cZfNNjC3PJgTSK2hqVzo=
+
+Name: graphdef.codegen.templates/Border.xpt
+SHA1-Digest: yqs1+irDiCGqYjgt8sSzvwY1Eh4=
+
+Name: codegen.lite.templates/xpt/commands/CreateNodeCommand.xpt
+SHA1-Digest: 4b8Qxh5NAQOAwnuSxWrSUIhT+u8=
+
+Name: codegen.templates/xpt/application/WorkbenchWindowAdvisor.xpt
+SHA1-Digest: 7EbiT018NRs/32WcPsdgOQcoxbc=
+
+Name: codegen.lite.templates/xpt/diagram/parts/LinkNotationModelRefres
+ her.ext
+SHA1-Digest: jVaQX3mxN52zfD1+Zxn00uwVxXM=
+
+Name: graphdef.codegen.templates/plugin/PluginProperties.xpt
+SHA1-Digest: hwLg9QpsPI1WHbeNjYaS8Tb/4tw=
+
+Name: codegen.lite.templates/xpt/diagram/policies/LayoutEditPolicy.xpt
+SHA1-Digest: yiWXmNHSv6QFTaOmv0IzXKlR5FY=
+
+Name: codegen.templates/xpt/diagram/editpolicies/BaseItemSemanticEditP
+ olicy.xpt
+SHA1-Digest: UtA5QGpymP2Ctbbbxu2r4+X549k=
+
+Name: codegen.templates/xpt/editor/ActionBarContributor.xpt
+SHA1-Digest: uCU+8DAqhMzcVYgOXeTcMMLgL34=
+
+Name: codegen.templates/xpt/diagram/updater/UpdateCommand.xpt
+SHA1-Digest: YuI/oe2IrMcb93Roa+b3Qe6y37k=
+
+Name: codegen.lite.templates/xpt/providers/MetricProvider.xpt
+SHA1-Digest: a4xr4vlqoVLxzpZiPnF886wlIcI=
+
+Name: codegen.templates/xpt/editor/ElementChooser.xpt
+SHA1-Digest: pMALJ5WtIL3S5b+Y6vDUP6jYbPU=
+
+Name: codegen.templates/impl/diagram/editparts/TextAware.xpt
+SHA1-Digest: fmu4dSvzGdXRl/9OAD3Ld0dwqO8=
+
+Name: codegen.templates/xpt/diagram/editpolicies/Utils.ext
+SHA1-Digest: ZRsM03lp5Jau1S+Qujtntt2M4R8=
+
+Name: codegen.templates/xpt/editor/palette/Utils.ext
+SHA1-Digest: qi4Idp0Pz9UtgnKt9mwDKn3Xa/w=
+
+Name: codegen.lite.templates/xpt/commands/Common.xpt
+SHA1-Digest: ofjus3OhhkV/THWahWkJcZbIx/Y=
+
+Name: codegen.templates/xpt/navigator/NavigatorSorter.xpt
+SHA1-Digest: lPk2AZ36X19HbyPnDFqSVby3yaU=
+
+Name: codegen.templates/xpt/application/ActionBarAdvisor.xpt
+SHA1-Digest: 74ndnkRTFKmFOFE/nPWJv0EkNOo=
+
+Name: codegen.lite.templates/xpt/expressions/RegexpExpressionFactory.x
+ pt
+SHA1-Digest: IL6N73LJq6sglcX5A92vcIpDLck=
+
+Name: codegen.lite.templates/xpt/editor/extensions.xpt
+SHA1-Digest: GdTRIiCy95TwgOztb42GfZwDLkg=
+
+Name: codegen.templates/xpt/diagram/updater/containerBaseCanonicalMeth
+ ods.xpt
+SHA1-Digest: 0gGFPjQNnxZlyP/bBhFnfZRHC5I=
+
+Name: graphdef.codegen.templates/attr/Shape.xpt
+SHA1-Digest: QkfJ/50bIuLe5ukp+3WZiHX3lJI=
+
+Name: codegen.lite.templates/aspects/xpt/Externalizer.xpt
+SHA1-Digest: yHtVPGF0eUXsUFGG3ykZVePquVo=
+
+Name: codegen.lite.templates/xpt/editor/DiagramEditorUtil.xpt
+SHA1-Digest: jfg7MUaqcugUl01+uGYZNtZrawU=
+
+Name: codegen.lite.templates/xpt/editor/palette/NodeToolEntry.xpt
+SHA1-Digest: +Pf4uBLko1QcGbUwAlYtDmFg46U=
+
+Name: codegen.templates/impl/diagram/editparts/ExternalNodeLabelEditPa
+ rt.xpt
+SHA1-Digest: hjwRPZdxTBYTXV2/rjkw0/ugWIk=
+
+Name: codegen.lite.templates/xpt/diagram/parts/TreeEditPart.xpt
+SHA1-Digest: qb5FtV/8pJnBeQ+l7nvNpnq+7QQ=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NodeLabelEditPart.xpt
+SHA1-Digest: qg5R6AsyRqklFXcjEZWkNHXDu3A=
+
+Name: codegen.templates/impl/diagram/editparts/NodeLabelEditPart.xpt
+SHA1-Digest: kpyJuuZ2ySScl64vaBE1l05e9Vk=
+
+Name: codegen.lite.templates/xpt/diagram/parts/NodeEditPart.ext
+SHA1-Digest: +UkULetrg+XPak3kO9cjNDMwYyE=
+
+Name: codegen.lite.templates/xpt/commands/AddNodeCommand.xpt
+SHA1-Digest: Aqq7gOR/gX+np7ih6gHgkTHaQsw=
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/META-INF/eclipse.inf Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,3 @@
+#Processed using Jarprocessor
+pack200.args = -E4
+pack200.conditioned = true
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/about.html Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/about.ini Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,17 @@
+# about.ini
+# contains information about a feature
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# "%key" are externalized strings defined in about.properties
+# This file does not need to be translated.
+
+# Property "aboutText" contains blurb for "About" dialog (translated)
+aboutText=%featureText
+
+# Property "featureImage" contains path to feature image (32x32)
+featureImage=modeling32.png
+
+# Property "appName" contains name of the application (translated)
+appName=%featureName
+
+# Property "welcomePage" contains path to welcome page (special XML-based format)
+welcomePage=$nl$/welcome.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/about.mappings Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,6 @@
+# about.mappings
+# contains fill-ins for about.properties
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# This file does not need to be translated.
+
+0=200906162001
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/about.properties Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,46 @@
+# /**
+# * <copyright>
+# *
+# * Copyright (c) 2008 Borland Software Corporation and others.
+# * 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:
+# * Borland - Initial API and implementation
+# *
+# * </copyright>
+# */
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+# about.properties
+# contains externalized strings for about.ini
+# java.io.Properties file (ISO 8859-1 with "\" escapes)
+# fill-ins are supplied by about.mappings
+# This file should be translated.
+
+featureName=Graphical Modeling Framework (GMF) Legacy Templates
+
+featureText=Eclipse Graphical Modeling Framework (GMF) Legacy Templates \n\
+\n\
+Version: {featureVersion}\n\
+Build id: {0}\n\
+\n\
+(c) Copyright Eclipse contributors and others. 2009. All rights reserved.\n\
+\n\
+GMF is a framework for generating graphical applications based on EMF and GEF.\n\
+Visit http://www.eclipse.org/gmf
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/Externalizer.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«AROUND Fields FOR GenEditorGenerator»
+ «EXPAND xpt::application::ActionBarAdvisor::i18nAccessors FOR application-»
+ «EXPAND xpt::application::WorkbenchWindowAdvisor::i18nAccessors FOR application-»
+ «EXPAND xpt::navigator::NavigatorContentProvider::i18nAccessors FOR navigator-»
+ «EXPAND xpt::navigator::NavigatorActionProvider::i18nAccessors FOR navigator-»
+ «EXPAND xpt::editor::ActionBarContributor::i18nAccessors FOR editor-»
+ «EXPAND xpt::editor::palette::PaletteFactory::i18nAccessors FOR diagram.palette-»
+«IF !editor.eclipseEditor-»
+ «EXPAND xpt::editor::OpenDiagramInViewAction::i18nAccessors FOR editor-»
+«ENDIF-»
+ «EXPAND xpt::editor::Editor::i18nAccessors FOR editor-»
+ «EXPAND xpt::editor::DiagramEditorUtil::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::CreationWizard::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::CreationWizardPage::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::InitDiagramFileAction::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::NewDiagramFileWizard::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::URISelectorPage::i18nAccessors FOR diagram-»
+ «EXPAND xpt::providers::MarkerNavigationProvider::i18nAccessors FOR diagram-»
+ «EXPAND xpt::providers::ValidateAction::i18nAccessors FOR diagram-»
+ «EXPAND xpt::providers::MetricsAction::i18nAccessors FOR diagram-»
+ «EXPAND xpt::providers::MetricProvider::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::ModelElementSelectionPage::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::ShortcutCreationWizard::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::CreateShortcutAction::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::ElementChooser::i18nAccessors FOR diagram-»
+ «EXPAND xpt::diagram::policies::ComponentEditPolicy::i18nAccessors FOR diagram-»
+«ENDAROUND»
+
+«AROUND Values FOR GenEditorGenerator»
+# TODO: manually put keys and values
+«EXPAND xpt::application::ActionBarAdvisor::i18nValues FOR application-»
+«EXPAND xpt::application::WorkbenchWindowAdvisor::i18nValues FOR application-»
+«EXPAND xpt::navigator::NavigatorContentProvider::i18nValues FOR navigator-»
+«EXPAND xpt::navigator::NavigatorActionProvider::i18nValues FOR navigator-»
+«EXPAND xpt::editor::ActionBarContributor::i18nValues FOR editor-»
+«EXPAND xpt::editor::palette::PaletteFactory::i18nValues FOR diagram.palette-»
+«IF !editor.eclipseEditor-»
+«EXPAND xpt::editor::OpenDiagramInViewAction::i18nValues FOR editor-»
+«ENDIF-»
+«EXPAND xpt::editor::Editor::i18nValues FOR editor-»
+«EXPAND xpt::editor::DiagramEditorUtil::i18nValues FOR diagram-»
+«EXPAND xpt::editor::CreationWizard::i18nValues FOR diagram-»
+«EXPAND xpt::editor::CreationWizardPage::i18nValues FOR diagram-»
+«EXPAND xpt::editor::InitDiagramFileAction::i18nValues FOR diagram-»
+«EXPAND xpt::editor::NewDiagramFileWizard::i18nValues FOR diagram-»
+«EXPAND xpt::editor::URISelectorPage::i18nValues FOR diagram-»
+«EXPAND xpt::providers::MarkerNavigationProvider::i18nValues FOR diagram-»
+«EXPAND xpt::providers::ValidateAction::i18nValues FOR diagram-»
+«EXPAND xpt::providers::MetricsAction::i18nValues FOR diagram-»
+«EXPAND xpt::providers::MetricProvider::i18nValues FOR diagram-»
+«EXPAND xpt::editor::ModelElementSelectionPage::i18nValues FOR diagram-»
+«EXPAND xpt::editor::ShortcutCreationWizard::i18nValues FOR diagram-»
+«EXPAND xpt::editor::CreateShortcutAction::i18nValues FOR diagram-»
+«EXPAND xpt::editor::ElementChooser::i18nValues FOR diagram-»
+«EXPAND xpt::diagram::policies::ComponentEditPolicy::i18nValues FOR diagram-»
+«ENDAROUND»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/application/ActionBarAdvisor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,73 @@
+/*
+ * 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:
+ * Boris Blajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::Util»
+
+«AROUND openEditor FOR gmfgen::GenEditorView-»
+«ENDAROUND»
+
+«AROUND AboutAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment("About action for the RCP application.")»
+ public static class AboutAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+ «EXPAND xpt::Common::generatedMemberComment("@see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)")»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.jface.dialogs.MessageDialog.openInformation(getWindow().getShell(), getString("_UI_About_title"), «EXPAND xpt::Common::nonNLS»
+ getString("_UI_About_text")); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+«ENDAROUND»
+
+«AROUND OpenAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedClassComment("Open action for the " + editorGen.domainGenModel.modelName + " diagram.")»
+ public static class OpenAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+ «EXPAND xpt::Common::generatedMemberComment("Opens the editors for the files selected using the file dialog.")»
+ public void run(org.eclipse.jface.action.IAction action) {
+ String filePath = «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openFilePathDialog(getWindow().getShell(), "*.«editorGen.diagramFileExtension»", org.eclipse.swt.SWT.OPEN); «EXPAND xpt::Common::nonNLS»
+ if (filePath != null) {
+«IF editorGen.editor.eclipseEditor-»
+ «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openEditor(org.eclipse.emf.common.util.URI.createFileURI(filePath));
+«ELSE-»
+ «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».showView(org.eclipse.emf.common.util.URI.createFileURI(filePath));
+«ENDIF-»
+ }
+ }
+ }
+«ENDAROUND»
+
+«AROUND OpenUriAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment("Open URI action for the " + editorGen.domainGenModel.modelName + " diagram.")»
+ public static class OpenURIAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+ «EXPAND xpt::Common::generatedMemberComment("Opens the editors for the files selected using the LoadResourceDialog.")»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog = new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(getWindow().getShell());
+ if (org.eclipse.jface.dialogs.Dialog.OK == loadResourceDialog.open()) {
+ for (java.util.Iterator it = loadResourceDialog.getURIs().iterator(); it.hasNext(); ) {
+«IF editorGen.editor.eclipseEditor»
+ «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».openEditor((org.eclipse.emf.common.util.URI) it.next());
+«ELSE»
+ «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».showView((org.eclipse.emf.common.util.URI) it.next());
+«ENDIF»
+ }
+ }
+ }
+ }
+«ENDAROUND»
+
+«AROUND additions FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment("Looks up a string in the plugin.properties file for the plugin.")»
+ private static String getString(String key) {
+ return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getBundleString(key);
+ }
+«ENDAROUND»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/application/Perspective.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,21 @@
+/*
+ * 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:
+ * Boris Blajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«AROUND layoutAdditions FOR gmfgen::GenApplication-»
+«IF !editorGen.editor.eclipseEditor»
+ org.eclipse.ui.IFolderLayout top = layout.createFolder("top", org.eclipse.ui.IPageLayout.TOP, (float)0.5, layout.getEditorArea()); «EXPAND xpt::Common::nonNLS»
+ top.addView(«editorGen.editor.getQualifiedClassName()».ID);
+«ENDIF»
+«ENDAROUND»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/application/WorkbenchWindowAdvisor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,25 @@
+/*
+ * 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:
+ * Boris Blajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«AROUND preWindowOpen FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void preWindowOpen() {
+ org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
+ configurer.setInitialSize(new org.eclipse.swt.graphics.Point(600, 450));
+ configurer.setShowCoolBar(false);
+ configurer.setShowStatusLine(true);
+ configurer.setTitle(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getBundleString("_UI_Application_title")); «EXPAND xpt::Common::nonNLS»
+ }
+«ENDAROUND»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«AROUND canCreate FOR gmfgen::GenLink»«ENDAROUND»
+
+«AROUND canCreateParameters FOR gmfgen::TypeLinkModelFacet»«EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::sourceTargetParameters»«ENDAROUND»
+
+«AROUND sourceTargetParameters FOR gmfgen::LinkModelFacet»org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target«ENDAROUND»
+
+«AROUND canCreateValues FOR gmfgen::TypeLinkModelFacet»source, target«ENDAROUND»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/editor/ModelElementSelectionPage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::editor::Wizard»
+
+«AROUND additions FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND setModelResource-»
+«ENDIF-»
+«ENDAROUND»
+
+«DEFINE setModelResource FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void setModelResource(org.eclipse.emf.ecore.resource.Resource resource) {
+ selectedModelElement = null;
+ if (modelViewer != null) {
+ if (resource != null) {
+ modelViewer.setInput(resource);
+ modelViewer.setSelection(org.eclipse.jface.viewers.StructuredSelection.EMPTY);
+ } else {
+ modelViewer.setInput(null);
+ }
+ setPageComplete(validatePage());
+ }
+}
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/editor/VisualIDRegistry.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«AROUND canCreateNode FOR gmfgen::GenDiagram»«ENDAROUND»
+
+«AROUND getNodeVisualID FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static int «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodName»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
+ if (domainElement == null) {
+ «EXPAND xpt::editor::VisualIDRegistry::unrecognizedVID-»
+ }
+ String containerModelID = «EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(containerView);
+ int containerVisualID = -1;
+ if («EXPAND xpt::editor::VisualIDRegistry::modelID».equals(containerModelID)) {
+ containerVisualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(containerView);
+«LET (Collection[String]) shortcutsProvidedFor.without({editorGen.modelID}) AS shortcutModels-»
+ «IF shortcutModels.size() > 0-»
+ } else {
+ if (false == containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ «EXPAND xpt::editor::VisualIDRegistry::unrecognizedVID-»
+ }
+ if («EXPAND checkContainerDiagramModelID FOREACH shortcutModels SEPARATOR ' && '») { «EXPAND xpt::Common::nonNLS({}) FOREACH shortcutModels SEPARATOR " "»
+ «EXPAND xpt::editor::VisualIDRegistry::unrecognizedVID-»
+ }
+ containerVisualID = «EXPAND xpt::editor::VisualIDRegistry::visualID»;
+ «ENDIF-»
+«ENDLET-»
+ }
+ switch (containerVisualID) {
+ «EXPAND xpt::editor::VisualIDRegistry::caseDomainContainerVisualID FOREACH getAllContainers()-»
+ }
+ «EXPAND xpt::editor::VisualIDRegistry::unrecognizedVID-»
+}
+«ENDAROUND»
+
+«DEFINE checkContainerDiagramModelID FOR String»!"«this»".equals(containerModelID)«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/editor/palette/PaletteFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::editor::palette::Utils»
+
+«AROUND Factory FOR gmfgen::Palette-»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «factoryClassName» {
+ «EXPAND contribute-»
+ «EXPAND xpt::editor::palette::PaletteFactory::createGroup FOREACH collectGroups()»
+ «EXPAND xpt::editor::palette::PaletteFactory::createEntry FOREACH collectTools()»
+ «IF needsNodeToolEntryClass()»«EXPAND xpt::editor::palette::NodeToolEntry::NodeToolEntry»«ENDIF-»
+ «IF needsLinkToolEntryClass()»«EXPAND xpt::editor::palette::LinkToolEntry::LinkToolEntry»«ENDIF-»
+ «EXPAND additions-»
+}
+«ENDAROUND»
+
+«DEFINE contribute FOR gmfgen::Palette-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void contributeToPalette(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
+«IF !definesStandardTools()-»
+ «EXPAND addStandardTools-»
+«ENDIF-»
+ «EXPAND xpt::editor::palette::PaletteFactory::addEntry("paletteRoot") FOREACH groups-»
+}
+«ENDDEFINE»
+
+«DEFINE addStandardTools FOR gmfgen::Palette-»
+org.eclipse.gef.palette.PaletteGroup controls = new org.eclipse.gef.palette.PaletteGroup("Controls");
+paletteRoot.add(controls);
+
+org.eclipse.gef.palette.ToolEntry tool = new org.eclipse.gef.palette.SelectionToolEntry();
+controls.add(tool);
+paletteRoot.setDefaultEntry(tool);
+
+controls.add(new org.eclipse.gef.palette.MarqueeToolEntry());
+«ENDDEFINE»
+
+«AROUND addEntry(String varName) FOR gmfgen::AbstractToolEntry-»
+{
+ org.eclipse.gef.palette.PaletteEntry paletteEntry = «createMethodName»();
+ if (paletteEntry != null) {
+ «varName».add(paletteEntry);
+«IF default_ && group.stack-»
+ «varName».setActiveEntry(paletteEntry);
+«ENDIF-»
+ }
+}
+«ENDAROUND»
+
+«AROUND newEntry(String toolVarName) FOR gmfgen::ToolEntry-»
+«IF elements.isEmpty()-»
+org.eclipse.gef.palette.ToolEntry «toolVarName» = new org.eclipse.gef.palette.ToolEntry(«EXPAND xpt::editor::palette::PaletteFactory::i18nTitle», «EXPAND xpt::editor::palette::PaletteFactory::i18nDesc», null, null) {};
+«ELSE-»
+final int[] visualIds = new int[] {
+ «EXPAND visualID FOREACH elements SEPARATOR ','-»
+};
+«LET genNodes.isEmpty() ? "LinkToolEntry" : "NodeToolEntry" AS toolEntryClass-»
+«toolEntryClass» «toolVarName» = new «toolEntryClass»(«EXPAND xpt::editor::palette::PaletteFactory::i18nTitle», «EXPAND xpt::editor::palette::PaletteFactory::i18nDesc», visualIds);
+«ENDLET-»
+«ENDIF-»
+«ENDAROUND»
+
+«DEFINE visualID FOR Object»«ERROR "Unexpected Type: " + this»«ENDDEFINE»
+
+«DEFINE visualID FOR gmfgen::GenCommonBase»«EXPAND xpt::editor::VisualIDRegistry::visualID»«ENDDEFINE»
+
+«AROUND setSmallImage(String toolVarName) FOR gmfgen::AbstractToolEntry-»
+«IF null != smallIconPath-»
+«toolVarName».setSmallIcon(«activatorFQN()».findImageDescriptor("«smallIconPath»")); «EXPAND xpt::Common::nonNLS»
+«ELSE-»
+«toolVarName».setSmallIcon(«EXPAND smallImage(toolVarName)»);
+«ENDIF-»
+«ENDAROUND»
+
+«DEFINE smallImage(String toolVarName) FOR gmfgen::AbstractToolEntry»null«ENDDEFINE»
+
+«DEFINE smallImage(String toolVarName) FOR gmfgen::ToolEntry-»
+«IF elements.isEmpty()»null«ELSE»«elementTypesClass()».getImageDescriptor(«EXPAND getElement FOR elements.first()»)«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getElement FOR Object»«ERROR "Unexpected type: " + this»«ENDDEFINE»
+
+«DEFINE getElement FOR gmfgen::GenNode»«EXPAND getElement FOR modelFacet»«ENDDEFINE»
+«DEFINE getElement FOR gmfgen::GenLink»«EXPAND getElement FOR modelFacet»«ENDDEFINE»
+
+«DEFINE getElement FOR gmfgen::LinkModelFacet»«ERROR "Unexpected model facet: " + this»«ENDDEFINE»
+
+«DEFINE getElement FOR gmfgen::TypeModelFacet»«EXPAND MetaModel::MetaClass FOR metaClass»«ENDDEFINE»
+«DEFINE getElement FOR gmfgen::TypeLinkModelFacet»«EXPAND MetaModel::MetaClass FOR metaClass»«ENDDEFINE»
+«DEFINE getElement FOR gmfgen::FeatureLinkModelFacet»«EXPAND MetaModel::MetaFeature FOR metaFeature»«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::Palette»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/navigator/NavigatorActionProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«AROUND ODA_run FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void run() {
+ if (myDiagram == null) {
+ return;
+ }
+ org.eclipse.ui.IWorkbenchPage page = myViewerSite.getPage();
+«IF editorGen.editor.eclipseEditor-»
+ org.eclipse.ui.IEditorInput editorInput = getEditorInput();
+ try {
+ page.openEditor(editorInput, «editorGen.editor.getQualifiedClassName()».ID);
+ } catch (org.eclipse.ui.PartInitException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while opening diagram", e); «EXPAND xpt::Common::nonNLS»
+ }
+«ELSE-»
+ try {
+ org.eclipse.gmf.runtime.lite.parts.DiagramViewPart diagramView = (org.eclipse.gmf.runtime.lite.parts.DiagramViewPart)page.showView(«editorGen.editor.getQualifiedClassName()».ID);
+ diagramView.showDiagram(null, org.eclipse.emf.ecore.util.EcoreUtil.getURI(myDiagram));
+ } catch (org.eclipse.ui.PartInitException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while opening diagram", e); «EXPAND xpt::Common::nonNLS»
+ }
+«ENDIF-»
+ }
+«ENDAROUND»
+
+«AROUND ODA_getEditorInput FOR gmfgen::GenNavigator-»
+«IF editorGen.editor.eclipseEditor»«targetDef.proceed()»«ENDIF-»
+«ENDAROUND»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/navigator/NavigatorContentProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,16 @@
+/*
+ * 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:
+ * Boris Blajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«AROUND createEditingDomain FOR gmfgen::GenNavigator»«EXPAND xpt::editor::Common::createEditingDomain FOR editorGen»«ENDAROUND»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/navigator/NavigatorLabelProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«AROUND caseImage FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::caseVisualID»
+ return getImage("«EXPAND xpt::navigator::NavigatorLabelProvider::key»", «EXPAND underlyingElementForIcon»); «EXPAND xpt::Common::nonNLS»
+«ENDAROUND»
+
+«DEFINE underlyingElementForIcon FOR gmfgen::GenCommonBase»«EXPAND underlyingElement»«ENDDEFINE»
+«DEFINE underlyingElementForIcon FOR gmfgen::GenLabel»«IF elementIcon»«EXPAND underlyingElement»«ELSE»null«ENDIF»«ENDDEFINE»
+«DEFINE underlyingElementForIcon FOR gmfgen::GenChildLabelNode»«IF labelElementIcon»«EXPAND underlyingElement»«ELSE»null«ENDIF»«ENDDEFINE»
+
+«DEFINE underlyingElement FOR gmfgen::GenCommonBase»view.getElement()«ENDDEFINE»
+«DEFINE underlyingElement FOR gmfgen::GenLinkLabel»«EXPAND underlyingElement FOR link»«ENDDEFINE»
+«DEFINE underlyingElement FOR gmfgen::GenLink»«EXPAND underlyingElement FOR modelFacet»«ENDDEFINE»
+
+«DEFINE underlyingElement FOR gmfgen::LinkModelFacet»«ERROR "Unexpected model facet: " + this»«ENDDEFINE»
+«DEFINE underlyingElement FOR gmfgen::TypeLinkModelFacet»view.getElement()«ENDDEFINE»
+«DEFINE underlyingElement FOR gmfgen::FeatureLinkModelFacet»(false == view instanceof org.eclipse.gmf.runtime.notation.Edge || ((org.eclipse.gmf.runtime.notation.Edge) view).getTarget() == null) ? null : ((org.eclipse.gmf.runtime.notation.Edge) view).getTarget().getElement()«ENDDEFINE»
+
+«AROUND getImageByKey FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.swt.graphics.Image getImage(String key, org.eclipse.emf.ecore.EObject object) {
+ org.eclipse.jface.resource.ImageRegistry imageRegistry = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry();
+ org.eclipse.swt.graphics.Image image = imageRegistry.get(key);
+ if (image == null && object != null) {
+ image = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemImage(object);
+ imageRegistry.put(key, image);
+ }
+ if (image == null) {
+ image = imageRegistry.get(«EXPAND xpt::navigator::NavigatorLabelProvider::notFoundElementKey»); «EXPAND xpt::Common::nonNLS»
+ imageRegistry.put(key, image);
+ }
+ return image;
+}
+«ENDAROUND»
+
+«AROUND getDiagramLabelText(gmfgen::GenCommonBase elementTypeHolder, gmfgen::GenCommonBase hintHolder) FOR gmfgen::LabelModelFacet-»
+«EXPAND getDisplayerDisplayText FOR hintHolder-»
+«ENDAROUND»
+
+«DEFINE getDisplayerDisplayText FOR gmfgen::GenCommonBase-»
+org.eclipse.emf.ecore.EObject domainModelElement = view.getElement();
+if (domainModelElement == null) {
+ return ""; «EXPAND xpt::Common::nonNLS»
+}
+String result = «getEditPartQualifiedClassName()».LABEL_DISPLAYER.getDisplayText(domainModelElement);
+ if (result == null) {
+ return ""; «EXPAND xpt::Common::nonNLS»
+}
+return result;
+«ENDDEFINE»
+
+«AROUND getDiagramLabelTextNoModelFacet(gmfgen::GenCommonBase label) FOR gmfgen::GenCommonBase-»
+«EXPAND getDisplayerDisplayText FOR label-»
+«ENDAROUND»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/aspects/xpt/navigator/NavigatorLinkHelper.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,39 @@
+/*
+ * 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«AROUND diagramEditorClassFQName FOR gmfgen::GenNavigator»org.eclipse.gmf.runtime.lite.parts.DiagramEditor«ENDAROUND»
+
+«AROUND getViewFromShortcut FOR gmfgen::GenNavigator»«ENDAROUND»
+
+«AROUND getDiagram FOR gmfgen::GenEditorGenerator-»
+org.eclipse.gmf.runtime.notation.Diagram diagram = null;
+if (anInput instanceof org.eclipse.gmf.runtime.lite.parts.DiagramEditorInput) {
+ diagram = ((org.eclipse.gmf.runtime.lite.parts.DiagramEditorInput) anInput).getDiagram();
+} else {
+ org.eclipse.ui.IWorkbenchWindow activeWindow = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (activeWindow != null) {
+ org.eclipse.ui.IWorkbenchPage activePage = activeWindow.getActivePage();
+ org.eclipse.ui.IEditorPart anEditor = activePage.findEditor(anInput);
+ if (anEditor instanceof «diagram.editorGen.editor.getQualifiedClassName()») {
+ diagram = ((«diagram.editorGen.editor.getQualifiedClassName()») anEditor).getDiagram();
+ }
+ }
+}
+if (diagram == null) {
+ return org.eclipse.jface.viewers.StructuredSelection.EMPTY;
+}
+«ENDAROUND»
+
+«AROUND defineDiagramDocument FOR gmfgen::GenPlugin-»
+«ENDAROUND»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/Util.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+String validJavaIdentifier(String s) :
+JAVA org.eclipse.emf.codegen.util.CodeGenUtil.validJavaIdentifier(java.lang.String)
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/application/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE extensions FOR gmfgen::GenApplication-»
+ <extension
+ point="org.eclipse.core.runtime.applications"
+ id="«iD»">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <application>
+ <run
+ class="«getQualifiedClassName()»">
+ </run>
+ </application>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.perspectives">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <perspective
+ name="%_UI_Perspective_label"
+ class="«getPerspectiveQualifiedClassName()»"
+ id="«perspectiveId»">
+ </perspective>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <command
+ name="%_UI_Menu_OpenURI_label"
+ description="%_UI_Menu_OpenURI_description"
+ categoryId="org.eclipse.ui.category.file"
+ id="«editorGen.plugin.iD».OpenURICommand" />
+ <command
+ name="%_UI_Menu_Open_label"
+ description="%_UI_Menu_Open_description"
+ categoryId="org.eclipse.ui.category.file"
+ id="«editorGen.plugin.iD».OpenCommand" />
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.bindings">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <key
+ commandId="«editorGen.plugin.iD».OpenURICommand"
+ sequence="M1+U"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
+ <key
+ commandId="«editorGen.plugin.iD».OpenCommand"
+ sequence="M1+O"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration" />
+ </extension>
+ <extension
+ point="org.eclipse.ui.actionSets">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <actionSet
+ label="%_UI_«editorGen.diagram.getDiagramEditorUtilQualifiedClassName()»_ActionSet_label"
+ visible="true"
+ id="«editorGen.plugin.iD».ActionSet">
+ <action
+ label="%_UI_Menu_About_label"
+ class="«getActionBarAdvisorQualifiedClassName()»$AboutAction"
+ menubarPath="help/additions"
+ id="«editorGen.plugin.iD».AboutAction">
+ </action>
+ <action
+ label="%_UI_Menu_OpenURI_label"
+ definitionId="«editorGen.plugin.iD».OpenURICommand"
+ class="«getActionBarAdvisorQualifiedClassName()»$OpenURIAction"
+ menubarPath="file/additions"
+ id="«editorGen.plugin.iD».OpenURIAction">
+ </action>
+ <action
+ label="%_UI_Menu_Open_label"
+ definitionId="«editorGen.plugin.iD».OpenCommand"
+ class="«getActionBarAdvisorQualifiedClassName()»$OpenAction"
+ menubarPath="file/additions"
+ id="«getActionBarAdvisorQualifiedClassName()»OpenDiagramAction">
+ </action>
+ <action
+ label="%_UI_«editorGen.diagram.getDiagramEditorUtilQualifiedClassName()»NewDiagramCommand"
+ class="«getActionBarAdvisorQualifiedClassName()»$NewDiagramAction"
+ menubarPath="file/new/additions"
+ id="«editorGen.plugin.iD».NewDiagramAction">
+ </action>
+ <action
+ label="%_UI_Menu_InitDiagramFile_label"
+ class="«editorGen.diagram.getInitDiagramFileActionQualifiedClassName()»"
+ menubarPath="file/additions"
+ id="«editorGen.diagram.getInitDiagramFileActionQualifiedClassName()»ID">
+ </action>
+ </actionSet>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE i18n FOR gmfgen::GenApplication-»
+_UI_Application_title=«title»
+_UI_Perspective_label=«editorGen.modelID» Diagram
+_UI_Menu_OpenURI_label=Open «editorGen.modelID» Diagram &URI...
+_UI_Menu_OpenURI_description=Opens a «editorGen.modelID» diagram loading it from a URI
+_UI_Menu_Open_label=&Open «editorGen.modelID» Diagram...
+_UI_Menu_Open_description=Opens a «editorGen.modelID» diagram
+_UI_«editorGen.diagram.getDiagramEditorUtilQualifiedClassName()»_ActionSet_label=«editorGen.modelID» Diagram Action Set
+_UI_«editorGen.diagram.getDiagramEditorUtilQualifiedClassName()»NewDiagramCommand=«editorGen.modelID» diagram
+_UI_Menu_About_label=«editorGen.modelID» Diagram &About...
+_UI_About_title=«editorGen.modelID» Diagram Application
+_UI_About_text=«editorGen.modelID» Diagram Application about box goes here.
+_UI_Menu_InitDiagramFile_label=Initialize «editorGen.diagramFileExtension» diagram file
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/buildProperties.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE buildProperties FOR gmfgen::GenPlugin-»
+bin.includes = «EXPAND binIncludes»
+jars.compile.order = «EXPAND jarsCompileOrder»
+source.«EXPAND target» = «EXPAND source»
+output.«EXPAND target» = «EXPAND output»
+«ENDDEFINE»
+
+«DEFINE binIncludes FOR gmfgen::GenPlugin-»
+«EXPAND target»,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties«-»
+«ENDDEFINE»
+
+«DEFINE jarsCompileOrder FOR gmfgen::GenPlugin»«EXPAND target»«ENDDEFINE»
+
+«DEFINE target FOR gmfgen::GenPlugin».«ENDDEFINE»
+
+«DEFINE source FOR gmfgen::GenPlugin»src/«ENDDEFINE»
+
+«DEFINE output FOR gmfgen::GenPlugin»bin/«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/AddNodeCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::commands::CommandUtils»
+
+«DEFINE AddNodeCommand FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+«REM»caching related nodes: calculating it may be quite expensive«ENDREM-»
+«LET getRelatedGenNodes() AS relatedNodes-»
+«LET relatedNodes.size() > 1 AS multipleRelatedNodes-»
+ «EXPAND attributes(multipleRelatedNodes)-»
+ «EXPAND ctors(multipleRelatedNodes)-»
+ «EXPAND createCommand(relatedNodes)-»
+ «EXPAND additions-»
+«ENDLET-»
+«ENDLET-»
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenNode»Add«EXPAND xpt::commands::Common::commandNameInfix»Command«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenNode»«getDiagram().editCommandsPackageName».«EXPAND className»«ENDDEFINE»
+«DEFINE supertypes FOR gmfgen::GenNode»extends org.eclipse.emf.common.command.CommandWrapper«ENDDEFINE»
+
+«DEFINE attributes(boolean multipleRelatedNodes) FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+private final org.eclipse.gmf.runtime.notation.View parentView;
+«EXPAND xpt::Common::generatedMemberComment»
+private final org.eclipse.gmf.runtime.notation.Node childNode;
+«IF multipleRelatedNodes-»
+«EXPAND xpt::Common::generatedMemberComment»
+private final int oldVisualID;
+«EXPAND xpt::Common::generatedMemberComment»
+private final int newVisualID;
+«ENDIF-»
+«EXPAND xpt::Common::generatedMemberComment»
+private final org.eclipse.draw2d.geometry.Rectangle constraint;
+«ENDDEFINE»
+
+«DEFINE ctors(boolean multipleRelatedNodes) FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND className»(org.eclipse.gmf.runtime.notation.View parentView, org.eclipse.gmf.runtime.notation.Node childNode, int newVisualID, org.eclipse.draw2d.geometry.Rectangle constraint) {
+ this.parentView = parentView;
+ this.childNode = childNode;
+«IF multipleRelatedNodes-»
+ this.oldVisualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(childNode);
+ this.newVisualID = newVisualID;
+«ENDIF-»
+ this.constraint = constraint;
+}
+«ENDDEFINE»
+
+«DEFINE createCommand(Collection[gmfgen::GenNode] relatedNodes) FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.common.command.Command createCommand() {
+ «EXPAND checkFeatures FOR modelFacet-»
+ org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
+ org.eclipse.emf.ecore.EObject element = childNode.getElement();
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(parentView.getDiagram().getElement());
+«IF relatedNodes.size() > 1-»
+ switch (oldVisualID) {
+«ENDIF-»
+«FOREACH relatedNodes AS next-»
+«IF relatedNodes.size() > 1-»
+ case «next.getEditPartQualifiedClassName()».VISUAL_ID:
+«ENDIF-»
+ «EXPAND unplugFeatures FOR next.modelFacet-»
+«IF relatedNodes.size() > 1-»
+ break;
+«ENDIF-»
+«ENDFOREACH-»
+«IF relatedNodes.size() > 1-»
+ }
+«ENDIF-»
+ «EXPAND plugFeatures FOR modelFacet-»
+ result.append(org.eclipse.emf.edit.command.RemoveCommand.create(editingDomain, childNode.eContainer(), childNode.eContainmentFeature(), childNode));
+«IF relatedNodes.size() > 1-»
+ if (newVisualID == oldVisualID) {
+«ENDIF-»
+ result.append(new org.eclipse.gmf.runtime.lite.commands.ExpandDrawerCommand(parentView));
+ result.append(org.eclipse.emf.edit.command.AddCommand.create(editingDomain, parentView, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_PersistedChildren(), childNode));
+ result.append(new org.eclipse.gmf.runtime.lite.commands.SetBoundsCommand(childNode, constraint));
+«IF relatedNodes.size() > 1-»
+ } else {
+ «EXPAND xpt::commands::Common::adjustConstraint-»
+ result.append(new org.eclipse.gmf.runtime.lite.commands.CreateNotationalNodeCommand(parentView, element, constraint, «getNotationViewFactoryQualifiedClassName()».INSTANCE));
+ }
+«ENDIF-»
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE checkFeatures FOR gmfgen::TypeModelFacet-»
+«EXPAND checkFeature("parentView.getElement()", null) FOR containmentMetaFeature-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS addChild-»
+«IF addChild-»
+ «EXPAND checkFeature("parentView.getElement()", null) FOR childMetaFeature-»
+«ENDIF-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE plugFeatures FOR gmfgen::TypeModelFacet-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS addChild-»
+«IF addChild-»
+result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "parentView.getElement()", "element") FOR childMetaFeature»);
+«ENDIF-»
+«ENDLET-»
+«IF containmentMetaFeature == null-»
+result.append(new org.eclipse.emf.edit.command.AddCommand(editingDomain, «EXPAND xpt::commands::Common::getPhantomContainmentResource FOR "parentView"».getContents(), element));
+«ELSE-»
+result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "parentView.getElement()", "element") FOR containmentMetaFeature»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE unplugFeatures FOR gmfgen::TypeModelFacet-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS removeChild-»
+«IF removeChild-»
+result.append(«EXPAND xpt::commands::Common::unplugFeatureCommand("editingDomain", "element.eContainer()", "element") FOR childMetaFeature»);
+«ENDIF-»
+«ENDLET-»
+«IF containmentMetaFeature == null-»
+if (element.eContainer() != null) {
+ result.append(org.eclipse.emf.edit.command.RemoveCommand.create(editingDomain, element.eContainer(), element.eContainmentFeature(), element));
+} else if (element.eResource() != null) {
+ result.append(new org.eclipse.emf.edit.command.RemoveCommand(editingDomain, element.eResource().getContents(), element));
+} else {
+ result.append(org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE);
+}
+«ELSE-»
+result.append(«EXPAND xpt::commands::Common::unplugFeatureCommand("editingDomain", "element.eContainer()", "element") FOR containmentMetaFeature»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkFeature(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
+«IF ecoreFeature.upperBound > 0-»
+if («EXPAND xpt::commands::Common::featureMultiplicityComparator(containerVar, containerClass)») {
+ return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/CloneNodeCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::commands::CommandUtils»
+
+«DEFINE CloneNodeCommand FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND attributes-»
+ «EXPAND ctors-»
+ «EXPAND createCommand-»
+ «EXPAND createAfterCopyCommand-»
+ «EXPAND execute-»
+ «EXPAND canUndo-»
+ «EXPAND undo-»
+ «EXPAND redo-»
+ «EXPAND dispose-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenNode»Clone«EXPAND xpt::commands::Common::commandNameInfix»Command«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenNode»«getDiagram().editCommandsPackageName».«EXPAND className»«ENDDEFINE»
+«DEFINE supertypes FOR gmfgen::GenNode»extends org.eclipse.emf.common.command.CommandWrapper«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+private final org.eclipse.gmf.runtime.notation.View parentView;
+«EXPAND xpt::Common::generatedMemberComment»
+private final org.eclipse.gmf.runtime.notation.Node childNode;
+«EXPAND xpt::Common::generatedMemberComment»
+private final org.eclipse.draw2d.geometry.Rectangle constraint;
+«EXPAND xpt::Common::generatedMemberComment»
+private final org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain;
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.common.command.Command afterCopyCommand;
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND className»(org.eclipse.gmf.runtime.notation.View parentView, org.eclipse.gmf.runtime.notation.Node childNode, org.eclipse.draw2d.geometry.Rectangle constraint) {
+ this.parentView = parentView;
+ this.childNode = childNode;
+ this.constraint = constraint;
+ this.editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(childNode.getDiagram().getElement());
+}
+«ENDDEFINE»
+
+«DEFINE createCommand FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.common.command.Command createCommand() {
+ «EXPAND checkFeatures FOR modelFacet-»
+ org.eclipse.emf.ecore.EObject element = childNode.getElement();
+ //We are being optimistic here about whether further commands can be executed.
+ //Otherwise, we would have to execute the CopyCommand on every mouse move, which could be much too expensive.
+ return org.eclipse.emf.edit.command.CopyCommand.create(editingDomain, element);
+}
+«ENDDEFINE»
+
+«DEFINE execute FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void execute() {
+ super.execute();
+ afterCopyCommand = createAfterCopyCommand();
+ if (afterCopyCommand.canExecute()) {
+ afterCopyCommand.execute();
+ } else {
+ assert false;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE createAfterCopyCommand FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.common.command.Command createAfterCopyCommand() {
+ final java.util.Collection copyResults = super.getResult();
+ assert copyResults.size() == 1;
+ org.eclipse.emf.ecore.EObject copyResult = (org.eclipse.emf.ecore.EObject) copyResults.iterator().next();
+ org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
+ «EXPAND plugFeatures FOR modelFacet-»
+ «EXPAND xpt::commands::Common::adjustConstraint-»
+ result.append(new org.eclipse.gmf.runtime.lite.commands.CreateNotationalNodeCommand(parentView, copyResult, constraint, «getNotationViewFactoryQualifiedClassName()».INSTANCE));
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE canUndo FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean canUndo() {
+ return super.canUndo() && afterCopyCommand != null && afterCopyCommand.canUndo();
+}
+«ENDDEFINE»
+
+«DEFINE undo FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void undo() {
+ afterCopyCommand.undo();
+ super.undo();
+}
+«ENDDEFINE»
+
+«DEFINE redo FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void redo() {
+ super.redo();
+ afterCopyCommand.redo();
+}
+«ENDDEFINE»
+
+«DEFINE dispose FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ super.dispose();
+ if (afterCopyCommand != null) {
+ afterCopyCommand.dispose();
+ }
+}
+«ENDDEFINE»
+
+«DEFINE checkFeatures FOR gmfgen::TypeModelFacet-»
+«EXPAND checkFeature("parentView.getElement()", null) FOR containmentMetaFeature-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS addChild-»
+«IF addChild-»
+ «EXPAND checkFeature("parentView.getElement()", null) FOR childMetaFeature-»
+«ENDIF-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE plugFeatures FOR gmfgen::TypeModelFacet-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS addChild-»
+«IF addChild-»
+result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "parentView.getElement()", "copyResult") FOR childMetaFeature»);
+«ENDIF-»
+«ENDLET-»
+«IF containmentMetaFeature == null-»
+result.append(new org.eclipse.emf.edit.command.AddCommand(editingDomain, «EXPAND xpt::commands::Common::getPhantomContainmentResource FOR "parentView"».getContents(), copyResult));
+«ELSE-»
+result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "parentView.getElement()", "copyResult") FOR containmentMetaFeature»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkFeature(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
+«IF ecoreFeature.upperBound > 0-»
+if («EXPAND xpt::commands::Common::featureMultiplicityComparator(containerVar, containerClass)») {
+ return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/CommandUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+Collection[gmfgen::GenNode] getChildNodes(gmfgen::GenContainerBase parent) :
+null
+;
+
+Collection[gmfgen::GenNode] getChildNodes(gmfgen::GenDiagram parent) :
+parent.topLevelNodes
+;
+
+Collection[gmfgen::GenNode] getChildNodes(gmfgen::GenChildContainer parent) :
+parent.childNodes
+;
+
+Collection[gmfgen::GenNode] getRelatedGenNodes(gmfgen::GenNode node) :
+node.getDiagram().getRelatedGenNodes(node.getDomainMetaClass())
+;
+
+Collection[gmfgen::GenNode] getRelatedGenNodes(gmfgen::GenDiagram diagram, genmodel::GenClass nodeClass) :
+diagram.getAllNodes().select(e| nodeClass.ecoreClass.isSuperTypeOf(e.getDomainMetaClass().ecoreClass))
+;
+
+Collection[gmfgen::GenNode] getRelatedChildLabelGenNodes(gmfgen::GenDiagram diagram, genmodel::GenClass nodeClass) :
+getRelatedGenNodes(diagram, nodeClass).typeSelect(gmfgen::GenChildLabelNode)
+;
+
+String getCreateShortcutNodeCommandClassName(gmfgen::GenDiagram diagram) :
+ "CreateShortcutNodeCommand"
+;
+
+String getCreateShortcutNodeCommandQualifiedClassName(gmfgen::GenDiagram diagram) :
+ diagram.editCommandsPackageName + "." + diagram.getCreateShortcutNodeCommandClassName()
+;
+
+String getCreateShortcutEdgeCommandClassName(gmfgen::GenDiagram diagram) :
+ "CreateShortcutEdgeCommand"
+;
+
+String getCreateShortcutEdgeCommandQualifiedClassName(gmfgen::GenDiagram diagram) :
+ diagram.editCommandsPackageName + "." + diagram.getCreateShortcutEdgeCommandClassName()
+;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/Common.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE getRelationshipContainer FOR gmfgen::LinkModelFacet»«ENDDEFINE»
+
+«DEFINE getRelationshipContainer FOR gmfgen::TypeLinkModelFacet-»
+ «EXPAND xpt::Common::generatedMemberComment("Finds container element for the relationship of the specified type.\n" +
+ "Default implementation goes up by containment hierarchy starting from\n" +
+ "the specified element and returns the first element that is instance of\n" +
+ "the specified container class.")»
+ protected org.eclipse.emf.ecore.EObject getRelationshipContainer(org.eclipse.emf.ecore.EObject element, org.eclipse.emf.ecore.EClass containerClass) {
+ for (; element != null; element = element.eContainer()) {
+ if (containerClass.isSuperTypeOf(element.eClass())) {
+ return element;
+ }
+ }
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE featureMultiplicityComparator(String ownerVar, genmodel::GenClass ownerClass) FOR genmodel::GenFeature-»
+«IF ecoreFeature.upperBound == 1»«EXPAND MetaModel::getFeatureValue(ownerVar, ownerClass, false)» != null«ELSE-»
+«EXPAND MetaModel::MetaFeature».getUpperBound() > 1 && «EXPAND MetaModel::getFeatureValue(ownerVar, ownerClass, true)».size() >= «EXPAND MetaModel::MetaFeature».getUpperBound()«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkLinkConstraints(String sourceVar, String targetVar) FOR gmfgen::GenLinkConstraints-»
+ if(!«EXPAND xpt::providers::DomainElementInitializer::qualifiedClassName FOR link.getDiagram()».«link.diagram.getLinkCreationConstraintsClassName()».canExist«link.getUniqueIdentifier()»(«sourceVar», «targetVar»)) {
+ return false;
+ }
+«ENDDEFINE»
+
+«DEFINE plugFeatureCommand(String domainVar, String containerVar, String elementVar) FOR genmodel::GenFeature-»
+«IF ecoreFeature.many»org.eclipse.emf.edit.command.AddCommand«ELSE»org.eclipse.emf.edit.command.SetCommand«ENDIF».create(«domainVar», «containerVar», «EXPAND MetaModel::MetaFeature», «elementVar»)«-»
+«ENDDEFINE»
+
+«DEFINE unplugFeatureCommand(String domainVar, String containerVar, String elementVar) FOR genmodel::GenFeature-»
+«IF ecoreFeature.many-»
+org.eclipse.emf.edit.command.RemoveCommand.create(«domainVar», «containerVar», «EXPAND MetaModel::MetaFeature», «elementVar»)«-»
+«ELSE-»
+org.eclipse.emf.edit.command.SetCommand.create(«domainVar», «containerVar», «EXPAND MetaModel::MetaFeature», org.eclipse.emf.edit.command.SetCommand.UNSET_VALUE)«-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE adjustConstraint FOR gmfgen::GenNode-»
+«LET getResizeConstraints(viewmap) AS rc-»
+«LET rc == null || rc.resizeHandleNames.select(e| e=="EAST" || e=="WEST").size() > 0 AS resizableWidth-»
+«LET rc == null || rc.resizeHandleNames.select(e| e=="NORTH" || e=="SOUTH").size() > 0 AS resizableHeight-»
+ if (constraint != null) {
+ «IF resizableWidth || resizableHeight-»
+ constraint.union(new org.eclipse.draw2d.geometry.Dimension(«EXPAND defaultWidth», «EXPAND defaultHeight»));
+ «ENDIF-»
+ «IF !resizableWidth-»
+ constraint.width = «EXPAND defaultWidth»;
+ «ENDIF-»
+ «IF !resizableHeight-»
+ constraint.height = «EXPAND defaultHeight»;
+ «ENDIF-»
+ }
+«ENDLET-»
+«ENDLET-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE defaultWidth FOR gmfgen::GenNode»«defaultSizeWidth(viewmap, 40)»«ENDDEFINE»
+«DEFINE defaultHeight FOR gmfgen::GenNode»«defaultSizeHeight(viewmap, 40)»«ENDDEFINE»
+
+«DEFINE commandNameInfix FOR gmfgen::GenNode-»
+«EXPAND commandNameInfix FOR modelFacet.metaClass»«visualID-»
+«ENDDEFINE»
+
+«DEFINE commandNameInfix FOR gmfgen::GenLink-»
+«EXPAND commandNameInfix FOR modelFacet»«visualID-»
+«ENDDEFINE»
+
+«DEFINE commandNameInfix FOR gmfgen::LinkModelFacet»«ENDDEFINE»
+
+«DEFINE commandNameInfix FOR gmfgen::TypeLinkModelFacet»«EXPAND commandNameInfix FOR metaClass»«ENDDEFINE»
+
+«DEFINE commandNameInfix FOR genmodel::GenClass»«ecoreClass.name»«ENDDEFINE»
+
+«DEFINE commandNameInfix FOR gmfgen::FeatureLinkModelFacet»«metaFeature.genClass.ecoreClass.name + "_" + metaFeature.ecoreFeature.name.toFirstUpper()»«ENDDEFINE»
+
+«DEFINE getPhantomContainmentResource FOR String»«this».getDiagram().getElement().eResource()«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/CreateLinkCompleteCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,225 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE CreateLinkCompleteCommand FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen»
+package «diagram.editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND attributes-»
+ «EXPAND ctors-»
+ «EXPAND prepare-»
+ «EXPAND initializeDomainModelCommand-»
+ «EXPAND canUndo-»
+ «EXPAND execute-»
+ «EXPAND undo-»
+ «EXPAND redo-»
+ «EXPAND xpt::commands::Common::getRelationshipContainer FOR modelFacet-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenLink»Create«EXPAND xpt::commands::Common::commandNameInfix»Command«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenLink»«getDiagram().editCommandsPackageName».«EXPAND className»«ENDDEFINE»
+«DEFINE supertypes FOR gmfgen::GenLink»extends org.eclipse.emf.common.command.AbstractCommand«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.gmf.runtime.notation.View source;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.gmf.runtime.notation.View target;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.gmf.runtime.notation.Edge createdEdge;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.common.command.Command domainModelAddCommand;
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx requestEx) {
+ if (requestEx.getSourceEditPart().getModel() instanceof org.eclipse.gmf.runtime.notation.View) {
+ source = (org.eclipse.gmf.runtime.notation.View) requestEx.getSourceEditPart().getModel();
+ } else {
+ source = null;
+ }
+ if (requestEx.getTargetEditPart().getModel() instanceof org.eclipse.gmf.runtime.notation.View) {
+ target = (org.eclipse.gmf.runtime.notation.View) requestEx.getTargetEditPart().getModel();
+ } else {
+ target = null;
+ }
+ if (source == null || target == null) {
+ createdEdge = null;
+ return;
+ }
+ createdEdge = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createEdge();
+ «EXPAND setEdgeElement(this) FOR modelFacet-»
+ «getNotationViewFactoryQualifiedClassName()».INSTANCE.decorateView(createdEdge);
+ }
+«ENDDEFINE»
+
+«DEFINE setEdgeElement(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
+ createdEdge.setElement(null);
+«ENDDEFINE»
+
+«DEFINE setEdgeElement(gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
+ «EXPAND MetaModel::NewInstance("createdDomainElement") FOR metaClass-»
+ createdEdge.setElement(«EXPAND MetaModel::DowncastToEObject("createdDomainElement") FOR metaClass»);
+ «EXPAND initialize(genLink, "createdDomainElement")-»
+«ENDDEFINE»
+
+«DEFINE prepare FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean prepare() {
+ if (source == null || target == null || createdEdge == null) {
+ return false;
+ }
+ «EXPAND xpt::commands::Common::checkLinkConstraints("source.getElement()", "target.getElement()") FOR creationConstraints-»
+ domainModelAddCommand = initializeDomainModelCommand();
+ if (domainModelAddCommand == null || !domainModelAddCommand.canExecute()) {
+ return false;
+ }
+ return true;
+ }
+«ENDDEFINE»
+
+«DEFINE initializeDomainModelCommand FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.common.command.Command initializeDomainModelCommand() {
+ «EXPAND initializeDomainModelCommand FOR modelFacet-»
+ }
+«ENDDEFINE»
+
+«DEFINE initializeDomainModelCommand FOR gmfgen::LinkModelFacet-»
+return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
+«ENDDEFINE»
+
+«DEFINE initializeDomainModelCommand FOR gmfgen::TypeLinkModelFacet-»
+ org.eclipse.emf.ecore.EObject containerEObj = getRelationshipContainer(source.getElement(), «EXPAND MetaModel::MetaClass FOR containmentMetaFeature.genClass»);
+ «EXPAND MetaModel::DeclareAndAssign("container", "containerEObj") FOR containmentMetaFeature.genClass»
+ if (container == null) {
+ return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
+ }
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS addChild-»
+«LET sourceMetaFeature != null && !sourceMetaFeature.ecoreFeature.derived && ecore::EReference.isSuperTypeOf(sourceMetaFeature.ecoreFeature.eClass())
+ && ((ecore::EReference) sourceMetaFeature.ecoreFeature).eOpposite !=containmentMetaFeature.ecoreFeature &&
+ (addChild implies ((ecore::EReference) sourceMetaFeature.ecoreFeature).eOpposite != childMetaFeature.ecoreFeature) AS addSource-»
+«LET targetMetaFeature != null && !targetMetaFeature.ecoreFeature.derived && ecore::EReference.isSuperTypeOf(targetMetaFeature.ecoreFeature.eClass())
+ && ((ecore::EReference) targetMetaFeature.ecoreFeature).eOpposite !=containmentMetaFeature.ecoreFeature &&
+ (addChild implies ((ecore::EReference) targetMetaFeature.ecoreFeature).eOpposite != childMetaFeature.ecoreFeature) AS addTarget-»
+ «IF addSource-»
+ «EXPAND checkFeature("createdEdge.getElement()", null) FOR sourceMetaFeature-»
+ «ENDIF-»
+ «IF addTarget-»
+ «EXPAND checkFeature("createdEdge.getElement()", null) FOR targetMetaFeature-»
+ «LET targetMetaFeature.getReverse() AS targetReverseFeature-»
+ «IF targetReverseFeature != null && !targetReverseFeature.ecoreFeature.derived-»
+ «EXPAND checkFeature("target.getElement()", null) FOR targetReverseFeature-»
+ «ENDIF-»
+ «ENDLET-»
+ «ENDIF-»
+ org.eclipse.emf.transaction.TransactionalEditingDomain domainModelEditDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(source.getDiagram().getElement());
+ org.eclipse.emf.common.command.CompoundCommand addLinkEndsCommand = new org.eclipse.emf.common.command.CompoundCommand();
+ addLinkEndsCommand.append(«EXPAND xpt::commands::Common::plugFeatureCommand("domainModelEditDomain", "container", "createdEdge.getElement()") FOR containmentMetaFeature»);
+ «IF addChild-»
+ addLinkEndsCommand.append(«EXPAND xpt::commands::Common::plugFeatureCommand("domainModelEditDomain", "container", "createdEdge.getElement()") FOR childMetaFeature»);
+ «ENDIF-»
+ «IF addSource-»
+ addLinkEndsCommand.append(«EXPAND xpt::commands::Common::plugFeatureCommand("domainModelEditDomain", "createdEdge.getElement()", "source.getElement()") FOR sourceMetaFeature»);
+ «ENDIF-»
+ «IF addTarget-»
+ addLinkEndsCommand.append(«EXPAND xpt::commands::Common::plugFeatureCommand("domainModelEditDomain", "createdEdge.getElement()", "target.getElement()") FOR targetMetaFeature»);
+ «ENDIF-»
+ return addLinkEndsCommand;
+«ENDLET-»
+«ENDLET-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE initializeDomainModelCommand FOR gmfgen::FeatureLinkModelFacet-»
+«LET metaFeature.getReverse() AS reverseMetaFeature-»
+ «IF reverseMetaFeature != null && !reverseMetaFeature.ecoreFeature.derived-»
+ «EXPAND checkFeature("target.getElement()", null) FOR reverseMetaFeature-»
+ «ENDIF-»
+«ENDLET-»
+ org.eclipse.emf.transaction.TransactionalEditingDomain domainModelEditDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(source.getDiagram().getElement());
+«IF metaFeature.isContains()-»
+ if (target.getElement().eContainer() != null) {
+ return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
+ }
+ org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
+ if (target.getElement().eResource() != null) {
+ result.append(new org.eclipse.emf.edit.command.RemoveCommand(domainModelEditDomain, target.getElement().eResource().getContents(), target.getElement()));
+ }
+ result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("domainModelEditDomain", "source.getElement()", "target.getElement()") FOR metaFeature»);
+ return result.unwrap();
+«ELSE-»
+ return «EXPAND xpt::commands::Common::plugFeatureCommand("domainModelEditDomain", "source.getElement()", "target.getElement()") FOR metaFeature»;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE canUndo FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean canUndo() {
+ return source != null && target != null && createdEdge != null && domainModelAddCommand != null && domainModelAddCommand.canUndo();
+ }
+«ENDDEFINE»
+
+«DEFINE execute FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void execute() {
+ domainModelAddCommand.execute();
+ source.getDiagram().insertEdge(createdEdge);
+ createdEdge.setSource(source);
+ createdEdge.setTarget(target);
+ }
+«ENDDEFINE»
+
+«DEFINE undo FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void undo() {
+ domainModelAddCommand.undo();
+ source.getDiagram().removeEdge(createdEdge);
+ createdEdge.setSource(null);
+ createdEdge.setTarget(null);
+ }
+«ENDDEFINE»
+
+«DEFINE redo FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void redo() {
+ execute();
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink-»
+«ENDDEFINE»
+
+«DEFINE checkFeature(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
+«IF ecoreFeature.upperBound > 0-»
+if («EXPAND xpt::commands::Common::featureMultiplicityComparator(containerVar, containerClass)») {
+ return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE initialize(GenLink link, String newElementVar) FOR TypeModelFacet»«IF modelElementInitializer != null-»
+«EXPAND xpt::providers::DomainElementInitializer::qualifiedClassName FOR link.getDiagram()».init_«link.getUniqueIdentifier()»(«newElementVar»);
+«ENDIF»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/CreateLinkStartCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE CreateLinkStartCommand FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen»
+package «diagram.editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND attributes-»
+ «EXPAND ctors-»
+ «EXPAND shouldExecute-»
+ «EXPAND xpt::commands::Common::getRelationshipContainer FOR modelFacet-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink-»
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenLink»Create«EXPAND xpt::commands::Common::commandNameInfix»StartCommand«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenLink»«getDiagram().editCommandsPackageName».«EXPAND className»«ENDDEFINE»
+«DEFINE supertypes FOR gmfgen::GenLink»extends org.eclipse.gmf.runtime.lite.commands.VetoCommand«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.View source;
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx requestEx) {
+ //Until the mouse button is pressed, the source of the connection is in request.getTargetEditPart(), not in request.getSourceEditPart().
+ source = (org.eclipse.gmf.runtime.notation.View)requestEx.getTargetEditPart().getModel();
+ }
+«ENDDEFINE»
+
+«DEFINE shouldExecute FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean shouldExecute() {
+ if (source == null) {
+ return false;
+ }
+ «EXPAND xpt::commands::Common::checkLinkConstraints("source.getElement()", "null") FOR creationConstraints-»
+ «EXPAND shouldExecute FOR modelFacet-»
+ }
+«ENDDEFINE»
+
+«DEFINE shouldExecute FOR gmfgen::LinkModelFacet»return false;«ENDDEFINE»
+
+«DEFINE shouldExecute FOR gmfgen::TypeLinkModelFacet-»
+«IF null != containmentMetaFeature-»
+«EXPAND shouldExecuteForNonNullContainmentMetaFeature-»
+«ELSE-»
+return false;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE shouldExecuteForNonNullContainmentMetaFeature FOR gmfgen::TypeLinkModelFacet-»
+ org.eclipse.emf.ecore.EObject containerEObj = getRelationshipContainer(source.getElement(), «EXPAND MetaModel::MetaClass FOR containmentMetaFeature.genClass»);
+ «EXPAND MetaModel::DeclareAndAssign("container", "containerEObj") FOR containmentMetaFeature.genClass»
+ if (container == null) {
+ return false;
+ }
+ «EXPAND checkFeature("container", containmentMetaFeature.genClass) FOR containmentMetaFeature-»
+«IF childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived-»
+ «EXPAND checkFeature("container", containmentMetaFeature.genClass) FOR childMetaFeature-»
+«ENDIF-»
+«IF sourceMetaFeature != null-»
+«LET sourceMetaFeature.getReverse() AS sourceReverseFeature-»
+«IF sourceReverseFeature != null && !sourceReverseFeature.ecoreFeature.derived && sourceReverseFeature != containmentMetaFeature && sourceReverseFeature != childMetaFeature-»
+ «EXPAND checkFeature("source.getElement()", null) FOR sourceReverseFeature-»
+«ENDIF-»
+«ENDLET-»
+«ENDIF-»
+ return true;
+«ENDDEFINE»
+
+«DEFINE shouldExecute FOR gmfgen::FeatureLinkModelFacet-»
+ «EXPAND checkFeature("source.getElement()", null) FOR metaFeature-»
+ return true;
+«ENDDEFINE»
+
+«DEFINE checkFeature(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
+«IF ecoreFeature.upperBound > 0-»
+if («EXPAND xpt::commands::Common::featureMultiplicityComparator(containerVar, containerClass)») {
+ return false;
+}
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/CreateNodeCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE CreateNodeCommand FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND attributes-»
+ «EXPAND ctors-»
+ «EXPAND prepare-»
+ «EXPAND canUndo-»
+ «EXPAND execute-»
+ «EXPAND undo-»
+ «EXPAND redo-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.gmf.runtime.lite.commands.CreateNotationalNodeCommand notationAddCommand;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.common.command.Command domainModelAddCommand;
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gmf.runtime.notation.View parent, org.eclipse.gmf.runtime.lite.requests.CreateRequestEx request) {
+ this(parent, request, null);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gmf.runtime.notation.View parent, org.eclipse.gmf.runtime.lite.requests.CreateRequestEx request, org.eclipse.draw2d.geometry.Rectangle constraint) {
+ «EXPAND MetaModel::NewInstance("createdDomainElement") FOR modelFacet.metaClass-»
+ «EXPAND initialize("createdDomainElement")-»
+ «EXPAND initializeDomainModelCommand FOR modelFacet-»
+ «EXPAND xpt::commands::Common::adjustConstraint-»
+ this.notationAddCommand = new org.eclipse.gmf.runtime.lite.commands.CreateNotationalNodeCommand(parent, «EXPAND MetaModel::DowncastToEObject("createdDomainElement") FOR modelFacet.metaClass»,
+ constraint, «getNotationViewFactoryQualifiedClassName()».INSTANCE);
+ request.setCreatedObject(notationAddCommand.getCreatedView());
+ }
+«ENDDEFINE»
+
+«DEFINE initializeDomainModelCommand FOR gmfgen::TypeModelFacet-»
+ «EXPAND checkFeature("parent.getElement()", null) FOR containmentMetaFeature-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS addChild-»
+ «IF addChild-»
+ «EXPAND checkFeature("parent.getElement()", null) FOR childMetaFeature-»
+ «ENDIF-»
+ org.eclipse.emf.transaction.TransactionalEditingDomain domainModelEditDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(parent.getDiagram().getElement());
+ «IF addChild-»
+ org.eclipse.emf.common.command.CompoundCommand compoundCommand = new org.eclipse.emf.common.command.CompoundCommand();
+ «IF containmentMetaFeature == null-»
+ compoundCommand.append(new org.eclipse.emf.edit.command.AddCommand(domainModelEditDomain, «EXPAND xpt::commands::Common::getPhantomContainmentResource FOR "parent"».getContents(), createdDomainElement));
+ «ELSE-»
+ compoundCommand.append(«EXPAND xpt::commands::Common::plugFeatureCommand("domainModelEditDomain", "parent.getElement()", "createdDomainElement") FOR containmentMetaFeature»);
+ «ENDIF-»
+ compoundCommand.append(«EXPAND xpt::commands::Common::plugFeatureCommand("domainModelEditDomain", "parent.getElement()", "createdDomainElement") FOR childMetaFeature»);
+ domainModelAddCommand = compoundCommand;
+ «ELSE-»
+ «IF containmentMetaFeature == null-»
+ domainModelAddCommand = new org.eclipse.emf.edit.command.AddCommand(domainModelEditDomain, «EXPAND xpt::commands::Common::getPhantomContainmentResource FOR "parent"».getContents(), createdDomainElement);
+ «ELSE-»
+ domainModelAddCommand = «EXPAND xpt::commands::Common::plugFeatureCommand("domainModelEditDomain", "parent.getElement()", "createdDomainElement") FOR containmentMetaFeature»;
+ «ENDIF-»
+ «ENDIF-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE prepare FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean prepare() {
+ return domainModelAddCommand != null && domainModelAddCommand.canExecute() && notationAddCommand != null && notationAddCommand.canExecute();
+ }
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenNode»Create«EXPAND xpt::commands::Common::commandNameInfix»Command«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenNode»«getDiagram().editCommandsPackageName».«EXPAND className»«ENDDEFINE»
+«DEFINE supertypes FOR gmfgen::GenNode»extends org.eclipse.emf.common.command.AbstractCommand«ENDDEFINE»
+
+«DEFINE canUndo FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean canUndo() {
+ return domainModelAddCommand != null && domainModelAddCommand.canUndo() && notationAddCommand != null && notationAddCommand.canUndo();
+ }
+«ENDDEFINE»
+
+«DEFINE execute FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void execute() {
+ domainModelAddCommand.execute();
+ notationAddCommand.execute();
+ }
+«ENDDEFINE»
+
+«DEFINE undo FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void undo() {
+ notationAddCommand.undo();
+ domainModelAddCommand.undo();
+ }
+«ENDDEFINE»
+
+«DEFINE redo FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void redo() {
+ execute();
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode-»
+«ENDDEFINE»
+
+«DEFINE checkFeature(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
+«IF ecoreFeature.upperBound > 0-»
+if («EXPAND xpt::commands::Common::featureMultiplicityComparator(containerVar, containerClass)») {
+ domainModelAddCommand = null;
+ notationAddCommand = null;
+ return;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE initialize(String newElementVar) FOR gmfgen::GenNode»«IF modelFacet.modelElementInitializer != null-»
+«EXPAND xpt::providers::DomainElementInitializer::qualifiedClassName FOR getDiagram()».init_«getUniqueIdentifier()»(«newElementVar»);
+«ENDIF»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/CreateShortcutEdgeCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::commands::CommandUtils»
+
+«DEFINE className FOR GenDiagram»«getCreateShortcutEdgeCommandClassName()»«ENDDEFINE»
+«DEFINE qualifiedClassName FOR GenDiagram»«getCreateShortcutEdgeCommandQualifiedClassName()»«ENDDEFINE»
+
+«DEFINE CreateShortcutEdgeCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND ctor-»
+ «EXPAND addShortcutAnnotation-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.gmf.runtime.lite.commands.CreateNotationalEdgeCommand«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND className»(org.eclipse.gmf.runtime.notation.Diagram parent, org.eclipse.emf.ecore.EObject domainElement, org.eclipse.gmf.runtime.notation.View source, org.eclipse.gmf.runtime.notation.View target, org.eclipse.gmf.runtime.lite.services.IViewDecorator decorator) {
+ super(parent, domainElement, source, target, decorator);
+ addShortcutAnnotation();
+}
+«ENDDEFINE»
+
+«DEFINE addShortcutAnnotation FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void addShortcutAnnotation() {
+ «EXPAND xpt::Common::addShortcutAnnotation("getCreatedView()")-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/CreateShortcutNodeCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::commands::CommandUtils»
+
+«DEFINE className FOR GenDiagram»«getCreateShortcutNodeCommandClassName()»«ENDDEFINE»
+«DEFINE qualifiedClassName FOR GenDiagram»«getCreateShortcutNodeCommandQualifiedClassName()»«ENDDEFINE»
+
+«DEFINE CreateShortcutNodeCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND ctor-»
+ «EXPAND addShortcutAnnotation-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.gmf.runtime.lite.commands.CreateNotationalNodeCommand«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND className»(org.eclipse.gmf.runtime.notation.View parent, org.eclipse.emf.ecore.EObject domainElement, org.eclipse.draw2d.geometry.Rectangle constraint, org.eclipse.gmf.runtime.lite.services.IViewDecorator decorator, boolean expose) {
+ super(parent, domainElement, constraint, decorator, expose);
+ addShortcutAnnotation();
+}
+«ENDDEFINE»
+
+«DEFINE addShortcutAnnotation FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void addShortcutAnnotation() {
+ «EXPAND xpt::Common::addShortcutAnnotation("getCreatedView()")-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/ReconnectLinkSourceCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE ReconnectLinkSourceCommand FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen»
+package «diagram.editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND attributes-»
+ «EXPAND ctors-»
+ «EXPAND prepare-»
+ «EXPAND canReconnect-»
+ «EXPAND createCommand-»
+ «EXPAND xpt::commands::Common::getRelationshipContainer FOR modelFacet-»
+«IF creationConstraints != null-»
+ «EXPAND xpt::commands::domainModelRemoveCommand::domainModelRemoveCommand("edge")-»
+«ENDIF-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenLink»Reconnect«EXPAND xpt::commands::Common::commandNameInfix»SourceCommand«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenLink»«getDiagram().editCommandsPackageName».«EXPAND className»«ENDDEFINE»
+«DEFINE supertypes FOR gmfgen::GenLink»extends org.eclipse.emf.common.command.CommandWrapper«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.Edge edge;
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.View newSource;
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.View oldSource;
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gef.requests.ReconnectRequest request) {
+ this((org.eclipse.gmf.runtime.notation.Edge)request.getConnectionEditPart().getModel(), (org.eclipse.gmf.runtime.notation.View)request.getTarget().getModel());
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gmf.runtime.notation.Edge edge, org.eclipse.gmf.runtime.notation.View newSource) {
+ this.edge = edge;
+ this.newSource = newSource;
+ this.oldSource = edge.getSource();
+ }
+«ENDDEFINE»
+
+«DEFINE prepare FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean prepare() {
+«IF creationConstraints == null-»
+ if (!canReconnect()) {
+ return false;
+ }
+ return super.prepare();
+«ELSE-»
+ final boolean[] resultHolder = new boolean[1];
+ //To validate the reconnection against constraints, the current link should be deleted. Of course, we must then undo its deletion.
+ final org.eclipse.emf.transaction.TransactionalEditingDomain domainModelEditDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(oldSource.getDiagram().getElement());
+ org.eclipse.emf.common.command.Command command = new org.eclipse.emf.common.command.AbstractCommand() {
+ private org.eclipse.emf.common.command.Command deleteCommand = createDomainModelRemoveCommand(domainModelEditDomain);
+ public boolean canExecute() {
+ return deleteCommand.canExecute();
+ }
+ public boolean canUndo() {
+ return true;
+ }
+ public void redo() {
+ }
+ public void undo() {
+ }
+ public void execute() {
+ deleteCommand.execute();
+ try {
+ resultHolder[0] = canReconnect();
+ } finally {
+ deleteCommand.undo();
+ }
+ }
+ };
+ if (!command.canExecute()) {
+ return false;
+ }
+ new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(domainModelEditDomain, command).execute();
+ if (!resultHolder[0]) {
+ return false;
+ }
+ return super.prepare();
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE canReconnect FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private boolean canReconnect() {
+ «EXPAND xpt::commands::Common::checkLinkConstraints("newSource.getElement()", "edge.getTarget().getElement()") FOR creationConstraints-»
+ «EXPAND canReconnect FOR modelFacet-»
+ }
+«ENDDEFINE»
+
+«DEFINE canReconnect FOR gmfgen::LinkModelFacet-»
+return false;
+«ENDDEFINE»
+
+«DEFINE canReconnect FOR gmfgen::TypeLinkModelFacet-»
+«IF containmentMetaFeature == null-»
+return false;
+«ELSE-»
+«ENDIF-»
+org.eclipse.emf.ecore.EObject containerEObj = getRelationshipContainer(newSource.getElement(), «EXPAND MetaModel::MetaClass FOR containmentMetaFeature.genClass»);
+«EXPAND MetaModel::DeclareAndAssign("container", "containerEObj") FOR containmentMetaFeature.genClass»
+if (container == null) {
+ return false;
+}
+«EXPAND checkFeature("container", containmentMetaFeature.genClass) FOR containmentMetaFeature-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS setChild-»
+«IF setChild-»
+«EXPAND checkFeature("container", containmentMetaFeature.genClass) FOR childMetaFeature-»
+«ENDIF-»
+«REM»No need to check the size of the source or target features: their size does not change«ENDREM-»
+«REM»Still need to check the eOpposite() of the source feature«ENDREM-»
+«LET sourceMetaFeature != null && !sourceMetaFeature.ecoreFeature.derived && ecore::EReference.isSuperTypeOf(sourceMetaFeature.ecoreFeature.eClass())
+ && ((ecore::EReference) sourceMetaFeature.ecoreFeature).eOpposite !=containmentMetaFeature.ecoreFeature &&
+ (setChild implies ((ecore::EReference) sourceMetaFeature.ecoreFeature).eOpposite != childMetaFeature.ecoreFeature) AS setSource-»
+ «IF setSource-»
+ «LET sourceMetaFeature.getReverse() AS sourceReverseFeature-»
+ «IF sourceReverseFeature != null && !sourceReverseFeature.ecoreFeature.derived && sourceReverseFeature != containmentMetaFeature && sourceReverseFeature != childMetaFeature-»
+«EXPAND checkFeature("newSource.getElement()", null) FOR sourceReverseFeature-»
+ «ENDIF-»
+ «ENDLET-»
+ «ENDIF-»
+«ENDLET-»
+«ENDLET-»
+return true;
+«ENDDEFINE»
+
+«DEFINE canReconnect FOR gmfgen::FeatureLinkModelFacet-»
+«EXPAND checkFeature("newSource.getElement()", null) FOR metaFeature-»
+return true;
+«ENDDEFINE»
+
+«DEFINE createCommand FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.common.command.Command createCommand() {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(oldSource.getDiagram().getElement());
+ org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
+ result.append(new org.eclipse.gmf.runtime.lite.commands.ReconnectNotationalEdgeSourceCommand(edge, newSource));
+ «EXPAND appendDomainModelCommand FOR modelFacet-»
+ return result;
+ }
+«ENDDEFINE»
+
+«DEFINE appendDomainModelCommand FOR gmfgen::LinkModelFacet-»
+result.append(org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE);
+«ENDDEFINE»
+
+«DEFINE appendDomainModelCommand FOR gmfgen::TypeLinkModelFacet-»
+«IF containmentMetaFeature == null-»
+result.append(org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE);
+«ELSE-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS setChild-»
+«LET sourceMetaFeature != null && !sourceMetaFeature.ecoreFeature.derived && ecore::EReference.isSuperTypeOf(sourceMetaFeature.ecoreFeature.eClass())
+ && ((ecore::EReference) sourceMetaFeature.ecoreFeature).eOpposite !=containmentMetaFeature.ecoreFeature &&
+ (setChild implies ((ecore::EReference) sourceMetaFeature.ecoreFeature).eOpposite != childMetaFeature.ecoreFeature) AS setSource-»
+ org.eclipse.emf.ecore.EObject container = getRelationshipContainer(newSource.getElement(), «EXPAND MetaModel::MetaClass FOR containmentMetaFeature.genClass»);
+ if (container == null) {
+ return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
+ }
+ org.eclipse.emf.ecore.EObject oldContainer = edge.getElement().eContainer();
+ if (oldContainer == null) {
+ return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
+ }
+ if (oldContainer != container) {
+ result.append(«EXPAND xpt::commands::Common::unplugFeatureCommand("editingDomain", "oldContainer", "edge.getElement()") FOR containmentMetaFeature»);
+ result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "container", "edge.getElement()") FOR containmentMetaFeature»);
+ «IF setChild-»
+ result.append(«EXPAND xpt::commands::Common::unplugFeatureCommand("editingDomain", "oldContainer", "edge.getElement()") FOR childMetaFeature»);
+ result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "container", "edge.getElement()") FOR childMetaFeature»);
+ «ENDIF-»
+ }
+ «IF setSource-»
+ «IF sourceMetaFeature.ecoreFeature.many-»
+ result.append(«EXPAND xpt::commands::Common::unplugFeatureCommand("editingDomain", "edge.getElement()", "oldSource.getElement()") FOR sourceMetaFeature»);
+ «ENDIF-»
+ result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "edge.getElement()", "newSource.getElement()") FOR sourceMetaFeature»);
+ «ENDIF-»
+«ENDLET-»
+«ENDLET-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE appendDomainModelCommand FOR gmfgen::FeatureLinkModelFacet-»
+result.append(«EXPAND xpt::commands::Common::unplugFeatureCommand("editingDomain", "oldSource.getElement()", "edge.getTarget().getElement()") FOR metaFeature»);
+result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "newSource.getElement()", "edge.getTarget().getElement()") FOR metaFeature»);
+«ENDDEFINE»
+
+«DEFINE checkFeature(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
+«IF ecoreFeature.upperBound > 0-»
+if («EXPAND xpt::commands::Common::featureMultiplicityComparator(containerVar, containerClass)») {
+ return false;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/ReconnectLinkTargetCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE ReconnectLinkTargetCommand FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen»
+package «diagram.editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND attributes-»
+ «EXPAND ctors-»
+ «EXPAND prepare-»
+ «EXPAND canReconnect-»
+ «EXPAND createCommand-»
+«IF creationConstraints != null-»
+ «EXPAND xpt::commands::domainModelRemoveCommand::domainModelRemoveCommand("edge")-»
+«ENDIF-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenLink»Reconnect«EXPAND xpt::commands::Common::commandNameInfix»TargetCommand«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenLink»«getDiagram().editCommandsPackageName».«EXPAND className»«ENDDEFINE»
+«DEFINE supertypes FOR gmfgen::GenLink»extends org.eclipse.emf.common.command.CommandWrapper«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.Edge edge;
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.View newTarget;
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.View oldTarget;
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gef.requests.ReconnectRequest request) {
+ this((org.eclipse.gmf.runtime.notation.Edge)request.getConnectionEditPart().getModel(), (org.eclipse.gmf.runtime.notation.View)request.getTarget().getModel());
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gmf.runtime.notation.Edge edge, org.eclipse.gmf.runtime.notation.View newTarget) {
+ this.edge = edge;
+ this.newTarget = newTarget;
+ this.oldTarget = edge.getTarget();
+ }
+«ENDDEFINE»
+
+«DEFINE prepare FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean prepare() {
+«IF creationConstraints == null-»
+ if (!canReconnect()) {
+ return false;
+ }
+ return super.prepare();
+«ELSE-»
+ final boolean[] resultHolder = new boolean[1];
+ //To validate the reconnection against constraints, the current link should be deleted. Of course, we must then undo its deletion.
+ final org.eclipse.emf.transaction.TransactionalEditingDomain domainModelEditDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(oldTarget.getDiagram().getElement());
+ org.eclipse.emf.common.command.Command command = new org.eclipse.emf.common.command.AbstractCommand() {
+ private org.eclipse.emf.common.command.Command deleteCommand = createDomainModelRemoveCommand(domainModelEditDomain);
+ public boolean canExecute() {
+ return deleteCommand.canExecute();
+ }
+ public boolean canUndo() {
+ return true;
+ }
+ public void redo() {
+ }
+ public void undo() {
+ }
+ public void execute() {
+ deleteCommand.execute();
+ try {
+ resultHolder[0] = canReconnect();
+ } finally {
+ deleteCommand.undo();
+ }
+ }
+ };
+ if (!command.canExecute()) {
+ return false;
+ }
+ new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(domainModelEditDomain, command).execute();
+ if (!resultHolder[0]) {
+ return false;
+ }
+ return super.prepare();
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE canReconnect FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private boolean canReconnect() {
+ «EXPAND xpt::commands::Common::checkLinkConstraints("edge.getSource().getElement()", "newTarget.getElement()") FOR creationConstraints-»
+ «EXPAND canReconnect FOR modelFacet-»
+ }
+«ENDDEFINE»
+
+«DEFINE canReconnect FOR gmfgen::LinkModelFacet-»
+return false;
+«ENDDEFINE»
+
+«DEFINE canReconnect FOR gmfgen::TypeLinkModelFacet-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS setChild-»
+«LET targetMetaFeature != null && !targetMetaFeature.ecoreFeature.derived && ecore::EReference.isSuperTypeOf(targetMetaFeature.ecoreFeature.eClass())
+ && ((ecore::EReference) targetMetaFeature.ecoreFeature).eOpposite !=containmentMetaFeature.ecoreFeature &&
+ (setChild implies ((ecore::EReference) targetMetaFeature.ecoreFeature).eOpposite != childMetaFeature.ecoreFeature) AS setTarget-»
+«REM»Need to check the opposite of the target feature«ENDREM-»
+ «IF setTarget-»
+ «LET targetMetaFeature.getReverse() AS targetReverseFeature-»
+ «IF targetReverseFeature != null && !targetReverseFeature.ecoreFeature.derived-»
+«EXPAND checkFeature("newTarget.getElement()", null) FOR targetReverseFeature-»
+ «ENDIF-»
+ «ENDLET-»
+ «ENDIF-»
+«ENDLET-»
+«ENDLET-»
+return true;
+«ENDDEFINE»
+
+«DEFINE canReconnect FOR gmfgen::FeatureLinkModelFacet-»
+«REM»Need to check the opposite of the meta feature«ENDREM-»
+«LET metaFeature.getReverse() AS reverseMetaFeature-»
+ «IF reverseMetaFeature != null && !reverseMetaFeature.ecoreFeature.derived-»
+ «EXPAND checkFeature("newTarget.getElement()", null) FOR reverseMetaFeature-»
+ «ENDIF-»
+«ENDLET-»
+return true;
+«ENDDEFINE»
+
+«DEFINE createCommand FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.common.command.Command createCommand() {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(oldTarget.getDiagram().getElement());
+ org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
+ result.append(new org.eclipse.gmf.runtime.lite.commands.ReconnectNotationalEdgeTargetCommand(edge, newTarget));
+ «EXPAND appendDomainModelCommand FOR modelFacet-»
+ return result;
+ }
+«ENDDEFINE»
+
+«DEFINE appendDomainModelCommand FOR gmfgen::LinkModelFacet-»
+result.append(org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE);
+«ENDDEFINE»
+
+«DEFINE appendDomainModelCommand FOR gmfgen::TypeLinkModelFacet-»
+«LET childMetaFeature != null && childMetaFeature != containmentMetaFeature && !childMetaFeature.ecoreFeature.derived AS setChild-»
+«LET targetMetaFeature != null && !targetMetaFeature.ecoreFeature.derived && ecore::EReference.isSuperTypeOf(targetMetaFeature.ecoreFeature.eClass())
+ && ((ecore::EReference) targetMetaFeature.ecoreFeature).eOpposite !=containmentMetaFeature.ecoreFeature &&
+ (setChild implies ((ecore::EReference) targetMetaFeature.ecoreFeature).eOpposite != childMetaFeature.ecoreFeature) AS setTarget-»
+ «IF setTarget-»
+ «IF targetMetaFeature.ecoreFeature.many-»
+result.append(«EXPAND xpt::commands::Common::unplugFeatureCommand("editingDomain", "edge.getElement()", "oldTarget.getElement()") FOR targetMetaFeature»);
+ «ENDIF-»
+result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "edge.getElement()", "newTarget.getElement()") FOR targetMetaFeature»);
+ «ELSE-»
+ «REM»No command may be generated here. Probably, this situation is impossible, but we'd better warn the user.«ENDREM-»
+//XXX: Command should be added manually here.
+ «ENDIF-»
+«ENDLET-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE appendDomainModelCommand FOR gmfgen::FeatureLinkModelFacet-»
+«IF metaFeature.isContains()-»
+if (newTarget.getElement().eContainer() != null) {
+ result.append(org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE);
+}
+«ENDIF-»
+«IF metaFeature.ecoreFeature.many-»
+result.append(«EXPAND xpt::commands::Common::unplugFeatureCommand("editingDomain", "edge.getSource().getElement()", "oldTarget.getElement()") FOR metaFeature»);
+«ENDIF-»
+«IF metaFeature.isContains()-»
+result.append(new org.eclipse.emf.edit.command.AddCommand(editingDomain, «EXPAND xpt::commands::Common::getPhantomContainmentResource FOR "edge"».getContents(), oldTarget.getElement()));
+if (oldTarget.getElement().eResource() != null) {
+ result.append(new org.eclipse.emf.edit.command.RemoveCommand(editingDomain, newTarget.getElement().eResource().getContents(), newTarget.getElement()));
+}
+«ENDIF-»
+result.append(«EXPAND xpt::commands::Common::plugFeatureCommand("editingDomain", "edge.getSource().getElement()", "newTarget.getElement()") FOR metaFeature»);
+«ENDDEFINE»
+
+«DEFINE checkFeature(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
+«IF ecoreFeature.upperBound > 0-»
+if («EXPAND xpt::commands::Common::featureMultiplicityComparator(containerVar, containerClass)») {
+ return false;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/createNotationalElementCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::commands::CommandUtils»
+«EXTENSION xpt::diagram::Helper»
+«EXTENSION xpt::diagram::LinkFinder»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE createNotationalNodeCommand(String parentViewCode) FOR gmfgen::GenContainerBase-»
+org.eclipse.emf.ecore.EObject domainElement = descriptor.getElement();
+int nodeVisualID = descriptor.getVisualID();
+switch (nodeVisualID) {
+«EXPAND createNotationalNodeCommandForChild(this, parentViewCode, "domainElement") FOREACH getChildNodes().select(e|e.modelFacet != null && e.modelFacet.metaClass != null)-»
+default:
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE createNotationalNodeCommandForChild(gmfgen::GenContainerBase parentContainer, String parentViewCode, String domainElementCode) FOR gmfgen::GenNode-»
+«EXPAND createNotationalNodeCommandForChild(parentContainer, parentViewCode, domainElementCode, "org.eclipse.gmf.runtime.lite.commands.CreateNotationalNodeCommand")-»
+«ENDDEFINE»
+
+«DEFINE createNotationalNodeCommandForChild(gmfgen::GenContainerBase parentContainer, String parentViewCode, String domainElementCode, String createNotationalNodeCommandFQN) FOR gmfgen::GenNode-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ if («EXPAND MetaModel::IsInstance(domainElementCode) FOR modelFacet.metaClass») {
+ return new «createNotationalNodeCommandFQN»(«parentViewCode», «domainElementCode», «EXPAND defaultConstraint(parentContainer.needsXYLayout() || {this}.typeSelect(gmfgen::GenChildSideAffixedNode).size() > 0)», «getNotationViewFactoryQualifiedClassName()».INSTANCE, false);
+ }
+ return null;
+«ENDDEFINE»
+
+«DEFINE defaultConstraint(boolean xyLayouted) FOR gmfgen::GenNode-»
+«IF xyLayouted»new org.eclipse.draw2d.geometry.Rectangle(0, 0, «EXPAND xpt::commands::Common::defaultWidth», «EXPAND xpt::commands::Common::defaultHeight»)«ELSE»null«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createNotationalEdgeCommand(String parentDiagramCode) FOR gmfgen::GenCommonBase-»
+«EXPAND defineDecorator-»
+«EXPAND instantiateNotationalEdgeCommand(parentDiagramCode)-»
+«ENDDEFINE»
+
+«DEFINE defineDecorator FOR gmfgen::GenCommonBase-»
+org.eclipse.gmf.runtime.notation.View sourceView = getViewService().findView(linkDescriptor.getSource());
+org.eclipse.gmf.runtime.notation.View targetView = getViewService().findView(linkDescriptor.getDestination());
+org.eclipse.gmf.runtime.lite.services.IViewDecorator decorator = null;
+if (sourceView == null || targetView == null) {
+ return null;
+}
+String sourceModelID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(sourceView);
+if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(sourceModelID)) {
+ return null;
+}
+String targetModelID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(targetView);
+if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(targetModelID)) {
+ return null;
+}
+ «IF needsSourceVisualID()-»
+int sourceVisualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(sourceView);
+ «ENDIF-»
+ «IF needsTargetVisualID()-»
+int targetVisualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(targetView);
+ «ENDIF-»
+switch (linkDescriptor.getVisualID()) {
+ «EXPAND createDecorator FOREACH containedLinks()-»
+}
+if (decorator == null) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE createDecorator FOR gmfgen::GenLink-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+«EXPAND restrictEdgeEnds("sourceVisualID", modelFacet.getSourceType()) FOR getDiagram()-»
+«EXPAND restrictEdgeEnds("targetVisualID", modelFacet.getTargetType()) FOR getDiagram()-»
+ if («EXPAND linkDescriptorCondition FOR modelFacet») {
+ decorator = «getNotationViewFactoryQualifiedClassName()».INSTANCE;
+ }
+ break;
+«ENDDEFINE»
+
+«DEFINE instantiateNotationalEdgeCommand(String parentDiagramCode) FOR gmfgen::GenCommonBase-»
+return new org.eclipse.gmf.runtime.lite.commands.CreateNotationalEdgeCommand(«parentDiagramCode», linkDescriptor.getElement(), sourceView, targetView, decorator);
+«ENDDEFINE»
+
+«DEFINE linkDescriptorCondition FOR gmfgen::LinkModelFacet»«ERROR "Unexpected type"»«ENDDEFINE»
+
+«DEFINE linkDescriptorCondition FOR gmfgen::TypeLinkModelFacet»«EXPAND MetaModel::IsInstance("linkDescriptor.getElement()") FOR metaClass»«ENDDEFINE»
+
+«DEFINE linkDescriptorCondition FOR gmfgen::FeatureLinkModelFacet»linkDescriptor.getElement() == null«ENDDEFINE»
+
+«DEFINE restrictEdgeEnds(String visualIdVar, genmodel::GenClass expectedClass) FOR gmfgen::GenDiagram-»
+«LET getRelatedChildLabelGenNodes(expectedClass) AS relatedChildLabelGenNodes-»
+«IF relatedChildLabelGenNodes.size() > 0-»
+switch («visualIdVar») {
+«FOREACH relatedChildLabelGenNodes AS nextNode-»
+case «nextNode.getEditPartQualifiedClassName()».VISUAL_ID:
+ return null;
+«ENDFOREACH-»
+}
+«ENDIF-»
+«ENDLET-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/commands/domainModelRemoveCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+/**
+ * EMF command to remove a link. Used by Reconnect*Commands and by ComponentEditPolicies.
+ */
+«DEFINE domainModelRemoveCommand(String edgeVar) FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.common.command.Command createDomainModelRemoveCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
+ «EXPAND domainModelRemoveCommand("editingDomain", edgeVar) FOR modelFacet-»
+}
+«ENDDEFINE»
+
+«DEFINE domainModelRemoveCommand(String domainVar, String edgeVar) FOR gmfgen::LinkModelFacet-»
+return org.eclipse.emf.common.command.UnexecutableCommand.INSTANCE;
+«ENDDEFINE»
+
+«DEFINE domainModelRemoveCommand(String domainVar, String edgeVar) FOR gmfgen::TypeLinkModelFacet-»
+«EXPAND deleteCommand(domainVar, edgeVar)-»
+«ENDDEFINE»
+
+«DEFINE domainModelRemoveCommand(String domainVar, String nodeVar) FOR gmfgen::TypeModelFacet-»
+«EXPAND deleteCommand(domainVar, nodeVar)-»
+«ENDDEFINE»
+
+«DEFINE deleteCommand(String domainVar, String elementVar) FOR gmfgen::TypeModelFacet-»
+return org.eclipse.gmf.runtime.lite.commands.DestroyElementCommand.create(«domainVar», «elementVar».getElement());
+«ENDDEFINE»
+
+«DEFINE domainModelRemoveCommand(String domainVar, String edgeVar) FOR gmfgen::FeatureLinkModelFacet-»
+«IF metaFeature.isContains()-»
+org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
+result.append(«EXPAND xpt::commands::Common::unplugFeatureCommand(domainVar, edgeVar + ".getSource().getElement()", edgeVar + ".getTarget().getElement()") FOR metaFeature»);
+result.append(new org.eclipse.emf.edit.command.AddCommand(«domainVar», «EXPAND xpt::commands::Common::getPhantomContainmentResource FOR edgeVar».getContents(), «edgeVar».getTarget().getElement()));
+return result;
+«ELSE-»
+return «EXPAND xpt::commands::Common::unplugFeatureCommand(domainVar, edgeVar + ".getSource().getElement()", edgeVar + ".getTarget().getElement()") FOR metaFeature»;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE domainModelRemoveCommand(String nodeVar) FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.common.command.Command createDomainModelRemoveCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
+ «EXPAND domainModelRemoveCommand("editingDomain", nodeVar) FOR modelFacet-»
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/Helper.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+extension xpt::commands::CommandUtils;
+
+boolean isXYLayout(gmfgen::GenNode node) :
+ node.getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value
+;
+
+boolean hasDirectChildren(gmfgen::GenNode node) :
+ node.getDirectChildren().size() > 0
+;
+
+Collection[gmfgen::GenNode] getDirectChildren(gmfgen::GenContainerBase gcb) :
+ gcb.getChildNodes()
+;
+
+Collection[gmfgen::GenNode] getDirectChildren(gmfgen::GenNode node) :
+ node.childNodes.select(e| {e}.typeSelect(gmfgen::GenChildSideAffixedNode).size() == 0)
+;
+
+boolean needsXYLayout(gmfgen::GenContainerBase container) :
+ false
+;
+
+boolean needsXYLayout(gmfgen::GenDiagram diagram) :
+ true
+;
+
+boolean needsXYLayout(gmfgen::GenCompartment compartment) :
+ !compartment.listLayout
+;
+
+boolean needsXYLayout(gmfgen::GenNode node) :
+ (node.hasDirectChildren() && node.isXYLayout())
+;
+
+boolean needsXYLayout(gmfgen::GenChildLabelNode node) :
+ false
+;
+
+boolean needsXYLayout(gmfgen::GenContainerBase container, gmfgen::GenNode child) :
+ container.needsXYLayout()
+;
+
+boolean needsXYLayout(gmfgen::GenContainerBase container, gmfgen::GenChildSideAffixedNode child) :
+ true
+;
+
+Collection[gmfgen::GenExternalNodeLabel] getExternalLabels(gmfgen::GenNode node) :
+ node.labels.typeSelect(gmfgen::GenExternalNodeLabel)
+;
+
+Collection[gmfgen::GenChildSideAffixedNode] getSideAffixedChildren(gmfgen::GenNode node) :
+ node.childNodes.typeSelect(gmfgen::GenChildSideAffixedNode)
+;
+
+boolean hasSideAffixedChildren(gmfgen::GenNode node) :
+ node.getSideAffixedChildren().size() > 0
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/LinkFinder.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+extension xpt::GenModelUtils;
+extension xpt::commands::CommandUtils;
+extension xpt::diagram::PhantomUtils;
+
+cached Collection[gmfgen::GenLink] incomingLinks(gmfgen::GenCommonBase gcb) :
+ let effectiveMetaClass = gcb.getEffectiveMetaClass() :
+ (effectiveMetaClass == null ? {} :
+ gcb.getDiagram().links.select(e| e.incomingGenClass().ecoreClass.isSuperTypeOf(effectiveMetaClass.ecoreClass)))
+;
+
+Collection[gmfgen::GenLink] incomingTypeLinks(gmfgen::GenCommonBase gcb) :
+ gcb.incomingLinks().select(e| {e.modelFacet}.typeSelect(gmfgen::TypeLinkModelFacet).size() > 0)
+;
+
+cached Collection[gmfgen::GenLink] outgoingLinks(gmfgen::GenCommonBase gcb) :
+ let effectiveMetaClass = gcb.getEffectiveMetaClass() :
+ (effectiveMetaClass == null ? {} :
+ gcb.getDiagram().links.select(e| e.outgoingGenClass().ecoreClass.isSuperTypeOf(effectiveMetaClass.ecoreClass)))
+;
+
+cached Collection[gmfgen::GenLink] outgoingNonPhantomLinks(gmfgen::GenCommonBase gcb) :
+ gcb.outgoingLinks().select(e| !e.modelFacet.isPhantomLink(gcb.getDiagram()))
+;
+
+cached Collection[gmfgen::GenLink] containedLinks(gmfgen::GenCommonBase gcb) :
+ let effectiveMetaClass = gcb.getEffectiveMetaClass() :
+ (effectiveMetaClass == null ? {} :
+ gcb.getDiagram().links.select(e | e.containerGenClass().ecoreClass.isSuperTypeOf(effectiveMetaClass.ecoreClass)))
+;
+
+cached Collection[gmfgen::GenLink] containedTypeModelFacetLinks(gmfgen::GenCommonBase gcb) :
+ gcb.containedLinks().select(e| {e.modelFacet}.typeSelect(gmfgen::TypeLinkModelFacet).size() > 0)
+;
+
+cached Collection[gmfgen::GenLink] containedFeatureModelFacetLinks(gmfgen::GenCommonBase gcb) :
+ gcb.containedLinks().select(e| {e.modelFacet}.typeSelect(gmfgen::FeatureLinkModelFacet).size() > 0)
+;
+
+cached Collection[gmfgen::GenLink] containedLinksWithSelector(gmfgen::GenCommonBase gcb) :
+ gcb.containedTypeModelFacetLinks().select(e| e.modelFacet.getElementSelector() != null)
+;
+
+boolean needsSourceVisualID(gmfgen::GenCommonBase gcb) :
+ gcb.containedLinks().select(e| e.modelFacet != null && e.getDiagram().getRelatedChildLabelGenNodes(e.modelFacet.getSourceType()).size() > 0).size() > 0
+;
+
+boolean needsTargetVisualID(gmfgen::GenCommonBase gcb) :
+ gcb.containedLinks().select(e| e.modelFacet != null && e.getDiagram().getRelatedChildLabelGenNodes(e.modelFacet.getTargetType()).size() > 0).size() > 0
+;
+
+Collection[gmfgen::GenCommonBase] getPossibleContainers(gmfgen::GenLink link) :
+ let containerClass = link.containerGenClass().ecoreClass :
+ (containerClass == null ? {} :
+ {link.getDiagram(), link.getDiagram().getAllNodes(), link.getDiagram().links}.flatten()
+ .select(e| let effectiveMetaClass = ((gmfgen::GenCommonBase) e).getEffectiveMetaClass() : effectiveMetaClass == null ? false :
+ containerClass.isSuperTypeOf(effectiveMetaClass.ecoreClass))
+ )
+;
+
+private gmfgen::GenConstraint getElementSelector(gmfgen::LinkModelFacet facet) :
+ null
+;
+
+private gmfgen::GenConstraint getElementSelector(gmfgen::TypeLinkModelFacet facet) :
+ facet.modelElementSelector
+;
+
+private genmodel::GenClass incomingGenClass(gmfgen::GenLink link) :
+ link.modelFacet.incomingGenClass()
+;
+
+private genmodel::GenClass incomingGenClass(gmfgen::LinkModelFacet facet) :
+ null
+;
+
+private genmodel::GenClass incomingGenClass(gmfgen::FeatureLinkModelFacet facet) :
+ facet.metaFeature.getTypeGenClass()
+;
+
+private genmodel::GenClass incomingGenClass(gmfgen::TypeLinkModelFacet facet) :
+ facet.targetMetaFeature.getTypeGenClass()
+;
+
+private genmodel::GenClass outgoingGenClass(gmfgen::GenLink link) :
+ link.modelFacet.outgoingGenClass()
+;
+
+private genmodel::GenClass outgoingGenClass(gmfgen::LinkModelFacet facet) :
+ null
+;
+
+private genmodel::GenClass outgoingGenClass(gmfgen::FeatureLinkModelFacet facet) :
+ facet.metaFeature.genClass
+;
+
+private genmodel::GenClass outgoingGenClass(gmfgen::TypeLinkModelFacet facet) :
+ facet.sourceMetaFeature == null ? facet.containmentMetaFeature.genClass
+ : facet.sourceMetaFeature.getTypeGenClass()
+;
+
+private genmodel::GenClass getTypeGenClass(genmodel::GenFeature feature) :
+ findGenClassifier(feature.genClass.genPackage.genModel, feature.ecoreFeature.eType)
+;
+
+private genmodel::GenClass containerGenClass(gmfgen::GenLink link) :
+ link.modelFacet.containerGenClass()
+;
+
+private genmodel::GenClass containerGenClass(gmfgen::LinkModelFacet facet) :
+ null
+;
+
+private genmodel::GenClass containerGenClass(gmfgen::TypeLinkModelFacet facet) :
+ facet.containmentMetaFeature.genClass
+;
+
+private genmodel::GenClass containerGenClass(gmfgen::FeatureLinkModelFacet facet) :
+ facet.metaFeature.genClass
+;
+
+private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenCommonBase gcb) :
+ null
+;
+
+private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenDiagram diagram) :
+ diagram.domainDiagramElement
+;
+
+private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenNode node) :
+ node.modelFacet.metaClass
+;
+
+private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenLink link) :
+ link.modelFacet.getEffectiveMetaClass()
+;
+
+private genmodel::GenClass getEffectiveMetaClass(gmfgen::LinkModelFacet facet) :
+ null
+;
+
+private genmodel::GenClass getEffectiveMetaClass(gmfgen::TypeLinkModelFacet facet) :
+ facet.metaClass
+;
+
+private genmodel::GenClass getEffectiveMetaClass(gmfgen::GenChildLabelNode node) :
+ null
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/PhantomUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+extension xpt::GenModelUtils;
+
+Collection[gmfgen::GenTopLevelNode] getPhantomNodes(gmfgen::GenDiagram diagram) :
+ diagram.topLevelNodes.select(e| e.modelFacet.isPhantomElement())
+;
+
+Collection[genmodel::GenFeature] getPhantomFeatures(gmfgen::GenDiagram diagram) :
+ diagram.getPhantomFeatures(diagram.getPhantomNodes())
+;
+
+Collection[genmodel::GenFeature] getPhantomFeatures(gmfgen::GenTopLevelNode phantom) :
+ phantom.getDiagram().getPhantomFeatures({phantom})
+;
+
+private Collection[genmodel::GenFeature] getPhantomFeatures(gmfgen::GenDiagram diagram, Collection[gmfgen::GenTopLevelNode] phantomNodes) :
+ diagram.links.select(e| e.modelFacet.isPhantomLink(phantomNodes)).collect(e| ((gmfgen::FeatureLinkModelFacet) e.modelFacet).metaFeature)
+;
+
+boolean isPhantomLink(gmfgen::LinkModelFacet facet, gmfgen::GenDiagram diagram) :
+ facet.isPhantomLink(diagram.getPhantomNodes())
+;
+
+boolean isPhantomLink(gmfgen::LinkModelFacet facet, Collection[gmfgen::GenTopLevelNode] phantoms) :
+ false
+;
+
+boolean isPhantomLink(gmfgen::FeatureLinkModelFacet facet, Collection[gmfgen::GenTopLevelNode] phantoms) :
+ !facet.metaFeature.isContains() ? false :
+ (let featureType = facet.metaFeature.getTypeGenClassX().ecoreClass :
+ phantoms.select(e| featureType.isSuperTypeOf(e.modelFacet.metaClass.ecoreClass)).size() > 0)
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/ChildNodeEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::LabelController»
+
+«DEFINE ChildNodeEditPart FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND supertypes» {
+ «EXPAND xpt::diagram::parts::Common::visualIDConstant-»
+ «EXPAND xpt::diagram::parts::Common::ctors-»
+ «EXPAND isSelectable-»
+
+ «EXPAND xpt::diagram::parts::Common::declareViewCode-»
+ «EXPAND xpt::diagram::parts::Common::registerModel-»
+
+ «EXPAND createEditPolicies-»
+
+ «EXPAND xpt::diagram::parts::requests::performRequest-»
+ «EXPAND xpt::diagram::parts::Common::getModelChildren-»
+ «EXPAND xpt::diagram::parts::Common::getModelSourceConnections-»
+ «EXPAND xpt::diagram::parts::Common::getModelTargetConnections-»
+
+
+ «EXPAND xpt::diagram::parts::Common::getAdapter-»
+
+ «EXPAND xpt::diagram::parts::TreeEditPart::getTreeEditPartAdapter-»
+
+ «EXPAND xpt::diagram::parts::Common::activate-»
+ «EXPAND xpt::diagram::parts::Common::deactivate-»
+ «EXPAND xpt::diagram::parts::Common::getTransactionalUpdateManager-»
+ «EXPAND xpt::diagram::parts::refresh::refresher-»
+ «EXPAND xpt::diagram::parts::refresh::externalRefreshers-»
+
+ «EXPAND xpt::diagram::parts::LabelController::directEditManager-»
+ «EXPAND xpt::diagram::parts::LabelController::performDirectEdit-»
+ «EXPAND xpt::diagram::parts::LabelController::labelDisplayer-»
+ «EXPAND xpt::diagram::parts::LabelController::labelText-»
+ «EXPAND xpt::diagram::parts::LabelController::labelIcon-»
+ «EXPAND xpt::diagram::parts::LabelController::labelFigure(this) FOR viewmap-»
+
+ «EXPAND xpt::diagram::parts::Common::viewmap FOR viewmap-»
+ «EXPAND xpt::diagram::parts::TreeEditPart::TreeEditPart-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenChildLabelNode»extends org.eclipse.gef.editparts.AbstractGraphicalEditPart implements org.eclipse.gmf.runtime.lite.edit.parts.update.IUpdatableEditPart, org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart, org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelController«ENDDEFINE»
+
+«DEFINE isSelectable FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean isSelectable() {
+ if (!super.isSelectable()) {
+ return false;
+ }
+ if (!isActive()) {
+ return false;
+ }
+ if (getViewer().getContents().equals(getViewer().getFocusEditPart())) {
+ return false;
+ }
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE createEditPolicies FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void createEditPolicies() {
+«IF !isReadOnly()-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.lite.edit.policies.LabelDirectEditPolicy());
+«ENDIF-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new «EXPAND xpt::diagram::policies::ComponentEditPolicy::qualifiedClassName»());
+ «EXPAND xpt::diagram::parts::Common::behaviour-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenChildLabelNode»«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/Common.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+extension xpt::diagram::parts::NotationModelRefresher;
+extension xpt::diagram::parts::LinkNotationModelRefresher;
+
+boolean isSelectable(gmfgen::GenCommonBase gcb) :
+ true
+;
+
+boolean isSelectable(gmfgen::GenNodeLabel label) :
+ false
+;
+
+boolean isSelectable(gmfgen::GenExternalNodeLabel label) :
+ true
+;
+
+boolean isSelectable(gmfgen::GenCompartment compartment) :
+ false
+;
+
+boolean needsTransactionalUpdateManager(gmfgen::GenCommonBase gcb) :
+ gcb.needsDomainModelRefresher() || gcb.needsLinkNotationModelRefresher()
+;
+
+boolean needsTransactionalUpdateManager(gmfgen::GenDiagram diagram) :
+ true //Force for the diagram, used by activate/deactivate
+;
+
+boolean needsTransactionalUpdateManager(gmfgen::GenContainerBase gcb) :
+ gcb.needsDomainModelRefresher() || gcb.needsNotationModelRefresher() || gcb.needsLinkNotationModelRefresher()
+;
+
+boolean needsDomainModelRefresher(gmfgen::GenCommonBase gcb) :
+ false
+;
+
+boolean needsDomainModelRefresher(gmfgen::GenLink link) :
+ needsDomainModelRefresher(link.modelFacet)
+;
+
+boolean needsDomainModelRefresher(gmfgen::LinkModelFacet facet) :
+ false
+;
+
+boolean needsDomainModelRefresher(gmfgen::TypeLinkModelFacet facet) :
+ facet.metaClass != null
+;
+
+boolean needsDomainModelRefresher(gmfgen::GenDiagram diagram) :
+ !diagram.sansDomain
+;
+
+boolean needsDomainModelRefresher(gmfgen::GenNode node) :
+ !node.sansDomain
+;
+
+gmfgen::GenLabel getPrimaryLabel(gmfgen::GenCommonBase gcb) :
+ null
+;
+
+gmfgen::GenLabel getPrimaryLabel(gmfgen::GenNode node) :
+ node.labels.select(e| !e.readOnly).first()
+;
+
+gmfgen::GenLabel getPrimaryLabel(gmfgen::GenLink link) :
+ link.labels.select(e| !e.readOnly).first()
+;
+
+gmfgen::GenLabel getPrimaryLabel(gmfgen::GenChildLabelNode node) :
+ null
+;
+
+Collection[gmfgen::GenLabel] getAllLabels(gmfgen::GenCommonBase gcb) :
+ {}
+;
+
+Collection[gmfgen::GenLabel] getAllLabels(gmfgen::GenNode node) :
+ node.labels
+;
+
+Collection[gmfgen::GenLabel] getAllLabels(gmfgen::GenLink link) :
+ link.labels
+;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/Common.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,347 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::Common»
+«EXTENSION xpt::diagram::Helper»
+
+«DEFINE visualIDConstant FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final int VISUAL_ID = «visualID»;
+«ENDDEFINE»
+
+«DEFINE modelIDConstant FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static String MODEL_ID = "«editorGen.modelID»"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE registerModel FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void registerModel() {
+ super.registerModel();
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getModel();
+ if (view != null && view.isSetElement() && view.getElement() != null) {
+ getViewer().getEditPartRegistry().put(view.getElement(), this);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void unregisterModel() {
+ super.unregisterModel();
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getModel();
+ if (view != null && view.isSetElement() && view.getElement() != null && getViewer().getEditPartRegistry().get(view.getElement()) == this) {
+ getViewer().getEditPartRegistry().remove(view.getElement());
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getAdapter FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public Object getAdapter(Class key) {
+ «EXPAND snapToAdapter-»
+ «EXPAND xpt::diagram::parts::TreeEditPart::getAdapterClause-»
+ «EXPAND externalChildPositionTrackerAdapter-»
+ «EXPAND getAdapterAdditions-»
+ return super.getAdapter(key);
+}
+«ENDDEFINE»
+
+«DEFINE getAdapterAdditions FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE snapToAdapter FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE snapToAdapter FOR gmfgen::GenContainerBase-»
+«IF needsXYLayout()-»
+if (org.eclipse.gef.SnapToHelper.class == key) {
+ return new org.eclipse.gef.SnapToGrid(this);
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE externalChildPositionTrackerAdapter FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
+
+«DEFINE externalChildPositionTrackerAdapter FOR gmfgen::GenChildSideAffixedNode-»
+if (org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker.class == key) {
+ return getPositionTracker();
+}
+«ENDDEFINE»
+
+«DEFINE externalChildPositionTracker FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
+
+«DEFINE externalChildPositionTracker FOR gmfgen::GenChildSideAffixedNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker myPositionTracker;
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker getPositionTracker() {
+ if (myPositionTracker == null) {
+ myPositionTracker = new org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker(this);
+ }
+ return myPositionTracker;
+}
+«ENDDEFINE»
+
+«DEFINE behaviour FOR gmfgen::GenCommonBase»«EXPAND behaviour FOREACH behaviour»«ENDDEFINE»
+
+«DEFINE behaviour FOR gmfgen::Behaviour»«ENDDEFINE»
+
+«DEFINE behaviour FOR gmfgen::SharedBehaviour»«EXPAND behaviour FOR delegate»«ENDDEFINE»
+
+«DEFINE behaviour FOR gmfgen::CustomBehaviour»
+installEditPolicy(«key», new «getEditPolicyQualifiedClassName()»()); «IF key.startsWith('\"') && key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
+«ENDDEFINE»
+
+«DEFINE behaviour FOR gmfgen::OpenDiagramBehaviour-»
+ installEditPolicy(org.eclipse.gmf.runtime.lite.edit.policies.EditPolicyRoles.OPEN_ROLE,
+ new «getEditPolicyQualifiedClassName()»());
+«ENDDEFINE»
+
+«DEFINE viewmap FOR gmfgen::Viewmap»«ENDDEFINE»
+
+«DEFINE viewmap FOR gmfgen::InnerClassViewmap-»
+«classBody-»
+«EXPAND mapModeWorkaround-»
+«ENDDEFINE»
+
+«DEFINE mapModeWorkaround FOR gmfgen::InnerClassViewmap-»
+«IF classBody.matches(".*[DL]Pto[LD]P.*")-»
+«EXPAND xpt::Common::generatedClassComment»
+private static class MapModeWorkaround {
+ «EXPAND xpt::Common::generatedMemberComment»
+ public int DPtoLP(int dp) {
+ return dp;
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ public int LPtoDP(int lp) {
+ return lp;
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static MapModeWorkaround INSTANCE = new MapModeWorkaround();
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private MapModeWorkaround getMapMode() {
+ return MapModeWorkaround.INSTANCE;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE declareViewCode FOR gmfgen::GenCommonBase»«EXPAND declareViewCode("org.eclipse.gmf.runtime.notation.Node")»«ENDDEFINE»
+«DEFINE declareViewCode FOR gmfgen::GenDiagram»«EXPAND declareViewCode("org.eclipse.gmf.runtime.notation.Diagram")»«ENDDEFINE»
+«DEFINE declareViewCode FOR gmfgen::GenLink»«EXPAND declareViewCode("org.eclipse.gmf.runtime.notation.Edge")»«ENDDEFINE»
+
+«DEFINE declareViewCode(String expectedModelType) FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «expectedModelType» «EXPAND getViewCode» {
+ return («expectedModelType») getModel();
+}
+«ENDDEFINE»
+
+«DEFINE contentPane FOR gmfgen::GenChildContainer-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure contentPane;
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.IFigure getContentPane() {
+ if (contentPane == null) {
+ return super.getContentPane();
+ }
+ return contentPane;
+}
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenCommonBase»«EXPAND ctors("org.eclipse.gmf.runtime.notation.Node")»«ENDDEFINE»
+«DEFINE ctors FOR gmfgen::GenLink»«EXPAND ctors("org.eclipse.gmf.runtime.notation.Edge")»«ENDDEFINE»
+
+«DEFINE ctors(String expectedModelType) FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «editPartClassName»(org.eclipse.gmf.runtime.notation.View model) {
+ assert model instanceof «expectedModelType»;
+ setModel(model);
+}
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «editPartClassName»(org.eclipse.gmf.runtime.notation.Diagram model) {
+ setModel(model);
+}
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenLinkLabel-»
+«EXPAND invokeSuperCtor-»
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenExternalNodeLabel-»
+«EXPAND invokeSuperCtor-»
+«ENDDEFINE»
+
+«DEFINE invokeSuperCtor FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «editPartClassName»(org.eclipse.gmf.runtime.notation.View model) {
+ super(model);
+}
+«ENDDEFINE»
+
+«DEFINE getViewCode FOR gmfgen::GenCommonBase»getDiagramNode()«ENDDEFINE»
+
+«DEFINE getViewCode FOR gmfgen::GenDiagram»getDiagram()«ENDDEFINE»
+
+«DEFINE getViewCode FOR gmfgen::GenLink»getDiagramEdge()«ENDDEFINE»
+
+«DEFINE getDiagramCode FOR gmfgen::GenCommonBase»«EXPAND getViewCode».getDiagram()«ENDDEFINE»
+
+«DEFINE getDiagramCode FOR gmfgen::GenDiagram»«EXPAND getViewCode»«ENDDEFINE»
+
+«DEFINE getDiagramElementCode FOR gmfgen::GenCommonBase»«EXPAND getDiagramCode».getElement()«ENDDEFINE»
+
+«DEFINE getModelChildren FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getModelChildren() {
+ return «EXPAND getViewCode».getVisibleChildren();
+}
+«ENDDEFINE»
+
+«DEFINE getModelSourceConnections FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getModelSourceConnections() {
+ return «EXPAND getViewCode».getSourceEdges();
+}
+«ENDDEFINE»
+
+«DEFINE getModelTargetConnections FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getModelTargetConnections() {
+ return «EXPAND getViewCode».getTargetEdges();
+}
+«ENDDEFINE»
+
+«DEFINE getModelChildren FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getModelChildren() {
+ return java.util.Collections.EMPTY_LIST;
+}
+«ENDDEFINE»
+
+«DEFINE getModelSourceConnections FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getModelSourceConnections() {
+ return java.util.Collections.EMPTY_LIST;
+}
+«ENDDEFINE»
+
+«DEFINE getModelTargetConnections FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getModelTargetConnections() {
+ return java.util.Collections.EMPTY_LIST;
+}
+«ENDDEFINE»
+
+«DEFINE notSelectable FOR gmfgen::GenCommonBase-»
+«IF !isSelectable()-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean isSelectable() {
+ return false;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getTransactionalUpdateManager FOR gmfgen::GenCommonBase-»
+«IF needsTransactionalUpdateManager()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager getTransactionalUpdateManager() {
+ return (org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager) getViewer().getProperty(org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager.class.getName());
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE activate FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void activate() {
+ super.activate();
+ «EXPAND activateAdditions-»
+}
+«ENDDEFINE»
+
+«DEFINE deactivate FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void deactivate() {
+ «EXPAND deactivateAdditions-»
+ super.deactivate();
+}
+«ENDDEFINE»
+
+«DEFINE activateAdditions FOR gmfgen::GenCommonBase»«ENDDEFINE»
+«DEFINE deactivateAdditions FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE activateAdditions FOR gmfgen::GenContainerBase-»
+«EXPAND activateRefreshers-»
+«ENDDEFINE»
+
+«DEFINE deactivateAdditions FOR gmfgen::GenContainerBase-»
+«EXPAND deactivateRefreshers-»
+«ENDDEFINE»
+
+«DEFINE activateAdditions FOR gmfgen::GenDiagram-»
+«EXPAND activateRefreshers-»
+getTransactionalUpdateManager().install(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND getViewCode»));
+«ENDDEFINE»
+
+«DEFINE deactivateAdditions FOR gmfgen::GenDiagram-»
+getTransactionalUpdateManager().uninstall();
+«EXPAND deactivateRefreshers-»
+«ENDDEFINE»
+
+«DEFINE activateAdditions FOR gmfgen::GenChildLabelNode-»
+addExternalRefresher(getLabelRefresher());
+«EXPAND activateRefreshers-»
+«ENDDEFINE»
+
+«DEFINE deactivateAdditions FOR gmfgen::GenChildLabelNode-»
+«EXPAND deactivateRefreshers-»
+removeExternalRefresher(getLabelRefresher());
+«ENDDEFINE»
+
+«DEFINE activateRefreshers FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::diagram::parts::domainModelRefresher::activate-»
+«EXPAND xpt::diagram::parts::NotationModelRefresher::installClause-»
+«EXPAND xpt::diagram::parts::LinkNotationModelRefresher::installClause-»
+«ENDDEFINE»
+
+«DEFINE deactivateRefreshers FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::diagram::parts::LinkNotationModelRefresher::uninstallClause-»
+«EXPAND xpt::diagram::parts::NotationModelRefresher::uninstallClause-»
+«EXPAND xpt::diagram::parts::domainModelRefresher::deactivate-»
+«ENDDEFINE»
+
+«DEFINE activateAdditions FOR gmfgen::GenLabel-»
+«EXPAND xpt::diagram::parts::LabelController::activateAdditions-»
+«ENDDEFINE»
+
+«DEFINE deactivateAdditions FOR gmfgen::GenLabel-»
+«EXPAND xpt::diagram::parts::LabelController::deactivateAdditions-»
+«ENDDEFINE»
+
+«DEFINE activateAdditions FOR gmfgen::GenLink-»
+«EXPAND xpt::diagram::parts::domainModelRefresher::activate-»
+«EXPAND xpt::diagram::parts::LinkNotationModelRefresher::installClause-»
+«ENDDEFINE»
+
+«DEFINE deactivateAdditions FOR gmfgen::GenLink-»
+«EXPAND xpt::diagram::parts::LinkNotationModelRefresher::uninstallClause-»
+«EXPAND xpt::diagram::parts::domainModelRefresher::deactivate-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/CompartmentEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«DEFINE CompartmentEditPart FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND supertypes» {
+ «EXPAND xpt::diagram::parts::Common::visualIDConstant-»
+
+ «EXPAND xpt::diagram::parts::Common::ctors-»
+ «EXPAND xpt::diagram::parts::Common::notSelectable-»
+ «EXPAND getModelChildren-»
+ «EXPAND xpt::diagram::parts::Common::declareViewCode-»
+ «EXPAND createEditPolicies-»
+
+ «EXPAND createSelectionHandles-»
+ «EXPAND xpt::diagram::parts::requests::performRequest-»
+ «EXPAND getTitleName-»
+ «EXPAND createFigure-»
+ «EXPAND xpt::diagram::parts::Common::getAdapter-»
+ «EXPAND xpt::diagram::parts::Common::contentPane-»
+ «EXPAND setupCompartmentHolder-»
+ «EXPAND xpt::diagram::parts::Common::activate-»
+ «EXPAND xpt::diagram::parts::Common::deactivate-»
+ «EXPAND xpt::diagram::parts::Common::getTransactionalUpdateManager-»
+ «EXPAND xpt::diagram::parts::NotationModelRefresher::all-»
+ «EXPAND xpt::diagram::parts::refresh::refresher-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenCompartment»extends org.eclipse.gef.editparts.AbstractGraphicalEditPart implements org.eclipse.gmf.runtime.lite.edit.parts.update.IUpdatableEditPart«ENDDEFINE»
+
+«DEFINE getModelChildren FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getModelChildren() {
+ org.eclipse.gmf.runtime.notation.DrawerStyle style = (org.eclipse.gmf.runtime.notation.DrawerStyle) «EXPAND xpt::diagram::parts::Common::getViewCode».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getDrawerStyle());
+ if (style != null && style.isCollapsed()) {
+ return java.util.Collections.EMPTY_LIST;
+ }
+ return «EXPAND xpt::diagram::parts::Common::getViewCode».getVisibleChildren();
+}
+«ENDDEFINE»
+
+«DEFINE createEditPolicies FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void createEditPolicies() {
+ installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new «EXPAND xpt::diagram::policies::LayoutEditPolicy::qualifiedClassName»());
+ «EXPAND xpt::diagram::parts::Common::behaviour-»
+ «EXPAND xpt::diagram::parts::NotationModelRefresher::installClause-»
+}
+«ENDDEFINE»
+
+«DEFINE createSelectionHandles FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::generatedMemberComment("Returns the selection handles that should be contributed to the parent when it becomes selected.")»
+public java.util.List createSelectionHandles() {
+«IF canCollapse-»
+ return java.util.Collections.singletonList(new org.eclipse.gmf.runtime.lite.handles.CompartmentCollapseHandle(this, getTitleName()));
+«ELSE-»
+ return java.util.Collections.singletonList(new org.eclipse.gmf.runtime.lite.handles.CompartmentNameHandle(this, getTitleName()));
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE getTitleName FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected String getTitleName() {
+«IF needsTitle-»
+ return "«title»"; «EXPAND xpt::Common::nonNLS»
+«ELSE-»
+ return ""; «EXPAND xpt::Common::nonNLS»
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.draw2d.Figure result = new org.eclipse.gmf.runtime.lite.figures.CompartmentFigure();
+ result.setLayoutManager(new org.eclipse.draw2d.StackLayout());
+ org.eclipse.draw2d.ScrollPane scrollPane = new org.eclipse.draw2d.ScrollPane();
+ result.add(scrollPane);
+«IF listLayout-»
+ org.eclipse.draw2d.Viewport viewport = new org.eclipse.draw2d.Viewport();
+ contentPane = new org.eclipse.draw2d.Figure();
+ contentPane.setLayoutManager(new org.eclipse.draw2d.ToolbarLayout());
+«ELSE-»
+ org.eclipse.draw2d.Viewport viewport = new org.eclipse.draw2d.FreeformViewport();
+ contentPane = new org.eclipse.draw2d.FreeformLayer();
+ contentPane.setLayoutManager(new org.eclipse.draw2d.FreeformLayout());
+«ENDIF-»
+ viewport.setContents(contentPane);
+ scrollPane.setViewport(viewport);
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE setupCompartmentHolder FOR gmfgen::GenCompartment-»
+«EXPAND setupCompartmentHolder FOR viewmap-»
+«ENDDEFINE»
+
+«DEFINE setupCompartmentHolder FOR gmfgen::Viewmap»«ENDDEFINE»
+
+«DEFINE setupCompartmentHolder FOR gmfgen::ParentAssignedViewmap-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void setupCompartmentHolder(org.eclipse.draw2d.IFigure shape) {
+ if (shape.getLayoutManager() == null) {
+ shape.setLayoutManager(new org.eclipse.draw2d.StackLayout());
+ }
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCompartment-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/DiagramEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«DEFINE DiagramEditPart FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND supertypes» {
+ «EXPAND xpt::diagram::parts::Common::modelIDConstant-»
+ «EXPAND xpt::diagram::parts::Common::visualIDConstant-»
+
+ «EXPAND xpt::diagram::parts::Common::ctors-»
+
+ «EXPAND xpt::diagram::parts::Common::declareViewCode-»
+ «EXPAND xpt::diagram::parts::Common::registerModel-»
+ «EXPAND createEditPolicies-»
+ «EXPAND createFigure-»
+ «EXPAND getDragTracker-»
+ «EXPAND xpt::diagram::parts::Common::getAdapter-»
+ «EXPAND xpt::diagram::parts::TreeEditPart::getTreeEditPartAdapter-»
+ «EXPAND xpt::diagram::parts::Common::getModelChildren-»
+ «EXPAND xpt::diagram::parts::refresh::refresher-»
+ «EXPAND xpt::diagram::parts::Common::activate-»
+ «EXPAND xpt::diagram::parts::Common::deactivate-»
+ «EXPAND xpt::diagram::parts::NotationModelRefresher::all-»
+ «EXPAND xpt::diagram::parts::LinkNotationModelRefresher::all-»
+ «EXPAND xpt::diagram::parts::Common::getTransactionalUpdateManager-»
+ «EXPAND xpt::diagram::parts::TreeEditPart::TreeEditPart-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.gef.editparts.AbstractGraphicalEditPart implements org.eclipse.gmf.runtime.lite.edit.parts.update.IUpdatableEditPart«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.draw2d.IFigure f = new org.eclipse.draw2d.FreeformLayer();
+ f.setBorder(new org.eclipse.draw2d.MarginBorder(5));
+ f.setOpaque(true);
+ f.setLayoutManager(new org.eclipse.draw2d.FreeformLayout());
+ return f;
+}
+«ENDDEFINE»
+
+«DEFINE getDragTracker FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request) {
+ return new org.eclipse.gef.tools.MarqueeDragTracker() {
+ protected boolean handleButtonDown(int button) {
+ if (super.handleButtonDown(button)) {
+ getViewer().setSelection(org.eclipse.jface.viewers.StructuredSelection.EMPTY);
+ getViewer().setFocus(null);
+ return true;
+ }
+ return false;
+ }
+ };
+}
+«ENDDEFINE»
+
+«DEFINE createEditPolicies FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void createEditPolicies() {
+ installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new org.eclipse.gef.editpolicies.RootComponentEditPolicy());
+ installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new «EXPAND xpt::diagram::policies::LayoutEditPolicy::qualifiedClassName»());
+ «EXPAND xpt::diagram::parts::Common::behaviour-»
+ «EXPAND xpt::diagram::parts::NotationModelRefresher::installClause-»
+ «EXPAND xpt::diagram::parts::LinkNotationModelRefresher::installClause-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/EditPartFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::parts::Common»
+
+«DEFINE EditPartFactory FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartFactoryClassName» «EXPAND supertypes» {
+
+ «EXPAND externalNodeLabels-»
+
+ «EXPAND createEditPart-»
+
+ «EXPAND createUnrecognizedEditPart-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»implements org.eclipse.gef.EditPartFactory«ENDDEFINE»
+
+«DEFINE externalNodeLabels FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static final String EXTERNAL_NODE_LABELS_LAYER = "External Node Labels"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE createEditPart FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gef.EditPart createEditPart(org.eclipse.gef.EditPart context, Object model) {
+ if (model instanceof org.eclipse.gmf.runtime.notation.View) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) model;
+ String modelID = «EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view);
+ if (!«EXPAND xpt::editor::VisualIDRegistry::modelID».equals(modelID)) {
+«IF containsShortcutsTo.size() > 0-»
+ if («getDiagramEditorUtilQualifiedClassName()».isKnownShortcutModelID(modelID)) {
+ org.eclipse.gmf.runtime.lite.shortcuts.IShortcutProvider shortcutProvider = org.eclipse.gmf.runtime.lite.shortcuts.ShortcutProvidersRegistry.INSTANCE.getShortcutProvider(modelID);
+ if (shortcutProvider != null) {
+ return shortcutProvider.createShortcutEditPart(context, view);
+ }
+ }
+«ENDIF-»
+ return null;
+ }
+ int viewVisualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view);
+ switch (viewVisualID) {
+ «EXPAND doCreate FOREACH getAllContainers()-»
+ «EXPAND doCreate FOREACH links-»
+ }
+ }
+ return createUnrecognizedEditPart(context, model);
+ }
+«ENDDEFINE»
+
+«DEFINE createUnrecognizedEditPart FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gef.EditPart createUnrecognizedEditPart(org.eclipse.gef.EditPart context, Object model) {
+ // Handle creation of unrecognized child node EditParts here
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE doCreate FOR gmfgen::GenCommonBase-»
+«EXPAND caseVisualID-»
+«EXPAND doCreate FOREACH getAllLabels()-»
+«ENDDEFINE»
+
+«DEFINE caseVisualID FOR gmfgen::GenCommonBase-»
+case «EXPAND xpt::editor::VisualIDRegistry::visualID»:
+ return new «getEditPartQualifiedClassName()»(«EXPAND cast»view);
+«ENDDEFINE»
+
+«DEFINE cast FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE cast FOR gmfgen::GenDiagram»(org.eclipse.gmf.runtime.notation.Diagram) «ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/LabelController.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+boolean isReadOnly(gmfgen::GenCommonBase gcb) :
+ true
+;
+
+boolean isReadOnly(gmfgen::GenChildLabelNode node) :
+ node.labelReadOnly
+;
+
+boolean isReadOnly(gmfgen::GenLabel label) :
+ label.readOnly
+;
+
+boolean isElementIcon(gmfgen::GenCommonBase gcb) :
+ false
+;
+
+boolean isElementIcon(gmfgen::GenChildLabelNode node) :
+ node.labelElementIcon
+;
+
+boolean isElementIcon(gmfgen::GenLabel label) :
+ label.elementIcon
+;
+
+gmfgen::LabelModelFacet getLabelModelFacet(gmfgen::GenCommonBase gcb) :
+ null
+;
+
+gmfgen::LabelModelFacet getLabelModelFacet(gmfgen::GenLabel label) :
+ label.modelFacet
+;
+
+gmfgen::LabelModelFacet getLabelModelFacet(gmfgen::GenChildLabelNode node) :
+ node.labelModelFacet
+;
+
+String getFigureQualifiedClassName(gmfgen::Viewmap viewmap) :
+ "org.eclipse.draw2d.IFigure"
+;
+
+String getFigureQualifiedClassName(gmfgen::FigureViewmap viewmap) :
+ viewmap.figureQualifiedClassName == null ? "org.eclipse.draw2d.Label" : viewmap.figureQualifiedClassName
+;
+
+String getFigureQualifiedClassName(gmfgen::ParentAssignedViewmap viewmap) :
+ viewmap.figureQualifiedClassName == null ? "org.eclipse.draw2d.Label" : viewmap.figureQualifiedClassName
+;
+
+String getFigureQualifiedClassName(gmfgen::InnerClassViewmap viewmap) :
+ viewmap.className
+;
+
+String getLabelHostQualifiedClassName(gmfgen::GenLabel label) :
+ null
+;
+
+String getLabelHostQualifiedClassName(gmfgen::GenNodeLabel label) :
+ label.node.getEditPartQualifiedClassName()
+;
+
+String getLabelHostQualifiedClassName(gmfgen::GenLinkLabel label) :
+ label.link.getEditPartQualifiedClassName()
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/LabelController.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::LabelController»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+«EXTENSION xpt::providers::ParserUtils»
+
+«DEFINE directEditManager FOR gmfgen::GenCommonBase-»
+«IF !isReadOnly()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gef.tools.DirectEditManager manager;
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.tools.DirectEditManager getManager() {
+ if (manager == null) {
+ manager = new org.eclipse.gef.tools.DirectEditManager(this, org.eclipse.jface.viewers.TextCellEditor.class, new org.eclipse.gmf.runtime.lite.services.LabelCellEditorLocator(getViewer(), getLabel())) {
+ protected void initCellEditor() {
+ getCellEditor().setValue(getLabelTextDisplayer().getEditText(«EXPAND xpt::diagram::parts::Common::getViewCode».getElement()));
+ }
+ };
+ }
+ return manager;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE performDirectEdit FOR gmfgen::GenCommonBase-»
+«IF !isReadOnly()-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void performDirectEdit() {
+ if («getDiagram().getDiagramEditorUtilQualifiedClassName()».isReadOnly(«EXPAND xpt::diagram::parts::Common::getViewCode».getElement()) || «getDiagram().getDiagramEditorUtilQualifiedClassName()».isReadOnly(«EXPAND xpt::diagram::parts::Common::getViewCode»)) {
+ return;
+ }
+ if (getLabelTextDisplayer() == null) {
+ return;
+ }
+ getManager().show();
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE labelDisplayer FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static final org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelTextDisplayer LABEL_DISPLAYER = createLabelTextDisplayer();
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelTextDisplayer getLabelTextDisplayer() {
+ return LABEL_DISPLAYER;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelTextDisplayer createLabelTextDisplayer() {
+«LET getLabelModelFacet() AS facet-»
+«IF facet == null-»
+«ERROR "Unexpected type"-»
+«ELSE-»
+«EXPAND createLabelTextDisplayer(isReadOnly()) FOR facet-»
+«ENDIF-»
+«ENDLET-»
+}
+«ENDDEFINE»
+
+«DEFINE createLabelTextDisplayer(Boolean isReadOnly) FOR gmfgen::LabelModelFacet-»
+// TODO: implement this method
+// Ensure that you remove @generated or mark it @generated NOT
+return null;
+«ENDDEFINE»
+
+«DEFINE createLabelTextDisplayer(Boolean isReadOnly) FOR gmfgen::FeatureLabelModelFacet-»
+«IF viewMethod.literal == editMethod.literal-»
+«LET (Collection[int]){} AS nonNLSHolder-»
+return «EXPAND instantiateLabelTextDisplayer(isReadOnly, nonNLSHolder)»; «FOREACH nonNLSHolder AS index»«EXPAND xpt::Common::nonNLS(index)»«ENDFOREACH»
+«ENDLET-»
+«ELSE-»
+«LET (Collection[int]){} AS nonNLSHolder-»
+org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelTextDisplayer reader = «EXPAND instantiateLabelTextReader(nonNLSHolder)»;
+«ENDLET-»
+«LET (Collection[int]){} AS nonNLSHolder-»
+org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelTextDisplayer writer = «IF isReadOnly»null«ELSE»«EXPAND instantiateLabelTextWriter(nonNLSHolder)»«ENDIF»;
+«ENDLET-»
+return new org.eclipse.gmf.runtime.lite.edit.parts.labels.CompositeLabelTextDisplayer(reader, writer);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE features FOR gmfgen::FeatureLabelModelFacet-»
+new org.eclipse.emf.ecore.EAttribute[] {«EXPAND MetaModel::MetaFeature FOREACH metaFeatures SEPARATOR ', '»}«-»
+«ENDDEFINE»
+
+«DEFINE instantiateLabelTextDisplayer(Boolean isReadOnly, Collection[int] nonNLSHolder) FOR gmfgen::FeatureLabelModelFacet-»
+«IF viewMethod.literal == gmfgen::LabelTextAccessMethod::MESSAGE_FORMAT.literal-»
+new org.eclipse.gmf.runtime.lite.edit.parts.labels.MessageFormatLabelTextDisplayer(«EXPAND readerPatterns(nonNLSHolder)»«IF !isReadOnly», «EXPAND writerPatterns(nonNLSHolder)»«ENDIF», «EXPAND features»)«-»
+«ELSEIF viewMethod.literal == gmfgen::LabelTextAccessMethod::NATIVE.literal-»
+ «IF metaFeatures.size() != 1»«ERROR "Unexpected features size for NATIVE label text access method"»«ENDIF-»
+new org.eclipse.gmf.runtime.lite.edit.parts.labels.NativeLabelTextDisplayer(«EXPAND features»)«-»
+«ELSEIF viewMethod.literal == gmfgen::LabelTextAccessMethod::PRINTF.literal-»
+new org.eclipse.gmf.runtime.lite.edit.parts.labels.PrintfLabelTextDisplayer(«EXPAND readerPatterns(nonNLSHolder)», «EXPAND features»)«-»
+«ELSE-»
+«ERROR "Unexpected label text access method"-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE instantiateLabelTextReader(Collection[int] nonNLSHolder) FOR gmfgen::FeatureLabelModelFacet»«EXPAND instantiateLabelTextDisplayer(true, nonNLSHolder)»«ENDDEFINE»
+
+«DEFINE instantiateLabelTextWriter(Collection[int] nonNLSHolder) FOR gmfgen::FeatureLabelModelFacet-»
+«IF viewMethod.literal == gmfgen::LabelTextAccessMethod::MESSAGE_FORMAT.literal-»
+new org.eclipse.gmf.runtime.lite.edit.parts.labels.MessageFormatLabelTextDisplayer(null, null, «EXPAND writerPatterns(nonNLSHolder)», «EXPAND features»)«-»
+«ELSEIF viewMethod.literal == gmfgen::LabelTextAccessMethod::NATIVE.literal-»
+ «IF metaFeatures.size() != 1»«ERROR "Unexpected features size for NATIVE label text access method"»«ENDIF-»
+new org.eclipse.gmf.runtime.lite.edit.parts.labels.NativeLabelTextDisplayer(«EXPAND features»)«-»
+«ELSEIF editMethod.literal == gmfgen::LabelTextAccessMethod::REGEXP.literal-»
+new org.eclipse.gmf.runtime.lite.edit.parts.labels.RegexpParser(«EXPAND writerPatterns(nonNLSHolder)», «EXPAND features»)«-»
+«ELSE-»
+«ERROR "Unexpected label text access method"-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE readerPatterns(Collection[int] nonNLSHolder) FOR gmfgen::FeatureLabelModelFacet-»
+«EXPAND quote(viewPattern, nonNLSHolder)», «EXPAND quote(isPatternSpecified(editorPattern) ? editorPattern : viewPattern, nonNLSHolder)-»
+«ENDDEFINE»
+
+«DEFINE writerPatterns(Collection[int] nonNLSHolder) FOR gmfgen::FeatureLabelModelFacet-»
+«EXPAND quote(isPatternSpecified(editPattern) ? editPattern : (isPatternSpecified(editorPattern) ? editorPattern : viewPattern), nonNLSHolder)-»
+«ENDDEFINE»
+
+«DEFINE quote(String text, Collection[int] nonNLSHolder) FOR gmfgen::FeatureLabelModelFacet-»
+«IF text == null»null«ELSE»"«text»"«nonNLSHolder.add(nonNLSHolder.size() + 1)->""»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE labelText FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private String defaultText;
+
+«EXPAND xpt::Common::generatedMemberComment»
+public void setLabelText(String text) {
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ getLabel().setText(text);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected String getLabelText() {
+ if (getLabelTextDisplayer() == null) {
+ return defaultText;
+ }
+ org.eclipse.emf.ecore.EObject element = «EXPAND xpt::diagram::parts::Common::getViewCode».getElement();
+ if (element == null) {
+ return defaultText;
+ }
+ String result = getLabelTextDisplayer().getDisplayText(element);
+ if (result == null || result.length() == 0) {
+ return defaultText;
+ }
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE labelFigure(gmfgen::GenCommonBase label) FOR gmfgen::ParentAssignedViewmap-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure createFigure() {
+ // Parent should assign one using «EXPAND xpt::diagram::parts::NodeEditPart::setter» method
+ return null;
+}
+
+«EXPAND getLabel-»
+
+«EXPAND xpt::Common::generatedMemberComment»
+public void «EXPAND xpt::diagram::parts::NodeEditPart::setter»(«getFigureQualifiedClassName()» label) {
+ unregisterVisuals();
+ setFigure(label);
+ «EXPAND initDefaultText-»
+ registerVisuals();
+ refreshVisuals();
+}
+«ENDDEFINE»
+
+«DEFINE labelFigure(gmfgen::GenCommonBase label) FOR gmfgen::Viewmap-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure createFigure() {
+ «getFigureQualifiedClassName()» label = createLabel();
+ «EXPAND initDefaultText-»
+ return label;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected «getFigureQualifiedClassName()» createLabel() {
+ «EXPAND createLabel-»
+}
+
+«EXPAND getLabel-»
+«ENDDEFINE»
+
+«DEFINE createLabel FOR gmfgen::Viewmap»«ERROR "Unexpected viewmap type: " + this»«ENDDEFINE»
+
+«DEFINE createLabel FOR gmfgen::FigureViewmap-»
+return new «getFigureQualifiedClassName()»();
+«ENDDEFINE»
+
+«DEFINE createLabel FOR gmfgen::SnippetViewmap-»
+return «body»;
+«ENDDEFINE»
+
+«DEFINE createLabel FOR gmfgen::InnerClassViewmap-»
+return new «getFigureQualifiedClassName()»();
+«ENDDEFINE»
+
+«DEFINE initDefaultText FOR gmfgen::Viewmap-»
+«IF "org.eclipse.draw2d.Label" == getFigureQualifiedClassName()-»
+defaultText = label.getText();
+«ELSE-»
+if (label instanceof org.eclipse.draw2d.Label) {
+ defaultText = label.getText();
+} else {
+ defaultText = ""; «EXPAND xpt::Common::nonNLS»
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE initDefaultText FOR gmfgen::InnerClassViewmap-»
+defaultText = label.getText();
+«ENDDEFINE»
+
+«DEFINE getLabel FOR gmfgen::Viewmap-»
+«EXPAND getLabelComment-»
+public org.eclipse.draw2d.Label getLabel() {
+ return (org.eclipse.draw2d.Label) getFigure();
+}
+«ENDDEFINE»
+
+«DEFINE getLabelComment FOR gmfgen::Viewmap-»
+«IF ("org.eclipse.draw2d.Label" == getFigureQualifiedClassName())-»
+«EXPAND xpt::Common::generatedMemberComment»
+«ELSE-»
+«EXPAND xpt::Common::generatedMemberComment("TODO: reimplement, since the figure used by this editpart may not be a Label.")»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getLabelComment FOR gmfgen::InnerClassViewmap-»
+«EXPAND xpt::Common::generatedMemberComment»
+«ENDDEFINE»
+
+
+«DEFINE labelIcon FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.graphics.Image getLabelIcon() {
+«IF isElementIcon()-»
+ return «getDiagram().getElementTypesQualifiedClassName()».getImage(«EXPAND getElement».eClass());
+«ELSE-»
+ return null;
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE getElement FOR gmfgen::GenCommonBase»«EXPAND xpt::diagram::parts::Common::getViewCode».getElement()«ENDDEFINE»
+
+«DEFINE getElement FOR gmfgen::GenLinkLabel-»
+«EXPAND getElement(link) FOR link.modelFacet-»
+«ENDDEFINE»
+
+«DEFINE getElement(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet»«ERROR "Unexpected model facet: " + this»«ENDDEFINE»
+
+«DEFINE getElement(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet»getUpdatableParent().«EXPAND xpt::diagram::parts::Common::getViewCode FOR link».getElement()«ENDDEFINE»
+
+«DEFINE getElement(gmfgen::GenLink link) FOR gmfgen::FeatureLinkModelFacet»getUpdatableParent().«EXPAND xpt::diagram::parts::Common::getViewCode FOR link».getTarget().getElement()«ENDDEFINE»
+
+«DEFINE getUpdatableParent FOR gmfgen::GenLabel-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «getLabelHostQualifiedClassName()» getUpdatableParent() {
+ assert getParent() instanceof «getLabelHostQualifiedClassName()»;
+ return («getLabelHostQualifiedClassName()») getParent();
+}
+«ENDDEFINE»
+
+«REM»
+The activate/deactivate pair for labels with updatable parents more belongs to the LabelController template.
+It is thus referenced from the common activate/deactivate mechanism.
+«ENDREM»
+«DEFINE activateAdditions FOR gmfgen::GenLabel-»
+«getLabelHostQualifiedClassName()» updatableParent = getUpdatableParent();
+if (updatableParent != null) {
+«IF !viewmap.isFixedFont()-»
+ updatableParent.addExternalRefresher(fontColorRefresher);
+ updatableParent.addExternalRefresher(fontRefresher);
+«ENDIF-»
+ updatableParent.addExternalRefresher(getLabelRefresher());
+ «EXPAND activateMore-»
+}
+«ENDDEFINE»
+
+«DEFINE deactivateAdditions FOR gmfgen::GenLabel-»
+«getLabelHostQualifiedClassName()» updatableParent = getUpdatableParent();
+if (updatableParent != null) {
+«IF !viewmap.isFixedFont()-»
+ updatableParent.removeExternalRefresher(fontColorRefresher);
+ updatableParent.removeExternalRefresher(fontRefresher);
+«ENDIF-»
+ updatableParent.removeExternalRefresher(getLabelRefresher());
+ «EXPAND deactivateMore-»
+}
+«ENDDEFINE»
+
+«DEFINE activateMore FOR gmfgen::GenLabel»«ENDDEFINE»
+«DEFINE deactivateMore FOR gmfgen::GenLabel»«ENDDEFINE»
+
+«DEFINE activateMore FOR gmfgen::GenExternalNodeLabel-»
+updatableParent.addExternalRefresher(boundsRefresher);
+«ENDDEFINE»
+
+«DEFINE deactivateMore FOR gmfgen::GenExternalNodeLabel-»
+updatableParent.removeExternalRefresher(boundsRefresher);
+«ENDDEFINE»
+
+«DEFINE activateMore FOR gmfgen::GenLinkLabel-»
+updatableParent.addExternalRefresher(boundsRefresher);
+«ENDDEFINE»
+
+«DEFINE deactivateMore FOR gmfgen::GenLinkLabel-»
+updatableParent.removeExternalRefresher(boundsRefresher);
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/LinkEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::Common»
+
+«DEFINE LinkEditPart FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND supertypes» {
+ «EXPAND xpt::diagram::parts::Common::visualIDConstant-»
+
+ «EXPAND xpt::diagram::parts::Common::ctors-»
+ «EXPAND xpt::diagram::parts::Common::declareViewCode-»
+ «EXPAND xpt::diagram::parts::Common::registerModel-»
+ «EXPAND xpt::diagram::parts::Common::getModelChildren-»
+ «EXPAND xpt::diagram::parts::Common::getModelSourceConnections-»
+ «EXPAND xpt::diagram::parts::Common::getModelTargetConnections-»
+ «EXPAND xpt::diagram::parts::LinkNotationModelRefresher::all-»
+ «EXPAND connectionAnchors-»
+ «EXPAND xpt::diagram::parts::decorations::decorationManager-»
+ «EXPAND createEditPolicies-»
+
+ «EXPAND xpt::diagram::parts::requests::getPrimaryLabelEditPart-»
+ «EXPAND xpt::diagram::parts::requests::performRequest-»
+ «EXPAND xpt::diagram::parts::requests::getLabelEditPart-»
+
+ «EXPAND xpt::diagram::parts::Common::getAdapter-»
+ «EXPAND xpt::diagram::parts::TreeEditPart::getTreeEditPartAdapter-»
+ «EXPAND xpt::diagram::parts::Common::activate-»
+ «EXPAND xpt::diagram::parts::Common::deactivate-»
+ «EXPAND xpt::diagram::parts::Common::getTransactionalUpdateManager-»
+ «EXPAND xpt::diagram::parts::refresh::refresher-»
+ «EXPAND xpt::diagram::parts::refresh::externalRefreshers-»
+
+ «EXPAND addNotify-»
+ «EXPAND createFigure-»
+
+ «EXPAND xpt::diagram::parts::decorations::createDecorationManager-»
+ «EXPAND primCreateFigure-»
+ «EXPAND xpt::diagram::parts::Common::viewmap FOR viewmap-»
+ «EXPAND xpt::diagram::parts::TreeEditPart::TreeEditPart-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenLink»extends org.eclipse.gef.editparts.AbstractConnectionEditPart implements org.eclipse.gmf.runtime.lite.edit.parts.update.IUpdatableEditPart, org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart, org.eclipse.gmf.runtime.lite.edit.parts.decorations.IDecoratableEditPart, org.eclipse.gef.NodeEditPart«ENDDEFINE»
+
+«DEFINE createEditPolicies FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void createEditPolicies() {
+ installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new «EXPAND xpt::diagram::policies::ComponentEditPolicy::qualifiedClassName»());
+ installEditPolicy(org.eclipse.gef.EditPolicy.CONNECTION_ENDPOINTS_ROLE, «IF labels.size() > 0»new «EXPAND xpt::diagram::policies::ConnectionEndpointEditPolicy::qualifiedClassName»()«ELSE»new org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy()«ENDIF»);
+ installEditPolicy(org.eclipse.gef.EditPolicy.CONNECTION_BENDPOINTS_ROLE, new org.eclipse.gmf.runtime.lite.edit.policies.BendpointEditPolicy());
+«IF getPrimaryLabel() != null-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.lite.edit.policies.DelegatingDirectEditPolicy());
+«ENDIF-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new «EXPAND xpt::diagram::policies::GraphicalNodeEditPolicy::qualifiedClassName»());
+ «EXPAND xpt::diagram::parts::Common::behaviour-»
+ «EXPAND xpt::diagram::parts::LinkNotationModelRefresher::installClause-»
+}
+«ENDDEFINE»
+
+«DEFINE addNotify FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void addNotify() {
+ super.addNotify();
+ getConnectionFigure().setConnectionRouter(«EXPAND instantiateConnectionRouter»);
+}
+«ENDDEFINE»
+
+«DEFINE instantiateConnectionRouter FOR gmfgen::GenLink»new org.eclipse.draw2d.BendpointConnectionRouter()«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.draw2d.Connection result = primCreateFigure();
+ myDecorationManager = createDecorationManager(result);
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE primCreateFigure FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment("Creates figure for this edit part.\n\n" +
+"Body of this method does not depend on settings in generation model\n" +
+"so you may safely remove <i>generated</i> tag and modify it.\n")»
+private org.eclipse.draw2d.Connection primCreateFigure() {
+ «EXPAND primCreateFigure FOR viewmap-»
+}
+«ENDDEFINE»
+
+«DEFINE primCreateFigure FOR gmfgen::Viewmap»«ERROR "Unexpected viewmap type " + this»«ENDDEFINE»
+
+«DEFINE primCreateFigure FOR gmfgen::FigureViewmap-»
+ return new «figureQualifiedClassName == null ? "org.eclipse.draw2d.PolylineConnection" : figureQualifiedClassName»();
+«ENDDEFINE»
+
+«DEFINE primCreateFigure FOR gmfgen::SnippetViewmap-»
+ return «body»;
+«ENDDEFINE»
+
+«DEFINE primCreateFigure FOR gmfgen::InnerClassViewmap-»
+ return new «className»();
+«ENDDEFINE»
+
+«DEFINE connectionAnchors FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection) {
+ return new org.eclipse.gmf.runtime.lite.figures.ConnectionConnectionAnchor(getConnectionFigure());
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.Request request) {
+ return new org.eclipse.gmf.runtime.lite.figures.ConnectionConnectionAnchor(getConnectionFigure());
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection) {
+ return new org.eclipse.gmf.runtime.lite.figures.ConnectionConnectionAnchor(getConnectionFigure());
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.Request request) {
+ return new org.eclipse.gmf.runtime.lite.figures.ConnectionConnectionAnchor(getConnectionFigure());
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/LinkLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::LabelController»
+
+«DEFINE LinkLabelEditPart FOR gmfgen::GenLinkLabel-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND supertypes» {
+ «EXPAND xpt::diagram::parts::Common::visualIDConstant-»
+
+ «EXPAND xpt::diagram::parts::Common::ctors-»
+ «EXPAND xpt::diagram::parts::Common::declareViewCode-»
+ «EXPAND createEditPolicies-»
+ «EXPAND xpt::diagram::parts::refresh::refresher-»
+ «EXPAND xpt::diagram::parts::requests::performRequest-»
+ «EXPAND xpt::diagram::parts::LabelController::directEditManager-»
+ «EXPAND xpt::diagram::parts::LabelController::performDirectEdit-»
+ «EXPAND xpt::diagram::parts::LabelController::labelDisplayer-»
+ «EXPAND xpt::diagram::parts::LabelController::labelText-»
+ «EXPAND xpt::diagram::parts::LabelController::labelIcon-»
+ «EXPAND xpt::diagram::parts::LabelController::labelFigure(this) FOR viewmap-»
+ «EXPAND xpt::diagram::parts::LabelController::getUpdatableParent-»
+ «EXPAND xpt::diagram::parts::Common::activate-»
+ «EXPAND xpt::diagram::parts::Common::deactivate-»
+ «EXPAND getAlignment-»
+
+ «EXPAND xpt::diagram::parts::Common::viewmap FOR viewmap-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenLinkLabel»extends org.eclipse.gmf.runtime.lite.edit.parts.labels.BaseLinkLabelEditPart implements org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelController«ENDDEFINE»
+
+«DEFINE createEditPolicies FOR gmfgen::GenLinkLabel-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void createEditPolicies() {
+ super.createEditPolicies();
+«IF !isReadOnly()-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.lite.edit.policies.LabelDirectEditPolicy());
+«ENDIF-»
+ «EXPAND xpt::diagram::parts::Common::behaviour-»
+}
+«ENDDEFINE»
+
+«DEFINE getAlignment FOR gmfgen::GenLinkLabel-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected int getAlignment() {
+ return org.eclipse.draw2d.ConnectionLocator.«alignment.literal»;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLinkLabel»«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/LinkNotationModelRefresher.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+extension xpt::diagram::LinkFinder;
+
+boolean needsLinkNotationModelRefresher(gmfgen::GenCommonBase gcb) :
+ gcb.primNeedsLinkNotationModelRefresher()
+;
+
+boolean needsLinkNotationModelRefresher(gmfgen::GenDiagram diagram) :
+ true //due to uncontained links
+;
+
+boolean primNeedsLinkNotationModelRefresher(gmfgen::GenCommonBase gcb) :
+ gcb.containedLinks().size() > 0
+;
+
+cached Collection[genmodel::GenFeature] getAffectingFeatures(gmfgen::GenCommonBase gcb) :
+ {}.union(gcb.containedLinks().modelFacet.collect(e| e.getAffectingFeatures()).flatten())
+;
+
+private Collection[genmodel::GenFeature] getAffectingFeatures(gmfgen::LinkModelFacet facet) :
+ {}
+;
+
+private Collection[genmodel::GenFeature] getAffectingFeatures(gmfgen::TypeLinkModelFacet facet) :
+ {facet.childMetaFeature, facet.sourceMetaFeature, facet.targetMetaFeature}.select(e| e != null)
+;
+
+private Collection[genmodel::GenFeature] getAffectingFeatures(gmfgen::FeatureLinkModelFacet facet) :
+ {facet.metaFeature}
+;
+
+Collection[genmodel::GenFeature] getLinkChildFeatures(gmfgen::GenCommonBase gcb) :
+ getLinkChildFeatures(gcb, containedLinks(gcb))
+;
+
+Collection[genmodel::GenFeature] getLinkChildFeatures(gmfgen::GenCommonBase gcb, Collection[gmfgen::GenLink] someOfContainedLinks) :
+ {}.union(someOfContainedLinks.collect(e| e.modelFacet.getLinkChildFeature())).select(e| e != null)
+;
+
+private genmodel::GenFeature getLinkChildFeature(gmfgen::LinkModelFacet facet) :
+ null
+;
+
+private genmodel::GenFeature getLinkChildFeature(gmfgen::TypeLinkModelFacet facet) :
+ facet.childMetaFeature
+;
+
+private genmodel::GenFeature getLinkChildFeature(gmfgen::FeatureLinkModelFacet facet) :
+ facet.metaFeature
+;
+
+Collection[gmfgen::GenNode] getTypeGenLinksForFeature(gmfgen::GenCommonBase gcb, genmodel::GenFeature genFeature, Collection[gmfgen::GenLink] containedLinks) :
+JAVA org.eclipse.gmf.internal.codegen.lite.utils.SemanticSyncUtils.getTypeGenLinks(org.eclipse.gmf.codegen.gmfgen.GenCommonBase, org.eclipse.emf.codegen.ecore.genmodel.GenFeature, java.util.Collection)
+;
+
+Collection[gmfgen::GenNode] getFeatureGenLinksForFeature(gmfgen::GenCommonBase gcb, genmodel::GenFeature genFeature, Collection[gmfgen::GenLink] containedLinks) :
+JAVA org.eclipse.gmf.internal.codegen.lite.utils.SemanticSyncUtils.getFeatureGenLinks(org.eclipse.gmf.codegen.gmfgen.GenCommonBase, org.eclipse.emf.codegen.ecore.genmodel.GenFeature, java.util.Collection)
+;
+
+cached Collection[gmfgen::GenCommonBase] getLinkContainersWithAncestors(gmfgen::GenDiagram diagram) :
+ buildAncestorClosure((Collection[gmfgen::GenCommonBase]) diagram.links.collect(e| e.getPossibleContainers()).flatten())
+;
+
+private Collection[gmfgen::GenCommonBase] buildAncestorClosure(Collection[gmfgen::GenCommonBase] elements) :
+JAVA org.eclipse.gmf.internal.codegen.lite.utils.SemanticSyncUtils.buildAncestorClosure(java.util.Collection)
+;
+
+Collection[gmfgen::GenCommonBase] getContainedContainers(gmfgen::GenCommonBase gcb) :
+ {}
+;
+
+Collection[gmfgen::GenCommonBase] getContainedContainers(gmfgen::GenContainerBase gcb) :
+ gcb.containedNodes
+;
+
+Collection[gmfgen::GenCommonBase] getContainedContainers(gmfgen::GenNode node) :
+ {}.addAll(node.containedNodes).addAll(node.compartments).addAll(node.containedLinks())
+;
+
+Collection[gmfgen::GenCommonBase] getContainedContainers(gmfgen::GenLink link) :
+ link.containedLinks()
+;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/LinkNotationModelRefresher.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,309 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::LinkFinder»
+«EXTENSION xpt::diagram::parts::LinkNotationModelRefresher»
+
+«DEFINE installClause FOR gmfgen::GenCommonBase-»
+«IF needsLinkNotationModelRefresher()-»
+installLinkNotationModelRefresher();
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE uninstallClause FOR gmfgen::GenCommonBase-»
+«IF needsLinkNotationModelRefresher()-»
+uninstallLinkNotationModelRefresher();
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE all FOR gmfgen::GenCommonBase-»
+«IF needsLinkNotationModelRefresher()-»
+«EXPAND install-»
+«EXPAND uninstall-»
+«EXPAND getLinkNotationModelRefresher-»
+«EXPAND viewService-»
+«EXPAND refresh-»
+«EXPAND LinkNotationModelRefresher-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenCommonBase»LinkNotationModelRefresher«ENDDEFINE»
+
+«DEFINE install FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void installLinkNotationModelRefresher() {
+ «EXPAND className» refresher = getLinkNotationModelRefresher();
+ if (!getTransactionalUpdateManager().isNotationModelRefresherInstalled(refresher)) {
+ getTransactionalUpdateManager().addNotationModelRefresher(refresher);
+ try {
+ refreshLinkNotationModel();
+ } catch (java.lang.IllegalStateException readOnlyContext) {
+ //Most likely, this means that the host element was created in a precommit notification of a transaction.
+ //While it is impossible to execute this command here, it will be executed as a trigger command.
+ //See org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager for details.
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE uninstall FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void uninstallLinkNotationModelRefresher() {
+ «EXPAND className» refresher = getLinkNotationModelRefresher();
+ getTransactionalUpdateManager().removeNotationModelRefresher(refresher);
+}
+«ENDDEFINE»
+
+«DEFINE getLinkNotationModelRefresher FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «EXPAND className» linkNotationModelRefresher;
+
+«EXPAND xpt::Common::generatedMemberComment»
+private «EXPAND className» getLinkNotationModelRefresher() {
+ if (linkNotationModelRefresher == null) {
+ linkNotationModelRefresher = new «EXPAND className»(getViewService());
+ }
+ return linkNotationModelRefresher;
+}
+«ENDDEFINE»
+
+«DEFINE viewService FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment("Service to find a notational element that corresponds to the given underlying domain element.")»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService;
+
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService getViewService() {
+ if (viewService == null) {
+ viewService = new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.EditPartRegistryBasedViewService(getViewer());
+ }
+ return viewService;
+}
+«ENDDEFINE»
+
+«DEFINE refresh FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshLinkNotationModel() {
+ «EXPAND className» linkRefresher = getLinkNotationModelRefresher();
+ org.eclipse.emf.common.command.Command command = linkRefresher.buildRefreshNotationModelCommand();
+ if (command == null) {
+ return;
+ }
+ org.eclipse.emf.transaction.TransactionalEditingDomain domainModelEditDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND xpt::diagram::parts::Common::getDiagramElementCode»);
+ getViewer().getEditDomain().getCommandStack().execute(new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(domainModelEditDomain, command));
+}
+«ENDDEFINE»
+
+«DEFINE LinkNotationModelRefresher FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedClassComment»
+private class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND ctors-»
+ «EXPAND getConstrainedChildrenFilter-»
+ «EXPAND createUncontainedLinksFilter-»
+ «EXPAND createFilter-»
+ «EXPAND getSemanticLinks-»
+ «EXPAND getNotationalLinks-»
+ «EXPAND getCreateNotationalElementCommand-»
+ «EXPAND shouldCreateView-»
+ «EXPAND getHost-»
+ «EXPAND additions-»
+ }
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenCommonBase»extends org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.OwnedLinksNotationModelRefresher«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND className»(org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService) {
+ super(viewService);
+}
+«ENDDEFINE»
+
+«DEFINE getConstrainedChildrenFilter FOR gmfgen::GenCommonBase-»
+«IF containedLinksWithSelector().size() > 0-»
+«EXPAND xpt::Common::generatedMemberComment("TODO: Child links of this element are selected based on constraint declared in " + getDiagram().getVisualIDRegistryQualifiedClassName() + ". \n" +
+ "Since no assumptions may be made concerning the runtime behavior of the constraint, <b>any</b> non-touch notification may result in \n" +
+ "notational model having to be updated.\n" +
+ "<p/>User is encouraged to change implementation of this method to provide an optimization if it is safe to assume that not all notifications\n" +
+ "result in such an update.")»
+private org.eclipse.emf.transaction.NotificationFilter getConstrainedChildLinksFilter() {
+ return org.eclipse.emf.transaction.NotificationFilter.NOT_TOUCH;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createUncontainedLinksFilter FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
+
+«DEFINE createUncontainedLinksFilter FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment("Creates a notification filter which filters notifications that may possibly result in uncontained links. ")»
+private org.eclipse.emf.transaction.NotificationFilter createUncontainedLinksFilter() {
+ return org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.SET).or(
+ org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.UNSET).or(
+ org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.REMOVE).or(
+ org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.REMOVE_MANY)
+ )));
+}
+«ENDDEFINE»
+
+«DEFINE createFilter FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment("Creates a notification filter which filters notifications that may possibly affect the notational model")»
+protected org.eclipse.emf.transaction.NotificationFilter createFilter() {
+«LET getAffectingFeatures() AS affectingFeatures-»
+«FOREACH affectingFeatures AS nextFeature ITERATOR it-»
+ «IF it.isFirstIteration()»org.eclipse.emf.transaction.NotificationFilter filter = «EXPAND createFeatureFilter FOR nextFeature»;«ELSE-»
+ filter = filter.or(«EXPAND createFeatureFilter FOR nextFeature»);«ENDIF-»
+«ENDFOREACH-»
+«IF containedLinksWithSelector().size() > 0-»
+ «IF affectingFeatures.size() > 0-»
+ filter = getConstrainedChildLinksFilter().or(filter);
+ «ELSE-»
+ org.eclipse.emf.transaction.NotificationFilter filter = getConstrainedChildLinksFilter();
+ «ENDIF-»
+«ENDIF-»
+«IF {this}.typeSelect(gmfgen::GenDiagram).size() > 0-»
+ «IF affectingFeatures.size() + containedLinksWithSelector().size() > 0-»
+ filter = filter.or(createUncontainedLinksFilter());
+ «ELSE-»
+ org.eclipse.emf.transaction.NotificationFilter filter = createUncontainedLinksFilter();
+ «ENDIF-»
+«ELSE-»
+ «REM»Make sure filter var is declared«ENDREM-»
+ «IF affectingFeatures.size() + containedLinksWithSelector().size() == 0-»
+ org.eclipse.emf.transaction.NotificationFilter filter = org.eclipse.emf.transaction.NotificationFilter.NOT_TOUCH;
+ «ENDIF-»
+«ENDIF-»
+«ENDLET-»
+ return filter;
+}
+«ENDDEFINE»
+
+«DEFINE createFeatureFilter FOR genmodel::GenFeature»org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(«EXPAND MetaModel::MetaFeature»)«ENDDEFINE»
+
+«DEFINE getSemanticLinks FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getSemanticChildLinks() {
+«EXPAND xpt::diagram::parts::semanticChildLinks::semanticChildLinks("getHost()")-»
+}
+«ENDDEFINE»
+
+«DEFINE getNotationalLinks FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getNotationalChildLinks() {
+ java.util.List result = new java.util.LinkedList();
+ java.util.List allLinks = «EXPAND xpt::diagram::parts::Common::getDiagramCode».getEdges();
+ for(java.util.Iterator it = allLinks.iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.notation.Edge next = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+ «EXPAND uncontainedLinks-»
+ «EXPAND containedFeatureModelLinks-»
+ «EXPAND containedTypeModelLinks-»
+ }
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE uncontainedLinks FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE uncontainedLinks FOR gmfgen::GenDiagram-»
+if (next.isSetElement() && next.getElement() != null && next.getElement().eResource() == null) {
+ result.add(next);
+ continue;
+}
+org.eclipse.gmf.runtime.notation.View source = next.getSource();
+if (source == null || (source.isSetElement() && source.getElement() != null && source.getElement().eResource() == null)) {
+ result.add(next);
+ continue;
+}
+org.eclipse.gmf.runtime.notation.View target = next.getTarget();
+if (target == null || (target.isSetElement() && target.getElement() != null && target.getElement().eResource() == null)) {
+ result.add(next);
+ continue;
+}
+«ENDDEFINE»
+
+«DEFINE containedFeatureModelLinks FOR gmfgen::GenCommonBase-»
+«IF containedFeatureModelFacetLinks().size() > 0-»
+if (next.isSetElement() && next.getElement() == null) {
+ if (next.getSource() == getHost()) {
+ int linkVID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(next);
+ switch (linkVID) {
+ «EXPAND caseVisualId FOREACH containedFeatureModelFacetLinks()-»
+ result.add(next);
+ break;
+ }
+ }
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE containedTypeModelLinks FOR gmfgen::GenCommonBase-»
+«IF containedTypeModelFacetLinks().size() > 0-»
+if (next.isSetElement() && next.getElement() != null) {
+ if (next.getElement().eContainer() == «EXPAND xpt::diagram::parts::Common::getViewCode».getElement()) {
+ int linkVID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(next);
+ switch (linkVID) {
+ «EXPAND caseVisualId FOREACH containedTypeModelFacetLinks()-»
+ result.add(next);
+ break;
+ }
+ }
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE caseVisualId FOR gmfgen::GenLink-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+«ENDDEFINE»
+
+«DEFINE getCreateNotationalElementCommand FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand getCreateNotationalElementCommand(org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor descriptor) {
+«IF primNeedsLinkNotationModelRefresher()-»
+ org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.LinkDescriptor linkDescriptor = (org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.LinkDescriptor) descriptor;
+ «EXPAND xpt::commands::createNotationalElementCommand::defineDecorator-»
+ «IF getDiagram().shortcutsProvidedFor.size() > 0-»
+ String diagramModelID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(getHost().getDiagram());
+ if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(diagramModelID)) {
+ return new «EXPAND xpt::commands::CreateShortcutEdgeCommand::qualifiedClassName FOR getDiagram()»(getHost().getDiagram(), linkDescriptor.getElement(), sourceView, targetView, decorator);
+ }
+ «ENDIF-»
+ «EXPAND xpt::commands::createNotationalElementCommand::instantiateNotationalEdgeCommand("getHost().getDiagram()")-»
+«ELSE-»
+ return null;
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE shouldCreateView FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment("Returns whether a notational edge should be created for the given domain element. \n" +
+ "The generated code respects canonical style. If the canonycal style is not present, " + (getDiagram().synchronized ? "true" : "false") + " is always returned. \n" +
+ "User can change implementation of this method to handle a more sophisticated logic.")»
+protected boolean shouldCreateView(org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor descriptor) {
+ org.eclipse.gmf.runtime.notation.CanonicalStyle style = (org.eclipse.gmf.runtime.notation.CanonicalStyle) «EXPAND xpt::diagram::parts::Common::getViewCode».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getCanonicalStyle());
+ if (style == null) {
+ return «getDiagram().synchronized»;
+ }
+ return style.isCanonical();
+}
+«ENDDEFINE»
+
+«DEFINE getHost FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.notation.View getHost() {
+ return «EXPAND xpt::diagram::parts::Common::getViewCode»;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCommonBase»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/NodeEditPart.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+List[gmfgen::GenLabel] getInnerFixedLabels(gmfgen::GenNode node) :
+ node.labels.without(node.labels.typeSelect(gmfgen::GenExternalNodeLabel)).
+ select(e | { ((gmfgen::GenLabel) e).viewmap }.typeSelect(gmfgen::ParentAssignedViewmap).size() > 0)
+;
+
+List[gmfgen::GenCompartment] getPinnedCompartments(gmfgen::GenNode node) :
+ node.compartments.select(e | { e.viewmap }.typeSelect(gmfgen::ParentAssignedViewmap).size() > 0)
+;
+
+String primaryShapeQualifiedClassName(gmfgen::Viewmap viewmap) :
+ null
+;
+
+String primaryShapeQualifiedClassName(gmfgen::FigureViewmap viewmap) :
+ viewmap.figureQualifiedClassName == null ? "org.eclipse.draw2d.RectangleFigure" : viewmap.figureQualifiedClassName
+;
+
+String primaryShapeQualifiedClassName(gmfgen::InnerClassViewmap viewmap) :
+ viewmap.className
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/NodeEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,541 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::Common»
+«EXTENSION xpt::diagram::parts::NodeEditPart»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+«EXTENSION xpt::diagram::Helper»
+
+«DEFINE NodeEditPart FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND supertypes» {
+ «EXPAND xpt::diagram::parts::Common::visualIDConstant-»
+ «EXPAND primaryShapeAttribute-»
+ «EXPAND xpt::diagram::parts::Common::ctors-»
+ «EXPAND xpt::diagram::parts::Common::registerModel-»
+ «EXPAND createEditPolicies-»
+ «EXPAND getPrimaryDragEditPolicy-»
+ «EXPAND getDragTracker-»
+
+ «EXPAND createFigure-»
+
+ «EXPAND createDecorationPane-»
+ «EXPAND xpt::diagram::parts::decorations::decorationManager-»
+ «EXPAND xpt::diagram::parts::decorations::createDecorationManager-»
+«IF compartments.size() > 0 && hasDirectChildren()-»
+ «EXPAND childNodesPane-»
+ «EXPAND setupChildNodesPane-»
+«ENDIF-»
+ «EXPAND createNodeShape-»
+ «EXPAND getPrimaryShape FOR primaryShapeQualifiedClassName(viewmap)-»
+ «EXPAND setupContentPane-»
+ «EXPAND xpt::diagram::parts::Common::contentPane-»
+
+ «EXPAND xpt::diagram::parts::Common::declareViewCode-»
+«IF getInnerFixedLabels().size() > 0 || getPinnedCompartments().size() > 0 || getSideAffixedChildren().size() > 0-»
+ «EXPAND addFixedChild-»
+ «EXPAND removeFixedChild-»
+«ENDIF-»
+
+ «EXPAND xpt::diagram::parts::requests::getPrimaryLabelEditPart-»
+ «EXPAND xpt::diagram::parts::requests::performRequest-»
+ «EXPAND xpt::diagram::parts::requests::getLabelEditPart-»
+«IF getExternalLabels().size() > 0-»
+ «EXPAND isExternalLabel-»
+«ENDIF-»
+«IF getExternalLabels().size() > 0 || getSideAffixedChildren().size() > 0-»
+ «EXPAND getExternalLabelsContainer-»
+«ENDIF-»
+
+«IF (compartments.size() > 0 || getSideAffixedChildren().size() > 0) && hasDirectChildren()-»
+ «EXPAND isDirectChild-»
+«ENDIF-»
+
+«IF getSideAffixedChildren().size() > 0-»
+ «EXPAND isSideAffixedChild-»
+«ENDIF-»
+
+«IF getExternalLabels().size() > 0 || (compartments.size() > 0 && hasDirectChildren()) || getPinnedCompartments().size() > 0 || getInnerFixedLabels().size() > 0 || getSideAffixedChildren().size() > 0-»
+ «EXPAND addChildVisual-»
+ «EXPAND removeChildVisual-»
+«ENDIF-»
+«IF getExternalLabels().size() > 0 || getSideAffixedChildren().size() > 0-»
+ «EXPAND removeNotify-»
+«ENDIF-»
+
+ «EXPAND xpt::diagram::parts::Common::getModelChildren-»
+ «EXPAND xpt::diagram::parts::Common::getModelSourceConnections-»
+ «EXPAND xpt::diagram::parts::Common::getModelTargetConnections-»
+ «EXPAND connectionAnchors-»
+ «EXPAND xpt::diagram::parts::Common::getAdapter-»
+
+ «EXPAND xpt::diagram::parts::TreeEditPart::getTreeEditPartAdapter-»
+ «EXPAND xpt::diagram::parts::Common::externalChildPositionTracker-»
+
+ «EXPAND xpt::diagram::parts::Common::activate-»
+ «EXPAND xpt::diagram::parts::Common::deactivate-»
+ «EXPAND xpt::diagram::parts::NotationModelRefresher::all-»
+ «EXPAND xpt::diagram::parts::LinkNotationModelRefresher::all-»
+ «EXPAND xpt::diagram::parts::Common::getTransactionalUpdateManager-»
+ «EXPAND xpt::diagram::parts::refresh::refresher-»
+ «EXPAND xpt::diagram::parts::refresh::externalRefreshers-»
+
+ «EXPAND xpt::diagram::parts::Common::viewmap FOR viewmap-»
+ «EXPAND xpt::diagram::parts::TreeEditPart::TreeEditPart-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenNode»extends org.eclipse.gef.editparts.AbstractGraphicalEditPart implements org.eclipse.gef.NodeEditPart, org.eclipse.gmf.runtime.lite.edit.parts.update.IUpdatableEditPart, org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart, org.eclipse.gmf.runtime.lite.edit.parts.decorations.IDecoratableEditPart«ENDDEFINE»
+
+«DEFINE primaryShapeAttribute FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure primaryShape;
+«ENDDEFINE»
+
+«DEFINE createEditPolicies FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void createEditPolicies() {
+ installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new «EXPAND xpt::diagram::policies::ComponentEditPolicy::qualifiedClassName»());
+ installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new «getGraphicalNodeEditPolicyQualifiedClassName()»());
+«IF getPrimaryLabel() != null-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.lite.edit.policies.DelegatingDirectEditPolicy());
+«ENDIF-»
+«IF getDirectChildren().size() > 0-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new «EXPAND xpt::diagram::policies::LayoutEditPolicy::qualifiedClassName»());
+«ENDIF-»
+«IF getSideAffixedChildren().size() > 0-»
+ installEditPolicy(org.eclipse.gmf.runtime.lite.edit.policies.EditPolicyRoles.SIDE_AFFIXED_LAYOUT_ROLE, new «EXPAND xpt::diagram::policies::LayoutEditPolicy::SideAffixedQualifiedClassName»());
+«ENDIF-»
+ «EXPAND xpt::diagram::parts::Common::behaviour-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
+ «EXPAND installRefreshers-»
+ }
+«ENDDEFINE»
+
+«DEFINE installRefreshers FOR gmfgen::GenNode-»
+«EXPAND xpt::diagram::parts::NotationModelRefresher::installClause-»
+«EXPAND xpt::diagram::parts::LinkNotationModelRefresher::installClause-»
+«ENDDEFINE»
+
+«DEFINE getPrimaryDragEditPolicy FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.EditPolicy getPrimaryDragEditPolicy() {
+«IF primaryDragEditPolicyQualifiedClassName != null-»
+ return new «primaryDragEditPolicyQualifiedClassName»();
+«ELSE-»
+ «EXPAND returnPrimaryDragEditPolicy-»
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE returnPrimaryDragEditPolicy FOR gmfgen::GenNode-»
+org.eclipse.gef.editpolicies.ResizableEditPolicy result = new org.eclipse.gef.editpolicies.ResizableEditPolicy()«EXPAND contributeSelectionHandles»;
+«EXPAND setResizeConstraints FOR viewmap.getResizeConstraints()-»
+return result;
+«ENDDEFINE»
+
+«DEFINE returnPrimaryDragEditPolicy FOR gmfgen::GenChildSideAffixedNode-»
+return new org.eclipse.gmf.runtime.lite.edit.policies.SideAffixedDragEditPolicy()«EXPAND contributeSelectionHandles»;
+«ENDDEFINE»
+
+«DEFINE contributeSelectionHandles FOR gmfgen::GenNode-»
+«IF compartments.size() + getExternalLabels().size() > 0-»
+{
+ protected java.util.List createSelectionHandles() {
+ java.util.List result = super.createSelectionHandles();
+ for(java.util.Iterator it = getChildren().iterator(); it.hasNext(); ) {
+ org.eclipse.gef.EditPart next = (org.eclipse.gef.EditPart) it.next();
+ org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) next.getModel();
+ switch («getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(nextView)) {
+ «EXPAND addSelectionHandles FOREACH compartments-»
+ «EXPAND addSelectionHandles FOREACH getExternalLabels()-»
+ }
+ }
+ return result;
+ }
+}«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getDragTracker FOR gmfgen::GenNode»«ENDDEFINE»
+
+«DEFINE getDragTracker FOR gmfgen::GenChildSideAffixedNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request) {
+ return new org.eclipse.gef.tools.DragEditPartsTracker(this) {
+ protected boolean isMove() {
+ return true;
+ }
+ };
+}
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.draw2d.IFigure invisibleRectangle = new org.eclipse.draw2d.Figure();
+ invisibleRectangle.setLayoutManager(new org.eclipse.draw2d.StackLayout());
+ org.eclipse.draw2d.IFigure shape = createNodeShape();
+ invisibleRectangle.add(shape);
+ contentPane = setupContentPane(shape);
+«IF compartments.size() > 0 && hasDirectChildren()-»
+ childNodesPane = createChildNodesPane();
+ shape.add(childNodesPane);
+«ENDIF-»
+ org.eclipse.draw2d.IFigure decorationShape = createDecorationPane();
+ if (decorationShape != null) {
+ myDecorationManager = createDecorationManager(decorationShape);
+ invisibleRectangle.add(decorationShape);
+ }
+ return invisibleRectangle;
+}
+«ENDDEFINE»
+
+«DEFINE addSelectionHandles FOR gmfgen::GenCommonBase-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ result.addAll(((«getEditPartQualifiedClassName()») next).createSelectionHandles());
+ break;
+«ENDDEFINE»
+
+«DEFINE setResizeConstraints FOR gmfgen::ResizeConstraints-»
+«IF resizeHandles == 0-»
+ result.setResizeDirections(org.eclipse.draw2d.PositionConstants.NONE);
+«ELSE-»
+ result.setResizeDirections(«EXPAND resizeHandleName FOREACH resizeHandleNames SEPARATOR ' | '»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE resizeHandleName FOR ecore::EString»org.eclipse.draw2d.PositionConstants.«this»«ENDDEFINE»
+
+«DEFINE childNodesPane FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure childNodesPane;
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure createChildNodesPane() {
+ org.eclipse.draw2d.IFigure result = new org.eclipse.draw2d.RectangleFigure()«IF isXYLayout()»«EXPAND forceUseLocalCoordinates»«ENDIF»;
+ setupChildNodesPane(result);
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE createNodeShape FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure createNodeShape() {
+ «EXPAND initPrimaryShape(this) FOR viewmap-»
+ return primaryShape;
+}
+«ENDDEFINE»
+
+«DEFINE initPrimaryShape(gmfgen::GenNode node) FOR gmfgen::Viewmap»«ERROR "Unexpected viewmap type " + this»«ENDDEFINE»
+
+«DEFINE initPrimaryShape(gmfgen::GenNode node) FOR gmfgen::FigureViewmap-»
+primaryShape = new «primaryShapeQualifiedClassName(this)»()«IF node.compartments.size() == 0 && node.hasDirectChildren() && node.isXYLayout()»«EXPAND forceUseLocalCoordinates»«ENDIF»;
+«ENDDEFINE»
+
+«DEFINE initPrimaryShape(gmfgen::GenNode node) FOR gmfgen::SnippetViewmap-»
+primaryShape = «body»;
+«ENDDEFINE»
+
+«DEFINE initPrimaryShape(gmfgen::GenNode node) FOR gmfgen::InnerClassViewmap-»
+«primaryShapeQualifiedClassName(this)» figure = new «primaryShapeQualifiedClassName(this)»();
+«IF node.compartments.size() == 0 && node.hasDirectChildren() && node.isXYLayout()-»
+figure.setUseLocalCoordinates(true);
+«ENDIF-»
+primaryShape = figure;
+«ENDDEFINE»
+
+«DEFINE forceUseLocalCoordinates FOR Object-»
+{
+ protected boolean useLocalCoordinates() {
+ return true;
+ }
+}«-»
+«ENDDEFINE»
+
+«DEFINE getPrimaryShape FOR ecore::EString-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «this» getPrimaryShape() {
+ return («this») primaryShape;
+}
+«ENDDEFINE»
+
+«DEFINE setupContentPane FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment("Default implementation treats passed figure as content pane.\n" +
+ "Respects layout one may have set for generated figure.\n" +
+ "@param nodeShape instance of generated figure class")»
+protected org.eclipse.draw2d.IFigure setupContentPane(org.eclipse.draw2d.IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ «EXPAND setLayoutManager("nodeShape", compartments.size() == 0 && isXYLayout())-»
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+}
+«ENDDEFINE»
+
+«DEFINE setupChildNodesPane FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void setupChildNodesPane(org.eclipse.draw2d.IFigure shape) {
+ if (shape.getLayoutManager() == null) {
+ «EXPAND setLayoutManager("shape", isXYLayout())-»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE setLayoutManager(String shapeVar, Boolean xyLayout) FOR gmfgen::GenNode-»
+«IF xyLayout-»
+«shapeVar».setLayoutManager(new org.eclipse.draw2d.FreeformLayout() {
+ public Object getConstraint(org.eclipse.draw2d.IFigure figure) {
+ Object result = constraints.get(figure);
+ if (result == null) {
+ result = new org.eclipse.draw2d.geometry.Rectangle(0, 0, -1, -1);
+ }
+ return result;
+ }
+});
+«ELSE-»
+org.eclipse.draw2d.ToolbarLayout layout = new org.eclipse.draw2d.ToolbarLayout();
+layout.setSpacing(5);
+«shapeVar».setLayoutManager(layout);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createDecorationPane FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.draw2d.IFigure createDecorationPane() {
+ return new org.eclipse.draw2d.Layer();
+}
+«ENDDEFINE»
+
+«DEFINE addFixedChild FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
+«EXPAND addFixedLabel FOREACH getInnerFixedLabels()-»
+«EXPAND addFixedCompartment FOREACH getPinnedCompartments()-»
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE addFixedLabel FOR gmfgen::GenLabel-»
+if (childEditPart instanceof «getEditPartQualifiedClassName()») {
+ ((«getEditPartQualifiedClassName()») childEditPart).«EXPAND setter FOR viewmap»(getPrimaryShape().«EXPAND getter FOR viewmap»());
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE getter FOR gmfgen::Viewmap»«ERROR "Unexpected type"»«ENDDEFINE»
+«DEFINE getter FOR gmfgen::ParentAssignedViewmap»«getterName»«ENDDEFINE»
+
+«DEFINE setter FOR gmfgen::Viewmap»«ERROR "Unexpected type"»«ENDDEFINE»
+«DEFINE setter FOR gmfgen::ParentAssignedViewmap»«IF setterName == null»setLabel«ELSE»«setterName»«ENDIF»«ENDDEFINE»
+
+«DEFINE addFixedCompartment FOR gmfgen::GenCompartment-»
+if (childEditPart instanceof «getEditPartQualifiedClassName()») {
+ org.eclipse.draw2d.IFigure pane = getPrimaryShape().«EXPAND getter FOR viewmap»();
+ ((«getEditPartQualifiedClassName()») childEditPart).setupCompartmentHolder(pane);
+ pane.add(((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure());
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE removeFixedChild FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
+«REM»ignore labels assuming that they never may be removed«ENDREM»
+«EXPAND removeFixedCompartment FOREACH getPinnedCompartments()-»
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE removeFixedCompartment FOR gmfgen::GenCompartment-»
+if (childEditPart instanceof «getEditPartQualifiedClassName()») {
+ org.eclipse.draw2d.IFigure pane = getPrimaryShape().«EXPAND getter FOR viewmap»();
+ pane.remove(((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure());
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE isExternalLabel FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean isExternalLabel(org.eclipse.gef.EditPart childEditPart) {
+«EXPAND returnInstanceof("childEditPart") FOREACH getExternalLabels()-»
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE isDirectChild FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean isDirectChild(org.eclipse.gef.EditPart childEditPart) {
+«EXPAND returnInstanceof("childEditPart") FOREACH getDirectChildren()-»
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE isSideAffixedChild FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean isSideAffixedChild(org.eclipse.gef.EditPart childEditPart) {
+ «EXPAND returnInstanceof("childEditPart") FOREACH getSideAffixedChildren()-»
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE returnInstanceof(String var) FOR gmfgen::GenCommonBase-»
+if («var» instanceof «getEditPartQualifiedClassName()») {
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE addChildVisual FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
+«IF getExternalLabels().size() > 0-»
+ if (isExternalLabel(childEditPart)) {
+ org.eclipse.draw2d.IFigure childFigure = ((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure();
+ getExternalLabelsContainer().add(childFigure);
+ «EXPAND addPositionTracker-»
+ return;
+ }
+«ENDIF-»
+«IF getSideAffixedChildren().size() > 0-»
+ if (isSideAffixedChild(childEditPart)) {
+ org.eclipse.draw2d.IFigure childFigure = ((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure();
+ getExternalLabelsContainer().add(childFigure);
+ «EXPAND addPositionTracker-»
+ return;
+ }
+«ENDIF-»
+«IF getInnerFixedLabels().size() > 0 || getPinnedCompartments().size() > 0-»
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+«ENDIF-»
+«IF compartments.size() > 0 && hasDirectChildren()-»
+ if (isDirectChild(childEditPart)) {
+ org.eclipse.draw2d.IFigure childFigure = ((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure();
+ childNodesPane.add(childFigure);
+ return;
+ }
+«ENDIF-»
+ super.addChildVisual(childEditPart, -1);
+}
+«ENDDEFINE»
+
+«DEFINE removeChildVisual FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) {
+«IF getExternalLabels().size() > 0-»
+ if (isExternalLabel(childEditPart)) {
+ org.eclipse.draw2d.IFigure childFigure = ((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure();
+ «EXPAND removePositionTracker-»
+ getExternalLabelsContainer().remove(childFigure);
+ return;
+ }
+«ENDIF-»
+«IF getSideAffixedChildren().size() > 0-»
+ if (isSideAffixedChild(childEditPart)) {
+ org.eclipse.draw2d.IFigure childFigure = ((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure();
+ «EXPAND removePositionTracker-»
+ getExternalLabelsContainer().remove(childFigure);
+ return;
+ }
+«ENDIF-»
+«IF getInnerFixedLabels().size() > 0 || getPinnedCompartments().size() > 0-»
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+«ENDIF-»
+«IF compartments.size() > 0 && hasDirectChildren()-»
+ if (isDirectChild(childEditPart)) {
+ org.eclipse.draw2d.IFigure childFigure = ((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure();
+ childNodesPane.remove(childFigure);
+ return;
+ }
+«ENDIF-»
+ super.removeChildVisual(childEditPart);
+}
+«ENDDEFINE»
+
+«DEFINE addPositionTracker FOR gmfgen::GenNode-»
+org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker positionTracker = (org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker) childEditPart.getAdapter(org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker.class);
+if (positionTracker != null) {
+ getFigure().addAncestorListener(positionTracker);
+}
+«ENDDEFINE»
+
+«DEFINE removePositionTracker FOR gmfgen::GenNode-»
+org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker positionTracker = (org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker) childEditPart.getAdapter(org.eclipse.gmf.runtime.lite.figures.ExternalChildPositionTracker.class);
+if (positionTracker != null) {
+ getFigure().removeAncestorListener(positionTracker);
+}
+«ENDDEFINE»
+
+«DEFINE getExternalLabelsContainer FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure getExternalLabelsContainer() {
+ org.eclipse.gef.editparts.LayerManager root = (org.eclipse.gef.editparts.LayerManager) getRoot();
+ return root.getLayer(«getDiagram().getEditPartFactoryQualifiedClassName()».EXTERNAL_NODE_LABELS_LAYER);
+}
+«ENDDEFINE»
+
+«DEFINE removeNotify FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void removeNotify() {
+ for (java.util.Iterator it = getChildren().iterator(); it.hasNext(); ) {
+ org.eclipse.gef.EditPart childEditPart = (org.eclipse.gef.EditPart) it.next();
+«IF getExternalLabels().size() > 0-»
+ if (isExternalLabel(childEditPart)) {
+ «EXPAND removePositionTracker-»
+ org.eclipse.draw2d.IFigure childFigure = ((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure();
+ getExternalLabelsContainer().remove(childFigure);
+ }
+«ENDIF-»
+«IF getSideAffixedChildren().size() > 0-»
+ if (isSideAffixedChild(childEditPart)) {
+ «EXPAND removePositionTracker-»
+ org.eclipse.draw2d.IFigure childFigure = ((org.eclipse.gef.GraphicalEditPart) childEditPart).getFigure();
+ getExternalLabelsContainer().remove(childFigure);
+ }
+«ENDIF-»
+ }
+ super.removeNotify();
+}
+«ENDDEFINE»
+
+«DEFINE connectionAnchors FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection) {
+ return new org.eclipse.draw2d.ChopboxAnchor(getFigure());
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.ConnectionAnchor getSourceConnectionAnchor(org.eclipse.gef.Request request) {
+ return new org.eclipse.draw2d.ChopboxAnchor(getFigure());
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.ConnectionEditPart connection) {
+ return new org.eclipse.draw2d.ChopboxAnchor(getFigure());
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.draw2d.ConnectionAnchor getTargetConnectionAnchor(org.eclipse.gef.Request request) {
+ return new org.eclipse.draw2d.ChopboxAnchor(getFigure());
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/NodeLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::LabelController»
+
+«DEFINE NodeLabelEditPart FOR gmfgen::GenNodeLabel-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND supertypes» {
+ «EXPAND xpt::diagram::parts::Common::visualIDConstant-»
+
+ «EXPAND xpt::diagram::parts::Common::ctors-»
+ «EXPAND xpt::diagram::parts::Common::notSelectable-»
+ «EXPAND xpt::diagram::parts::Common::declareViewCode-»
+ «EXPAND createEditPolicies-»
+ «EXPAND xpt::diagram::parts::refresh::refresher-»
+ «EXPAND xpt::diagram::parts::requests::performRequest-»
+ «EXPAND xpt::diagram::parts::LabelController::directEditManager-»
+ «EXPAND xpt::diagram::parts::LabelController::performDirectEdit-»
+ «EXPAND xpt::diagram::parts::LabelController::labelDisplayer-»
+ «EXPAND xpt::diagram::parts::LabelController::labelText-»
+ «EXPAND xpt::diagram::parts::LabelController::labelIcon-»
+ «EXPAND xpt::diagram::parts::LabelController::labelFigure(this) FOR viewmap-»
+ «EXPAND xpt::diagram::parts::LabelController::getUpdatableParent-»
+ «EXPAND xpt::diagram::parts::Common::activate-»
+ «EXPAND xpt::diagram::parts::Common::deactivate-»
+ «EXPAND xpt::diagram::parts::Common::viewmap FOR viewmap-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenNodeLabel»extends org.eclipse.gef.editparts.AbstractGraphicalEditPart implements org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelController«ENDDEFINE»
+«DEFINE supertypes FOR gmfgen::GenExternalNodeLabel»extends org.eclipse.gmf.runtime.lite.edit.parts.labels.BaseExternalNodeLabelEditPart implements org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelController«ENDDEFINE»
+
+«DEFINE createEditPolicies FOR gmfgen::GenNodeLabel-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void createEditPolicies() {
+«EXPAND createSuperEditPolicies-»
+«IF !isReadOnly()-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.lite.edit.policies.LabelDirectEditPolicy());
+«ENDIF-»
+ «EXPAND xpt::diagram::parts::Common::behaviour-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNodeLabel»«ENDDEFINE»
+
+«DEFINE createSuperEditPolicies FOR gmfgen::GenNodeLabel-»
+«ENDDEFINE»
+
+«DEFINE createSuperEditPolicies FOR gmfgen::GenExternalNodeLabel-»
+super.createEditPolicies();
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/NotationModelRefresher.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+extension xpt::commands::CommandUtils;
+extension xpt::diagram::PhantomUtils;
+extension xpt::GenModelUtils;
+
+boolean needsNotationModelRefresher(gmfgen::GenContainerBase gcb) :
+ gcb.getChildNodesForNotationModelRefresher().size() > 0
+;
+
+boolean needsNotationModelRefresher(gmfgen::GenDiagram diagram) :
+ diagram.getChildNodesForNotationModelRefresher().size() > 0 || diagram.getPhantomNodes().size() > 0
+;
+
+//Phantom features are not included here
+cached Collection[gmfgen::GenNode] getChildNodesForNotationModelRefresher(gmfgen::GenContainerBase gcb) :
+ gcb.getChildNodes().select(e| e.modelFacet != null && e.modelFacet.metaClass != null && !e.modelFacet.isPhantomElement() && e.modelFacet.childMetaFeature != null)
+;
+
+Collection[gmfgen::GenNode] getConstraintsInChildren(gmfgen::GenContainerBase gcb) :
+ gcb.getChildNodes().select(e| e.modelFacet != null && e.modelFacet.metaClass != null && e.modelFacet.modelElementSelector != null)
+;
+
+Collection[genmodel::GenFeature] getChildFeatures(gmfgen::GenContainerBase gcb) :
+ //{}.union() provides uniqueness
+ {}.union(gcb.getChildNodesForNotationModelRefresher().modelFacet.childMetaFeature)
+;
+
+Collection[genmodel::GenFeature] getChildFeaturesForFilter(gmfgen::GenContainerBase gcb) :
+ //{}.union() provides uniqueness
+ {}.union(gcb.getChildNodesForNotationModelRefresher().modelFacet.childMetaFeatureForFilter())
+;
+
+private genmodel::GenFeature childMetaFeatureForFilter(gmfgen::TypeModelFacet modelFacet) :
+ modelFacet.childMetaFeature.ecoreFeature.derived ? modelFacet.containmentMetaFeature : modelFacet.childMetaFeature
+;
+
+Collection[gmfgen::GenNode] getGenNodes(gmfgen::GenContainerBase genContainerBase, genmodel::GenFeature genFeature) :
+JAVA org.eclipse.gmf.internal.codegen.lite.utils.SemanticSyncUtils.getGenNodes(org.eclipse.gmf.codegen.gmfgen.GenContainerBase, org.eclipse.emf.codegen.ecore.genmodel.GenFeature)
+;
+
+cached Collection[gmfgen::GenContainerBase] getAllInitableContainers(gmfgen::GenDiagram diagram) :
+ diagram.getAllContainersWithChildren().union(diagram.getAllNodes().select(e|e.getInitableCompartments().size() > 0))
+;
+
+private Collection[gmfgen::GenContainerBase] getAllContainersWithChildren(gmfgen::GenDiagram diagram) :
+ diagram.getAllContainers().select(e| e.needsNotationModelRefresher())
+;
+
+cached Collection[gmfgen::GenCompartment] getInitableCompartments(gmfgen::GenNode node) :
+ node.compartments.select(e| e.needsNotationModelRefresher())
+;
+
+Collection[gmfgen::GenContainerBase] getInitableGrandChildren(gmfgen::GenContainerBase gcb) :
+ let allInitableContainers = getAllInitableContainers(gcb.getDiagram()) :
+ gcb.getChildNodesForNotationModelRefresher().select(e| allInitableContainers.contains(e))
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/NotationModelRefresher.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::parts::NotationModelRefresher»
+«EXTENSION xpt::commands::CommandUtils»
+«EXTENSION xpt::diagram::PhantomUtils»
+
+«DEFINE installClause FOR gmfgen::GenContainerBase-»
+«IF needsNotationModelRefresher()-»
+installNotationModelRefresher();
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE uninstallClause FOR gmfgen::GenContainerBase-»
+«IF needsNotationModelRefresher()-»
+uninstallNotationModelRefresher();
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE all FOR gmfgen::GenContainerBase-»
+«IF needsNotationModelRefresher()-»
+«EXPAND install-»
+«EXPAND uninstall-»
+«EXPAND getNotationModelRefresher-»
+«EXPAND refresh-»
+«EXPAND NotationModelRefresher-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE install FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void installNotationModelRefresher() {
+ org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ChildNotationModelRefresher refresher = getNotationModelRefresher();
+ if (!getTransactionalUpdateManager().isNotationModelRefresherInstalled(refresher)) {
+ getTransactionalUpdateManager().addNotationModelRefresher(refresher);
+ try {
+ refreshNotationModel();
+ } catch (java.lang.IllegalStateException readOnlyContext) {
+ //Most likely, this means that the host element was created in a precommit notification of a transaction.
+ //While it is impossible to execute this command here, it will be executed as a trigger command.
+ //See org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager for details.
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE uninstall FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void uninstallNotationModelRefresher() {
+ org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ChildNotationModelRefresher refresher = getNotationModelRefresher();
+ getTransactionalUpdateManager().removeNotationModelRefresher(refresher);
+}
+«ENDDEFINE»
+
+«DEFINE getNotationModelRefresher FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ChildNotationModelRefresher notationModelRefresher;
+
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ChildNotationModelRefresher getNotationModelRefresher() {
+ if (notationModelRefresher == null) {
+ notationModelRefresher = new «EXPAND className»();
+ }
+ return notationModelRefresher;
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenContainerBase»NotationModelRefresher«ENDDEFINE»
+
+«DEFINE refresh FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshNotationModel() {
+ org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ChildNotationModelRefresher childRefresher = getNotationModelRefresher();
+ org.eclipse.emf.common.command.Command command = childRefresher.buildRefreshNotationModelCommand();
+ if (command == null) {
+ return;
+ }
+ org.eclipse.emf.transaction.TransactionalEditingDomain domainModelEditDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND xpt::diagram::parts::Common::getDiagramElementCode»);
+ getViewer().getEditDomain().getCommandStack().execute(new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(domainModelEditDomain, command));
+}
+«ENDDEFINE»
+
+«DEFINE NotationModelRefresher FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedClassComment»
+private class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND getConstrainedChildrenFilter-»
+ «EXPAND getPhantomsFilter-»
+ «EXPAND createFilter-»
+ «EXPAND getCreateNotationalElementCommand-»
+ «EXPAND getSemanticChildNodes-»
+ «EXPAND xpt::diagram::parts::semanticChildren::getPhantomNodesIterator-»
+ «EXPAND shouldCreateView-»
+ «EXPAND externalViews-»
+ «EXPAND getHost-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenContainerBase»extends org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ChildNotationModelRefresher«ENDDEFINE»
+
+«DEFINE getConstrainedChildrenFilter FOR gmfgen::GenContainerBase-»
+«IF getConstraintsInChildren().size() > 0-»
+«EXPAND xpt::Common::generatedMemberComment("TODO: Children of this element are selected based on constraint declared in " + getDiagram().getVisualIDRegistryQualifiedClassName() + ". \n" +
+ "Since no assumptions may be made concerning the runtime behavior of the constraint, <b>any</b> non-touch notification may result in \n" +
+ "notational model having to be updated.\n" +
+ "<p/>User is encouraged to change implementation of this method to provide an optimization if it is safe to assume that not all notifications\n" +
+ "result in such an update.")»
+private org.eclipse.emf.transaction.NotificationFilter getConstrainedChildrenFilter() {
+ return org.eclipse.emf.transaction.NotificationFilter.NOT_TOUCH;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getPhantomsFilter FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE getPhantomsFilter FOR gmfgen::GenDiagram-»
+«IF getPhantomNodes().size() > 0-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.transaction.NotificationFilter getPhantomsFilter() {
+«LET getPhantomFeatures() AS phantomFeatures-»
+«FOREACH phantomFeatures AS nextFeature ITERATOR it-»
+«IF it.isFirstIteration()»org.eclipse.emf.transaction.NotificationFilter phantomFeaturesFilter = «EXPAND createFeatureFilter FOR nextFeature»;«ELSE-»
+phantomFeaturesFilter = phantomFeaturesFilter.or(«EXPAND createFeatureFilter FOR nextFeature»);«ENDIF-»
+«ENDFOREACH-»
+ return «IF phantomFeatures.size() > 0»phantomFeaturesFilter.or(«ENDIF»org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(org.eclipse.emf.ecore.resource.Resource.class, org.eclipse.emf.ecore.resource.Resource.RESOURCE__CONTENTS)«IF phantomFeatures.size() > 0»)«ENDIF»;
+«ENDLET-»
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createFilter FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment("Creates a notification filter which filters notifications that may possibly affect the notational model")»
+protected org.eclipse.emf.transaction.NotificationFilter createFilter() {
+«LET getChildFeaturesForFilter() AS genChildFeatures-»
+ «FOREACH genChildFeatures AS nextFeature ITERATOR it-»
+ «IF it.isFirstIteration()»org.eclipse.emf.transaction.NotificationFilter filter = «EXPAND createFeatureFilter FOR nextFeature»;«ELSE-»
+ filter = filter.or(«EXPAND createFeatureFilter FOR nextFeature»);«ENDIF-»
+ «ENDFOREACH-»
+ «IF genChildFeatures.size() > 0»filter = filter.and(«EXPAND createNotifierFilter»);«ELSE-»
+ org.eclipse.emf.transaction.NotificationFilter filter = «EXPAND createNotifierFilter»;«ENDIF-»
+ «EXPAND plugPhantomNotifier-»
+ «IF getConstraintsInChildren().size() > 0-»
+ filter = getConstrainedChildrenFilter().or(filter);
+ «ENDIF-»
+«ENDLET-»
+ return filter;
+}
+«ENDDEFINE»
+
+«DEFINE plugPhantomNotifier FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE plugPhantomNotifier FOR gmfgen::GenDiagram-»
+«IF getPhantomFeatures().size() > 0-»
+filter = filter.or(getPhantomsFilter());
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createFeatureFilter FOR genmodel::GenFeature»org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(«EXPAND MetaModel::MetaFeature»)«ENDDEFINE»
+
+«DEFINE createNotifierFilter FOR gmfgen::GenContainerBase»org.eclipse.emf.transaction.NotificationFilter.createNotifierFilter(«EXPAND xpt::diagram::parts::Common::getViewCode».getElement())«ENDDEFINE»
+
+«DEFINE getCreateNotationalElementCommand FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand getCreateNotationalElementCommand(org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor descriptor) {
+«EXPAND xpt::commands::createNotationalElementCommand::createNotationalNodeCommand("getHost()")-»
+}
+«ENDDEFINE»
+
+«DEFINE getSemanticChildNodes FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getSemanticChildNodes() {
+«EXPAND xpt::diagram::parts::semanticChildren::semanticChildren("getHost()")-»
+}
+«ENDDEFINE»
+
+«DEFINE shouldCreateView FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment("Returns whether a notational element should be created for the given domain element. \n" +
+ "The generated code respects canonical style. If the canonycal style is not present, " + (getDiagram().synchronized ? "true" : "false") + " is always returned. \n" +
+ "User can change implementation of this method to handle a more sophisticated logic.")»
+protected boolean shouldCreateView(org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor descriptor) {
+ org.eclipse.gmf.runtime.notation.CanonicalStyle style = (org.eclipse.gmf.runtime.notation.CanonicalStyle) «EXPAND xpt::diagram::parts::Common::getViewCode».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getCanonicalStyle());
+ if (style == null) {
+ return «getDiagram().synchronized»;
+ }
+ return style.isCanonical();
+}
+«ENDDEFINE»
+
+«DEFINE externalViews FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE externalViews FOR gmfgen::GenDiagram-»
+«IF containsShortcutsTo.size() > 0-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected boolean shouldRemoveView(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
+ if (annotation == null) {
+ return super.shouldRemoveView(view);
+ }
+ String modelID = «EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view);
+ if («getDiagramEditorUtilQualifiedClassName()».isKnownShortcutModelID(modelID)) {
+ return !view.isSetElement() || view.getElement() == null || view.getElement().eIsProxy();
+ }
+ return true;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.common.command.Command getRefreshExternalElementCommand(org.eclipse.gmf.runtime.notation.View view) {
+ //the element is a shortcut that exists, but may have changed: see #shouldRemoveView(org.eclipse.gmf.runtime.notation.View)
+ String modelID = «EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view);
+ org.eclipse.gmf.runtime.lite.shortcuts.IShortcutProvider shortcutProvider = org.eclipse.gmf.runtime.lite.shortcuts.ShortcutProvidersRegistry.INSTANCE.getShortcutProvider(modelID);
+ if (shortcutProvider == null) {
+ return null;
+ }
+ return shortcutProvider.getRefreshShortcutCommand(view);
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getHost FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.notation.View getHost() {
+ return «EXPAND xpt::diagram::parts::Common::getViewCode»;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/TreeEditPart.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+extension xpt::diagram::parts::Common;
+
+boolean needsTreeEditPartAdapter(gmfgen::GenCommonBase gcb) :
+ false
+;
+
+boolean needsTreeEditPartAdapter(gmfgen::GenDiagram gcb) :
+ true
+;
+
+boolean needsTreeEditPartAdapter(gmfgen::GenNode gcb) :
+ true
+;
+
+boolean needsTreeEditPartAdapter(gmfgen::GenLink gcb) :
+ true
+;
+
+boolean needsTreeDirectEditPolicy(gmfgen::GenCommonBase gcb) :
+ false
+;
+
+boolean needsTreeDirectEditPolicy(gmfgen::GenChildLabelNode node) :
+ !node.labelReadOnly
+;
+
+boolean needsTreeDirectEditPolicy(gmfgen::GenNode node) :
+ getPrimaryLabel(node) != null
+;
+
+boolean needsTreeDirectEditPolicy(gmfgen::GenLink link) :
+ getPrimaryLabel(link) != null
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/TreeEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,280 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::policies::ComponentEditPolicy»
+«EXTENSION xpt::diagram::parts::TreeEditPart»
+«EXTENSION xpt::diagram::parts::Common»
+«EXTENSION xpt::diagram::LinkFinder»
+
+«DEFINE getAdapterClause FOR gmfgen::GenCommonBase-»
+«IF needsTreeEditPartAdapter()-»
+if (org.eclipse.gef.TreeEditPart.class == key) {
+ return getTreeEditPartAdapter();
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getTreeEditPartAdapter FOR gmfgen::GenCommonBase-»
+«IF needsTreeEditPartAdapter()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «EXPAND className» myTreeEditPartAdapter;
+
+«EXPAND xpt::Common::generatedMemberComment»
+private «EXPAND className» getTreeEditPartAdapter() {
+ if (myTreeEditPartAdapter == null) {
+ myTreeEditPartAdapter = new «EXPAND className»();
+ }
+ return myTreeEditPartAdapter;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE TreeEditPart FOR gmfgen::GenCommonBase-»
+«IF needsTreeEditPartAdapter()-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class «EXPAND className» extends org.eclipse.gmf.runtime.lite.edit.parts.tree.BaseTreeEditPart {
+ «EXPAND ctors-»
+ «EXPAND createEditPolicies-»
+ «EXPAND listeners-»
+ «EXPAND setWidget-»
+«LET getPrimaryLabel() AS primaryLabel-»
+ «EXPAND createLabelTextDisplayer(primaryLabel)-»
+ «EXPAND getImage(primaryLabel)-»
+ «EXPAND getPrimaryLabel(primaryLabel)-»
+«ENDLET-»
+ «EXPAND getModelChildren-»
+ «EXPAND additions-»
+}
+«ELSE»«ERROR "Unexpected Type"»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setWidget FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void setWidget(org.eclipse.swt.widgets.Widget widget) {
+ if (widget == null) {
+ myTreeEditPartAdapter = null;
+ }
+ super.setWidget(widget);
+}
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»() {
+ super(«EXPAND xpt::diagram::parts::Common::getViewCode», «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+ }
+«ENDDEFINE»
+
+«DEFINE createEditPolicies FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void createEditPolicies() {
+ «EXPAND installComponentEditPolicy-»
+«IF needsTreeDirectEditPolicy()-»
+ «EXPAND installDirectEditPolicy-»
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE installComponentEditPolicy FOR gmfgen::GenCommonBase-»
+installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, «EXPAND instantiateComponentEditPolicy»);
+«ENDDEFINE»
+
+«DEFINE instantiateComponentEditPolicyPrim FOR gmfgen::GenCommonBase»new «EXPAND xpt::diagram::policies::ComponentEditPolicy::qualifiedClassName»()«ENDDEFINE»
+
+«DEFINE instantiateComponentEditPolicy FOR gmfgen::GenDiagram»new org.eclipse.gef.editpolicies.RootComponentEditPolicy()«ENDDEFINE»
+
+«DEFINE instantiateComponentEditPolicy FOR gmfgen::GenCommonBase-»
+«IF needsGetGraphicalEditPart()-»
+new «EXPAND xpt::diagram::policies::ComponentEditPolicy::qualifiedClassName»() {
+ protected org.eclipse.gef.GraphicalEditPart getGraphicalEditPart() {
+ return «editPartClassName».this;
+ }
+}«ELSE»«EXPAND instantiateComponentEditPolicyPrim»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE installDirectEditPolicy FOR gmfgen::GenCommonBase-»
+installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.lite.edit.policies.LabelDirectEditPolicy());
+«ENDDEFINE»
+
+«DEFINE listeners FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
+
+«DEFINE listeners FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void activate() {
+ myUpdateManager = new org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager(getViewer());
+ getViewer().setProperty(org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager.class.getName(), myUpdateManager);
+ super.activate();
+ getTransactionalUpdateManager().install(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(getNotationView()));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void deactivate() {
+ getTransactionalUpdateManager().uninstall();
+ super.deactivate();
+ org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager updateManager = (org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager) getViewer().getProperty(org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager.class.getName());
+ if (updateManager != null) {
+ updateManager.dispose();
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager getTransactionalUpdateManager() {
+ return myUpdateManager;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager myUpdateManager;
+«ENDDEFINE»
+
+«REM»Nodes and links share the same template«ENDREM»
+«DEFINE createLabelTextDisplayer(gmfgen::GenLabel primaryLabel) FOR gmfgen::GenCommonBase-»
+«IF primaryLabel != null-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelTextDisplayer createLabelTextDisplayer() {
+ «primaryLabel.getEditPartQualifiedClassName()» primaryLabelEditPart = getPrimaryLabelEditPart();
+ if (primaryLabelEditPart != null) {
+ return primaryLabelEditPart.getLabelTextDisplayer();
+ }
+ return super.createLabelTextDisplayer();
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«REM»For diagrams, use text displayer from the base class«ENDREM»
+«DEFINE createLabelTextDisplayer(gmfgen::GenLabel primaryLabel) FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE createLabelTextDisplayer(gmfgen::GenLabel primaryLabel) FOR gmfgen::GenChildLabelNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelTextDisplayer createLabelTextDisplayer() {
+ return «editPartClassName».this.getLabelTextDisplayer();
+ }
+«ENDDEFINE»
+
+«DEFINE getImage(gmfgen::GenLabel primaryLabel) FOR gmfgen::GenCommonBase-»
+«IF primaryLabel != null-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.graphics.Image getImage() {
+ «primaryLabel.getEditPartQualifiedClassName()» primaryLabelEditPart = getPrimaryLabelEditPart();
+ if (primaryLabelEditPart != null) {
+ return primaryLabelEditPart.getLabelIcon();
+ }
+ return null;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getImage(gmfgen::GenLabel primaryLabel) FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE getImage(gmfgen::GenLabel primaryLabel) FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.graphics.Image getImage() {
+ return «editPartClassName».this.getLabelIcon();
+}
+«ENDDEFINE»
+
+«DEFINE getPrimaryLabel(gmfgen::GenLabel primaryLabel) FOR gmfgen::GenCommonBase-»
+«IF primaryLabel != null-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «primaryLabel.getEditPartQualifiedClassName()» getPrimaryLabelEditPart() {
+ if (!isActive() || !«editPartClassName».this.isActive()) {
+ return null;
+ }
+ for(java.util.Iterator it = «EXPAND xpt::diagram::parts::Common::getViewCode».getChildren().iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.notation.View nextChild = (org.eclipse.gmf.runtime.notation.View)it.next();
+ if («getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(nextChild) == «primaryLabel.getEditPartQualifiedClassName()».VISUAL_ID) {
+ return («primaryLabel.getEditPartQualifiedClassName()») «editPartClassName».this.getViewer().getEditPartRegistry().get(nextChild);
+ }
+ }
+ return null;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getPrimaryLabel(gmfgen::GenLabel primaryLabel) FOR gmfgen::GenChildLabelNode-»
+«ENDDEFINE»
+
+«DEFINE getPrimaryLabel(gmfgen::GenLabel primaryLabel) FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE getModelChildren FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
+
+«DEFINE getModelChildren FOR gmfgen::GenChildLabelNode-»
+ «EXPAND xpt::Common::generatedClassComment»
+ protected java.util.List getModelChildren() {
+ return java.util.Collections.EMPTY_LIST;
+ }
+«ENDDEFINE»
+
+«DEFINE getModelChildren FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment("Since labels are not selectable edit parts, they are filtered from the overview as well.")»
+ protected java.util.List getModelChildren() {
+ java.util.List result = new java.util.ArrayList();
+ for (java.util.Iterator it = getNotationView().getSourceEdges().iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.notation.Edge next = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+ if (next.isVisible()) {
+ result.add(next);
+ }
+ }
+ return result;
+ }
+«ENDDEFINE»
+
+«DEFINE getModelChildren FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment("Since compartments and labels are not selectable edit parts, they are filtered from the overview as well.")»
+ protected java.util.List getModelChildren() {
+ java.util.List result = new java.util.ArrayList();
+ for(java.util.Iterator it = getNotationView().getVisibleChildren().iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.notation.View next = (org.eclipse.gmf.runtime.notation.View) it.next();
+ switch («getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(next)) {
+«EXPAND addChildren FOREACH childNodes-»
+«EXPAND addChildren FOREACH compartments-»
+ }
+ }
+ for (java.util.Iterator it = getNotationView().getSourceEdges().iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.notation.Edge next = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+ if (next.isVisible()) {
+ result.add(next);
+ }
+ }
+ return result;
+ }
+«ENDDEFINE»
+
+«DEFINE addChildren FOR gmfgen::GenNode-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ result.add(next);
+ break;
+«ENDDEFINE»
+
+«DEFINE addChildren FOR gmfgen::GenCompartment-»
+case «getEditPartQualifiedClassName()».VISUAL_ID: {
+ org.eclipse.gmf.runtime.notation.DrawerStyle style = (org.eclipse.gmf.runtime.notation.DrawerStyle) next.getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getDrawerStyle());
+ if (style != null && style.isCollapsed()) {
+ break;
+ }
+ result.addAll(next.getVisibleChildren());
+ break;
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenCommonBase»TreeEditPartAdapter«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/decorations.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«DEFINE decorationManager FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.decorations.IDecorationManager myDecorationManager;
+
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gmf.runtime.lite.edit.parts.decorations.IDecorationManager getDecorationManager() {
+ return myDecorationManager;
+}
+«ENDDEFINE»
+
+«DEFINE createDecorationManager FOR gmfgen::GenCommonBase»«ERROR "Unexpected type"»«ENDDEFINE»
+
+«DEFINE createDecorationManager FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.lite.edit.parts.decorations.IDecorationManager createDecorationManager(org.eclipse.draw2d.IFigure decorationShape) {
+ org.eclipse.gmf.runtime.lite.edit.parts.decorations.PaneDecorationManager result = new org.eclipse.gmf.runtime.lite.edit.parts.decorations.PaneDecorationManager(decorationShape);
+ «EXPAND adjustDecorationManager-»
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE createDecorationManager FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.lite.edit.parts.decorations.IDecorationManager createDecorationManager(org.eclipse.draw2d.Connection connection) {
+ return new org.eclipse.gmf.runtime.lite.edit.parts.decorations.ConnectionDecorationManager(connection);
+}
+«ENDDEFINE»
+
+«DEFINE adjustDecorationManager FOR gmfgen::GenNode-»
+«ENDDEFINE»
+
+«DEFINE adjustDecorationManager FOR gmfgen::GenTopLevelNode-»
+«IF getDiagram().shortcutsProvidedFor.size() > 0-»
+ result.installDecorationPosition("Shortcut", org.eclipse.draw2d.PositionConstants.SOUTH_WEST); «EXPAND xpt::Common::nonNLS»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/domainModelRefresher.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::Common»
+
+«DEFINE activate FOR gmfgen::GenCommonBase-»
+«IF needsDomainModelRefresher()-»
+getTransactionalUpdateManager().addUpdatableEditPart(«EXPAND xpt::diagram::parts::Common::getViewCode».getElement(), this);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE deactivate FOR gmfgen::GenCommonBase-»
+«IF needsDomainModelRefresher()-»
+getTransactionalUpdateManager().removeUpdatableEditPart(«EXPAND xpt::diagram::parts::Common::getViewCode».getElement(), this);
+«ENDIF-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/refresh.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,756 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::Common»
+«EXTENSION xpt::diagram::parts::LabelController»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE refresher FOR gmfgen::GenCommonBase-»
+«EXPAND updatableEditPartRefresher-»
+«EXPAND refreshMethods-»
+«EXPAND refreshVisuals-»
+«ENDDEFINE»
+
+«DEFINE updatableEditPartRefresher FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.RefreshersRegistry myRefreshersRegistry;
+
+«EXPAND xpt::Common::generatedMemberComment»
+public Refresher getRefresher(org.eclipse.emf.ecore.EStructuralFeature feature, org.eclipse.emf.common.notify.Notification msg) {
+ if (myRefreshersRegistry == null) {
+ createRefreshers();
+ }
+ return myRefreshersRegistry.getRefresher(feature, msg);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private void createRefreshers() {
+ myRefreshersRegistry = new org.eclipse.gmf.runtime.lite.edit.parts.update.RefreshersRegistry();
+ «EXPAND fillRefreshers-»
+}
+«ENDDEFINE»
+
+«DEFINE updatableEditPartRefresher FOR gmfgen::GenLabel»«ENDDEFINE»
+
+«DEFINE fillRefreshers FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE fillRefreshers FOR gmfgen::GenDiagram-»
+«EXPAND children-»
+«ENDDEFINE»
+
+«DEFINE fillRefreshers FOR gmfgen::GenCompartment-»
+«EXPAND children-»
+«EXPAND visibility-»
+«ENDDEFINE»
+
+/*
+ * By default, nodes have FontStyle installed. However, the color part of this style is only used by its child labels.
+ * Otherwise, there is a conflict between the font color and the foreground color.
+ */
+«DEFINE fillRefreshers FOR gmfgen::GenNode-»
+«EXPAND children-»
+«EXPAND visibility-»
+«EXPAND sourceEdges-»
+«EXPAND targetEdges-»
+«EXPAND bounds-»
+«EXPAND font-»
+«EXPAND fillColor-»
+«EXPAND lineColor-»
+«EXPAND shortcutAnnotation-»
+«ENDDEFINE»
+
+«DEFINE fillRefreshers FOR gmfgen::GenChildLabelNode-»
+«EXPAND visibility-»
+«EXPAND font-»
+«EXPAND fontColor-»
+«ENDDEFINE»
+
+/*
+ * By default, links have FontStyle installed. However, this style is only used by its child labels.
+ */
+«DEFINE fillRefreshers FOR gmfgen::GenLink-»
+«EXPAND children-»
+«EXPAND visibility-»
+«EXPAND sourceEdges-»
+«EXPAND targetEdges-»
+«EXPAND bendpoints-»
+«EXPAND fillColor-»
+«EXPAND lineColor-»
+«ENDDEFINE»
+
+«DEFINE children FOR gmfgen::GenCommonBase-»
+Refresher childrenRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshChildren();
+ }
+ public boolean isAffectingEvent(org.eclipse.emf.common.notify.Notification msg) {
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_PersistedChildren() == msg.getFeature() ||
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_TransientChildren() == msg.getFeature() ||
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getDrawerStyle_Collapsed() == msg.getFeature()) {
+ return true;
+ }
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles() == msg.getFeature()) {
+ return org.eclipse.gmf.runtime.lite.edit.parts.update.UpdaterUtil.affects(msg, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getDrawerStyle());
+ }
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Visible() == msg.getFeature()) {
+ return msg.getNotifier() != «EXPAND xpt::diagram::parts::Common::getViewCode»;
+ }
+ if (org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getEModelElement_EAnnotations() == msg.getFeature()) {
+ return msg.getNotifier() != «EXPAND xpt::diagram::parts::Common::getViewCode»;
+ }
+ return false;
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_PersistedChildren(), childrenRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_TransientChildren(), childrenRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles(), childrenRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getDrawerStyle_Collapsed(), childrenRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Visible(), childrenRefresher);
+myRefreshersRegistry.add(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getEModelElement_EAnnotations(), childrenRefresher);
+«ENDDEFINE»
+
+«DEFINE visibility FOR gmfgen::GenCommonBase-»
+Refresher visibilityRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshVisibility();
+ }
+ public boolean isAffectingEvent(org.eclipse.emf.common.notify.Notification msg) {
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Visible() == msg.getFeature()) {
+ return msg.getNotifier() == «EXPAND xpt::diagram::parts::Common::getViewCode»;
+ }
+ return false;
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Visible(), visibilityRefresher);
+«ENDDEFINE»
+
+«DEFINE bendpoints FOR gmfgen::GenLink-»
+Refresher bendpointsRefresher = new Refresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshBendpoints();
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getEdge_Bendpoints(), bendpointsRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getRelativeBendpoints_Points(), bendpointsRefresher);
+«ENDDEFINE»
+
+«DEFINE bounds FOR gmfgen::GenCommonBase-»
+Refresher boundsRefresher = new Refresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshBounds();
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getNode_LayoutConstraint(), boundsRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width(), boundsRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height(), boundsRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X(), boundsRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y(), boundsRefresher);
+«ENDDEFINE»
+
+«DEFINE sourceEdges FOR gmfgen::GenCommonBase-»
+Refresher sourceEdgesRefresher = new Refresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshSourceConnections();
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_SourceEdges(), sourceEdgesRefresher);
+«ENDDEFINE»
+
+«DEFINE targetEdges FOR gmfgen::GenCommonBase-»
+Refresher targetEdgesRefresher = new Refresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshTargetConnections();
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_TargetEdges(), targetEdgesRefresher);
+«ENDDEFINE»
+
+«DEFINE fillColor FOR gmfgen::GenCommonBase-»
+«IF !viewmap.isFixedBackground()-»
+Refresher backgroundColorRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshBackgroundColor();
+ }
+ public boolean isAffectingEvent(org.eclipse.emf.common.notify.Notification msg) {
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor() == msg.getFeature()) {
+ return true;
+ }
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles() == msg.getFeature()) {
+ return org.eclipse.gmf.runtime.lite.edit.parts.update.UpdaterUtil.affects(msg, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle());
+ }
+ return false;
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(), backgroundColorRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles(), backgroundColorRefresher);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE lineColor FOR gmfgen::GenCommonBase-»
+«IF !viewmap.isFixedForeground()-»
+Refresher foregroundColorRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshForegroundColor();
+ }
+ public boolean isAffectingEvent(org.eclipse.emf.common.notify.Notification msg) {
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor() == msg.getFeature()) {
+ return true;
+ }
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles() == msg.getFeature()) {
+ return org.eclipse.gmf.runtime.lite.edit.parts.update.UpdaterUtil.affects(msg, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle());
+ }
+ return false;
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(), foregroundColorRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles(), foregroundColorRefresher);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE font FOR gmfgen::GenCommonBase-»
+«IF !viewmap.isFixedFont()-»
+Refresher fontRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshFont();
+ }
+ public boolean isAffectingEvent(org.eclipse.emf.common.notify.Notification msg) {
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle().getEStructuralFeatures().contains(msg.getFeature())) {
+ return true;
+ }
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles() == msg.getFeature()) {
+ return org.eclipse.gmf.runtime.lite.edit.parts.update.UpdaterUtil.affects(msg, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ }
+ return false;
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontHeight(), fontRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontName(), fontRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Bold(), fontRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Italic(), fontRefresher);
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles(), fontRefresher);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE fontColor FOR gmfgen::GenCommonBase-»
+«IF !viewmap.isFixedFont()-»
+Refresher fontColorRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshFontColor();
+ }
+ public boolean isAffectingEvent(org.eclipse.emf.common.notify.Notification msg) {
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontColor() == msg.getFeature()) {
+ return true;
+ }
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles() == msg.getFeature()) {
+ return org.eclipse.gmf.runtime.lite.edit.parts.update.UpdaterUtil.affects(msg, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ }
+ return false;
+ }
+};
+myRefreshersRegistry.add(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontColor(), fontColorRefresher);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE shortcutAnnotation FOR gmfgen::GenNode-»
+«IF getDiagram().shortcutsProvidedFor.size() > 0-»
+Refresher shortcutPropertyRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshShortcutDecoration();
+ }
+ public boolean isAffectingEvent(org.eclipse.emf.common.notify.Notification msg) {
+ if (org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getEModelElement_EAnnotations() == msg.getFeature()) {
+ java.util.Collection affectedAnnotations = org.eclipse.gmf.runtime.lite.edit.parts.update.UpdaterUtil.getAffectedValues(msg, org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getEAnnotation());
+ for (java.util.Iterator it = affectedAnnotations.iterator(); it.hasNext(); ) {
+ org.eclipse.emf.ecore.EAnnotation nextAnnotation = (org.eclipse.emf.ecore.EAnnotation) it.next();
+ if ("Shortcut".equals(nextAnnotation.getSource())) { «EXPAND xpt::Common::nonNLS»
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+};
+myRefreshersRegistry.add(org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getEModelElement_EAnnotations(), shortcutPropertyRefresher);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE labelRefresher FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher labelRefresher;
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher getLabelRefresher() {
+ if (labelRefresher == null && getDiagramNode() != null) {
+ labelRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.labels.ILabelController.ExternalRefresherAdapter(this, «EXPAND xpt::diagram::parts::Common::getViewCode».getElement());
+ }
+ return labelRefresher;
+}
+«ENDDEFINE»
+
+«DEFINE refreshMethods FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE refreshMethods FOR gmfgen::GenCompartment-»
+«EXPAND refreshVisibility-»
+«ENDDEFINE»
+
+«DEFINE refreshMethods FOR gmfgen::GenNode-»
+«EXPAND refreshVisibility-»
+«EXPAND refreshBounds-»
+«EXPAND refreshFont-»
+«EXPAND refreshBackgroundColor-»
+«EXPAND refreshForegroundColor-»
+«EXPAND refreshShortcutDecoration-»
+«ENDDEFINE»
+
+«DEFINE refreshMethods FOR gmfgen::GenChildLabelNode-»
+«EXPAND refreshVisibility-»
+«EXPAND refreshFont-»
+«EXPAND refreshFontColor-»
+«EXPAND refreshLabel-»
+«EXPAND labelRefresher-»
+«ENDDEFINE»
+
+«DEFINE refreshMethods FOR gmfgen::GenLabel-»
+«EXPAND refreshFont-»
+«EXPAND refreshFontColor-»
+«EXPAND refreshLabel-»
+«EXPAND labelRefresher-»
+«EXPAND externalFontRefresher-»
+«EXPAND externalFontColorRefresher-»
+«ENDDEFINE»
+
+«DEFINE refreshMethods FOR gmfgen::GenLink-»
+«EXPAND refreshVisibility-»
+«EXPAND refreshBendpoints-»
+«EXPAND refreshBackgroundColor-»
+«EXPAND refreshForegroundColor-»
+«ENDDEFINE»
+
+«DEFINE externalFontColorRefresher FOR gmfgen::GenLabel-»
+«IF !viewmap.isFixedFont()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher fontColorRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshFontColor();
+ }
+ public boolean isAffectingEvent(org.eclipse.emf.common.notify.Notification msg) {
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontColor() == msg.getFeature()) {
+ return true;
+ }
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles() == msg.getFeature()) {
+ return org.eclipse.gmf.runtime.lite.edit.parts.update.UpdaterUtil.affects(msg, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ }
+ return false;
+ }
+};
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE externalFontRefresher FOR gmfgen::GenLabel-»
+«IF !viewmap.isFixedFont()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher fontRefresher = new org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher() {
+ public void refresh() {
+ «EXPAND ignoreIfInactive-»
+ refreshFont();
+ }
+ public boolean isAffectingEvent(org.eclipse.emf.common.notify.Notification msg) {
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle().getEStructuralFeatures().contains(msg.getFeature())) {
+ return true;
+ }
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Styles() == msg.getFeature()) {
+ return org.eclipse.gmf.runtime.lite.edit.parts.update.UpdaterUtil.affects(msg, org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ }
+ return false;
+ }
+};
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE refreshVisibility FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshVisibility() {
+ boolean isVisible = «EXPAND xpt::diagram::parts::Common::getViewCode».isVisible();
+ boolean wasVisible = getFigure().isVisible();
+ if (isVisible == wasVisible) {
+ return;
+ }
+«IF isSelectable()-»
+ if (!isVisible && (getSelected() != SELECTED_NONE)) {
+ getViewer().deselect(this);
+ }
+«ENDIF-»
+ getFigure().setVisible(isVisible);
+ getFigure().revalidate();
+}
+«ENDDEFINE»
+
+«DEFINE refreshBendpoints FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshBendpoints() {
+ org.eclipse.gmf.runtime.notation.RelativeBendpoints bendpoints = (org.eclipse.gmf.runtime.notation.RelativeBendpoints) getDiagramEdge().getBendpoints();
+ if (bendpoints == null) {
+ getConnectionFigure().setRoutingConstraint(java.util.Collections.EMPTY_LIST);
+ return;
+ }
+ java.util.List modelConstraint = bendpoints.getPoints();
+ java.util.List figureConstraint = new java.util.ArrayList();
+ for (int i = 0; i < modelConstraint.size(); i++) {
+ org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint wbp = (org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint) modelConstraint.get(i);
+ org.eclipse.draw2d.RelativeBendpoint rbp = new org.eclipse.draw2d.RelativeBendpoint(getConnectionFigure());
+ rbp.setRelativeDimensions(new org.eclipse.draw2d.geometry.Dimension(wbp.getSourceX(), wbp.getSourceY()), new org.eclipse.draw2d.geometry.Dimension(wbp.getTargetX(), wbp.getTargetY()));
+ rbp.setWeight((i + 1) / ((float) modelConstraint.size() + 1));
+ figureConstraint.add(rbp);
+ }
+ getConnectionFigure().setRoutingConstraint(figureConstraint);
+}
+«ENDDEFINE»
+
+«DEFINE refreshBounds FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshBounds() {
+ org.eclipse.gmf.runtime.notation.Node node = «EXPAND xpt::diagram::parts::Common::getViewCode»;
+ if (node.getLayoutConstraint() == null) {
+ return;
+ }
+ assert node.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Bounds;
+ org.eclipse.gmf.runtime.notation.Bounds bounds = (org.eclipse.gmf.runtime.notation.Bounds) node.getLayoutConstraint();
+ int x = bounds.getX();
+ int y = bounds.getY();
+ int width = bounds.getWidth();
+ int height = bounds.getHeight();
+ if (width < 0) {
+ x -= width;
+ width = -width;
+ }
+ if (height < 0) {
+ y -= height;
+ height = -height;
+ }
+ «EXPAND setLayoutConstraint-»
+}
+«ENDDEFINE»
+
+«DEFINE setLayoutConstraint FOR gmfgen::GenCommonBase-»
+((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
+«ENDDEFINE»
+
+«DEFINE setLayoutConstraint FOR gmfgen::GenChildSideAffixedNode-»
+org.eclipse.draw2d.IFigure parentFigure = getFigure().getParent();
+if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ org.eclipse.gmf.runtime.lite.figures.BorderItemLocator locator;
+ if (constraint instanceof org.eclipse.gmf.runtime.lite.figures.BorderItemLocator) {
+ locator = (org.eclipse.gmf.runtime.lite.figures.BorderItemLocator) constraint;
+ } else {
+ locator = new org.eclipse.gmf.runtime.lite.figures.BorderItemLocator(this);
+ parentFigure.getLayoutManager().setConstraint(getFigure(), locator);
+ }
+ locator.setModelConstraint(new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
+}
+«ENDDEFINE»
+
+«DEFINE refreshFont FOR gmfgen::GenCommonBase-»
+«IF !isFixedFont(viewmap)-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshFont() {
+ org.eclipse.gmf.runtime.notation.FontStyle style = (org.eclipse.gmf.runtime.notation.FontStyle) «EXPAND getStyleHolderCode».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ org.eclipse.jface.resource.FontDescriptor toDispose = createdFontDescriptor;
+ if (style != null) {
+ String fontName = style.getFontName();
+ if (fontName != null && «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().isStrictFont()) {
+ org.eclipse.swt.graphics.FontData[] matchingDatas = getViewer().getControl().getDisplay().getFontList(fontName, true);
+ if (matchingDatas == null || matchingDatas.length == 0) {
+ fontName = null;
+ }
+ }
+ int fontHeight = style.getFontHeight();
+ if (fontName == null || fontHeight <= 0) {
+ org.eclipse.swt.graphics.FontData defaultFont = org.eclipse.jface.preference.PreferenceConverter.getFontData(«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(), org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.DEFAULT_FONT);
+ if (fontName == null) {
+ fontName = defaultFont.getName();
+ }
+ if (fontHeight <= 0) {
+ fontHeight = defaultFont.getHeight();
+ }
+ }
+ int fontStyle = org.eclipse.swt.SWT.NORMAL;
+ if (style.isBold()) {
+ fontStyle |= org.eclipse.swt.SWT.BOLD;
+ }
+ if (style.isItalic()) {
+ fontStyle |= org.eclipse.swt.SWT.ITALIC;
+ }
+ org.eclipse.swt.graphics.Font currentFont = getFigure().getFont();
+ if (currentFont != null) {
+ org.eclipse.swt.graphics.FontData currentFontData = currentFont.getFontData()[0];
+ if (currentFontData.getName().equals(fontName) && currentFontData.getHeight() == fontHeight && currentFontData.getStyle() == fontStyle) {
+ return;
+ }
+ }
+ createdFontDescriptor = org.eclipse.jface.resource.FontDescriptor.createFrom(fontName, fontHeight, fontStyle);
+ getFigure().setFont(getViewer().getResourceManager().createFont(createdFontDescriptor));
+ } else {
+ //revert to the default font
+ getFigure().setFont(getViewer().getControl().getFont());
+ createdFontDescriptor = null;
+ }
+ if (toDispose != null) {
+ getViewer().getResourceManager().destroyFont(toDispose);
+ }
+}
+
+«EXPAND xpt::Common::generatedMemberComment("The font descriptor (created by {@link #refreshFont()}) currently assigned to the label (unless the default font is assigned).\n" +
+ "Whenever another non-default font is assigned to it, the previous one should be destroyed through the resource manager.")»
+private org.eclipse.jface.resource.FontDescriptor createdFontDescriptor;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE refreshFontColor FOR gmfgen::GenCommonBase-»
+«IF !isFixedFont(viewmap)-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshFontColor() {
+ org.eclipse.gmf.runtime.notation.FontStyle style = (org.eclipse.gmf.runtime.notation.FontStyle) «EXPAND getStyleHolderCode».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ org.eclipse.jface.resource.ColorDescriptor toDispose = createdFontColorDescriptor;
+ if (style != null) {
+ int fontColor = style.getFontColor();
+ int red = fontColor & 0x000000FF;
+ int green = (fontColor & 0x0000FF00) >> 8;
+ int blue = (fontColor & 0x00FF0000) >> 16;
+ org.eclipse.swt.graphics.Color currentColor = getFigure().getForegroundColor();
+ if (currentColor != null && currentColor.getRed() == red && currentColor.getGreen() == green && currentColor.getBlue() == blue) {
+ return;
+ }
+ createdFontColorDescriptor = org.eclipse.jface.resource.ColorDescriptor.createFrom(new org.eclipse.swt.graphics.RGB(red, green, blue));
+ } else {
+ createdFontColorDescriptor = org.eclipse.jface.resource.ColorDescriptor.createFrom(«EXPAND defaultColor("FONT_COLOR")»);
+ }
+ getFigure().setForegroundColor(getViewer().getResourceManager().createColor(createdFontColorDescriptor));
+ if (toDispose != null) {
+ getViewer().getResourceManager().destroyColor(toDispose);
+ }
+}
+
+«EXPAND xpt::Common::generatedMemberComment("The color descriptor (created by {@link #refreshFontColor()}) currently assigned to the label.\n" +
+ "Whenever another color is assigned to it, the previous one should be destroyed through the resource manager.")»
+private org.eclipse.jface.resource.ColorDescriptor createdFontColorDescriptor;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE refreshForegroundColor FOR gmfgen::GenCommonBase-»
+«IF !viewmap.isFixedForeground()-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshForegroundColor() {
+ org.eclipse.gmf.runtime.notation.LineStyle style = (org.eclipse.gmf.runtime.notation.LineStyle) «EXPAND getStyleHolderCode».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle());
+ org.eclipse.jface.resource.ColorDescriptor toDispose = createdForegroundColorDescriptor;
+ if (style != null) {
+ int foregroundColor = style.getLineColor();
+ int red = foregroundColor & 0x000000FF;
+ int green = (foregroundColor & 0x0000FF00) >> 8;
+ int blue = (foregroundColor & 0x00FF0000) >> 16;
+ org.eclipse.swt.graphics.Color currentColor = getFigure().getForegroundColor();
+ if (currentColor != null && currentColor.getRed() == red && currentColor.getGreen() == green && currentColor.getBlue() == blue) {
+ return;
+ }
+ createdForegroundColorDescriptor = org.eclipse.jface.resource.ColorDescriptor.createFrom(new org.eclipse.swt.graphics.RGB(red, green, blue));
+ } else {
+ createdForegroundColorDescriptor = org.eclipse.jface.resource.ColorDescriptor.createFrom(«EXPAND defaultColor("LINE_COLOR")»);
+ }
+ getFigure().setForegroundColor(getViewer().getResourceManager().createColor(createdForegroundColorDescriptor));
+ if (toDispose != null) {
+ getViewer().getResourceManager().destroyColor(toDispose);
+ }
+}
+
+«EXPAND xpt::Common::generatedMemberComment("The color descriptor (created by {@link #refreshForegroundColor()}) currently assigned to the figure.\n" +
+ "Whenever another color is assigned to it, the previous one should be destroyed through the resource manager.")»
+private org.eclipse.jface.resource.ColorDescriptor createdForegroundColorDescriptor;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE refreshBackgroundColor FOR gmfgen::GenCommonBase-»
+«IF !viewmap.isFixedBackground()-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshBackgroundColor() {
+ org.eclipse.gmf.runtime.notation.FillStyle style = (org.eclipse.gmf.runtime.notation.FillStyle) «EXPAND getStyleHolderCode».getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle());
+ org.eclipse.jface.resource.ColorDescriptor toDispose = createdBackgroundColorDescriptor;
+ if (style != null) {
+ int backgroundColor = style.getFillColor();
+ int red = backgroundColor & 0x000000FF;
+ int green = (backgroundColor & 0x0000FF00) >> 8;
+ int blue = (backgroundColor & 0x00FF0000) >> 16;
+ org.eclipse.swt.graphics.Color currentColor = getFigure().getBackgroundColor();
+ if (currentColor != null && currentColor.getRed() == red && currentColor.getGreen() == green && currentColor.getBlue() == blue) {
+ return;
+ }
+ createdBackgroundColorDescriptor = org.eclipse.jface.resource.ColorDescriptor.createFrom(new org.eclipse.swt.graphics.RGB(red, green, blue));
+ } else {
+ createdBackgroundColorDescriptor = org.eclipse.jface.resource.ColorDescriptor.createFrom(«EXPAND defaultColor("FILL_COLOR")»);
+ }
+ getFigure().setBackgroundColor(getViewer().getResourceManager().createColor(createdBackgroundColorDescriptor));
+ if (toDispose != null) {
+ getViewer().getResourceManager().destroyColor(toDispose);
+ }
+}
+
+«EXPAND xpt::Common::generatedMemberComment("The color descriptor (created by {@link #refreshBackgroundColor()}) currently assigned to the figure.\n" +
+ "Whenever another color is assigned to it, the previous one should be destroyed through the resource manager.")»
+private org.eclipse.jface.resource.ColorDescriptor createdBackgroundColorDescriptor;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE refreshLabel FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshLabel() {
+ getLabel().setText(getLabelText());
+ getLabel().setIcon(getLabelIcon());
+}
+«ENDDEFINE»
+
+«DEFINE refreshShortcutDecoration FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshShortcutDecoration() {
+ org.eclipse.gmf.runtime.lite.edit.parts.decorations.IDecorationManager decorationManager = getDecorationManager();
+ if (decorationManager == null) {
+ return;
+ }
+ org.eclipse.draw2d.Label decorationFigure = null;
+ org.eclipse.emf.ecore.EAnnotation annotation = «EXPAND xpt::diagram::parts::Common::getViewCode».getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
+ if (annotation != null) {
+ org.eclipse.swt.graphics.Image image = «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getBundledImage("icons/shortcut.gif"); «EXPAND xpt::Common::nonNLS»
+ decorationFigure = new org.eclipse.draw2d.Label(image);
+ }
+ decorationManager.installDecoration("Shortcut", decorationFigure);
+}
+«ENDDEFINE»
+
+«DEFINE refreshVisuals FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE refreshVisuals FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshVisibility();
+}
+«ENDDEFINE»
+
+«DEFINE refreshVisuals FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshVisibility();
+ refreshBounds();
+«IF !viewmap.isFixedFont()-»
+ refreshFont();
+«ENDIF-»
+«IF !viewmap.isFixedBackground()-»
+ refreshBackgroundColor();
+«ENDIF-»
+«IF !viewmap.isFixedForeground()-»
+ refreshForegroundColor();
+«ENDIF-»
+«IF getDiagram().shortcutsProvidedFor.size() > 0-»
+ refreshShortcutDecoration();
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE refreshVisuals FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshVisibility();
+ refreshLabel();
+«IF !viewmap.isFixedFont()-»
+ refreshFont();
+ refreshFontColor();
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE refreshVisuals FOR gmfgen::GenLabel-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+«IF !viewmap.isFixedFont()-»
+ refreshFont();
+ refreshFontColor();
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE refreshVisuals FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshVisibility();
+ refreshBendpoints();
+«IF !viewmap.isFixedBackground()-»
+ refreshBackgroundColor();
+«ENDIF-»
+«IF !viewmap.isFixedForeground()-»
+ refreshForegroundColor();
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE externalRefreshers FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection externalRefreshers = new java.util.ArrayList();
+
+«EXPAND xpt::Common::generatedMemberComment»
+public java.util.Collection getExternalRefreshers() {
+ return externalRefreshers;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public void addExternalRefresher(org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher externalRefresher) {
+ if (externalRefresher != null && !externalRefreshers.contains(externalRefresher)) {
+ externalRefreshers.add(externalRefresher);
+ }
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public void removeExternalRefresher(org.eclipse.gmf.runtime.lite.edit.parts.update.IExternallyUpdatableEditPart.ExternalRefresher externalRefresher) {
+ externalRefreshers.remove(externalRefresher);
+}
+«ENDDEFINE»
+
+«DEFINE getStyleHolderCode FOR gmfgen::GenCommonBase»«EXPAND xpt::diagram::parts::Common::getViewCode»«ENDDEFINE»
+
+«DEFINE getStyleHolderCode FOR gmfgen::GenNodeLabel»getUpdatableParent().«EXPAND xpt::diagram::parts::Common::getViewCode FOR node»«ENDDEFINE»
+
+«DEFINE getStyleHolderCode FOR gmfgen::GenLinkLabel»getUpdatableParent().«EXPAND xpt::diagram::parts::Common::getViewCode FOR link»«ENDDEFINE»
+
+«DEFINE ignoreIfInactive FOR GenCommonBase-»
+if (!isActive()) {
+ return;
+}
+«ENDDEFINE»
+
+«DEFINE defaultColor(String colorConstant) FOR gmfgen::GenCommonBase»org.eclipse.jface.preference.PreferenceConverter.getColor(«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(), org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.«colorConstant»)«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/requests.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::parts::Common»
+«EXTENSION xpt::diagram::parts::LabelController»
+
+«DEFINE performRequest FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void performRequest(org.eclipse.gef.Request req) {
+ «EXPAND performOpen-»
+ «EXPAND performDirectEdit-»
+ super.performRequest(req);
+}
+«ENDDEFINE»
+
+«DEFINE performOpen FOR gmfgen::GenCommonBase-»
+if (org.eclipse.gef.RequestConstants.REQ_OPEN.equals(req.getType())) {
+ org.eclipse.gef.commands.Command command = getCommand(req);
+ if (command != null && command.canExecute()) {
+ getViewer().getEditDomain().getCommandStack().execute(command);
+ }
+ return;
+}
+«ENDDEFINE»
+
+«DEFINE performOpen FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE performDirectEdit FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE performDirectEdit FOR gmfgen::GenLabel»
+«IF !isReadOnly()-»
+«EXPAND performLabelDirectEdit-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE performDirectEdit FOR gmfgen::GenChildLabelNode-»
+«IF !isReadOnly()-»
+«EXPAND performLabelDirectEdit-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE performLabelDirectEdit FOR gmfgen::GenCommonBase-»
+if (org.eclipse.gef.RequestConstants.REQ_DIRECT_EDIT.equals(req.getType()) && understandsRequest(req)) {
+ performDirectEdit();
+ return;
+}
+«ENDDEFINE»
+
+«DEFINE performDirectEdit FOR gmfgen::GenNode-»
+«EXPAND performDelegatingDirectEdit-»
+«ENDDEFINE»
+
+«DEFINE performDirectEdit FOR gmfgen::GenLink-»
+«EXPAND performDelegatingDirectEdit-»
+«ENDDEFINE»
+
+«DEFINE performDelegatingDirectEdit FOR gmfgen::GenCommonBase-»
+«IF getPrimaryLabel() != null-»
+if (org.eclipse.gef.RequestConstants.REQ_DIRECT_EDIT.equals(req.getType())) {
+ org.eclipse.gef.EditPart labelToEdit;
+ if (req instanceof org.eclipse.gef.requests.DirectEditRequest) {
+ labelToEdit = getLabelEditPart((org.eclipse.gef.requests.DirectEditRequest) req);
+ } else {
+ labelToEdit = getPrimaryLabelEditPart();
+ }
+ if (labelToEdit != null) {
+ labelToEdit.performRequest(req);
+ }
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getLabelEditPart FOR gmfgen::GenCommonBase-»
+«IF getPrimaryLabel() != null-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gef.EditPart getLabelEditPart(org.eclipse.gef.requests.DirectEditRequest req) {
+ org.eclipse.gef.EditPart result = getViewer().findObjectAt(req.getLocation());
+ if (result != null) {
+ if («EXPAND xpt::diagram::parts::Common::getViewCode».getChildren().contains(result.getModel())) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) result.getModel();
+ int visualId = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(view);
+ switch (visualId) {
+ «EXPAND returnLabelEditPart FOREACH getAllLabels().select(e| !e.readOnly)-»
+ }
+ }
+ }
+ return getPrimaryLabelEditPart();
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE returnLabelEditPart FOR gmfgen::GenLabel-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ return result;
+«ENDDEFINE»
+
+«DEFINE getPrimaryLabelEditPart FOR gmfgen::GenCommonBase-»
+«IF getPrimaryLabel() != null-»
+«EXPAND xpt::Common::generatedMemberComment("Returns the label which should be direct-edited by default.")»
+private org.eclipse.gef.EditPart getPrimaryLabelEditPart() {
+ for(java.util.Iterator it = «EXPAND xpt::diagram::parts::Common::getViewCode».getChildren().iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.notation.View nextChild = (org.eclipse.gmf.runtime.notation.View)it.next();
+ if («getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(nextChild) == «getPrimaryLabel().getEditPartQualifiedClassName()».VISUAL_ID) {
+ return (org.eclipse.gef.EditPart) getViewer().getEditPartRegistry().get(nextChild);
+ }
+ }
+ return null;
+}
+«ENDIF-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/semanticChildLinks.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::commands::CommandUtils»
+«EXTENSION xpt::diagram::LinkFinder»
+«EXTENSION xpt::diagram::parts::LinkNotationModelRefresher»
+
+«DEFINE semanticChildLinks(String parentViewCode) FOR gmfgen::GenCommonBase-»
+ «LET getLinkChildFeatures(containedTypeModelFacetLinks()) AS genTypeLinkFeatures-»
+ «LET getLinkChildFeatures(containedFeatureModelFacetLinks()) AS genFeatureLinkFeatures-»
+ «IF genTypeLinkFeatures.size() + genFeatureLinkFeatures.size() == 0-»
+return java.util.Collections.EMPTY_LIST;
+ «ELSE-»
+java.util.List result = new java.util.LinkedList();
+org.eclipse.emf.ecore.EObject modelObject = «parentViewCode».getElement();
+org.eclipse.emf.ecore.EObject nextValue;
+ «IF genTypeLinkFeatures.size() > 0-»
+int linkVID;
+ «ENDIF-»
+ «FOREACH genTypeLinkFeatures AS metaFeature-»
+ «LET getTypeGenLinksForFeature(metaFeature, containedLinks()) AS genLinksCollection-»
+ «IF metaFeature.isListType()-»
+for(java.util.Iterator it = «EXPAND MetaModel::getFeatureValue("modelObject", null, true) FOR metaFeature».iterator(); it.hasNext(); ) {
+ nextValue = (org.eclipse.emf.ecore.EObject) it.next();
+ «ELSE-»
+ nextValue = (org.eclipse.emf.ecore.EObject) «EXPAND MetaModel::getFeatureValue("modelObject", null, false) FOR metaFeature»;
+ «ENDIF-»
+ linkVID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getLinkWithClassVisualID(nextValue);
+ «LET genLinksCollection.size() > 1 AS generateSwitch-»
+ «IF generateSwitch-»
+ switch (linkVID) {
+ «ENDIF-»
+ «FOREACH genLinksCollection AS nextLink-»
+ «IF generateSwitch-»
+ case «nextLink.getEditPartQualifiedClassName()».VISUAL_ID: {
+ «ELSE-»
+ if («nextLink.getEditPartQualifiedClassName()».VISUAL_ID == linkVID) {
+ «ENDIF-»
+ «LET ((gmfgen::TypeLinkModelFacet) nextLink.modelFacet).sourceMetaFeature AS sourceFeature-»
+ «IF sourceFeature != null-»
+ «IF sourceFeature.isListType()-»
+ java.util.List sources = «EXPAND MetaModel::getFeatureValue("nextValue", null, true) FOR sourceFeature»;
+ org.eclipse.emf.ecore.EObject source = sources.size() == 1 ? (org.eclipse.emf.ecore.EObject) sources.get(0) : null;
+ «ELSE-»
+ org.eclipse.emf.ecore.EObject source = (org.eclipse.emf.ecore.EObject) «EXPAND MetaModel::getFeatureValue("nextValue", null, false) FOR sourceFeature»;
+ «ENDIF-»
+ «ELSE-»
+ org.eclipse.emf.ecore.EObject source = modelObject;
+ «ENDIF-»
+ «ENDLET-»
+ «LET ((gmfgen::TypeLinkModelFacet) nextLink.modelFacet).targetMetaFeature AS targetFeature-»
+ «IF targetFeature != null-»
+ «IF targetFeature.isListType()-»
+ java.util.List targets = «EXPAND MetaModel::getFeatureValue("nextValue", null, true) FOR targetFeature»;
+ org.eclipse.emf.ecore.EObject target = targets.size() == 1 ? (org.eclipse.emf.ecore.EObject) targets.get(0) : null;
+ «ELSE-»
+ org.eclipse.emf.ecore.EObject target = (org.eclipse.emf.ecore.EObject) «EXPAND MetaModel::getFeatureValue("nextValue", null, false) FOR targetFeature»;
+ «ENDIF-»
+ «ELSE-»
+ org.eclipse.emf.ecore.EObject target = modelObject;
+ «ENDIF-»
+ «ENDLET-»
+ if (source != null && target != null) {
+ result.add(new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.LinkDescriptor(source, target, nextValue, linkVID));
+ }
+ «IF generateSwitch-»
+ break;
+ }
+ «ELSE-»
+ }
+ «ENDIF-»
+ «ENDFOREACH-»
+ «IF generateSwitch-»
+ }
+ «ENDIF-»
+ «IF metaFeature.isListType()-»
+}
+ «ENDIF-»
+ «ENDLET-»
+ «ENDLET-»
+ «ENDFOREACH-»
+ «FOREACH genFeatureLinkFeatures AS metaFeature-»
+ «LET getFeatureGenLinksForFeature(metaFeature, containedLinks()) AS genLinksCollection-»
+ «IF metaFeature.isListType()-»
+for(java.util.Iterator it = «EXPAND MetaModel::getFeatureValue("modelObject", null, true) FOR metaFeature».iterator(); it.hasNext(); ) {
+ nextValue = (org.eclipse.emf.ecore.EObject) it.next();
+ «ELSE-»
+ nextValue = (org.eclipse.emf.ecore.EObject) «EXPAND MetaModel::getFeatureValue("modelObject", null, false) FOR metaFeature»;
+ «ENDIF-»
+ if (nextValue != null) {
+ «FOREACH genLinksCollection AS nextLink-»
+ result.add(new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.LinkDescriptor(modelObject, nextValue, null, «nextLink.getEditPartQualifiedClassName()».VISUAL_ID));
+ «ENDFOREACH-»
+ }
+ «IF metaFeature.isListType()-»
+}
+ «ENDIF-»
+ «ENDLET-»
+ «ENDFOREACH-»
+return result;
+ «ENDIF-»
+ «ENDLET-»
+ «ENDLET-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/parts/semanticChildren.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::commands::CommandUtils»
+«EXTENSION xpt::diagram::parts::NotationModelRefresher»
+«EXTENSION xpt::diagram::PhantomUtils»
+
+«DEFINE semanticChildren(String viewCode) FOR gmfgen::GenContainerBase-»
+«IF !needsNotationModelRefresher()-»
+return java.util.Collections.EMPTY_LIST;
+«ELSE-»
+java.util.List result = new java.util.LinkedList();
+org.eclipse.gmf.runtime.notation.View viewObject = «viewCode»;
+org.eclipse.emf.ecore.EObject modelObject = viewObject.getElement();
+org.eclipse.emf.ecore.EObject nextValue;
+int nodeVID;
+«EXPAND addPhantoms-»
+«FOREACH getChildFeatures() AS childMetaFeature-»
+ «LET getGenNodes(childMetaFeature) AS genNodesCollection-»
+ «IF genNodesCollection.size() > 0-»
+ «IF childMetaFeature.isListType()-»
+for(java.util.Iterator it = «EXPAND MetaModel::getFeatureValue("modelObject", null, true) FOR childMetaFeature».iterator(); it.hasNext(); ) {
+ nextValue = (org.eclipse.emf.ecore.EObject) it.next();
+ «ELSE-»
+nextValue = (org.eclipse.emf.ecore.EObject) «EXPAND MetaModel::getFeatureValue("modelObject", null, false) FOR childMetaFeature»;
+ «ENDIF-»
+nodeVID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getNodeVisualID(viewObject, nextValue);
+ «LET genNodesCollection.size() > 1 AS generateSwitch-»
+ «IF generateSwitch-»
+switch (nodeVID) {
+ «ENDIF-»
+ «FOREACH genNodesCollection AS nextNode-»
+ «IF generateSwitch-»
+case «nextNode.getEditPartQualifiedClassName()».VISUAL_ID: {
+ «ELSE-»
+if («nextNode.getEditPartQualifiedClassName()».VISUAL_ID == nodeVID) {
+ «ENDIF-»
+ result.add(new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor(nextValue, nodeVID));
+ «IF generateSwitch-»
+ break;
+ }
+ «ELSE-»
+ }
+ «ENDIF-»
+ «ENDFOREACH-»
+ «IF generateSwitch-»
+}
+ «ENDIF-»
+ «IF childMetaFeature.isListType()-»
+ }
+ «ENDIF-»
+ «ENDLET-»
+ «ENDIF-»
+ «ENDLET-»
+«ENDFOREACH-»
+ return result;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addPhantoms FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE addPhantoms FOR gmfgen::GenDiagram-»
+«IF getPhantomNodes().size() > 0-»
+org.eclipse.emf.ecore.resource.Resource resource = «EXPAND xpt::commands::Common::getPhantomContainmentResource FOR "viewObject"»;
+for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext(); ) {
+ org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next();
+ if (childElement == modelObject) {
+ continue;
+ }
+ nodeVID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getNodeVisualID(viewObject, childElement);
+ switch (nodeVID) {
+ «EXPAND addNextIfPhantom FOREACH getPhantomNodes()-»
+ }
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addNextIfPhantom FOR gmfgen::GenTopLevelNode-»
+case «getEditPartQualifiedClassName()».VISUAL_ID: {
+«LET getPhantomFeatures() AS phantomFeatures-»
+ org.eclipse.emf.ecore.EStructuralFeature containmentFeature = childElement.eContainmentFeature();
+ if (childElement.eContainer() == null«IF phantomFeatures.size() > 0» || «EXPAND checkFeature FOREACH phantomFeatures SEPARATOR "||"»«ENDIF») {
+ result.add(new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor(childElement, nodeVID));
+ }
+«ENDLET-»
+ break;
+}
+«ENDDEFINE»
+
+«DEFINE checkFeature FOR genmodel::GenFeature»containmentFeature == «EXPAND MetaModel::MetaFeature»«ENDDEFINE»
+
+«DEFINE getPhantomNodesIterator FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE getPhantomNodesIterator FOR gmfgen::GenDiagram-»
+«IF getPhantomNodes().size() > 0-»
+«EXPAND xpt::Common::generatedMemberComment("By default, returns all contents of the resource. If phantoms are known to be confined in a subset of the resource contents,\n" +
+ "overwriting this method (and marking it as generated NOT) will significantly improve performance.")»
+private java.util.Iterator getPhantomNodesIterator(org.eclipse.emf.ecore.resource.Resource resource) {
+ return resource.getAllContents();
+}
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/policies/ClassNames.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+String getComponentEditPolicyClassName(gmfgen::GenCommonBase element) :
+getBaseName(element) + "ComponentEditPolicy"
+;
+
+String getLayoutEditPolicyClassName(gmfgen::GenContainerBase element) :
+getBaseName(element) + "LayoutEditPolicy"
+;
+
+String getSideAffixedLayoutEditPolicyClassName(gmfgen::GenContainerBase element) :
+getBaseName(element) + "SideAffixedLayoutEditPolicy"
+;
+
+String getGraphicalNodeEditPolicyClassName(gmfgen::GenCommonBase gcb) :
+getBaseName(gcb) + "GraphicalNodeEditPolicy"
+;
+
+String getGraphicalNodeEditPolicyClassName(gmfgen::GenNode node) :
+node.graphicalNodeEditPolicyClassName
+;
+
+String getConnectionEndpointEditPolicyClassName(gmfgen::GenLink link) :
+getBaseName(link) + "EndpointEditPolicy"
+;
+
+private String getBaseName(gmfgen::GenCommonBase element) :
+ let editPartClassName = element.editPartClassName :
+ editPartClassName.endsWith("EditPart") ? editPartClassName.subString(0, editPartClassName.length() - "EditPart".length())
+ : editPartClassName
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/policies/Common.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«DEFINE getViewCode FOR gmfgen::GenCommonBase»«ERROR "Unexpected type"»«ENDDEFINE»
+
+«DEFINE getViewCode FOR gmfgen::GenDiagram»(org.eclipse.gmf.runtime.notation.Diagram) getHost().getModel()«ENDDEFINE»
+
+«DEFINE getViewCode FOR gmfgen::GenChildContainer»(org.eclipse.gmf.runtime.notation.Node) getHost().getModel()«ENDDEFINE»
+
+«DEFINE getViewCode FOR gmfgen::GenLink»(org.eclipse.gmf.runtime.notation.Edge) getHost().getModel()«ENDDEFINE»
+
+«DEFINE getDiagramCode FOR gmfgen::GenCommonBase»«ERROR "Unexpected type"»«ENDDEFINE»
+
+«DEFINE getDiagramCode FOR gmfgen::GenDiagram»«EXPAND getViewCode»«ENDDEFINE»
+
+«DEFINE getDiagramCode FOR gmfgen::GenChildContainer»(«EXPAND getViewCode»).getDiagram()«ENDDEFINE»
+
+«DEFINE getDiagramCode FOR gmfgen::GenLink»(«EXPAND getViewCode»).getDiagram()«ENDDEFINE»
+
+«DEFINE getDiagramElementCode FOR gmfgen::GenCommonBase»«EXPAND getDiagramCode».getElement()«ENDDEFINE»
+
+«DEFINE getDiagramElementCode FOR gmfgen::GenDiagram»(«EXPAND getDiagramCode»).getElement()«ENDDEFINE»
+
+«DEFINE getCastToEditPart FOR gmfgen::GenChildContainer»(«getEditPartQualifiedClassName()») getHost()«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/policies/ComponentEditPolicy.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+extension xpt::diagram::LinkFinder;
+
+boolean needsGetGraphicalEditPart(gmfgen::GenCommonBase gcb) :
+gcb.outgoingLinks().size() > 0 || gcb.incomingLinks().size() > 0
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/policies/ComponentEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::policies::i18n»
+«EXTENSION xpt::diagram::policies::ClassNames»
+«EXTENSION xpt::diagram::policies::ComponentEditPolicy»
+«EXTENSION xpt::diagram::LinkFinder»
+
+«DEFINE ComponentEditPolicy FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND createDeleteCommand-»
+ «EXPAND getDeleteViewCommand-»
+ «EXPAND canDeleteView-»
+«IF needsGetGraphicalEditPart()-»
+ «EXPAND getGraphicalEditPart-»
+«ENDIF-»
+ «EXPAND domainModelRemoveCommand-»
+ «EXPAND getDiagramElement-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE domainModelRemoveCommand FOR GenCommonBase»«ERROR "Unexpected type!"»«ENDDEFINE»
+
+«DEFINE domainModelRemoveCommand FOR GenNode-»
+«EXPAND xpt::commands::domainModelRemoveCommand::domainModelRemoveCommand("getDiagramNode()")-»
+«ENDDEFINE»
+
+«DEFINE domainModelRemoveCommand FOR GenLink-»
+«EXPAND xpt::commands::domainModelRemoveCommand::domainModelRemoveCommand("getDiagramEdge()")-»
+«ENDDEFINE»
+
+«DEFINE getDiagramElement FOR GenCommonBase»«ERROR "Unexpected type!"»«ENDDEFINE»
+
+«DEFINE getDiagramElement FOR GenNode-»
+«EXPAND getDiagramNode-»
+«ENDDEFINE»
+
+«DEFINE getDiagramElement FOR GenLink-»
+«EXPAND getDiagramEdge-»
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenCommonBase»«getComponentEditPolicyClassName()»«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenCommonBase»«getDiagram().editPoliciesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenCommonBase»extends org.eclipse.gmf.runtime.lite.edit.policies.ComponentEditPolicyEx«ENDDEFINE»
+
+«DEFINE createDeleteCommand FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command createDeleteCommand(org.eclipse.gef.requests.GroupRequest deleteRequest) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND getDiagramElementMethodName»().getDiagram().getElement());
+«LET incomingTypeLinks() AS incomingTypeLinks-»
+«LET outgoingNonPhantomLinks() AS outgoingLinks-»
+«IF incomingTypeLinks.size() > 0 || outgoingLinks.size() > 0-»
+ org.eclipse.gmf.runtime.lite.commands.CompositeWrappingCommand result = new org.eclipse.gmf.runtime.lite.commands.CompositeWrappingCommand(editingDomain, «EXPAND xpt::Externalizer::accessorCall(getDiagram().i18nKeyForDeleteModelElementLabel()) FOR getDiagram().editorGen»);
+«ENDIF-»
+ «EXPAND deleteIncomingLinks(incomingTypeLinks, true)-»
+ «EXPAND deleteOutgoingLinks(outgoingLinks, true)-»
+ «EXPAND createDeleteCommandPrim(true)-»
+«IF incomingTypeLinks.size() > 0 || outgoingLinks.size() > 0-»
+ result.add(cc);
+ return result;
+«ELSE-»
+ return new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(editingDomain, cc);
+«ENDIF-»
+«ENDLET-»
+«ENDLET-»
+}
+«ENDDEFINE»
+
+«DEFINE deleteIncomingLinks(Collection[gmfgen::GenLink] incomingLinks, boolean deleteFromModel) FOR gmfgen::GenCommonBase-»
+«IF incomingLinks.size() > 0-»
+ for(java.util.Iterator it = getGraphicalEditPart().getTargetConnections().iterator(); it.hasNext(); ) {
+ org.eclipse.gef.EditPart nextEditPart = (org.eclipse.gef.EditPart) it.next();
+ org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) nextEditPart.getModel();
+ int visualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(nextEdge);
+ switch (visualID) {
+«FOREACH incomingLinks AS nextLink-»
+ case «nextLink.getEditPartQualifiedClassName()».VISUAL_ID:
+«ENDFOREACH-»
+ «EXPAND deleteDependentLinks(deleteFromModel)-»
+ }
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE deleteOutgoingLinks(Collection[gmfgen::GenLink] outgoingLinks, boolean deleteFromModel) FOR gmfgen::GenCommonBase-»
+«IF outgoingLinks.size() > 0-»
+ for(java.util.Iterator it = getGraphicalEditPart().getSourceConnections().iterator(); it.hasNext(); ) {
+ org.eclipse.gef.EditPart nextEditPart = (org.eclipse.gef.EditPart) it.next();
+ org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) nextEditPart.getModel();
+ int visualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(nextEdge);
+ switch (visualID) {
+«FOREACH outgoingLinks AS nextLink-»
+ case «nextLink.getEditPartQualifiedClassName()».VISUAL_ID:
+«ENDFOREACH-»
+ «EXPAND deleteDependentLinks(deleteFromModel)-»
+ }
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE deleteDependentLinks(boolean deleteFromModel) FOR gmfgen::GenCommonBase-»
+{
+ org.eclipse.gef.requests.GroupRequest deleteLinkRequest = new org.eclipse.gef.requests.GroupRequest(«IF deleteFromModel»org.eclipse.gef.RequestConstants.REQ_DELETE«ELSE»org.eclipse.gmf.runtime.lite.requests.RequestConstants.REQ_FORCED_DELETE_VIEW«ENDIF»);
+ deleteLinkRequest.setEditParts(nextEditPart);
+ result.add(nextEditPart.getCommand(deleteLinkRequest));
+ break;
+}
+«ENDDEFINE»
+
+«DEFINE getGraphicalEditPart FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.GraphicalEditPart getGraphicalEditPart() {
+ return (org.eclipse.gef.GraphicalEditPart) getHost();
+}
+«ENDDEFINE»
+
+«DEFINE createDeleteCommandPrim(boolean deleteFromModel) FOR gmfgen::GenCommonBase»«ERROR "UnexpectedType"»«ENDDEFINE»
+
+«DEFINE createDeleteCommandPrim(boolean deleteFromModel) FOR gmfgen::GenNode-»
+org.eclipse.emf.common.command.CompoundCommand cc = new org.eclipse.emf.common.command.CompoundCommand();
+«IF deleteFromModel-»
+cc.append(createDomainModelRemoveCommand(editingDomain));
+«ENDIF-»
+cc.append(new org.eclipse.gmf.runtime.lite.commands.RemoveNotationalElementCommand((org.eclipse.gmf.runtime.notation.View) «EXPAND getDiagramElementMethodName»().eContainer(), «EXPAND getDiagramElementMethodName»()));
+«ENDDEFINE»
+
+«DEFINE createDeleteCommandPrim(boolean deleteFromModel) FOR gmfgen::GenLink-»
+org.eclipse.emf.common.command.CompoundCommand cc = new org.eclipse.emf.common.command.CompoundCommand();
+«IF deleteFromModel-»
+cc.append(createDomainModelRemoveCommand(editingDomain));
+«ENDIF-»
+cc.append(new org.eclipse.gmf.runtime.lite.commands.RemoveNotationalEdgeCommand(«EXPAND getDiagramElementMethodName»().getDiagram(), «EXPAND getDiagramElementMethodName»()));
+«ENDDEFINE»
+
+«DEFINE getDiagramElementMethodName FOR gmfgen::GenCommonBase»«ERROR "Unexpected type: " + this»«ENDDEFINE»
+«DEFINE getDiagramElementMethodName FOR gmfgen::GenNode»getDiagramNode«ENDDEFINE»
+«DEFINE getDiagramElementMethodName FOR gmfgen::GenLink»getDiagramEdge«ENDDEFINE»
+
+«DEFINE getDiagramNode FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.notation.Node «EXPAND getDiagramElementMethodName»() {
+ return (org.eclipse.gmf.runtime.notation.Node) getHost().getModel();
+}
+«ENDDEFINE»
+
+«DEFINE getDiagramEdge FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.notation.Edge «EXPAND getDiagramElementMethodName»() {
+ return (org.eclipse.gmf.runtime.notation.Edge) getHost().getModel();
+}
+«ENDDEFINE»
+
+«DEFINE getDeleteViewCommand FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getDeleteViewCommand(org.eclipse.gef.requests.GroupRequest deleteRequest, boolean isForced) {
+ if (!isForced && !canDeleteView()) {
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ }
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND getDiagramElementMethodName»().getDiagram().getElement());
+«LET incomingLinks() AS incomingLinks-»
+«LET outgoingLinks() AS outgoingLinks-»
+«IF incomingLinks.size() > 0 || outgoingLinks.size() > 0-»
+ org.eclipse.gmf.runtime.lite.commands.CompositeWrappingCommand result = new org.eclipse.gmf.runtime.lite.commands.CompositeWrappingCommand(editingDomain, «EXPAND xpt::Externalizer::accessorCall(getDiagram().i18nKeyForDeleteDiagramElementLabel()) FOR getDiagram().editorGen»);
+«ENDIF-»
+ «EXPAND deleteIncomingLinks(incomingLinks, false)-»
+ «EXPAND deleteOutgoingLinks(outgoingLinks, false)-»
+ «EXPAND createDeleteCommandPrim(false)-»
+«IF incomingLinks.size() > 0 || outgoingLinks.size() > 0-»
+ result.add(cc);
+ return result;
+«ELSE-»
+ return new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(editingDomain, cc);
+«ENDIF-»
+«ENDLET-»
+«ENDLET-»
+}
+«ENDDEFINE»
+
+«DEFINE canDeleteView FOR gmfgen::GenCommonBase»«ERROR "Unexpected Type: " + this»«ENDDEFINE»
+
+«DEFINE canDeleteView FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::generatedMemberComment»
+private boolean canDeleteView() {
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE canDeleteView FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+private boolean canDeleteView() {
+ if («EXPAND getDiagramElementMethodName»().getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
+ return true;
+ }
+ org.eclipse.gmf.runtime.notation.View parentView = (org.eclipse.gmf.runtime.notation.View) «EXPAND getDiagramElementMethodName»().eContainer();
+ if (parentView == null) {
+ return true;
+ }
+ org.eclipse.gmf.runtime.notation.CanonicalStyle canonicalStyle = (org.eclipse.gmf.runtime.notation.CanonicalStyle) parentView.getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getCanonicalStyle());
+ if (canonicalStyle != null) {
+ return !canonicalStyle.isCanonical();
+ }
+ return «!getDiagram().synchronized»;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForDeleteModelElementLabel())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForDeleteDiagramElementLabel())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDeleteModelElementLabel(), "Delete Model Element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDeleteDiagramElementLabel(), "Delete Diagram Element")-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/policies/ConnectionEndpointEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::policies::ClassNames»
+
+«DEFINE ConnectionEndpointEditPolicy FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+«EXPAND createSelectionHandles-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenLink»«getConnectionEndpointEditPolicyClassName()»«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenLink»«getDiagram().editPoliciesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenLink»extends org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy«ENDDEFINE»
+
+«DEFINE createSelectionHandles FOR gmfgen::GenLink-»
+«IF labels.size() > 0-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List createSelectionHandles() {
+ java.util.List result = super.createSelectionHandles();
+ for(java.util.Iterator it = getHost().getChildren().iterator(); it.hasNext(); ) {
+ org.eclipse.gef.EditPart next = (org.eclipse.gef.EditPart) it.next();
+ org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) next.getModel();
+ switch («getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(nextView)) {
+ «EXPAND addSelectionHandles FOREACH labels-»
+ }
+ }
+ return result;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addSelectionHandles FOR gmfgen::GenLinkLabel-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ result.addAll(((«getEditPartQualifiedClassName()») next).createSelectionHandles());
+ break;
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/policies/GraphicalNodeEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::policies::ClassNames»
+«EXTENSION xpt::diagram::Helper»
+«EXTENSION xpt::diagram::LinkFinder»
+«EXTENSION xpt::commands::CommandUtils»
+
+«DEFINE GraphicalNodeEditPolicy FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND getConnectionCreateCommand-»
+ «EXPAND getConnectionCompleteCommand-»
+ «EXPAND getReconnectSourceCommand-»
+ «EXPAND getReconnectTargetCommand-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenCommonBase»«getGraphicalNodeEditPolicyClassName()»«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenCommonBase»«getDiagram().editPoliciesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenCommonBase»extends org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy«ENDDEFINE»
+
+«DEFINE getConnectionCreateCommand FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getConnectionCreateCommand(org.eclipse.gef.requests.CreateConnectionRequest request) {
+«IF getDiagram().palette != null && outgoingLinks().size() > 0-»
+ if (request instanceof org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx) {
+ org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx requestEx = (org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx) request;
+ if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(requestEx.getModelID())) {
+ «EXPAND notApplicable-»
+ }
+ int[] visualIds = requestEx.getVisualIds();
+ org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
+ for (int i = 0; i < visualIds.length; i++) {
+ int nextVisualId = visualIds[i];
+ switch (nextVisualId) {
+«EXPAND getConnectionCreateCommandContribution FOREACH outgoingLinks()-»
+ }
+ }
+ if (!result.canExecute()) {
+ «EXPAND notApplicable-»
+ }
+ org.eclipse.gef.commands.Command wrappedResult = new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND xpt::diagram::policies::Common::getDiagramElementCode»), result);
+ request.setStartCommand(wrappedResult);
+ return wrappedResult;
+ }
+«ENDIF-»
+ «EXPAND notApplicable-»
+}
+«ENDDEFINE»
+
+«DEFINE getConnectionCreateCommandContribution FOR gmfgen::GenLink-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ result.appendIfCanExecute(new «getDiagram().editCommandsPackageName».«EXPAND xpt::commands::CreateLinkStartCommand::className»(requestEx));
+ break;
+«ENDDEFINE»
+
+«DEFINE getConnectionCompleteCommand FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getConnectionCompleteCommand(org.eclipse.gef.requests.CreateConnectionRequest request) {
+«IF getDiagram().palette != null && incomingLinks().size() > 0-»
+ if (request instanceof org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx) {
+ if (request.getStartCommand() == null || !request.getStartCommand().canExecute()) {
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ }
+ org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx requestEx = (org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx) request;
+ if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(requestEx.getModelID())) {
+ «EXPAND notApplicable-»
+ }
+ int[] visualIds = requestEx.getVisualIds();
+ org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
+ for (int i = 0; i < visualIds.length; i++) {
+ int nextVisualId = visualIds[i];
+ switch (nextVisualId) {
+«EXPAND getConnectionCompleteCommandContribution FOREACH incomingLinks()-»
+ }
+ }
+ if (result.getCommandList().size() != 1 || !result.canExecute()) {
+ //Cannot create several connections at once.
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ }
+ return request.getStartCommand().chain(new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND xpt::diagram::policies::Common::getDiagramElementCode»), result));
+ }
+«ENDIF-»
+ «EXPAND notApplicable-»
+}
+«ENDDEFINE»
+
+«DEFINE getConnectionCompleteCommandContribution FOR gmfgen::GenLink-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ result.appendIfCanExecute(new «getDiagram().editCommandsPackageName».«EXPAND xpt::commands::CreateLinkCompleteCommand::className»(requestEx));
+ break;
+«ENDDEFINE»
+
+«DEFINE getReconnectSourceCommand FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getReconnectSourceCommand(org.eclipse.gef.requests.ReconnectRequest request) {
+«IF outgoingLinks().size() > 0-»
+ org.eclipse.gef.ConnectionEditPart connection = request.getConnectionEditPart();
+ if (connection.getModel() instanceof org.eclipse.gmf.runtime.notation.Edge == false) {
+ «EXPAND notApplicable-»
+ }
+ org.eclipse.gmf.runtime.notation.Edge edge = (org.eclipse.gmf.runtime.notation.Edge)connection.getModel();
+ String modelID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(edge);
+ if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(modelID)) {
+ «EXPAND notApplicable-»
+ }
+ org.eclipse.emf.common.command.Command result = null;
+ int visualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(edge);
+ switch (visualID) {
+«EXPAND getReconnectSourceCommandContribution FOREACH outgoingLinks()-»
+ }
+ if (result == null || !result.canExecute()) {
+ «EXPAND notApplicable-»
+ }
+ return new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND xpt::diagram::policies::Common::getDiagramElementCode»), result);
+«ELSE-»
+ «EXPAND notApplicable-»
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE getReconnectSourceCommandContribution FOR gmfgen::GenLink-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ result = new «getDiagram().editCommandsPackageName».«EXPAND xpt::commands::ReconnectLinkSourceCommand::className»(request);
+ break;
+«ENDDEFINE»
+
+«DEFINE getReconnectTargetCommand FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getReconnectTargetCommand(org.eclipse.gef.requests.ReconnectRequest request) {
+«IF incomingLinks().size() > 0-»
+ org.eclipse.gef.ConnectionEditPart connection = request.getConnectionEditPart();
+ if (connection.getModel() instanceof org.eclipse.gmf.runtime.notation.Edge == false) {
+ «EXPAND notApplicable-»
+ }
+ org.eclipse.gmf.runtime.notation.Edge edge = (org.eclipse.gmf.runtime.notation.Edge)connection.getModel();
+ String modelID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(edge);
+ if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(modelID)) {
+ «EXPAND notApplicable-»
+ }
+ org.eclipse.emf.common.command.Command result = null;
+ int visualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(edge);
+ switch (visualID) {
+«EXPAND getReconnectTargetCommandContribution FOREACH incomingLinks()-»
+ }
+ if (result == null || !result.canExecute()) {
+ «EXPAND notApplicable-»
+ }
+ return new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND xpt::diagram::policies::Common::getDiagramElementCode»), result);
+«ELSE-»
+ «EXPAND notApplicable-»
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE getReconnectTargetCommandContribution FOR gmfgen::GenLink-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ result = new «getDiagram().editCommandsPackageName».«EXPAND xpt::commands::ReconnectLinkTargetCommand::className»(request);
+ break;
+«ENDDEFINE»
+
+/**
+ * Command is not applicable for the given request. Should return either null or
+ * org.eclipse.gef.commands.UnexecutableCommand.INSTANCE, but the same value everywhere.
+ */
+«DEFINE notApplicable FOR gmfgen::GenCommonBase-»
+return null;
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCommonBase»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/policies/LayoutEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,242 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::policies::ClassNames»
+«EXTENSION xpt::diagram::Helper»
+«EXTENSION xpt::commands::CommandUtils»
+
+«DEFINE LayoutEditPolicy FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND getCreateCommand(getDirectChildren())-»
+ «EXPAND createAddCommand(getDirectChildren())-»
+ «EXPAND createCloneCommand(getDirectChildren())-»
+ «EXPAND createChangeConstraintCommand(getDirectChildren())-»
+«IF needsXYLayout() && null != getDiagram().palette && getDirectChildren().size() > 0-»
+ «EXPAND showSizeOnDropFeedback-»
+ «EXPAND adjustConstraint(getDirectChildren())-»
+«ENDIF-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenContainerBase»«getLayoutEditPolicyClassName()»«ENDDEFINE»
+«DEFINE qualifiedClassName FOR gmfgen::GenContainerBase»«getDiagram().editPoliciesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE SideAffixedLayoutEditPolicy FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND SideAffixedClassName» «EXPAND SideAffixedSupertypes» {
+ «EXPAND getCreateCommand(getSideAffixedChildren())-»
+ «EXPAND createAddCommand(getSideAffixedChildren())-»
+ «EXPAND createCloneCommand(getSideAffixedChildren())-»
+ «EXPAND createChangeSideAffixedConstraintCommand(getSideAffixedChildren())-»
+«IF null != getDiagram().palette-»
+ «EXPAND showSizeOnDropFeedback-»
+ «EXPAND adjustConstraint(getSideAffixedChildren())-»
+ «EXPAND getExternalLabelsContainer-»
+«ENDIF-»
+ «EXPAND SideAffixedAdditions-»
+}
+«ENDDEFINE»
+
+«DEFINE SideAffixedClassName FOR gmfgen::GenContainerBase»«getSideAffixedLayoutEditPolicyClassName()»«ENDDEFINE»
+«DEFINE SideAffixedQualifiedClassName FOR gmfgen::GenContainerBase»«getDiagram().editPoliciesPackageName».«EXPAND SideAffixedClassName»«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenContainerBase-»
+«IF needsXYLayout()»extends org.eclipse.gmf.runtime.lite.edit.policies.XYLayoutEditPolicyEx«ELSE»extends org.eclipse.gmf.runtime.lite.edit.policies.ListLayoutEditPolicy«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE SideAffixedSupertypes FOR gmfgen::GenNode»extends org.eclipse.gmf.runtime.lite.edit.policies.SideAffixedLayoutEditPolicy«ENDDEFINE»
+
+«DEFINE getCreateCommand(Collection[gmfgen::GenNode] childNodes) FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
+«IF null != getDiagram().palette && childNodes.size() > 0-»
+ if (request instanceof org.eclipse.gmf.runtime.lite.requests.CreateRequestEx) {
+ org.eclipse.gmf.runtime.lite.requests.CreateRequestEx requestEx = (org.eclipse.gmf.runtime.lite.requests.CreateRequestEx) request;
+ if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(requestEx.getModelID())) {
+ return null;
+ }
+ int[] visualIds = requestEx.getVisualIds();
+ org.eclipse.emf.common.command.CompoundCommand result = new org.eclipse.emf.common.command.CompoundCommand();
+ for(int i = 0; i < visualIds.length; i++) {
+ int nextVisualId = visualIds[i];
+ switch (nextVisualId) {
+«EXPAND getCreateCommandContribution(this) FOREACH childNodes-»
+ }
+ }
+ return new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(«EXPAND xpt::diagram::policies::Common::getDiagramElementCode»), result);
+ }
+«ENDIF-»
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getCreateCommandContribution(gmfgen::GenContainerBase container) FOR gmfgen::GenNode-»
+«IF !sansDomain && !modelFacet.metaClass.ecoreClass.abstract-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ result.append(new «getDiagram().editCommandsPackageName».«EXPAND xpt::commands::CreateNodeCommand::className»(«EXPAND xpt::diagram::policies::Common::getViewCode FOR container», requestEx«IF container.needsXYLayout(this)», (org.eclipse.draw2d.geometry.Rectangle) getConstraintFor(request)«ENDIF»));
+ break;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createAddCommand(Collection[gmfgen::GenNode] childNodes) FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, Object constraint) {
+ if (child.getModel() instanceof org.eclipse.gmf.runtime.notation.Node) {
+ org.eclipse.gmf.runtime.notation.Node childNode = (org.eclipse.gmf.runtime.notation.Node) child.getModel();
+ String modelID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(childNode);
+ if («getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(modelID)) {
+ int newVisualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getNodeVisualID(«EXPAND xpt::diagram::policies::Common::getViewCode», childNode.getElement());
+ org.eclipse.emf.common.command.Command command = null;
+ switch (newVisualID) {
+«EXPAND getAddCommandContribution(this) FOREACH childNodes-»
+ }
+ if (command != null) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(childNode.getDiagram().getElement());
+ return new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(editingDomain, command);
+ }
+ }
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getAddCommandContribution(gmfgen::GenContainerBase container) FOR gmfgen::GenNode-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ command = new «getDiagram().editCommandsPackageName».«EXPAND xpt::commands::AddNodeCommand::className»(«EXPAND xpt::diagram::policies::Common::getViewCode FOR container», childNode, newVisualID, «IF container.needsXYLayout(this)»(org.eclipse.draw2d.geometry.Rectangle) constraint«ELSE»null«ENDIF»);
+ break;
+«ENDDEFINE»
+
+«DEFINE createCloneCommand(Collection[gmfgen::GenNode] childNodes) FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command createCloneCommand(org.eclipse.gef.EditPart child, Object constraint) {
+ if (child.getModel() instanceof org.eclipse.gmf.runtime.notation.Node) {
+ org.eclipse.gmf.runtime.notation.Node childNode = (org.eclipse.gmf.runtime.notation.Node) child.getModel();
+ String modelID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(childNode);
+ if («getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(modelID)) {
+ int newVisualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getNodeVisualID(«EXPAND xpt::diagram::policies::Common::getViewCode», childNode.getElement());
+ org.eclipse.emf.common.command.Command command = null;
+ switch (newVisualID) {
+«EXPAND getCloneCommandContribution(this) FOREACH childNodes-»
+ }
+ if (command != null) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(childNode.getDiagram().getElement());
+ return new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(editingDomain, command);
+ }
+ }
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getCloneCommandContribution(gmfgen::GenContainerBase container) FOR gmfgen::GenNode-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ command = new «getDiagram().editCommandsPackageName».«EXPAND xpt::commands::CloneNodeCommand::className»(«EXPAND xpt::diagram::policies::Common::getViewCode FOR container», childNode, «IF container.needsXYLayout(this)»(org.eclipse.draw2d.geometry.Rectangle) constraint«ELSE»null«ENDIF»);
+ break;
+«ENDDEFINE»
+
+«DEFINE createChangeConstraintCommand(Collection[gmfgen::GenNode] childNodes) FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE createChangeConstraintCommand(Collection[gmfgen::GenNode] childNodes) FOR gmfgen::GenNode-»
+«IF needsXYLayout()-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command createChangeConstraintCommand(org.eclipse.gef.requests.ChangeBoundsRequest request, org.eclipse.gef.EditPart child, Object constraint) {
+«IF hasDirectChildren()-»
+ if ((«EXPAND xpt::diagram::policies::Common::getCastToEditPart»).isDirectChild(child)) {
+ return super.createChangeConstraintCommand(request, child, constraint);
+ }
+«ENDIF-»
+ return null;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createChangeSideAffixedConstraintCommand(Collection[gmfgen::GenNode] childNodes) FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command createChangeConstraintCommand(org.eclipse.gef.requests.ChangeBoundsRequest request, org.eclipse.gef.EditPart child, Object constraint) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE showSizeOnDropFeedback FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void showSizeOnDropFeedback(org.eclipse.gef.requests.CreateRequest request) {
+ org.eclipse.draw2d.IFigure feedback = getSizeOnDropFeedback(request);
+ org.eclipse.draw2d.geometry.Rectangle rect = new org.eclipse.draw2d.geometry.Rectangle(request.getLocation(), request.getSize());
+ getLayoutContainer().translateToRelative(rect);
+ adjustConstraint(request, rect);
+ getLayoutContainer().translateToAbsolute(rect);
+ feedback.translateToRelative(rect);
+ feedback.setBounds(rect.expand(getCreationFeedbackOffset(request)));
+}
+«ENDDEFINE»
+
+«DEFINE adjustConstraint(Collection[gmfgen::GenNode] childNodes) FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void adjustConstraint(org.eclipse.gef.requests.CreateRequest request, org.eclipse.draw2d.geometry.Rectangle constraint) {
+ if (request instanceof org.eclipse.gmf.runtime.lite.requests.CreateRequestEx) {
+ org.eclipse.gmf.runtime.lite.requests.CreateRequestEx requestEx = (org.eclipse.gmf.runtime.lite.requests.CreateRequestEx) request;
+ if («getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(requestEx.getModelID())) {
+ int[] visualIds = requestEx.getVisualIds();
+ boolean adjusted = false;
+ for(int i = 0; i < visualIds.length && !adjusted; i++) {
+ int nextVisualId = visualIds[i];
+ switch (nextVisualId) {
+«EXPAND adjustConstraint FOREACH childNodes-»
+ }
+ }
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE adjustConstraint FOR gmfgen::GenNode-»
+«IF !sansDomain && !modelFacet.metaClass.ecoreClass.abstract-»
+case «getEditPartQualifiedClassName()».VISUAL_ID: {
+ «EXPAND xpt::commands::Common::adjustConstraint-»
+ «EXPAND adjustConstraintLocation-»
+ adjusted = true;
+ break;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE adjustConstraintLocation FOR gmfgen::GenNode-»
+«ENDDEFINE»
+
+«DEFINE adjustConstraintLocation FOR gmfgen::GenChildSideAffixedNode-»
+org.eclipse.gmf.runtime.lite.figures.SideAffixedFeedbackPositioner elementPositioner = getSideAffixedElementPositionerForRequest(request);
+elementPositioner.setSiblingsParent(getExternalLabelsContainer());
+constraint.setBounds(elementPositioner.getValidLocation(constraint));
+«ENDDEFINE»
+
+«DEFINE getExternalLabelsContainer FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.draw2d.IFigure getExternalLabelsContainer() {
+ org.eclipse.gef.editparts.LayerManager root = (org.eclipse.gef.editparts.LayerManager) getHost().getRoot();
+ return root.getLayer(«getDiagram().getEditPartFactoryQualifiedClassName()».EXTERNAL_NODE_LABELS_LAYER);
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenContainerBase»«ENDDEFINE»
+«DEFINE SideAffixedAdditions FOR gmfgen::GenContainerBase»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/policies/OpenDiagramEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE OpenDiagramEditPolicy FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::copyright FOR subject.getDiagram().editorGen-»
+package «subject.getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPolicyClassName» «EXPAND supertypes» {
+ «EXPAND commandForRequest-»
+
+ «EXPAND commandForView-»
+
+ «EXPAND OpenDiagramCommandClass-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::OpenDiagramBehaviour»extends org.eclipse.gmf.runtime.lite.edit.policies.OpenDiagramEditPolicy«ENDDEFINE»
+
+«DEFINE commandForRequest FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getOpenCommand(org.eclipse.gef.Request openRequest) {
+ org.eclipse.gef.EditPart targetEditPart = getTargetEditPart(openRequest);
+ if (false == targetEditPart.getModel() instanceof org.eclipse.gmf.runtime.notation.View) {
+ return null;
+ }
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) targetEditPart.getModel();
+ return getOpenCommand(view);
+}
+«ENDDEFINE»
+
+«DEFINE commandForView FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getOpenCommand(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gmf.runtime.notation.Style linkStyle = view.getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getHintedDiagramLinkStyle());
+ if (false == linkStyle instanceof org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle) {
+ return null;
+ }
+ org.eclipse.emf.transaction.TransactionalEditingDomain domain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(linkStyle);
+ org.eclipse.emf.common.command.Command result = new «EXPAND commandClassName»((org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle) linkStyle);
+ return new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(domain, result);
+}
+«ENDDEFINE»
+
+«DEFINE commandClassName FOR gmfgen::OpenDiagramBehaviour»OpenDiagramCommand«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClass FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedClassComment»
+protected static class «EXPAND commandClassName» «EXPAND OpenDiagramCommandSupertypes» {
+ «EXPAND OpenDiagramCommandClassAttributes-»
+
+ «EXPAND OpenDiagramCommandClassCtors-»
+
+ «EXPAND OpenDiagramCommandClassPrepare-»
+
+ «EXPAND OpenDiagramCommandClassExecute-»
+
+ «EXPAND OpenDiagramCommandClassRedo-»
+
+ «EXPAND OpenDiagramCommandClassCanUndo-»
+
+ «EXPAND OpenDiagramCommandClassGetDiagramToOpen-»
+
+ «EXPAND OpenDiagramCommandClassCreateNewDiagram-»
+
+ «EXPAND OpenDiagramCommandClassGetDiagramDomainElement-»
+
+ «EXPAND OpenDiagramCommandClassAddToResource-»
+
+ «EXPAND OpenDiagramCommandClassGetDiagramKind-»
+
+ «EXPAND OpenDiagramCommandClassGetID-»
+
+ «EXPAND OpenDiagramCommandClassAdditions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::OpenDiagramBehaviour»«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandSupertypes FOR gmfgen::OpenDiagramBehaviour»extends org.eclipse.emf.common.command.AbstractCommand«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassAttributes FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+private final org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle myDiagramLink;
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassCtors FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected «EXPAND commandClassName»(org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle linkStyle) {
+ myDiagramLink = linkStyle;
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassPrepare FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected boolean prepare() {
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassExecute FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void execute() {
+ org.eclipse.gmf.runtime.notation.Diagram diagramToOpen = getDiagramToOpen();
+ if (diagramToOpen == null) {
+ diagramToOpen = createNewDiagram();
+ }
+ org.eclipse.ui.IWorkbenchPage page = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+«IF openAsEclipseEditor-»
+ «EXPAND xpt::navigator::getEditorInput::defineURIEditorInput("diagramToOpen", "editorInput") FOR subject.getDiagram()-»
+ try {
+ page.openEditor(editorInput, «EXPAND getIDName»());
+ } catch (org.eclipse.ui.PartInitException e) {
+ «subject.getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while opening diagram", e); «EXPAND xpt::Common::nonNLS»
+ }
+«ELSE-»
+ try {
+ org.eclipse.gmf.runtime.lite.parts.DiagramViewPart diagramView = (org.eclipse.gmf.runtime.lite.parts.DiagramViewPart)page.showView(«EXPAND getIDName»());
+ org.eclipse.emf.common.util.URI diagramURI = org.eclipse.emf.ecore.util.EcoreUtil.getURI(diagramToOpen);
+ diagramView.showDiagram(null, diagramURI);
+ } catch (org.eclipse.ui.PartInitException e) {
+ «subject.getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while opening diagram", e); «EXPAND xpt::Common::nonNLS»
+ }
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassRedo FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void redo() {
+ execute();
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassCanUndo FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean canUndo() {
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassGetDiagramToOpen FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.notation.Diagram getDiagramToOpen() {
+ org.eclipse.gmf.runtime.notation.Diagram result = myDiagramLink.getDiagramLink();
+ if (result != null && result.getType().equals(getDiagramKind())) {
+ return result;
+ }
+ return null;
+}
+«ENDDEFINE»
+«DEFINE OpenDiagramCommandClassCreateNewDiagram FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.notation.Diagram createNewDiagram() {
+ org.eclipse.gmf.runtime.notation.Diagram result = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();
+ myDiagramLink.setDiagramLink(result);
+ result.setElement(getDiagramDomainElement());
+ addToResource(result);
+ try {
+ for (java.util.Iterator it = myDiagramLink.eResource().getResourceSet().getResources().iterator(); it.hasNext(); ) {
+ org.eclipse.emf.ecore.resource.Resource next = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ if (next.isLoaded() && !«subject.getDiagram().getDiagramEditorUtilQualifiedClassName()».isReadOnly(next)) {
+ next.save(«subject.getDiagram().getDiagramEditorUtilQualifiedClassName()».getSaveOptions());
+ }
+ }
+ } catch (java.io.IOException e) {
+ «subject.getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while creating diagram", e); «EXPAND xpt::Common::nonNLS»
+ }
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassGetDiagramDomainElement FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment("Returns the element that should be the underlying model element for the diagram.\n" +
+"By default, the element associated with the edit part is returned.")»
+protected org.eclipse.emf.ecore.EObject getDiagramDomainElement() {
+ return ((org.eclipse.gmf.runtime.notation.View) myDiagramLink.eContainer()).getElement();
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassAddToResource FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment("Adds the created diagram to a resource. By default, the diagram is added to the resource which contains the initiating diagram.")»
+protected void addToResource(org.eclipse.gmf.runtime.notation.Diagram diagram) {
+ assert diagram.eResource() == null;
+ assert myDiagramLink.eResource() != null;
+ myDiagramLink.eResource().getContents().add(diagram);
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassGetDiagramKind FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected String getDiagramKind() {
+ return «IF diagramKind == null»«EXPAND xpt::editor::VisualIDRegistry::modelID FOR subject.getDiagram()»;«ELSE»"«diagramKind»"; «EXPAND xpt::Common::nonNLS»«ENDIF»
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassGetID FOR gmfgen::OpenDiagramBehaviour-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected String «EXPAND getIDName»() {
+ return «IF editorID == null»«subject.getDiagram().editorGen.editor.getQualifiedClassName()».ID;«ELSE»"«editorID»"; «EXPAND xpt::Common::nonNLS»«ENDIF»
+}
+«ENDDEFINE»
+
+«DEFINE getIDName FOR gmfgen::OpenDiagramBehaviour-»
+«IF openAsEclipseEditor»getEditorID«ELSE»getViewID«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE OpenDiagramCommandClassAdditions FOR gmfgen::OpenDiagramBehaviour»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/policies/i18n.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+String i18nKeyForDeleteModelElementLabel(gmfgen::GenDiagram diagram) :
+ diagram.editorGen.modelID + ".DeleteModelElementLabel"
+;
+
+String i18nKeyForDeleteDiagramElementLabel(gmfgen::GenDiagram diagram) :
+ diagram.editorGen.modelID + ".DeleteDiagramElementLabel"
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/preferences/AppearancePreferencePage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DiagramAppearancePreferencePage«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«preferencesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE preferenceInitializerClassName FOR gmfgen::GenDiagram»PreferenceInitializer«ENDDEFINE»
+«DEFINE preferenceInitializerQualifiedClassName FOR gmfgen::GenDiagram»«EXPAND qualifiedClassName»$«EXPAND preferenceInitializerClassName»«ENDDEFINE»
+
+«DEFINE AppearancePreferencePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «preferencesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND xpt::diagram::preferences::Common::doGetPreferenencePage-»
+ «EXPAND PreferenceInitializer-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.gmf.runtime.lite.preferences.ColorsAndFontsPreferencePage«ENDDEFINE»
+
+«DEFINE PreferenceInitializer FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedClassComment»
+public static class «EXPAND preferenceInitializerClassName» «EXPAND PreferenceInitializer_supertypes» {
+ «EXPAND PreferenceInitializer_ctor-»
+ «EXPAND PreferenceInitializer_preferences FOR preferences-»
+ «EXPAND PreferenceInitializer_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE PreferenceInitializer_supertypes FOR gmfgen::GenDiagram»extends org.eclipse.gmf.runtime.lite.preferences.ColorsAndFontsPreferencePage.ColorsAndFontsPreferenceInitializer«ENDDEFINE»
+
+«DEFINE PreferenceInitializer_ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND preferenceInitializerClassName»() {
+ super(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore());
+}
+«ENDDEFINE»
+
+«DEFINE PreferenceInitializer_preferences FOR gmfgen::GenDiagramPreferences-»
+«EXPAND getDefaultFontData FOR defaultFont-»
+«EXPAND getDefaultColor("getDefaultFontColor") FOR fontColor-»
+«EXPAND getDefaultColor("getDefaultFillColor") FOR fillColor-»
+«EXPAND getDefaultColor("getDefaultLineColor") FOR lineColor-»
+«ENDDEFINE»
+
+«DEFINE getDefaultFontData FOR gmfgen::GenFont-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.graphics.FontData getDefaultFontData() {
+ return «EXPAND fontData»;
+}
+«ENDDEFINE»
+
+«DEFINE fontData FOR gmfgen::GenFont-»
+«ERROR "Unknown font: " + this»
+«ENDDEFINE»
+
+«DEFINE fontData FOR gmfgen::GenCustomFont-»
+new org.eclipse.swt.graphics.FontData("«name»", «height», org.eclipse.swt.SWT.«style»)
+«ENDDEFINE»
+
+«DEFINE fontData FOR gmfgen::GenStandardFont-»
+org.eclipse.jface.resource.JFaceResources.get«name»Font().getFontData()
+«ENDDEFINE»
+
+«DEFINE getDefaultColor(String methodName) FOR gmfgen::GenColor-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.graphics.RGB «methodName»() {
+ return «EXPAND rgb»;
+}
+«ENDDEFINE»
+
+«DEFINE rgb FOR gmfgen::GenColor-»
+«ERROR "Unknown colour: " + this»
+«ENDDEFINE»
+
+«DEFINE rgb FOR gmfgen::GenConstantColor-»
+«REM»TODO: support DIAGRAM_* constants«ENDREM»
+«IF this.name.value > gmfgen::DiagramColors::darkBlue.value»«ERROR "Color constant not supported: " + this»«ENDIF-»
+org.eclipse.draw2d.ColorConstants.«name».getRGB()
+«ENDDEFINE»
+
+«DEFINE rgb FOR gmfgen::GenRGBColor-»
+new org.eclipse.swt.graphics.RGB(«red», «green», «blue»)
+«ENDDEFINE»
+
+«DEFINE PreferenceInitializer_additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/preferences/Common.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE doGetPreferenencePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.jface.preference.IPreferenceStore doGetPreferenceStore() {
+ return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore();
+}
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/preferences/GeneralPreferencePage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DiagramGeneralPreferencePage«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«preferencesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE preferenceInitializerClassName FOR gmfgen::GenDiagram»PreferenceInitializer«ENDDEFINE»
+«DEFINE preferenceInitializerQualifiedClassName FOR gmfgen::GenDiagram»«EXPAND qualifiedClassName»$«EXPAND preferenceInitializerClassName»«ENDDEFINE»
+
+«DEFINE GeneralPreferencePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «preferencesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND createFieldEditors-»
+ «EXPAND xpt::diagram::preferences::Common::doGetPreferenencePage-»
+ «EXPAND init-»
+ «EXPAND PreferenceInitializer-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.jface.preference.FieldEditorPreferencePage implements org.eclipse.ui.IWorkbenchPreferencePage«ENDDEFINE»
+
+«DEFINE createFieldEditors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void createFieldEditors() {
+}
+«ENDDEFINE»
+
+«DEFINE init FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void init(org.eclipse.ui.IWorkbench workbench) {
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE PreferenceInitializer FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedClassComment»
+public static class «EXPAND preferenceInitializerClassName» «EXPAND PreferenceInitializer_supertypes» {
+ «EXPAND PreferenceInitializer_initializeDefaultPreferences-»
+ «EXPAND PreferenceInitializer_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE PreferenceInitializer_supertypes FOR gmfgen::GenDiagram»extends org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer«ENDDEFINE»
+
+«DEFINE PreferenceInitializer_initializeDefaultPreferences FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void initializeDefaultPreferences() {
+}
+«ENDDEFINE»
+
+«DEFINE PreferenceInitializer_additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/preferences/Util.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+Boolean hasSupportedPreferencePages(Collection[gmfgen::GenPreferencePage] pages) :
+ pages.exists(e| e.isSupported() || e.children.hasSupportedPreferencePages())
+;
+
+//TODO: support more page types
+Boolean isSupported(gmfgen::GenPreferencePage page) :
+ false
+;
+
+Boolean isSupported(gmfgen::GenCustomPreferencePage page) :
+ true
+;
+
+Boolean isSupported(gmfgen::GenStandardPreferencePage page) :
+ gmfgen::StandardPreferencePages::Appearance.value == page.kind.value ||
+ gmfgen::StandardPreferencePages::General.value == page.kind.value
+;
+
+Boolean hasPreferencePagesWithInitializers(Collection[gmfgen::GenPreferencePage] pages) :
+ pages.exists(e| e.hasInitializer() || e.children.hasPreferencePagesWithInitializers())
+;
+
+Boolean hasInitializer(gmfgen::GenPreferencePage page) :
+ false
+;
+
+Boolean hasInitializer(gmfgen::GenStandardPreferencePage page) :
+ //All standard preference pages are initialized in the same way
+ page.isSupported()
+;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/diagram/preferences/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::preferences::Util»
+
+«DEFINE extensions FOR gmfgen::GenDiagram-»
+«EXPAND preferencePages-»
+«EXPAND preferenceInitializers-»
+«ENDDEFINE»
+
+«DEFINE preferencePages FOR gmfgen::GenDiagram-»
+«IF preferencePages.hasSupportedPreferencePages()-»
+ <extension point="org.eclipse.ui.preferencePages">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+«EXPAND preferencePage FOREACH preferencePages-»
+ </extension>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE preferenceInitializers FOR gmfgen::GenDiagram-»
+«IF preferencePages.hasPreferencePagesWithInitializers()-»
+ <extension point="org.eclipse.core.runtime.preferences">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+«EXPAND preferenceInitializer FOREACH preferencePages-»
+ </extension>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE preferencePage FOR gmfgen::GenPreferencePage-»
+«IF isSupported()-»
+ <page
+ id="«iD»"
+ name="%preference.page.title.«iD»"
+«IF null != parent-»
+ category="«parent.iD»"
+«ENDIF-»
+ class="«EXPAND qualifiedClassName»">
+ </page>
+«ENDIF-»
+«EXPAND preferencePage FOREACH children-»
+«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenPreferencePage»
+«ERROR "Unknown preference page: " + this»
+«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenCustomPreferencePage»«qualifiedClassName»«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenStandardPreferencePage-»
+«IF gmfgen::StandardPreferencePages::General.value == kind.value-»
+«EXPAND xpt::diagram::preferences::GeneralPreferencePage::qualifiedClassName FOR getDiagram()-»
+«ELSEIF gmfgen::StandardPreferencePages::Appearance.value == kind.value-»
+«EXPAND xpt::diagram::preferences::AppearancePreferencePage::qualifiedClassName FOR getDiagram()-»
+«REM»TODO: accept more standard preferences, do not forget to register them with Util.ext«ENDREM»«ELSE-»
+«ERROR "Unknown preference page: " + this»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE preferenceInitializer FOR gmfgen::GenPreferencePage»
+«IF hasInitializer()-»
+<initializer class="«EXPAND preferenceInitializerQualifiedClassName»"/>
+«ENDIF-»
+«EXPAND preferenceInitializer FOREACH children-»
+«ENDDEFINE»
+
+«DEFINE preferenceInitializerQualifiedClassName FOR gmfgen::GenPreferencePage-»
+«ERROR "Unknown preference page: " + this»
+«ENDDEFINE»
+
+«DEFINE preferenceInitializerQualifiedClassName FOR gmfgen::GenStandardPreferencePage-»
+«IF gmfgen::StandardPreferencePages::General.value == kind.value-»
+«EXPAND xpt::diagram::preferences::GeneralPreferencePage::preferenceInitializerQualifiedClassName FOR getDiagram()-»
+«ELSEIF gmfgen::StandardPreferencePages::Appearance.value == kind.value-»
+«EXPAND xpt::diagram::preferences::AppearancePreferencePage::preferenceInitializerQualifiedClassName FOR getDiagram()-»
+«REM»TODO: accept more standard preferences, do not forget to register them with Util.ext«ENDREM»«ELSE-»
+«ERROR "Unknown preference page: " + this»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18n FOR gmfgen::GenDiagram-»
+
+# Preferences
+«EXPAND internal_i18n FOREACH preferencePages»
+«ENDDEFINE»
+
+«DEFINE internal_i18n FOR gmfgen::GenPreferencePage-»
+«IF isSupported()-»
+preference.page.title.«iD»=«name»
+«ENDIF-»
+«EXPAND internal_i18n FOREACH children-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/ActionBarContributor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::editor::i18n»
+
+«DEFINE ActionBarContributor FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment("The action bar contributor for the " + editorGen.domainGenModel.modelName + " editor.")»
+public class «actionBarContributorClassName» «EXPAND supertypes» {
+ «EXPAND attributes-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void buildActions() {
+ «EXPAND fillActions-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void declareGlobalActionKeys() {
+ «EXPAND addGlobalActionKeys-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void contributeToMenu(org.eclipse.jface.action.IMenuManager menuManager) {
+ super.contributeToMenu(menuManager);
+
+ «EXPAND menuContribution-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void contributeToToolBar(org.eclipse.jface.action.IToolBarManager toolBarManager) {
+ super.contributeToToolBar(toolBarManager);
+
+ «EXPAND toolBarContribution-»
+ }
+
+«IF !eclipseEditor-»
+ «EXPAND viewSpecific-»
+«ENDIF-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenEditorView»extends org.eclipse.gef.ui.actions.ActionBarContributor«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenEditorView-»
+«IF !eclipseEditor-»
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.List globalActionKeys = new java.util.ArrayList();
+
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gef.ui.actions.ZoomComboContributionItem myZoomContributionItem;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE fillActions FOR gmfgen::GenEditorView-»
+addRetargetAction(new org.eclipse.gef.ui.actions.UndoRetargetAction());
+addRetargetAction(new org.eclipse.gef.ui.actions.RedoRetargetAction());
+addRetargetAction(new org.eclipse.gef.ui.actions.DeleteRetargetAction());
+
+addRetargetAction(new org.eclipse.gef.ui.actions.ZoomInRetargetAction());
+addRetargetAction(new org.eclipse.gef.ui.actions.ZoomOutRetargetAction());
+«ENDDEFINE»
+
+«DEFINE addGlobalActionKeys FOR gmfgen::GenEditorView-»
+addGlobalActionKey(org.eclipse.ui.actions.ActionFactory.PRINT.getId());
+addGlobalActionKey(org.eclipse.ui.actions.ActionFactory.DELETE.getId());
+«ENDDEFINE»
+
+«DEFINE viewSpecific FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void addGlobalActionKey(String key) {
+ super.addGlobalActionKey(key);
+ globalActionKeys.add(key);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public void updateGlobalActions(org.eclipse.ui.IViewPart viewPart) {
+ org.eclipse.gef.ui.actions.ActionRegistry registry = viewPart == null ? null : (org.eclipse.gef.ui.actions.ActionRegistry) viewPart.getAdapter(org.eclipse.gef.ui.actions.ActionRegistry.class);
+ org.eclipse.ui.IActionBars bars = getActionBars();
+ if (registry == null) {
+ bars.clearGlobalActionHandlers();
+ } else {
+ for (int i = 0; i < globalActionKeys.size(); i++) {
+ String id = (String) globalActionKeys.get(i);
+ bars.setGlobalActionHandler(id, registry.getAction(id));
+ }
+ }
+ org.eclipse.gef.editparts.ZoomManager zoomManager = viewPart == null ? null : (org.eclipse.gef.editparts.ZoomManager) viewPart.getAdapter(org.eclipse.gef.editparts.ZoomManager.class);
+ myZoomContributionItem.setZoomManager(zoomManager);
+ bars.updateActionBars();
+}
+«ENDDEFINE»
+
+«DEFINE menuContribution FOR gmfgen::GenEditorView-»
+«IF eclipseEditor-»
+ // add a "View" menu after "Edit"
+ org.eclipse.jface.action.MenuManager viewMenu = new org.eclipse.jface.action.MenuManager(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForActionBarContributorViewMenu()) FOR editorGen»);
+ viewMenu.add(getAction(org.eclipse.gef.ui.actions.GEFActionConstants.ZOOM_IN));
+ viewMenu.add(getAction(org.eclipse.gef.ui.actions.GEFActionConstants.ZOOM_OUT));
+
+ menuManager.insertAfter(org.eclipse.ui.IWorkbenchActionConstants.M_EDIT, viewMenu);
+«ELSE-»
+ menuManager.add(getAction(org.eclipse.gef.ui.actions.GEFActionConstants.ZOOM_IN));
+ menuManager.add(getAction(org.eclipse.gef.ui.actions.GEFActionConstants.ZOOM_OUT));
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE toolBarContribution FOR gmfgen::GenEditorView-»
+ toolBarManager.add(getAction(org.eclipse.ui.actions.ActionFactory.UNDO.getId()));
+ toolBarManager.add(getAction(org.eclipse.ui.actions.ActionFactory.REDO.getId()));
+
+ toolBarManager.add(new org.eclipse.jface.action.Separator());
+«IF eclipseEditor-»
+ toolBarManager.add(new org.eclipse.gef.ui.actions.ZoomComboContributionItem(getPage()));
+«ELSE-»
+ myZoomContributionItem = new org.eclipse.gef.ui.actions.ZoomComboContributionItem(getPage());
+ toolBarManager.add(myZoomContributionItem);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenEditorView»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForActionBarContributorViewMenu())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForActionBarContributorViewMenu(), "View")-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/Common.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE createEditingDomain FOR gmfgen::GenEditorGenerator»org.eclipse.emf.workspace.WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain()«ENDDEFINE»
+
+«DEFINE wizardDialogSettings(String wizardVarName, String sectionName) FOR gmfgen::GenDiagram-»
+org.eclipse.jface.dialogs.IDialogSettings pluginDialogSettings = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getDialogSettings();
+org.eclipse.jface.dialogs.IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection("«sectionName»"); «EXPAND xpt::Common::nonNLS»
+if (wizardDialogSettings == null) {
+ wizardDialogSettings = pluginDialogSettings.addNewSection("«sectionName»"); «EXPAND xpt::Common::nonNLS»
+}
+«wizardVarName».setDialogSettings(wizardDialogSettings);
+«ENDDEFINE»
+
+«DEFINE setDefaultShellSize(String shellVar) FOR gmfgen::GenDiagram-»
+«shellVar».setSize(Math.max(500, «shellVar».getSize().x), 500);
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/CreateShortcutAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::editor::i18n»
+«EXTENSION xpt::editor::Wizard»
+
+«DEFINE CreateShortcutAction FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «createShortcutActionClassName» «EXPAND supertypes» {
+ «EXPAND CREATE_SHORTCUT_ACTION-»
+ «EXPAND ctor-»
+ «EXPAND init-»
+ «EXPAND calculateEnabled-»
+ «EXPAND run-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.gef.ui.actions.WorkbenchPartAction«ENDDEFINE»
+
+«DEFINE CREATE_SHORTCUT_ACTION FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static final String CREATE_SHORTCUT_ACTION = "CreateShortcut"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «createShortcutActionClassName»(org.eclipse.ui.IWorkbenchPart part) {
+ super(part);
+}
+«ENDDEFINE»
+
+«DEFINE init FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void init() {
+ super.init();
+ setId(CREATE_SHORTCUT_ACTION);
+ setText(«EXPAND xpt::Externalizer::accessorCall(i18nForCreateShortcutActionLabel()) FOR editorGen»);
+ setToolTipText(«EXPAND xpt::Externalizer::accessorCall(i18nForCreateShortcutActionTooltip()) FOR editorGen»);
+}
+«ENDDEFINE»
+
+«DEFINE calculateEnabled FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected boolean calculateEnabled() {
+ org.eclipse.gef.GraphicalViewer graphicalViewer = (org.eclipse.gef.GraphicalViewer) getWorkbenchPart().getAdapter(org.eclipse.gef.GraphicalViewer.class);
+ if (graphicalViewer == null) {
+ return false;
+ }
+ return graphicalViewer.getContents().getModel() instanceof org.eclipse.gmf.runtime.notation.Diagram;
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void run() {
+ org.eclipse.gef.GraphicalViewer graphicalViewer = (org.eclipse.gef.GraphicalViewer) getWorkbenchPart().getAdapter(org.eclipse.gef.GraphicalViewer.class);
+ org.eclipse.gmf.runtime.notation.Diagram diagram = (org.eclipse.gmf.runtime.notation.Diagram) graphicalViewer.getContents().getModel();
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(diagram.getElement());
+«IF isRichClientPlatform()-»
+ org.eclipse.jface.wizard.Wizard wizard = new «EXPAND xpt::editor::ShortcutCreationWizard::qualifiedClassName»(diagram, editingDomain, graphicalViewer);
+ «EXPAND xpt::editor::Common::wizardDialogSettings("wizard", "CreateShortcut")-»
+ wizard.setWindowTitle(«EXPAND xpt::Externalizer::accessorCall(i18nForCreateShortcutActionWizardWindowTitle()) FOR editorGen»);
+ org.eclipse.jface.wizard.WizardDialog dialog = new org.eclipse.jface.wizard.WizardDialog(«EXPAND getShell», wizard);
+ dialog.create();
+ «EXPAND xpt::editor::Common::setDefaultShellSize("dialog.getShell()")-»
+ dialog.open();
+«ELSE-»
+ «getElementChooserQualifiedClassName()» elementChooser = new «getElementChooserQualifiedClassName()»(«EXPAND getShell», diagram, graphicalViewer);
+ int result = elementChooser.open();
+ if (result != org.eclipse.jface.window.Window.OK) {
+ return;
+ }
+ org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand createShortcutCommand = elementChooser.getCreateShortcutCommand();
+ if (createShortcutCommand == null || !createShortcutCommand.canExecute()) {
+ return;
+ }
+ if (graphicalViewer.getEditDomain() != null && graphicalViewer.getEditDomain().getCommandStack() != null) {
+ graphicalViewer.getEditDomain().getCommandStack().execute(new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(editingDomain, createShortcutCommand));
+ } else {
+ new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(editingDomain, createShortcutCommand).execute();
+ }
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE getShell FOR gmfgen::GenDiagram»getWorkbenchPart().getSite().getShell()«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF generateCreateShortcutAction()-»
+«EXPAND xpt::Externalizer::accessorField(i18nForCreateShortcutActionLabel())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForCreateShortcutActionTooltip())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForCreateShortcutActionWizardWindowTitle())-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF generateCreateShortcutAction()-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForCreateShortcutActionLabel(), "Create sh&ortcut...")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForCreateShortcutActionTooltip(), "Creates a shortcut on the diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForCreateShortcutActionWizardWindowTitle(), "Create shortcut")-»
+«ENDIF-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/CreationWizard.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::editor::Wizard»
+«EXTENSION xpt::editor::i18n»
+
+«DEFINE wizardBannerStem FOR genmodel::GenClass»«genPackage.prefix»«ENDDEFINE»
+
+«DEFINE wizardBannerStem FOR gmfgen::GenDiagram»«IF domainDiagramElement == null»«editorGen.diagramFileExtension»«ELSE»«EXPAND wizardBannerStem FOR domainDiagramElement»«ENDIF»«ENDDEFINE»
+
+«DEFINE wizardBannerLocation FOR gmfgen::GenDiagram»icons/wizban/New«EXPAND wizardBannerStem FOR domainDiagramElement»Wizard.gif«ENDDEFINE»
+
+«DEFINE CreationWizard FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «creationWizardClassName» «EXPAND supertypes» {
+ «EXPAND diagramFile-»
+
+ «EXPAND page-»
+
+ «EXPAND addPages-»
+
+ «EXPAND init-»
+
+ «EXPAND performFinish-»
+
+ «EXPAND getResult-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends «IF null == editorGen.application»org.eclipse.ui.wizards.newresource.BasicNewResourceWizard«ELSE»org.eclipse.jface.wizard.Wizard«ENDIF» implements org.eclipse.ui.INewWizard«ENDDEFINE»
+«DEFINE diagramFile FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «EXPAND createdDiagramFileType» «EXPAND createdDiagramFileAttributeName»;
+«ENDDEFINE»
+
+«DEFINE page FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+ private «getCreationWizardPageQualifiedClassName()» myPage;
+«ENDDEFINE»
+
+«DEFINE addPages FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void addPages() {
+ super.addPages();
+ if (myPage == null) {
+ myPage = new «getCreationWizardPageQualifiedClassName()»(«IF null == editorGen.application»getSelection()«ENDIF»);
+ }
+ addPage(myPage);
+}
+«ENDDEFINE»
+
+«DEFINE init FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection) {
+«IF null == editorGen.application-»
+ super.init(workbench, selection);
+«ENDIF-»
+ setWindowTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardWindowTitle()) FOR editorGen»);
+ setDefaultPageImageDescriptor(«editorGen.plugin.getActivatorQualifiedClassName()».getBundledImageDescriptor("«EXPAND wizardBannerLocation»")); «EXPAND xpt::Common::nonNLS»
+ setNeedsProgressMonitor(true);
+ }
+«ENDDEFINE»
+
+«DEFINE performFinish FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean performFinish() {
+ boolean retVal = myPage.finish();
+ «EXPAND createdDiagramFileAttributeName» = myPage.«EXPAND xpt::editor::CreationWizardPage::createdDiagramFileMethodName»();
+ return retVal;
+}
+«ENDDEFINE»
+
+«DEFINE getResult FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment("returns the diagram file")»
+public final «EXPAND createdDiagramFileType» «EXPAND createdDiagramFileMethodName»() {
+ return «EXPAND createdDiagramFileAttributeName»;
+}
+«ENDDEFINE»
+
+«DEFINE createdDiagramFileAttributeName FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»myCreatedDiagramFileURI«ELSE»myCreatedDiagramFile«ENDIF»«ENDDEFINE»
+«DEFINE createdDiagramFileMethodName FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»getCreatedDiagramFileURI«ELSE»getCreatedDiagramFile«ENDIF»«ENDDEFINE»
+«DEFINE createdDiagramFileType FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»org.eclipse.emf.common.util.URI«ELSE»org.eclipse.core.resources.IFile«ENDIF»«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardWindowTitle())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardWindowTitle(), "New " + editorGen.domainGenModel.modelName + " Diagram")-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/CreationWizardPage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::editor::Wizard»
+«EXTENSION xpt::editor::GenDiagram»
+«EXTENSION xpt::editor::i18n»
+
+«DEFINE CreationWizardPage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «creationWizardPageClassName» «EXPAND supertypes» {
+ «EXPAND attrs-»
+
+ «EXPAND ctor-»
+
+ «EXPAND createControl-»
+
+ «EXPAND validatePage-»
+
+ «EXPAND getResult-»
+
+ «EXPAND getDiagramFileURI-»
+
+ «EXPAND finish-»
+
+ «EXPAND doFinish-»
+
+ «EXPAND createDiagramFile-»
+
+«IF standaloneDomainModel() && hasDocumentRoot()-»
+ «EXPAND createDocumentRoot-»
+«ENDIF-»
+
+ «EXPAND handleException-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends «IF isRichClientPlatform()»org.eclipse.jface.wizard.WizardPage«ELSE»org.eclipse.ui.dialogs.WizardNewFileCreationPage«ENDIF»«ENDDEFINE»
+
+«DEFINE attrs FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.swt.widgets.Text fileField;
+«ENDIF-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «EXPAND createdDiagramFileType» «EXPAND createdDiagramFileAttributeName»;
+«ENDDEFINE»
+
+«DEFINE createdDiagramFileAttributeName FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»myCreatedDiagramFileURI«ELSE»myCreatedDiagramFile«ENDIF»«ENDDEFINE»
+«DEFINE createdDiagramFileMethodName FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»getCreatedDiagramFileURI«ELSE»getCreatedDiagramFile«ENDIF»«ENDDEFINE»
+«DEFINE createdDiagramFileType FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»org.eclipse.emf.common.util.URI«ELSE»org.eclipse.core.resources.IFile«ENDIF»«ENDDEFINE»
+
+«DEFINE getResult FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND createdDiagramFileType» «EXPAND createdDiagramFileMethodName»() {
+ return «EXPAND createdDiagramFileAttributeName»;
+}
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «creationWizardPageClassName»(«EXPAND ctorFormalParams») {
+ super(«EXPAND ctor_superCallParams»);
+ setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageTitle()) FOR editorGen»);
+ setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageDescription()) FOR editorGen»);
+}
+«ENDDEFINE»
+
+«DEFINE ctorFormalParams FOR gmfgen::GenDiagram»«IF !isRichClientPlatform()»org.eclipse.jface.viewers.IStructuredSelection selection«ENDIF»«ENDDEFINE»
+
+«DEFINE ctor_superCallParams FOR gmfgen::GenDiagram»«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPagePageName()) FOR editorGen»«IF !isRichClientPlatform()», selection«ENDIF»«ENDDEFINE»
+
+«DEFINE createControl FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void createControl(org.eclipse.swt.widgets.Composite parent) {
+ org.eclipse.swt.widgets.Composite composite = new org.eclipse.swt.widgets.Composite(parent, org.eclipse.swt.SWT.NONE);
+ {
+ org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 12;
+ composite.setLayout(layout);
+
+ org.eclipse.swt.layout.GridData data = new org.eclipse.swt.layout.GridData();
+ data.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ data.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ composite.setLayoutData(data);
+ }
+ org.eclipse.swt.widgets.Label resourceURILabel = new org.eclipse.swt.widgets.Label(composite, org.eclipse.swt.SWT.LEFT);
+ {
+ resourceURILabel.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageResourceURILabel()) FOR editorGen»);
+
+ org.eclipse.swt.layout.GridData data = new org.eclipse.swt.layout.GridData();
+ data.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ resourceURILabel.setLayoutData(data);
+ }
+
+ org.eclipse.swt.widgets.Composite fileComposite = new org.eclipse.swt.widgets.Composite(composite, org.eclipse.swt.SWT.NONE);
+ {
+ org.eclipse.swt.layout.GridData data = new org.eclipse.swt.layout.GridData();
+ data.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ fileComposite.setLayoutData(data);
+
+ org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ fileComposite.setLayout(layout);
+ }
+ fileField = new org.eclipse.swt.widgets.Text(fileComposite, org.eclipse.swt.SWT.BORDER);
+ {
+ org.eclipse.swt.layout.GridData data = new org.eclipse.swt.layout.GridData();
+ data.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalSpan = 1;
+ fileField.setLayoutData(data);
+ }
+
+ fileField.addModifyListener(validator);
+ org.eclipse.swt.widgets.Button resourceURIBrowseFileSystemButton = new org.eclipse.swt.widgets.Button(fileComposite, org.eclipse.swt.SWT.PUSH);
+ resourceURIBrowseFileSystemButton.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageBrowseButtonLabel()) FOR editorGen»);
+
+ resourceURIBrowseFileSystemButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
+ String fileExtension = "«editorGen.diagramFileExtension»";
+ String filePath = «getDiagramEditorUtilQualifiedClassName()».openFilePathDialog(getShell(), "*." + fileExtension, org.eclipse.swt.SWT.OPEN); «EXPAND xpt::Common::nonNLS»
+ if (filePath != null) {
+ if (!filePath.endsWith("." + fileExtension)) { «EXPAND xpt::Common::nonNLS»
+ filePath += "." + fileExtension; «EXPAND xpt::Common::nonNLS»
+ }
+ fileField.setText(filePath);
+ }
+ }
+ });
+ setPageComplete(validatePage());
+ setControl(composite);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.events.ModifyListener validator =
+ new org.eclipse.swt.events.ModifyListener() {
+ public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+ };
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE validatePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected boolean validatePage() {
+«IF isRichClientPlatform()-»
+ org.eclipse.emf.common.util.URI diagramFileURI = getDiagramFileURI();
+ if (diagramFileURI == null || diagramFileURI.isEmpty()) {
+ setErrorMessage(null);
+ return false;
+ }
+
+ if (diagramFileURI.isFile()) {
+ java.io.File diagramFile = new java.io.File(diagramFileURI.toFileString());
+ if (diagramFile.exists()) {
+ setErrorMessage(java.text.MessageFormat.format(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageDiagramFileExists()) FOR editorGen», new Object[] {diagramFile}));
+ return false;
+ }
+ }
+«ELSE-»
+ if (!super.validatePage()) {
+ return false;
+ }
+ String fileName = getFileName();
+ if (fileName == null) {
+ setErrorMessage(null);
+ return false;
+ }
+
+ org.eclipse.core.runtime.IPath path = getContainerFullPath().append(fileName);
+ if (path.getFileExtension() == null) {
+ path = path.addFileExtension("«editorGen.diagramFileExtension»"); «EXPAND xpt::Common::nonNLS»
+ }
+ if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().exists(path)) {
+ setErrorMessage(java.text.MessageFormat.format(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageDiagramFileExists()) FOR editorGen», new Object[] {path.toOSString()}));
+ return false;
+ }
+«ENDIF-»
+ String requiredExt = "«editorGen.diagramFileExtension»"; «EXPAND xpt::Common::nonNLS»
+«IF isRichClientPlatform()-»
+ String enteredExt = diagramFileURI.fileExtension();
+«ELSE-»
+ String enteredExt = path.getFileExtension();
+«ENDIF-»
+ if (enteredExt == null || !enteredExt.equals(requiredExt)) {
+ setErrorMessage(java.text.MessageFormat.format(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageIncorrectExtension()) FOR editorGen», new Object[] {requiredExt}));
+ return false;
+ }
+«IF !editorGen.sameFileForDiagramAndModel-»
+ «IF isRichClientPlatform()-»
+ org.eclipse.emf.common.util.URI modelFileURI = «getDiagramEditorUtilQualifiedClassName()».getModelFileURI(getDiagramFileURI());
+ java.io.File modelFile = new java.io.File(modelFileURI.toFileString());
+ if (modelFile.exists()) {
+ setErrorMessage(java.text.MessageFormat.format(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageDiagramFileExists()) FOR editorGen», new Object[] {modelFile}));
+ return false;
+ }
+ «ELSE-»
+ path = path.removeFileExtension().addFileExtension("«editorGen.domainFileExtension»"); «EXPAND xpt::Common::nonNLS»
+ if (org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().exists(path)) {
+ setErrorMessage(java.text.MessageFormat.format(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageDiagramFileExists()) FOR editorGen», new Object[] {path.lastSegment()}));
+ return false;
+ }
+ «ENDIF-»
+«ENDIF-»
+ setErrorMessage(null);
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE getDiagramFileURI FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.common.util.URI getDiagramFileURI() {
+ try {
+ return org.eclipse.emf.common.util.URI.createFileURI(fileField.getText());
+ } catch (Exception exception) {
+ }
+ return null;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE finish FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment("Performs the operations necessary to create and open the diagram\n" +
+ "@return boolean indicating whether the creation and opening the Diagram was successful ")»
+public boolean finish() {
+ final boolean[] result = new boolean[1];
+«IF isRichClientPlatform()-»
+ org.eclipse.jface.operation.IRunnableWithProgress op = new org.eclipse.jface.operation.IRunnableWithProgress() {
+ public void run(org.eclipse.core.runtime.IProgressMonitor monitor) {
+«ELSE-»
+ org.eclipse.ui.actions.WorkspaceModifyOperation op = new org.eclipse.ui.actions.WorkspaceModifyOperation(null) {
+ protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) {
+«ENDIF-»
+ result[0] = doFinish(monitor);
+ }
+ };
+
+ try {
+ getContainer().run(false, true, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ if (e.getTargetException() instanceof org.eclipse.core.runtime.CoreException) {
+ org.eclipse.jface.dialogs.ErrorDialog.openError(
+ getContainer().getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageCreationFailed()) FOR editorGen»,
+ null, // no special message
+ ((org.eclipse.core.runtime.CoreException) e.getTargetException()).getStatus());
+ }
+ else {
+ // CoreExceptions are handled above, but unexpected runtime exceptions and errors may still occur.
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getLog().log(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageCreationFailed()) FOR editorGen», e.getTargetException()));
+ }
+ return false;
+ }
+ return result[0];
+ }
+«ENDDEFINE»
+
+«DEFINE doFinish FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment("@param monitor the <code>org.eclipse.core.runtime.IProgressMonitor</code> to use to indicate progress and check for cancellation\n" +
+ "@return boolean indicating whether the diagram was created and opened successfully")»
+public boolean doFinish(org.eclipse.core.runtime.IProgressMonitor monitor) {
+ «EXPAND createdDiagramFileAttributeName» = createDiagramFile(monitor);
+ return «EXPAND createdDiagramFileAttributeName» != null;
+}
+«ENDDEFINE»
+
+«DEFINE createDiagramFile FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «EXPAND createdDiagramFileType» createDiagramFile(org.eclipse.core.runtime.IProgressMonitor monitor) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «EXPAND xpt::editor::Common::createEditingDomain FOR editorGen»;
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet();
+ «EXPAND defineResources-»
+
+ if (diagramResource != null«IF standaloneDomainModel()» && modelResource != null«ENDIF») {
+«IF domainDiagramElement != null && !standaloneDomainModel()-»
+ ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
+ ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultLoadOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
+«ENDIF-»
+ org.eclipse.emf.workspace.AbstractEMFOperation saveOperation = new org.eclipse.emf.workspace.AbstractEMFOperation(editingDomain, «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageCommandLabel()) FOR editorGen») {
+ public org.eclipse.core.runtime.IStatus doExecute(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
+ «EXPAND createAndSave-»
+ }
+ };
+ try {
+ saveOperation.execute(new org.eclipse.core.runtime.NullProgressMonitor(), null);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception occurred while creating the diagram", e); «EXPAND xpt::Common::nonNLS»
+ return null;
+ }
+ «EXPAND setCharset-»
+ «EXPAND openDiagram-»
+«IF isRichClientPlatform()-»
+ return getDiagramFileURI();
+«ELSE-»
+ return diagramFile;
+«ENDIF-»
+ }
+return null;
+}
+«ENDDEFINE»
+
+«DEFINE defineResources FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.createResource(getDiagramFileURI());
+ «IF standaloneDomainModel()-»
+final org.eclipse.emf.ecore.resource.Resource modelResource = resourceSet.createResource(«getDiagramEditorUtilQualifiedClassName()».getModelFileURI(getDiagramFileURI()));
+ «ENDIF-»
+«ELSE-»
+org.eclipse.core.runtime.IPath diagramFilePath = getContainerFullPath().append(getFileName());
+if (diagramFilePath.getFileExtension() == null) {
+ diagramFilePath = diagramFilePath.addFileExtension("«editorGen.diagramFileExtension»"); «EXPAND xpt::Common::nonNLS»
+}
+final org.eclipse.core.resources.IFile diagramFile = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFile(diagramFilePath);
+final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.createResource(org.eclipse.emf.common.util.URI.createPlatformResourceURI(diagramFilePath.toString(), true));
+ «IF standaloneDomainModel()-»
+org.eclipse.core.runtime.IPath modelFilePath = diagramFilePath.removeFileExtension().addFileExtension("«editorGen.domainFileExtension»"); «EXPAND xpt::Common::nonNLS»
+final org.eclipse.core.resources.IFile modelFile = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFile(modelFilePath);
+final org.eclipse.emf.ecore.resource.Resource modelResource = resourceSet.createResource(org.eclipse.emf.common.util.URI.createPlatformResourceURI(modelFilePath.toString(), true));
+ «ENDIF-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createAndSave FOR gmfgen::GenDiagram-»
+monitor.beginTask(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageTaskName()) FOR editorGen», 1);
+try {
+«IF domainDiagramElement != null-»
+ «EXPAND createInitialModel("model")»
+ «LET standaloneDomainModel() ? "modelResource" : "diagramResource" AS resourceToUse-»
+ «resourceToUse».getContents().add(«IF hasDocumentRoot()»createDocumentRoot(model)«ELSE»«EXPAND MetaModel::DowncastToEObject("model") FOR domainDiagramElement»«ENDIF»);
+ «ENDLET-»
+«ENDIF-»
+ org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();
+«IF domainDiagramElement != null-»
+ diagram.setElement(«EXPAND MetaModel::DowncastToEObject("model") FOR domainDiagramElement»);
+«ENDIF-»
+ «getNotationViewFactoryQualifiedClassName()».INSTANCE.decorateView(diagram);
+ diagramResource.getContents().add(diagram);
+ try {
+«IF standaloneDomainModel()-»
+ modelResource.save(«getDiagramEditorUtilQualifiedClassName()».getSaveOptions());
+«ENDIF-»
+ diagramResource.save(«getDiagramEditorUtilQualifiedClassName()».getSaveOptions());
+ } catch (java.io.IOException e) {
+ handleSaveException(e);
+ }
+ return org.eclipse.core.runtime.Status.OK_STATUS;
+} finally {
+ monitor.done();
+}
+«ENDDEFINE»
+
+// TODO: introduce separate method as in FullRT
+«DEFINE createInitialModel(String varName) FOR gmfgen::GenDiagram»«EXPAND MetaModel::NewInstance(varName) FOR domainDiagramElement»«ENDDEFINE»
+
+«DEFINE setCharset FOR gmfgen::GenDiagram-»
+«IF !isRichClientPlatform()-»
+«getDiagramEditorUtilQualifiedClassName()».setCharset(diagramFile);
+ «IF standaloneDomainModel()-»
+«getDiagramEditorUtilQualifiedClassName()».setCharset(modelFile);
+ «ENDIF-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE openDiagram FOR gmfgen::GenDiagram-»
+«IF editorGen.editor.eclipseEditor-»
+«IF isRichClientPlatform()-»
+if («getDiagramEditorUtilQualifiedClassName()».openEditor(getDiagramFileURI()) == null) {
+ return null;
+}
+«ELSE-»
+try {
+ org.eclipse.ui.ide.IDE.openEditor(org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), diagramFile);
+} catch (org.eclipse.ui.PartInitException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getLog().log(e.getStatus());
+ return null;
+}
+«ENDIF-»
+«ELSE-»
+if («getDiagramEditorUtilQualifiedClassName()».showView(diagramResource.getURI()) == null) {
+ return null;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createDocumentRoot FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static «EXPAND MetaModel::QualifiedClassName FOR getDocumentRoot()» createDocumentRoot(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model) {
+ «EXPAND MetaModel::NewInstance("docRoot") FOR getDocumentRoot()»
+«LET getDocumentRootSetFeature() AS f»«IF f == null-»
+ docRoot.set«domainDiagramElement.ecoreClass.name»(model); // FIXME name of the set method is pure guess«ELSE-»
+ «EXPAND MetaModel::setFeatureValue("docRoot", getDocumentRoot(), "model") FOR f»;«ENDIF»
+«ENDLET-»
+ return docRoot;
+}
+«ENDDEFINE»
+
+«DEFINE handleException FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void handleSaveException(java.io.IOException e) throws org.eclipse.core.commands.ExecutionException {
+ throw new org.eclipse.core.commands.ExecutionException(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageSaveFailed()) FOR editorGen», e);
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPagePageName())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageTitle())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageDescription())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageDiagramFileExists())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageIncorrectExtension())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageModelFileExists())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageCreationFailed())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageCommandLabel())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageTaskName())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageSaveFailed())-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageResourceURILabel())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageBrowseButtonLabel())-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPagePageName(), "Diagram Location")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageTitle(), "Create " + editorGen.domainGenModel.modelName + " Diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageDescription(), "Create a new " + editorGen.domainGenModel.modelName + " Diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageDiagramFileExists(), "Diagram File already exists: {0}")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageIncorrectExtension(), "The file name must end in {0}")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageModelFileExists(), "Model File already exists: {0}")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageCreationFailed(), "Creation Failed")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageCommandLabel(), "Create Diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageTaskName(), "Creating Diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageSaveFailed(), "Save Failed")-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageResourceURILabel(), "&File")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageBrowseButtonLabel(), "&Browse...")-»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/DiagramEditorUtil.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::editor::i18n»
+
+«DEFINE DiagramEditorUtil FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «diagramEditorUtilClassName» «EXPAND supertypes» {
+ «EXPAND openFilePathDialog-»
+«IF editorGen.editor.eclipseEditor-»
+ «EXPAND openEditor-»
+«ELSE-»
+ «EXPAND showView-»
+«ENDIF-»
+ «EXPAND initializeDiagram-»
+«IF !editorGen.sameFileForDiagramAndModel-»
+ «EXPAND convertURIs-»
+«ENDIF-»
+ «EXPAND isReadOnly-»
+«IF editorGen.application == null-»
+ «EXPAND setCharset-»
+«ENDIF-»
+ «EXPAND saveOptions-»
+ «EXPAND isKnownShortcutModelID-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE openFilePathDialog FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static String openFilePathDialog(org.eclipse.swt.widgets.Shell shell, String fileExtensionFilter, int style) {
+ org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell, style);
+ fileDialog.setFilterExtensions(new String[]{fileExtensionFilter});
+
+ fileDialog.open();
+ if (fileDialog.getFileName() != null && fileDialog.getFileName().length() > 0) {
+ return fileDialog.getFilterPath() + java.io.File.separator + fileDialog.getFileName();
+ }
+ else {
+ return null;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE openEditor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.ui.IEditorPart openEditor(org.eclipse.emf.common.util.URI fileURI) {
+ org.eclipse.ui.IWorkbench workbench = org.eclipse.ui.PlatformUI.getWorkbench();
+ org.eclipse.ui.IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ org.eclipse.ui.IWorkbenchPage page = workbenchWindow.getActivePage();
+
+ org.eclipse.ui.IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().getDefaultEditor(fileURI.lastSegment());
+ if (editorDescriptor == null) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(
+ workbenchWindow.getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDiagramEditorUtilErrorNoDescriptor().titleKey()) FOR editorGen»,
+ java.text.MessageFormat.format(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDiagramEditorUtilErrorNoDescriptor().messageKey()) FOR editorGen», new Object[] {fileURI.toFileString()}));
+ return null;
+ } else {
+ try {
+ return page.openEditor(new org.eclipse.emf.common.ui.URIEditorInput(fileURI), editorDescriptor.getId());
+ } catch (org.eclipse.ui.PartInitException exception) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(
+ workbenchWindow.getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDiagramEditorUtilErrorOpeningEditor()) FOR editorGen»,
+ exception.getMessage());
+ return null;
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE showView FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.ui.IViewPart showView(org.eclipse.emf.common.util.URI fileURI) {
+ org.eclipse.ui.IWorkbench workbench = org.eclipse.ui.PlatformUI.getWorkbench();
+ org.eclipse.ui.IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ org.eclipse.ui.IWorkbenchPage page = workbenchWindow.getActivePage();
+
+ try {
+ org.eclipse.gmf.runtime.lite.parts.DiagramViewPart diagramView = (org.eclipse.gmf.runtime.lite.parts.DiagramViewPart) page.showView(«editorGen.editor.getQualifiedClassName()».ID);
+ if (!diagramView.showDiagram(null, fileURI)) {
+ return null;
+ }
+ return diagramView;
+ } catch (org.eclipse.ui.PartInitException exception) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(
+ workbenchWindow.getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDiagramEditorUtilErrorOpeningView()) FOR editorGen»,
+ exception.getMessage());
+ return null;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE convertURIs FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.emf.common.util.URI getDiagramFileURI(org.eclipse.emf.common.util.URI modelFileURI) {
+ if (modelFileURI == null || !modelFileURI.isFile()) {
+ return null;
+ }
+ return modelFileURI.trimFileExtension().appendFileExtension("«editorGen.diagramFileExtension»"); «EXPAND xpt::Common::nonNLS»
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.emf.common.util.URI getModelFileURI(org.eclipse.emf.common.util.URI diagramFileURI) {
+ if (diagramFileURI == null || !diagramFileURI.isFile()) {
+ return null;
+ }
+ return diagramFileURI.trimFileExtension().appendFileExtension("«editorGen.domainFileExtension»"); «EXPAND xpt::Common::nonNLS»
+}
+«ENDDEFINE»
+
+«DEFINE isReadOnly FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment("Returns whether the given element is read only in its editing domain.")»
+public static boolean isReadOnly(org.eclipse.emf.ecore.EObject element) {
+ if (element == null) {
+ return true;
+ }
+ org.eclipse.emf.ecore.resource.Resource resource = element.eResource();
+ if (resource == null) {
+ return false;
+ }
+ return isReadOnly(resource);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public static boolean isReadOnly(org.eclipse.emf.ecore.resource.Resource resource) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(resource);
+ if (editingDomain == null) {
+ return false;
+ }
+ return editingDomain.isReadOnly(resource);
+}
+«ENDDEFINE»
+
+«DEFINE initializeDiagram FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.gmf.runtime.notation.Diagram createDiagramFor(org.eclipse.emf.ecore.EObject diagramRoot) {
+ if («getEditPartQualifiedClassName()».VISUAL_ID != «getVisualIDRegistryQualifiedClassName()».getDiagramVisualID(diagramRoot)) {
+ return null;
+ }
+ org.eclipse.gmf.runtime.notation.Diagram result = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();
+ result.setElement(diagramRoot);
+ «getNotationViewFactoryQualifiedClassName()».INSTANCE.decorateView(result);
+ new DiagramInitializer().initDiagramContents(result);
+ return result;
+}
+
+«EXPAND xpt::editor::DiagramInitializer::DiagramInitializer-»
+«ENDDEFINE»
+
+«DEFINE setCharset FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static void setCharset(org.eclipse.core.resources.IFile file) {
+ if (file == null) {
+ return;
+ }
+ try {
+ file.setCharset("UTF-8", new org.eclipse.core.runtime.NullProgressMonitor()); «EXPAND xpt::Common::nonNLS»
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to set charset for file " + file.getFullPath(), e); «EXPAND xpt::Common::nonNLS»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE saveOptions FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static java.util.Map getSaveOptions() {
+ java.util.Map saveOptions = new java.util.HashMap();
+ saveOptions.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_ENCODING, "UTF-8"); «EXPAND xpt::Common::nonNLS»
+ saveOptions.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
+ saveOptions.put(org.eclipse.emf.ecore.resource.Resource.OPTION_SAVE_ONLY_IF_CHANGED, org.eclipse.emf.ecore.resource.Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+ return saveOptions;
+}
+«ENDDEFINE»
+
+«DEFINE isKnownShortcutModelID FOR gmfgen::GenDiagram-»
+«IF containsShortcutsTo.size() > 0-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static boolean isKnownShortcutModelID(String modelID) {
+ «EXPAND acceptModelID(this) FOREACH containsShortcutsTo-»
+ return false;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE acceptModelID(gmfgen::GenDiagram diagram) FOR String-»
+«IF this == diagram.editorGen.modelID-»
+if («diagram.getEditPartQualifiedClassName()».MODEL_ID.equals(modelID)) {
+«ELSE-»
+if ("«this»".equals(modelID)) { «EXPAND xpt::Common::nonNLS»
+«ENDIF-»
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF editorGen.editor.eclipseEditor-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForDiagramEditorUtilErrorOpeningEditor())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForDiagramEditorUtilErrorNoDescriptor().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForDiagramEditorUtilErrorNoDescriptor().messageKey())-»
+«ELSE-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForDiagramEditorUtilErrorOpeningView())-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF editorGen.editor.eclipseEditor-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDiagramEditorUtilErrorOpeningEditor(), "Error Opening Editor")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDiagramEditorUtilErrorNoDescriptor().titleKey(), "Error")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDiagramEditorUtilErrorNoDescriptor().messageKey(), "There is no editor registered for the file {0}")-»
+«ELSE-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDiagramEditorUtilErrorOpeningView(), "Error Opening View")-»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/DiagramInitializer.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::parts::NotationModelRefresher»
+«EXTENSION xpt::diagram::parts::LinkNotationModelRefresher»
+«EXTENSION xpt::diagram::LinkFinder»
+
+«DEFINE DiagramInitializer FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedClassComment»
+private static class DiagramInitializer {
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void initDiagramContents(org.eclipse.gmf.runtime.notation.Diagram diagram) {
+«IF getAllInitableContainers().size() > 0-»
+ create«getUniqueIdentifier()»Children(diagram);
+«ENDIF-»
+«IF links.size() > 0-»
+ myViewService = new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.NaiveViewService(diagram);
+ create«getUniqueIdentifier()»ChildLinks(diagram);
+«ENDIF-»
+ }
+
+«LET getAllInitableContainers() AS containers2Generate-»
+«FOREACH containers2Generate AS nextContainer-»
+«EXPAND createChildren FOR nextContainer-»
+ «IF nextContainer.needsNotationModelRefresher()-»
+«EXPAND getSemanticChildNodes FOR nextContainer-»
+«EXPAND getCreateNotationalChildNodeCommand FOR nextContainer-»
+ «ENDIF-»
+«ENDFOREACH-»
+«ENDLET-»
+
+«IF links.size() > 0-»
+ «LET getLinkContainersWithAncestors() AS linkContainersWithAncestors»
+ «FOREACH linkContainersWithAncestors AS nextContainer-»
+ «EXPAND createChildLinks(linkContainersWithAncestors) FOR nextContainer-»
+ «IF nextContainer.containedLinks().size() > 0-»
+ «EXPAND getSemanticChildLinks FOR nextContainer-»
+ «EXPAND getCreateNotationalChildLinkCommand FOR nextContainer-»
+ «ENDIF-»
+ «ENDFOREACH-»
+ «ENDLET-»
+«ENDIF-»
+ «EXPAND viewService-»
+ «EXPAND xpt::diagram::parts::semanticChildren::getPhantomNodesIterator-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE createChildren FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void create«getUniqueIdentifier()»Children(org.eclipse.gmf.runtime.notation.View viewObject) {
+ «EXPAND createChildrenOfCompartments-»
+ «IF needsNotationModelRefresher()-»
+ java.util.List semanticChildren = get«getUniqueIdentifier()»SemanticChildNodes(viewObject);
+ for(java.util.Iterator it = semanticChildren.iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor nextDescriptor = (org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor) it.next();
+ org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand createCommand = getCreate«getUniqueIdentifier()»NotationalChildNodeCommand(viewObject, nextDescriptor);
+ if (createCommand != null && createCommand.canExecute()) {
+ createCommand.execute();
+ «LET getInitableGrandChildren() AS initableGrandChildren-»
+ «IF initableGrandChildren.size() > 0-»
+ org.eclipse.gmf.runtime.notation.View nextChild = createCommand.getCreatedView();
+ int childVisualID = nextDescriptor.getVisualID();
+ switch (childVisualID) {
+ «EXPAND createGrandChildren("nextChild") FOREACH initableGrandChildren-»
+ }
+ «ENDIF-»
+ «ENDLET-»
+ }
+ }
+ «ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE createChildrenOfCompartments FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE createChildrenOfCompartments FOR gmfgen::GenNode-»
+«LET getInitableCompartments() AS initableCompartments-»
+«IF initableCompartments.size() > 0-»
+ for(java.util.Iterator it = viewObject.getChildren().iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.notation.View next = (org.eclipse.gmf.runtime.notation.View) it.next();
+ int visualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(next);
+ switch (visualID) {
+ «EXPAND createGrandChildren("next") FOREACH initableCompartments-»
+ }
+ }
+«ENDIF-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE createGrandChildren(String viewCode) FOR gmfgen::GenContainerBase-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ create«getUniqueIdentifier()»Children(«viewCode»);
+ break;
+«ENDDEFINE»
+
+«DEFINE getSemanticChildNodes FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.List get«getUniqueIdentifier()»SemanticChildNodes(org.eclipse.gmf.runtime.notation.View parentView) {
+ «EXPAND xpt::diagram::parts::semanticChildren::semanticChildren("parentView")-»
+}
+«ENDDEFINE»
+
+«DEFINE getCreateNotationalChildNodeCommand FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand getCreate«getUniqueIdentifier()»NotationalChildNodeCommand(org.eclipse.gmf.runtime.notation.View parentView, org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.ElementDescriptor descriptor) {
+ «EXPAND xpt::commands::createNotationalElementCommand::createNotationalNodeCommand("parentView")-»
+}
+«ENDDEFINE»
+
+«DEFINE createChildLinks(Collection[gmfgen::GenCommonBase] allContainersWithAncestors) FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void create«getUniqueIdentifier()»ChildLinks(org.eclipse.gmf.runtime.notation.View viewObject) {
+«IF containedLinks().size() > 0-»
+ java.util.List semanticChildLinks = get«getUniqueIdentifier()»SemanticChildLinks(viewObject);
+ for(java.util.Iterator it = semanticChildLinks.iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.LinkDescriptor nextDescriptor = (org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.LinkDescriptor) it.next();
+ org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand createCommand = getCreate«getUniqueIdentifier()»NotationalChildLinkCommand(viewObject, nextDescriptor);
+ if (createCommand != null && createCommand.canExecute()) {
+ createCommand.execute();
+ }
+ }
+«ENDIF-»
+ «LET getContainedContainers().select(e| allContainersWithAncestors.contains(e)) AS containedLinkContainers-»
+ «LET containedLinkContainers.typeSelect(gmfgen::GenLink) AS linkContainersContainedInSourceEdges-»
+ «LET (Collection[gmfgen::GenCommonBase]) containedLinkContainers.without(linkContainersContainedInSourceEdges) AS linkContainersContainedInChildren-»
+ «IF linkContainersContainedInChildren.size() > 0-»
+ for(java.util.Iterator it = viewObject.getChildren().iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.notation.View next = (org.eclipse.gmf.runtime.notation.View) it.next();
+ int visualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(next);
+ switch (visualID) {
+ «EXPAND createGrandChildLinks FOREACH linkContainersContainedInChildren-»
+ }
+ }
+ «ENDIF-»
+ «IF linkContainersContainedInSourceEdges.size() > 0-»
+ for(java.util.Iterator it = viewObject.getSourceEdges().iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.notation.View next = (org.eclipse.gmf.runtime.notation.View) it.next();
+ int visualID = «getDiagram().getVisualIDRegistryQualifiedClassName()».getVisualID(next);
+ switch (visualID) {
+ «EXPAND createGrandChildLinks FOREACH linkContainersContainedInSourceEdges-»
+ }
+ }
+ «ENDIF-»
+ «ENDLET-»
+ «ENDLET-»
+ «ENDLET-»
+}
+«ENDDEFINE»
+
+«DEFINE createGrandChildLinks FOR gmfgen::GenCommonBase-»
+case «getEditPartQualifiedClassName()».VISUAL_ID:
+ create«getUniqueIdentifier()»ChildLinks(next);
+ break;
+«ENDDEFINE»
+
+«DEFINE getSemanticChildLinks FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.List get«getUniqueIdentifier()»SemanticChildLinks(org.eclipse.gmf.runtime.notation.View parentView) {
+ «EXPAND xpt::diagram::parts::semanticChildLinks::semanticChildLinks("parentView")-»
+}
+«ENDDEFINE»
+
+«DEFINE getCreateNotationalChildLinkCommand FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand getCreate«getUniqueIdentifier()»NotationalChildLinkCommand(org.eclipse.gmf.runtime.notation.View parentView, org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.LinkDescriptor linkDescriptor) {
+ «EXPAND xpt::commands::createNotationalElementCommand::createNotationalEdgeCommand("parentView.getDiagram()")-»
+}
+«ENDDEFINE»
+
+«DEFINE viewService FOR gmfgen::GenDiagram-»
+«IF links.size() > 0-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService myViewService;
+
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService getViewService() {
+ return myViewService;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/Editor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,921 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::providers::ValidationUtils»
+«EXTENSION xpt::editor::i18n»
+
+«DEFINE Editor FOR gmfgen::GenEditorView-»
+«IF eclipseEditor-»
+«EXPAND EditorPart-»
+«ELSE-»
+«EXPAND ViewPart-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE EditorPart FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» extends org.eclipse.gmf.runtime.lite.parts.DiagramEditor «IF editorGen.diagram.validationNeeded() && null == editorGen.application» implements org.eclipse.ui.ide.IGotoMarker«ENDIF» {
+«EXPAND partId-»
+«IF null == editorGen.application-»
+«EXPAND ResourceTracker-»
+«EXPAND getFileFromInput-»
+«ENDIF»
+«EXPAND diagramAttributes-»
+«EXPAND domainAdapterFactory-»
+«EXPAND validationDecorationProvider-»
+«EXPAND createActions-»
+«EXPAND disposeEditor-»
+«EXPAND save-»
+«EXPAND configurePalette-»
+«EXPAND propertySheetSupport FOR editorGen.propertySheet-»
+«EXPAND initEditor-»
+«EXPAND getURIFromInput-»
+«EXPAND loadDiagramFile-»
+«EXPAND initializeGraphicalViewer-»
+«EXPAND configureGraphicalViewer-»
+«EXPAND defaultFontAttribute-»
+«EXPAND preferenceStoreListener-»
+«EXPAND flyoutPalette-»
+«EXPAND getSaveOptions-»
+«IF editorGen.diagram.validationNeeded() && null == editorGen.application-»
+«EXPAND gotoMarker-»
+«ENDIF-»
+«EXPAND ContextMenuProvider-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE ViewPart FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» extends org.eclipse.gmf.runtime.lite.parts.DiagramViewPart {
+«EXPAND partId-»
+«EXPAND viewActionBarContributor-»
+«EXPAND diagramAttributes-»
+«EXPAND domainAdapterFactory-»
+«EXPAND validationDecorationProvider-»
+«EXPAND createActions-»
+«EXPAND disposeView-»
+«EXPAND configurePalette-»
+«EXPAND propertySheetSupport FOR editorGen.propertySheet-»
+«EXPAND initView-»
+«EXPAND loadDiagramFile-»
+«EXPAND initializeGraphicalViewer-»
+«EXPAND configureGraphicalViewer-»
+«EXPAND defaultFontAttribute-»
+«EXPAND preferenceStoreListener-»
+«EXPAND flyoutPalette-»
+«EXPAND getSaveOptions-»
+«EXPAND ContextMenuProvider-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE viewActionBarContributor FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «getActionBarContributorQualifiedClassName()» myActionBarContributor;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void updateActionBars() {
+ if (myActionBarContributor != null) {
+ myActionBarContributor.updateGlobalActions(this);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE partId FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String ID = "«iD»"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE ResourceTracker FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedClassComment("This class listens to changes to the file system in the workspace, and\n" +
+ "makes the following changes: \n" +
+ "<ul><li>If an open, saved file gets deleted, the editor is closed.</li>\n" +
+ "<li>If an open file gets renamed or moved, the editor\'s\n" +
+ "input is changed accordingly.</li></ul>")»
+ private class ResourceTracker implements org.eclipse.core.resources.IResourceChangeListener {
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void resourceChanged(org.eclipse.core.resources.IResourceChangeEvent event) {
+ org.eclipse.core.resources.IResourceDelta delta = event.getDelta();
+ if (delta != null) {
+ org.eclipse.core.resources.IFile file = getFileFromInput(getEditorInput());
+ if (file != null) {
+ org.eclipse.core.resources.IResourceDelta fileDelta = delta.findMember(file.getFullPath());
+ if (fileDelta != null) {
+ processFileDelta(fileDelta);
+ }
+ }
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void processFileDelta(org.eclipse.core.resources.IResourceDelta delta) {
+ assert (delta != null && delta.getResource().equals(getFileFromInput(getEditorInput())));
+ if (delta.getKind() == org.eclipse.core.resources.IResourceDelta.REMOVED) {
+ if ((org.eclipse.core.resources.IResourceDelta.MOVED_TO & delta.getFlags()) == 0) {
+ //TODO: make sure unsaved deleted file is handled correctly
+ if (!isDirty()) {
+ closeEditor();
+ }
+ } else {
+ // else if it was moved or renamed
+ final org.eclipse.core.resources.IFile newFile = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFile(delta.getMovedToPath());
+ final org.eclipse.ui.IEditorInput newEditorInput;
+ if (getEditorInput() instanceof org.eclipse.emf.common.ui.URIEditorInput) {
+ org.eclipse.emf.common.util.URI newFileURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
+ org.eclipse.emf.common.util.URI oldFileURI = ((org.eclipse.emf.common.ui.URIEditorInput) getEditorInput()).getURI();
+ String newEditorName = newFileURI.lastSegment();
+ if (oldFileURI.fragment() != null) {
+ newFileURI = newFileURI.appendFragment(oldFileURI.fragment());
+ newEditorName += '#' + oldFileURI.fragment();
+ }
+ newEditorInput = new org.eclipse.emf.common.ui.URIEditorInput(newFileURI, newEditorName);
+ } else {
+ newEditorInput = new org.eclipse.ui.part.FileEditorInput(newFile);
+ }
+ org.eclipse.swt.widgets.Display display = getSite().getShell().getDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ setInput(newEditorInput);
+ }
+ });
+ }
+ }
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private ResourceTracker resourceTracker;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private ResourceTracker getResourceTracker() {
+ if (resourceTracker == null) {
+ resourceTracker = new ResourceTracker();
+ }
+ return resourceTracker;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ void closeEditor() {
+ getSite().getShell().getDisplay().syncExec(new Runnable() {
+ public void run() {
+ getSite().getPage().closeEditor(«className».this, false);
+ }
+ });
+ }
+«ENDDEFINE»
+
+«DEFINE hookResourceTracker FOR gmfgen::GenEditorView-»
+«IF null == editorGen.application-»
+ org.eclipse.core.resources.IFile newResource = getFileFromInput(getEditorInput());
+ if (newResource != null) {
+ newResource.getWorkspace().addResourceChangeListener(getResourceTracker());
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE unhookResourceTracker FOR gmfgen::GenEditorView-»
+«IF null == editorGen.application-»
+ org.eclipse.core.resources.IFile oldResource = getFileFromInput(getEditorInput());
+ if (oldResource != null) {
+ oldResource.getWorkspace().removeResourceChangeListener(getResourceTracker());
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE domainAdapterFactory FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.edit.provider.ComposedAdapterFactory domainAdapterFactory;
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.common.notify.AdapterFactory getDomainAdapterFactory() {
+ if (domainAdapterFactory == null) {
+ java.util.List factories = new java.util.ArrayList();
+ factories.add(new org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory());
+«EXPAND MetaModel::PopulateItemProviderFactories("factories") FOR editorGen-»
+ factories.add(new org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory());
+ factories.add(new org.eclipse.gmf.runtime.notation.provider.NotationItemProviderAdapterFactory());
+ domainAdapterFactory = new org.eclipse.emf.edit.provider.ComposedAdapterFactory(factories);
+ }
+ return domainAdapterFactory;
+ }
+
+«ENDDEFINE»
+
+«DEFINE diagramAttributes FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «EXPAND MetaModel::QualifiedClassName FOR editorGen.diagram.domainDiagramElement» diagramRoot;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.Diagram diagram;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND MetaModel::QualifiedClassName FOR editorGen.diagram.domainDiagramElement» getDiagramRoot() {
+ return diagramRoot;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.notation.Diagram getDiagram() {
+ return diagram;
+ }
+«ENDDEFINE»
+
+«DEFINE validationDecorationProvider FOR gmfgen::GenEditorView-»
+«IF editorGen.diagram.validationNeeded() && editorGen.diagram.validationDecorators-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.lite.validation.ValidationDecorationProvider validationDecorationProvider;
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.lite.validation.ValidationDecorationProvider createValidationDecorationProvider() {
+ return new org.eclipse.gmf.runtime.lite.validation.ValidationDecorationProvider() {
+ protected org.eclipse.gef.GraphicalViewer getGraphicalViewer() {
+ return «className».this.getGraphicalViewer();
+ }
+ protected org.eclipse.emf.ecore.resource.ResourceSet getResourceSet() {
+ return getEditingDomain().getResourceSet();
+ }
+ };
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE hookValidation FOR gmfgen::GenEditorView-»
+«IF editorGen.diagram.validationNeeded() && editorGen.diagram.validationDecorators-»
+ if (validationDecorationProvider == null) {
+ validationDecorationProvider = createValidationDecorationProvider();
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getValidationStateManager().addValidationStateListener(validationDecorationProvider);
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE unhookValidation FOR gmfgen::GenEditorView-»
+«IF editorGen.diagram.validationNeeded() && editorGen.diagram.validationDecorators-»
+ if (validationDecorationProvider != null) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getValidationStateManager().removeValidationStateListener(validationDecorationProvider);
+ validationDecorationProvider.dispose();
+ validationDecorationProvider = null;
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createActions FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void createActions() {
+«EXPAND stackActions-»
+«EXPAND editPartActions-»
+«EXPAND editorActions-»
+«EXPAND zoomActions-»
+«EXPAND hookKeyHandler-»
+
+«IF editorGen.diagram.validationNeeded()-»
+«EXPAND validateActions-»
+«ENDIF-»
+
+«EXPAND metricsActions FOR editorGen.metrics-»
+«EXPAND moreActions-»
+ }
+«ENDDEFINE»
+
+«DEFINE stackActions FOR gmfgen::GenEditorView-»
+ addStackAction(new org.eclipse.gef.ui.actions.UndoAction(this));
+ addStackAction(new org.eclipse.gef.ui.actions.RedoAction(this));
+«ENDDEFINE»
+
+«DEFINE editPartActions FOR gmfgen::GenEditorView-»
+ addEditPartAction(new org.eclipse.gmf.runtime.lite.ui.actions.DeleteAction((org.eclipse.ui.IWorkbenchPart) this));
+ addEditPartAction(new org.eclipse.gmf.runtime.lite.ui.actions.DeleteViewAction((org.eclipse.ui.IWorkbenchPart) this));
+ addEditPartAction(new org.eclipse.gmf.runtime.lite.ui.actions.DeleteViewOrModelAction((org.eclipse.ui.IWorkbenchPart) this));
+ addEditPartAction(new org.eclipse.gef.ui.actions.DirectEditAction((org.eclipse.ui.IWorkbenchPart) this));
+«EXPAND alignActions-»
+«ENDDEFINE»
+
+«DEFINE alignActions FOR gmfgen::GenEditorView-»
+ addEditPartAction(new org.eclipse.gef.ui.actions.AlignmentAction((org.eclipse.ui.IWorkbenchPart) this, org.eclipse.draw2d.PositionConstants.LEFT));
+ addEditPartAction(new org.eclipse.gef.ui.actions.AlignmentAction((org.eclipse.ui.IWorkbenchPart) this, org.eclipse.draw2d.PositionConstants.RIGHT));
+ addEditPartAction(new org.eclipse.gef.ui.actions.AlignmentAction((org.eclipse.ui.IWorkbenchPart) this, org.eclipse.draw2d.PositionConstants.TOP));
+ addEditPartAction(new org.eclipse.gef.ui.actions.AlignmentAction((org.eclipse.ui.IWorkbenchPart) this, org.eclipse.draw2d.PositionConstants.BOTTOM));
+ addEditPartAction(new org.eclipse.gef.ui.actions.AlignmentAction((org.eclipse.ui.IWorkbenchPart) this, org.eclipse.draw2d.PositionConstants.CENTER));
+ addEditPartAction(new org.eclipse.gef.ui.actions.AlignmentAction((org.eclipse.ui.IWorkbenchPart) this, org.eclipse.draw2d.PositionConstants.MIDDLE));
+«ENDDEFINE»
+
+«DEFINE editorActions FOR gmfgen::GenEditorView-»
+«IF eclipseEditor-»
+ addEditorAction(new org.eclipse.gef.ui.actions.SaveAction(this));
+«ENDIF-»
+ addEditorAction(new org.eclipse.gef.ui.actions.PrintAction(this));
+ addEditorAction(new org.eclipse.gmf.runtime.lite.ui.actions.LayoutDiagramAction(this));
+«IF editorGen.diagram.generateCreateShortcutAction()-»
+ addEditorAction(new «editorGen.diagram.getCreateShortcutActionQualifiedClassName()»(this));
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE zoomActions FOR gmfgen::GenEditorView-»
+ org.eclipse.jface.action.IAction zoomIn = new org.eclipse.gef.ui.actions.ZoomInAction(getZoomManager());
+ org.eclipse.jface.action.IAction zoomOut = new org.eclipse.gef.ui.actions.ZoomOutAction(getZoomManager());
+ addAction(zoomIn);
+ addAction(zoomOut);
+ getSite().getKeyBindingService().registerAction(zoomIn);
+ getSite().getKeyBindingService().registerAction(zoomOut);
+«ENDDEFINE»
+
+«DEFINE hookKeyHandler FOR gmfgen::GenEditorView-»
+ org.eclipse.gef.KeyHandler keyHandler = getGraphicalViewer().getKeyHandler();
+ keyHandler.put(org.eclipse.gef.KeyStroke.getPressed(org.eclipse.swt.SWT.DEL, 127, 0), getActionRegistry().getAction(org.eclipse.gmf.runtime.lite.ui.actions.ActionIds.DELETE_VIEW_OR_MODEL));
+ keyHandler.put(org.eclipse.gef.KeyStroke.getPressed((char) 0x4, 100, SWT.CTRL), getActionRegistry().getAction(org.eclipse.ui.actions.ActionFactory.DELETE.getId()));
+ keyHandler.put(org.eclipse.gef.KeyStroke.getPressed((char) 0x4, 100, SWT.CTRL | SWT.SHIFT), getActionRegistry().getAction(org.eclipse.gmf.runtime.lite.ui.actions.ActionIds.DELETE_VIEW));
+ keyHandler.put(org.eclipse.gef.KeyStroke.getPressed(org.eclipse.swt.SWT.F2, 0), getActionRegistry().getAction(org.eclipse.gef.ui.actions.GEFActionConstants.DIRECT_EDIT));
+«ENDDEFINE»
+
+«DEFINE validateActions FOR gmfgen::GenEditorView-»
+ addAction(new «EXPAND xpt::providers::ValidateAction::qualifiedClassName FOR editorGen.diagram»(this));
+«ENDDEFINE»
+
+«DEFINE metricsActions FOR gmfgen::GenMetricContainer-»
+ addAction(new «EXPAND xpt::providers::MetricsAction::qualifiedClassName FOR editorGen.diagram»(this));
+«ENDDEFINE»
+
+«DEFINE moreActions FOR gmfgen::GenEditorView-»
+«ENDDEFINE»
+
+«DEFINE disposeEditor FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void dispose() {
+«EXPAND unhookResourceTracker-»
+«EXPAND unhookValidation-»
+«EXPAND disposeTransactionalUpdateManager-»
+ // important: always call super implementation of dispose
+«EXPAND disposeDefaultFont-»
+«EXPAND unhookPreferenceStoreListener-»
+ super.dispose();
+ }
+«ENDDEFINE»
+
+«DEFINE disposeView FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void dispose() {
+ myActionBarContributor.dispose();
+ myActionBarContributor = null;
+«EXPAND unhookValidation-»
+«EXPAND disposeTransactionalUpdateManager-»
+«EXPAND disposeDefaultFont-»
+«EXPAND unhookPreferenceStoreListener-»
+ // important: always call super implementation of dispose
+ super.dispose();
+ }
+«ENDDEFINE»
+
+«DEFINE disposeTransactionalUpdateManager FOR GenEditorView-»
+org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager updateManager = (org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager) getGraphicalViewer().getProperty(org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager.class.getName());
+if (updateManager != null) {
+ updateManager.dispose();
+}
+«ENDDEFINE»
+
+«DEFINE save FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor) {
+ try {
+ save(monitor);
+ getCommandStack().markSaveLocation();
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ org.eclipse.jface.dialogs.ErrorDialog.openError(getSite().getShell(), «EXPAND xpt::Externalizer::accessorCall(i18nKeyForEditorErrorDuringSave().titleKey()) FOR editorGen», «EXPAND xpt::Externalizer::accessorCall(i18nKeyForEditorErrorDuringSave().messageKey()) FOR editorGen», e.getStatus());
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE configurePalette FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void configurePalette(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
+«IF null != editorGen.diagram.palette-»
+ new «editorGen.diagram.palette.getFactoryQualifiedClassName()»().contributeToPalette(paletteRoot);
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE propertySheetSupport FOR gmfgen::GenPropertySheet-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.ui.views.properties.IPropertySheetPage getPropertySheetPage() {
+ if (myPropertySheetPage == null) {
+ myPropertySheetPage = new org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage(new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() {
+ public String getContributorId() {
+ return «editorGen.plugin.getActivatorQualifiedClassName()».ID;
+ }
+ });
+ }
+ return myPropertySheetPage;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.views.properties.IPropertySheetPage myPropertySheetPage;
+«ENDDEFINE»
+
+«DEFINE initEditor FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input) throws org.eclipse.ui.PartInitException {
+ org.eclipse.emf.common.util.URI file = getURIFromInput(input);
+ if (file == null) {
+ throw new org.eclipse.ui.PartInitException(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForEditorInvalidInputMsg()) FOR editorGen»);
+ }
+ super.init(site, input);
+ // validate
+ if (getDiagramRoot() == null) {
+ throw new org.eclipse.ui.PartInitException(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForEditorInvalidInputMsg()) FOR editorGen»);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setInput(org.eclipse.ui.IEditorInput input) {
+«EXPAND unhookValidation-»
+«EXPAND unhookResourceTracker-»
+ org.eclipse.emf.common.util.URI file = getURIFromInput(input);
+ load(file);
+ setPartName(input.getName());
+ super.setInput(input);
+«EXPAND hookResourceTracker-»
+«EXPAND hookValidation-»
+ }
+«ENDDEFINE»
+
+«DEFINE getFileFromInput FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.core.resources.IFile getFileFromInput(org.eclipse.ui.IEditorInput input) {
+ if (input instanceof org.eclipse.ui.IFileEditorInput) {
+ return ((org.eclipse.ui.IFileEditorInput) input).getFile();
+ }
+ org.eclipse.emf.common.util.URI uri = getURIFromInput(input);
+ if (uri != null) {
+ if ("platform".equals(uri.scheme()) && (uri.segmentCount() > 2)) { «EXPAND xpt::Common::nonNLS»
+ if ("resource".equals(uri.segment(0))) { «EXPAND xpt::Common::nonNLS»
+ org.eclipse.core.runtime.IPath path = new org.eclipse.core.runtime.Path(org.eclipse.emf.common.util.URI.decode(uri.path())).removeFirstSegments(1);
+ return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ }
+ }
+ }
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE getURIFromInput FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.common.util.URI getURIFromInput(org.eclipse.ui.IEditorInput input) {
+ if (input == null) {
+ return null;
+ }
+«IF null == editorGen.application-»
+ if (input instanceof org.eclipse.ui.IFileEditorInput) {
+ return org.eclipse.emf.common.util.URI.createPlatformResourceURI(((org.eclipse.ui.IFileEditorInput)input).getFile().getFullPath().toString(), true);
+ }
+«ENDIF-»
+ if (input instanceof org.eclipse.emf.common.ui.URIEditorInput) {
+ return ((org.eclipse.emf.common.ui.URIEditorInput) input).getURI();
+ }
+ if (input instanceof org.eclipse.ui.IPathEditorInput) {
+ return org.eclipse.emf.common.util.URI.createFileURI(((org.eclipse.ui.IPathEditorInput)input).getPath().toOSString());
+ }
+ org.eclipse.emf.common.util.URI uri = (org.eclipse.emf.common.util.URI) input.getAdapter(org.eclipse.emf.common.util.URI.class);
+ if (uri != null) {
+ return uri;
+ }
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE initView FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void createPartControl(org.eclipse.swt.widgets.Composite parent) {
+ super.createPartControl(parent);
+ org.eclipse.ui.IActionBars bars = getViewSite().getActionBars();
+ myActionBarContributor = new «getActionBarContributorQualifiedClassName()»();
+ myActionBarContributor.init(bars, getSite().getPage());
+ bars.updateActionBars();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setInput(org.eclipse.emf.common.util.URI diagramURI) throws org.eclipse.core.runtime.CoreException {
+«EXPAND unhookValidation-»
+ load(diagramURI);
+ if (diagram == null || diagramRoot == null) {
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR,
+ «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, «EXPAND xpt::Externalizer::accessorCall(i18nKeyForEditorFailedLoadDiagramMsg()) FOR editorGen», null));
+ }
+«EXPAND hookValidation-»
+ }
+«ENDDEFINE»
+
+«DEFINE loadDiagramFile FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void load(org.eclipse.emf.common.util.URI diagramFile) {
+ diagramRoot = null;
+ diagram = null;
+ if (diagramFile == null) {
+ return;
+ }
+ final org.eclipse.emf.common.util.URI diagramFileURI = diagramFile;
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = getEditingDomain();
+ final org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet();
+ final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.getResource(diagramFile.trimFragment(), true);
+ if (diagramResource == null) {
+ return;
+ }
+ org.eclipse.emf.workspace.AbstractEMFOperation operation = new org.eclipse.emf.workspace.AbstractEMFOperation(editingDomain, «EXPAND xpt::Externalizer::accessorCall(i18nKeyForEditorLoadDiagramLabel()) FOR editorGen», null) {
+ protected org.eclipse.core.runtime.IStatus doExecute(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
+ if (diagramFileURI.fragment() != null) {
+ org.eclipse.emf.ecore.EObject possibleDiagram = diagramResource.getEObject(diagramFileURI.fragment());
+ if (possibleDiagram instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ diagram = (org.eclipse.gmf.runtime.notation.Diagram) possibleDiagram;
+ } else {
+ return org.eclipse.core.runtime.Status.CANCEL_STATUS;
+ }
+ } else {
+ diagram = (org.eclipse.gmf.runtime.notation.Diagram) findInResource(diagramResource, org.eclipse.gmf.runtime.notation.Diagram.class);
+ if (diagram == null) {
+ diagram = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagram();
+ diagramResource.getContents().add(0, diagram);
+ //Auxiliary creation should not be undoable.
+ try {
+ diagramResource.save(getSaveOptions());
+ } catch (java.io.IOException e) {
+ diagram = null;
+ diagramRoot = null;
+ return org.eclipse.core.runtime.Status.CANCEL_STATUS;
+ }
+ }
+ }
+ diagramRoot = «EXPAND MetaModel::CastEObject("diagram.getElement()") FOR editorGen.diagram.domainDiagramElement»;
+ if (diagramRoot == null) {
+«LET editorGen.sameFileForDiagramAndModel ? "diagramResource" : "modelResource" AS resourceToUse-»
+«IF !editorGen.sameFileForDiagramAndModel-»
+ org.eclipse.emf.common.util.URI modelFile = «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».getModelFileURI(diagramFileURI);
+ org.eclipse.emf.ecore.resource.Resource modelResource = resourceSet.getResource(modelFile, true);
+ if (modelResource == null) {
+ diagram = null;
+ return org.eclipse.core.runtime.Status.CANCEL_STATUS;
+ }
+«ENDIF-»
+«REM»
+ FIXME: for code-less domain model findInResource(, Class) is useless.
+ Another approach to get appropriate diagram root element is needed.
+«ENDREM»
+ diagramRoot = («EXPAND MetaModel::QualifiedClassName FOR editorGen.diagram.domainDiagramElement») findInResource(«resourceToUse», «EXPAND MetaModel::QualifiedClassName FOR editorGen.diagram.domainDiagramElement».class);
+ if (diagramRoot == null) {
+ diagramRoot = «EXPAND MetaModel::NewInstance FOR editorGen.diagram.domainDiagramElement»;
+ «resourceToUse».getContents().add(0, «EXPAND MetaModel::DowncastToEObject("diagramRoot") FOR editorGen.diagram.domainDiagramElement»);
+ //We don't want this auxiliary creation to be undoable.
+ try {
+ «resourceToUse».save(getSaveOptions());
+ } catch (java.io.IOException e) {
+ diagram = null;
+ diagramRoot = null;
+ return org.eclipse.core.runtime.Status.CANCEL_STATUS;
+ }
+ }
+ if (!diagramRoot.equals(diagram.getElement())) {
+ diagram.setElement(«EXPAND MetaModel::DowncastToEObject("diagramRoot") FOR editorGen.diagram.domainDiagramElement»);
+ }
+ }
+ if (!diagram.eIsSet(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Type())) {
+ «editorGen.diagram.getNotationViewFactoryQualifiedClassName()».INSTANCE.decorateView(diagram);
+«IF eclipseEditor-»
+ doSave(new org.eclipse.core.runtime.NullProgressMonitor());
+«ELSE-»
+ try {
+ diagramResource.save(getSaveOptions());
+ } catch (java.io.IOException e) {
+ diagram = null;
+ diagramRoot = null;
+ return org.eclipse.core.runtime.Status.CANCEL_STATUS;
+ }
+«ENDIF-»
+ }
+ return org.eclipse.core.runtime.Status.OK_STATUS;
+ }
+ };
+ try {
+ operation.execute(new org.eclipse.core.runtime.NullProgressMonitor(), null);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ diagram = null;
+ diagramRoot = null;
+ }
+ }
+«ENDLET-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private Object findInResource(org.eclipse.emf.ecore.resource.Resource resource, Class expectedClass) {
+ for(java.util.Iterator it = resource.getContents().iterator(); it.hasNext(); ) {
+ Object next = it.next();
+ if (expectedClass.isInstance(next)) {
+ return next;
+ }
+ }
+ return null;
+ }
+
+«ENDDEFINE»
+
+«DEFINE initializeGraphicalViewer FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void initializeGraphicalViewer() {
+ // initialize the viewer with input
+ org.eclipse.gef.editparts.ScalableFreeformRootEditPart root = new org.eclipse.gef.editparts.ScalableFreeformRootEditPart();
+ «EXPAND adjustRoot-»
+ getGraphicalViewer().setRootEditPart(root);
+ getGraphicalViewer().setEditPartFactory(new «editorGen.diagram.getEditPartFactoryQualifiedClassName()»());
+ org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager updateManager = new org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager(getGraphicalViewer());
+ getGraphicalViewer().setProperty(org.eclipse.gmf.runtime.lite.edit.parts.update.TransactionalUpdateManager.class.getName(), updateManager);
+
+«EXPAND addLayers-»
+ getGraphicalViewer().setContents(getDiagram());
+ org.eclipse.emf.common.command.Command updateCommand = updateManager.buildRefreshNotationModelCommand();
+ if (updateCommand != null && updateCommand.canExecute()) {
+ getCommandStack().execute(new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(getEditingDomain(), updateCommand));
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE adjustRoot FOR gmfgen::GenEditorView-»
+ root.getZoomManager().setZoomLevels(getZoomLevels());
+ root.getZoomManager().setZoomLevelContributions(java.util.Arrays.asList(new String[] {org.eclipse.gef.editparts.ZoomManager.FIT_WIDTH, org.eclipse.gef.editparts.ZoomManager.FIT_HEIGHT}));
+«ENDDEFINE»
+
+«DEFINE addLayers FOR gmfgen::GenEditorView-»
+ org.eclipse.draw2d.LayeredPane printableLayers = (org.eclipse.draw2d.LayeredPane) root.getLayer(org.eclipse.gef.LayerConstants.PRINTABLE_LAYERS);
+ org.eclipse.draw2d.FreeformLayer extLabelsLayer = new org.eclipse.draw2d.FreeformLayer();
+ extLabelsLayer.setLayoutManager(new org.eclipse.draw2d.DelegatingLayout());
+ printableLayers.addLayerAfter(extLabelsLayer, «editorGen.diagram.getEditPartFactoryQualifiedClassName()».EXTERNAL_NODE_LABELS_LAYER, org.eclipse.gef.LayerConstants.PRIMARY_LAYER);
+«ENDDEFINE»
+
+«DEFINE configureGraphicalViewer FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ org.eclipse.gef.GraphicalViewer viewer = getGraphicalViewer();
+ «EXPAND configureDefaultFont-»
+ «EXPAND hookPreferenceStoreListener-»
+ // configure the context menu
+ org.eclipse.gef.ContextMenuProvider provider = new «className»ContextMenuProvider(viewer);
+ viewer.setContextMenu(provider);
+ getSite().registerContextMenu(«editorGen.plugin.getActivatorQualifiedClassName()».ID + ".editor.contextmenu", provider, getSite().getSelectionProvider()); «EXPAND xpt::Common::nonNLS»
+
+ org.eclipse.gef.KeyHandler keyHandler = new org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler(viewer);
+ viewer.setKeyHandler(keyHandler);
+
+ viewer.setProperty(org.eclipse.gef.MouseWheelHandler.KeyGenerator.getKey(org.eclipse.swt.SWT.CTRL), org.eclipse.gef.MouseWheelZoomHandler.SINGLETON);
+ }
+«ENDDEFINE»
+
+«DEFINE configureDefaultFont FOR gmfgen::GenEditorView-»
+org.eclipse.swt.graphics.FontData[] defaultFontData = org.eclipse.jface.preference.PreferenceConverter.getFontDataArray(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(), org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.DEFAULT_FONT);
+myDefaultFont = new org.eclipse.swt.graphics.Font(null, defaultFontData);
+viewer.getControl().setFont(myDefaultFont);
+«ENDDEFINE»
+
+«DEFINE hookPreferenceStoreListener FOR gmfgen::GenEditorView-»
+myPreferenceStoreChangeListener = new org.eclipse.jface.util.IPropertyChangeListener() {
+ public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
+ org.eclipse.gef.GraphicalViewer viewer = getGraphicalViewer();
+ if (org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.DEFAULT_FONT.equals(event.getProperty())) {
+ org.eclipse.swt.graphics.FontData[] defaultFontData = org.eclipse.jface.preference.PreferenceConverter.getFontDataArray(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(), org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.DEFAULT_FONT);
+ org.eclipse.swt.graphics.Font newDefaultFont = new org.eclipse.swt.graphics.Font(null, defaultFontData);
+ viewer.getControl().setFont(newDefaultFont);
+ refreshDiagram();
+ myDefaultFont.dispose();
+ myDefaultFont = newDefaultFont;
+ } else if (org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.FONT_COLOR.equals(event.getProperty()) ||
+ org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.LINE_COLOR.equals(event.getProperty()) ||
+ org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.FILL_COLOR.equals(event.getProperty())) {
+ refreshDiagram();
+ }
+ }
+ /**
+ * Do a full refresh on the editor so that all elements pick up their defaults.
+ */
+ private void refreshDiagram() {
+ org.eclipse.gef.GraphicalViewer viewer = getGraphicalViewer();
+ viewer.getControl().setRedraw(false);
+ try {
+ org.eclipse.gef.EditPart contents = viewer.getRootEditPart().getContents();
+ refreshRecursive(contents);
+ } finally {
+ viewer.getControl().setRedraw(true);
+ }
+ }
+
+ /**
+ * Refreshes the given edit part and all its children.
+ */
+ private void refreshRecursive(org.eclipse.gef.EditPart editPart) {
+ if (editPart == null || !editPart.isActive()) {
+ return;
+ }
+ editPart.refresh();
+ for (java.util.Iterator it = editPart.getChildren().iterator(); it.hasNext(); ) {
+ org.eclipse.gef.EditPart nextChild = (org.eclipse.gef.EditPart) it.next();
+ refreshRecursive(nextChild);
+ }
+ }
+};
+«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore().addPropertyChangeListener(myPreferenceStoreChangeListener);
+«ENDDEFINE»
+
+«DEFINE defaultFontAttribute FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.swt.graphics.Font myDefaultFont;
+«ENDDEFINE»
+
+«DEFINE disposeDefaultFont FOR gmfgen::GenEditorView-»
+if (myDefaultFont != null) {
+ myDefaultFont.dispose();
+}
+«ENDDEFINE»
+
+«DEFINE preferenceStoreListener FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.util.IPropertyChangeListener myPreferenceStoreChangeListener;
+«ENDDEFINE»
+
+«DEFINE unhookPreferenceStoreListener FOR gmfgen::GenEditorView-»
+if (myPreferenceStoreChangeListener != null) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore().removePropertyChangeListener(myPreferenceStoreChangeListener);
+}
+«ENDDEFINE»
+
+«DEFINE flyoutPalette FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean isFlyoutPalette() {
+«LET editorGen.diagram.palette AS palette-»
+ return «palette != null && palette.flyout»;
+«ENDLET-»
+ }
+«ENDDEFINE»
+
+«DEFINE getSaveOptions FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected java.util.Map getSaveOptions() {
+ return «editorGen.diagram.getDiagramEditorUtilQualifiedClassName()».getSaveOptions();
+}
+«ENDDEFINE»
+
+«DEFINE gotoMarker FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void gotoMarker(org.eclipse.core.resources.IMarker marker) {
+ try {
+ if (marker.isSubtypeOf(org.eclipse.emf.ecore.EValidator.MARKER)) {
+ String uriAttribute = marker.getAttribute(org.eclipse.emf.ecore.EValidator.URI_ATTRIBUTE, null);
+ if (uriAttribute != null) {
+ org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI.createURI(uriAttribute);
+ org.eclipse.emf.ecore.EObject eObject = getEditingDomain().getResourceSet().getEObject(uri, true);
+ if (eObject != null) {
+ org.eclipse.gef.EditPart markerEditPart = (org.eclipse.gef.EditPart) getGraphicalViewer().getEditPartRegistry().get(eObject);
+ if (markerEditPart != null) {
+ getGraphicalViewer().select(markerEditPart);
+ }
+ }
+ }
+ }
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Failed to navigate to marker", e); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE ContextMenuProvider FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedClassComment»
+ private class «className»ContextMenuProvider extends org.eclipse.gef.ContextMenuProvider {
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «className»ContextMenuProvider(org.eclipse.gef.EditPartViewer viewer) {
+ super(viewer);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void buildContextMenu(org.eclipse.jface.action.IMenuManager menuManager) {
+ org.eclipse.gef.ui.actions.GEFActionConstants.addStandardActionGroups(menuManager);
+«EXPAND provideStackActions-»
+«EXPAND provideEditPartActions-»
+«EXPAND provideEditorActions-»
+«IF editorGen.diagram.validationNeeded()-»
+«EXPAND provideValidateActions-»
+«ENDIF-»
+
+«EXPAND provideMetricsActions FOR editorGen.metrics-»
+
+«EXPAND provideMoreActions-»
+ }
+
+«EXPAND appendAlignmentSubmenu-»
+«EXPAND appendActionToMenu-»
+«ENDDEFINE»
+
+«DEFINE appendAlignmentSubmenu FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void appendAlignmentSubmenu(org.eclipse.jface.action.IMenuManager menuManager) {
+ // Alignment Actions
+ org.eclipse.jface.action.MenuManager submenu = new org.eclipse.jface.action.MenuManager(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForEditorAlignMenu()) FOR editorGen»);
+ submenu.add(new org.eclipse.jface.action.Separator(org.eclipse.gef.ui.actions.GEFActionConstants.MB_ADDITIONS));
+
+ appendActionToMenu(submenu, org.eclipse.gef.ui.actions.GEFActionConstants.ALIGN_LEFT, org.eclipse.gef.ui.actions.GEFActionConstants.MB_ADDITIONS);
+ appendActionToMenu(submenu, org.eclipse.gef.ui.actions.GEFActionConstants.ALIGN_CENTER, org.eclipse.gef.ui.actions.GEFActionConstants.MB_ADDITIONS);
+ appendActionToMenu(submenu, org.eclipse.gef.ui.actions.GEFActionConstants.ALIGN_RIGHT, org.eclipse.gef.ui.actions.GEFActionConstants.MB_ADDITIONS);
+ appendActionToMenu(submenu, org.eclipse.gef.ui.actions.GEFActionConstants.ALIGN_TOP, org.eclipse.gef.ui.actions.GEFActionConstants.MB_ADDITIONS);
+ appendActionToMenu(submenu, org.eclipse.gef.ui.actions.GEFActionConstants.ALIGN_MIDDLE, org.eclipse.gef.ui.actions.GEFActionConstants.MB_ADDITIONS);
+ appendActionToMenu(submenu, org.eclipse.gef.ui.actions.GEFActionConstants.ALIGN_BOTTOM, org.eclipse.gef.ui.actions.GEFActionConstants.MB_ADDITIONS);
+
+ if (!submenu.isEmpty()) {
+ menuManager.appendToGroup(org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_REST, submenu);
+ }
+ }
+
+«ENDDEFINE»
+
+«DEFINE appendActionToMenu FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void appendActionToMenu(org.eclipse.jface.action.IMenuManager menu, String actionId, String menuGroup) {
+ org.eclipse.jface.action.IAction action = getActionRegistry().getAction(actionId);
+ if (action != null && action.isEnabled()) {
+ menu.appendToGroup(menuGroup, action);
+ }
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE provideStackActions FOR gmfgen::GenEditorView-»
+ appendActionToMenu(menuManager, org.eclipse.ui.actions.ActionFactory.UNDO.getId(), org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_UNDO);
+ appendActionToMenu(menuManager, org.eclipse.ui.actions.ActionFactory.REDO.getId(), org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_UNDO);
+«ENDDEFINE»
+
+«DEFINE provideEditPartActions FOR gmfgen::GenEditorView-»
+ appendActionToMenu(menuManager, org.eclipse.ui.actions.ActionFactory.COPY.getId(), org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_EDIT);
+ appendActionToMenu(menuManager, org.eclipse.ui.actions.ActionFactory.PASTE.getId(), org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_EDIT);
+ appendActionToMenu(menuManager, org.eclipse.gmf.runtime.lite.ui.actions.ActionIds.DELETE_VIEW, org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_EDIT);
+ appendActionToMenu(menuManager, org.eclipse.ui.actions.ActionFactory.DELETE.getId(), org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_EDIT);
+ appendActionToMenu(menuManager, org.eclipse.gef.ui.actions.GEFActionConstants.DIRECT_EDIT, org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_EDIT);
+«EXPAND provideAlignmentActions-»
+«ENDDEFINE»
+
+«DEFINE provideAlignmentActions FOR gmfgen::GenEditorView-»
+ appendAlignmentSubmenu(menuManager);
+«ENDDEFINE»
+
+«DEFINE provideEditorActions FOR gmfgen::GenEditorView-»
+«IF eclipseEditor-»
+ appendActionToMenu(menuManager, org.eclipse.ui.actions.ActionFactory.SAVE.getId(), org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_SAVE);
+«ENDIF-»
+ appendActionToMenu(menuManager, org.eclipse.gmf.runtime.lite.ui.actions.ActionIds.LAYOUT_ALL_ACTION, org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_REST);
+«IF editorGen.diagram.generateCreateShortcutAction()-»
+ appendActionToMenu(menuManager, «editorGen.diagram.getCreateShortcutActionQualifiedClassName()».CREATE_SHORTCUT_ACTION, org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_REST);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE provideValidateActions FOR gmfgen::GenEditorView-»
+ appendActionToMenu(menuManager, «EXPAND xpt::providers::ValidateAction::actionKey FOR editorGen.diagram», org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_REST);
+«ENDDEFINE»
+
+«DEFINE provideMetricsActions FOR gmfgen::GenMetricContainer-»
+ appendActionToMenu(menuManager, «EXPAND xpt::providers::MetricsAction::actionKey FOR editorGen.diagram», org.eclipse.gef.ui.actions.GEFActionConstants.GROUP_REST);
+«ENDDEFINE»
+
+«DEFINE provideMoreActions FOR gmfgen::GenEditorView-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenEditorView-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForEditorAlignMenu())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForEditorLoadDiagramLabel())-»
+«IF !eclipseEditor-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForEditorFailedLoadDiagramMsg())-»
+«ELSE-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForEditorInvalidInputMsg())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForEditorErrorDuringSave().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForEditorErrorDuringSave().messageKey())-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForEditorAlignMenu(), "Align")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForEditorLoadDiagramLabel(), "Load Diagram")-»
+«IF !eclipseEditor-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForEditorFailedLoadDiagramMsg(), "Failed to load diagram")-»
+«ELSE-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForEditorInvalidInputMsg(), "The specified input is not valid.")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForEditorErrorDuringSave().titleKey(), "Error during save")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForEditorErrorDuringSave().messageKey(), "The current " + editorGen.domainGenModel.modelName + " model could not be saved")-»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/ElementChooser.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::editor::Utils»
+«EXTENSION xpt::editor::Wizard»
+
+«DEFINE ElementChooser FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «elementChooserClassName» extends org.eclipse.jface.dialogs.Dialog {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND createDialogArea-»
+
+ «EXPAND createButtonBar-»
+
+ «EXPAND createModelBrowser-»
+
+ «EXPAND setOkButtonEnabled-»
+
+ «EXPAND isValidModelFile-»
+
+ «EXPAND getCreateShortcutCommand-»
+
+ «EXPAND getCreateShortcutCommandForGivenObject-»
+
+ «EXPAND open-»
+
+ «EXPAND ModelElementsTreeContentProvider-»
+
+ «EXPAND ModelElementsTreeLabelProvider-»
+
+ «EXPAND ModelFilesFilter-»
+
+ «EXPAND OkButtonEnabler-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.TreeViewer myTreeViewer;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.common.util.URI mySelectedModelElementURI;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.notation.View myView;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain = «EXPAND xpt::editor::Common::createEditingDomain FOR editorGen»;
+
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gef.GraphicalViewer myGraphicalViewer;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «elementChooserClassName»(org.eclipse.swt.widgets.Shell parentShell, org.eclipse.gmf.runtime.notation.View view, org.eclipse.gef.GraphicalViewer graphicalViewer) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | org.eclipse.swt.SWT.RESIZE);
+ myView = view;
+ myGraphicalViewer = graphicalViewer;
+}
+«ENDDEFINE»
+
+«DEFINE createDialogArea FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent) {
+ org.eclipse.swt.widgets.Composite composite = (org.eclipse.swt.widgets.Composite) super.createDialogArea(parent);
+ getShell().setText(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForSelectModelElement(this))) FOR editorGen»);
+ createModelBrowser(composite);
+ return composite;
+}
+«ENDDEFINE»
+
+«DEFINE createButtonBar FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite parent) {
+ org.eclipse.swt.widgets.Control buttonBar = super.createButtonBar(parent);
+ setOkButtonEnabled(false);
+ return buttonBar;
+}
+«ENDDEFINE»
+
+«DEFINE createModelBrowser FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void createModelBrowser(org.eclipse.swt.widgets.Composite composite) {
+ myTreeViewer = new org.eclipse.jface.viewers.TreeViewer(composite, org.eclipse.swt.SWT.SINGLE | org.eclipse.swt.SWT.H_SCROLL | org.eclipse.swt.SWT.V_SCROLL | org.eclipse.swt.SWT.BORDER);
+ org.eclipse.swt.layout.GridData layoutData = new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ myTreeViewer.getTree().setLayoutData(layoutData);
+ myTreeViewer.setContentProvider(new ModelElementsTreeContentProvider());
+ myTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider());
+ myTreeViewer.setInput(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot());
+ myTreeViewer.addFilter(new ModelFilesFilter());
+ myTreeViewer.addSelectionChangedListener(new OkButtonEnabler());
+}
+«ENDDEFINE»
+
+«DEFINE setOkButtonEnabled FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void setOkButtonEnabled(boolean enabled) {
+ getButton(org.eclipse.jface.dialogs.IDialogConstants.OK_ID).setEnabled(enabled);
+}
+«ENDDEFINE»
+
+«DEFINE isValidModelFile FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean isValidModelFile(org.eclipse.core.resources.IFile file) {
+ String fileExtension = file.getFullPath().getFileExtension();
+ return «EXPAND compareModelFileExtension FOREACH containsShortcutsTo SEPARATOR " || "»; «EXPAND xpt::Common::nonNLS({}) FOREACH containsShortcutsTo SEPARATOR " "»
+}
+«ENDDEFINE»
+
+/**
+ * NB: For the lite runtime, "containsShortcutsTo" is considered not file extension,
+ * but the model ID of the diagram whose elements may appear on this diagram.
+ * The mapping between model ID and the file extension is not predefined, but the most typical case
+ * is covered here.
+ */
+«DEFINE compareModelFileExtension FOR String»"«this»".equalsIgnoreCase(fileExtension)«ENDDEFINE»
+
+«DEFINE getCreateShortcutCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand getCreateShortcutCommand() {
+ final org.eclipse.emf.ecore.EObject selectedElement;
+ try {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(myView.getElement());
+ selectedElement = editingDomain.getResourceSet().getEObject(mySelectedModelElementURI, true);
+ } catch (org.eclipse.emf.common.util.WrappedException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while loading object: " + mySelectedModelElementURI.toString(), e); «EXPAND xpt::Common::nonNLS»
+ return null;
+ }
+ if (selectedElement == null) {
+ return null;
+ }
+ return getCreateShortcutCommand(selectedElement);
+}
+«ENDDEFINE»
+
+«DEFINE getCreateShortcutCommandForGivenObject FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand getCreateShortcutCommand(org.eclipse.emf.ecore.EObject domainModelElement) {
+ «FOREACH containsShortcutsTo AS nextModelID ITERATOR it-»
+ «IF it.isFirstIteration()»org.eclipse.gmf.runtime.lite.shortcuts.IShortcutProvider «ENDIF»shortcutProvider = org.eclipse.gmf.runtime.lite.shortcuts.ShortcutProvidersRegistry.INSTANCE.getShortcutProvider(«IF nextModelID == editorGen.modelID»«getEditPartQualifiedClassName()».MODEL_ID«ELSE»"«nextModelID»"«ENDIF»);«IF nextModelID != editorGen.modelID» «EXPAND xpt::Common::nonNLS»«ENDIF»
+ if (shortcutProvider != null) {
+ org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand result = shortcutProvider.getCreateShortcutCommand(myView, domainModelElement);
+ if (result != null && result.canExecute()) {
+ return result;
+ }
+ }
+ «ENDFOREACH-»
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE open FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int open() {
+ int result = super.open();
+ for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ resource.unload();
+ }
+ myEditingDomain.dispose();
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE ModelElementsTreeContentProvider FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class ModelElementsTreeContentProvider implements org.eclipse.jface.viewers.ITreeContentProvider {
+
+ «EXPAND METCP_attributes-»
+
+ «EXPAND METCP_getChildren-»
+
+ «EXPAND METCP_getParent-»
+
+ «EXPAND METCP_hasChildren-»
+
+ «EXPAND METCP_getElements-»
+
+ «EXPAND METCP_dispose-»
+
+ «EXPAND METCP_inputChanged-»
+
+ «EXPAND METCP_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE METCP_attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.ITreeContentProvider myWorkbenchContentProvider = new «IF null == editorGen.application»org.eclipse.ui.model.WorkbenchContentProvider«ELSE»org.eclipse.ui.model.BaseWorkbenchContentProvider«ENDIF»();
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider myAdapterFactoryContentProvier = new org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+«ENDDEFINE»
+
+«DEFINE METCP_getChildren FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] getChildren(Object parentElement) {
+ Object[] result = myWorkbenchContentProvider.getChildren(parentElement);
+ if (result != null && result.length > 0) {
+ return result;
+ }
+ if (parentElement instanceof org.eclipse.core.resources.IFile) {
+ org.eclipse.core.resources.IFile modelFile = (org.eclipse.core.resources.IFile) parentElement;
+ org.eclipse.core.runtime.IPath resourcePath = modelFile.getFullPath();
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet();
+ try {
+ org.eclipse.emf.ecore.resource.Resource modelResource = resourceSet.getResource(org.eclipse.emf.common.util.URI.createPlatformResourceURI(resourcePath.toString(), true), true);
+ return myAdapterFactoryContentProvier.getChildren(modelResource);
+ } catch (org.eclipse.emf.common.util.WrappedException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to load resource: " + resourcePath.toString(), e); «EXPAND xpt::Common::nonNLS»
+ }
+ return java.util.Collections.EMPTY_LIST.toArray();
+ }
+ return myAdapterFactoryContentProvier.getChildren(parentElement);
+}
+«ENDDEFINE»
+
+«DEFINE METCP_getParent FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object getParent(Object element) {
+ Object parent = myWorkbenchContentProvider.getParent(element);
+ if (parent != null) {
+ return parent;
+ }
+ if (element instanceof org.eclipse.emf.ecore.EObject) {
+ org.eclipse.emf.ecore.EObject eObject = (org.eclipse.emf.ecore.EObject) element;
+ if (eObject.eContainer() == null && eObject.eResource().getURI().isFile()) {
+ String path = eObject.eResource().getURI().path();
+ return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new org.eclipse.core.runtime.Path(path));
+ }
+ return myAdapterFactoryContentProvier.getParent(eObject);
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE METCP_hasChildren FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean hasChildren(Object element) {
+ if (element instanceof org.eclipse.core.resources.IFile) {
+ return isValidModelFile((org.eclipse.core.resources.IFile) element);
+ }
+ return myWorkbenchContentProvider.hasChildren(element) || myAdapterFactoryContentProvier.hasChildren(element);
+}
+«ENDDEFINE»
+
+«DEFINE METCP_getElements FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] getElements(Object inputElement) {
+ Object[] elements = myWorkbenchContentProvider.getElements(inputElement);
+ return elements;
+}
+«ENDDEFINE»
+
+«DEFINE METCP_dispose FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ myWorkbenchContentProvider.dispose();
+ myAdapterFactoryContentProvier.dispose();
+}
+«ENDDEFINE»
+
+«DEFINE METCP_inputChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
+ myWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput);
+ myAdapterFactoryContentProvier.inputChanged(viewer, oldInput, newInput);
+}
+«ENDDEFINE»
+
+«DEFINE ModelElementsTreeLabelProvider FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class ModelElementsTreeLabelProvider implements org.eclipse.jface.viewers.ILabelProvider {
+
+ «EXPAND METLP_attributes-»
+
+ «EXPAND METLP_getImage-»
+
+ «EXPAND METLP_getText-»
+
+ «EXPAND METLP_addListener-»
+
+ «EXPAND METLP_dispose-»
+
+ «EXPAND METLP_isLabelProperty-»
+
+ «EXPAND METLP_removeListener-»
+
+ «EXPAND METLP_additions-»
+}
+«ENDDEFINE»
+
+
+«DEFINE METLP_attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.model.WorkbenchLabelProvider myWorkbenchLabelProvider = new org.eclipse.ui.model.WorkbenchLabelProvider();
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+«ENDDEFINE»
+
+«DEFINE METLP_getImage FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.swt.graphics.Image getImage(Object element) {
+ org.eclipse.swt.graphics.Image result = myWorkbenchLabelProvider.getImage(element);
+ return result != null ? result : myAdapterFactoryLabelProvider.getImage(element);
+}
+«ENDDEFINE»
+
+«DEFINE METLP_getText FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getText(Object element) {
+ String result = myWorkbenchLabelProvider.getText(element);
+ return result != null && result.length() > 0 ? result : myAdapterFactoryLabelProvider.getText(element);
+}
+«ENDDEFINE»
+
+«DEFINE METLP_addListener FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.addListener(listener);
+ myAdapterFactoryLabelProvider.addListener(listener);
+}
+«ENDDEFINE»
+
+«DEFINE METLP_dispose FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ myWorkbenchLabelProvider.dispose();
+ myAdapterFactoryLabelProvider.dispose();
+}
+«ENDDEFINE»
+
+«DEFINE METLP_isLabelProperty FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isLabelProperty(Object element, String property) {
+ return myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+}
+«ENDDEFINE»
+
+«DEFINE METLP_removeListener FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.removeListener(listener);
+ myAdapterFactoryLabelProvider.removeListener(listener);
+}
+«ENDDEFINE»
+
+«DEFINE ModelFilesFilter FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class ModelFilesFilter extends org.eclipse.jface.viewers.ViewerFilter {
+
+ «EXPAND MFF_select-»
+
+ «EXPAND MFF_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE MFF_select FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean select(org.eclipse.jface.viewers.Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof org.eclipse.core.resources.IContainer) {
+ return true;
+ }
+ if (element instanceof org.eclipse.core.resources.IFile) {
+ org.eclipse.core.resources.IFile file = (org.eclipse.core.resources.IFile) element;
+ return isValidModelFile(file);
+ }
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE OkButtonEnabler FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class OkButtonEnabler implements org.eclipse.jface.viewers.ISelectionChangedListener {
+
+ «EXPAND OBE_selectionChanged-»
+
+ «EXPAND OBE_canCreateShortcutNode-»
+
+ «EXPAND OBE_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE OBE_selectionChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event) {
+ if (event.getSelection() instanceof org.eclipse.jface.viewers.IStructuredSelection) {
+ org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) event.getSelection();
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof org.eclipse.emf.edit.provider.IWrapperItemProvider) {
+ selectedElement = ((org.eclipse.emf.edit.provider.IWrapperItemProvider) selectedElement).getValue();
+ }
+ if (selectedElement instanceof org.eclipse.emf.ecore.util.FeatureMap.Entry) {
+ selectedElement = ((org.eclipse.emf.ecore.util.FeatureMap.Entry) selectedElement).getValue();
+ }
+ if (selectedElement instanceof org.eclipse.emf.ecore.EObject) {
+ org.eclipse.emf.ecore.EObject selectedModelElement = (org.eclipse.emf.ecore.EObject) selectedElement;
+ setOkButtonEnabled(canCreateShortcutNode(selectedModelElement));
+ mySelectedModelElementURI = org.eclipse.emf.ecore.util.EcoreUtil.getURI(selectedModelElement);
+ return;
+ }
+ }
+ }
+ mySelectedModelElementURI = null;
+ setOkButtonEnabled(false);
+}
+«ENDDEFINE»
+
+«DEFINE OBE_canCreateShortcutNode FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private boolean canCreateShortcutNode(org.eclipse.emf.ecore.EObject modelElement) {
+ if (myGraphicalViewer.getEditPartRegistry().get(modelElement) != null) {
+ return false;
+ }
+ org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand command = getCreateShortcutCommand(modelElement);
+ return command != null && command.canExecute();
+}
+«ENDDEFINE»
+
+«DEFINE METCP_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE METLP_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE MFF_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE OBE_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF !isRichClientPlatform()-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForSelectModelElement(this)), "Select model element")-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF !isRichClientPlatform()-»
+ «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForSelectModelElement(this)))-»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/InitDiagramFileAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::editor::i18n»
+«EXTENSION xpt::editor::Wizard»
+
+«DEFINE InitDiagramFileAction FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «initDiagramFileActionClassName» «EXPAND supertypes» {
+ «EXPAND selectedModelFile-»
+ «EXPAND selection-»
+ «EXPAND targetPart-»
+ «EXPAND selectionChanged-»
+ «EXPAND run-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()»extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate«ELSE»implements org.eclipse.ui.IObjectActionDelegate«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE selectedModelFileType FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»org.eclipse.emf.common.util.URI«ELSE»org.eclipse.core.resources.IFile«ENDIF»«ENDDEFINE»
+«DEFINE selectedModelFileName FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»mySelectedModelFileURI«ELSE»mySelectedModelFile«ENDIF»«ENDDEFINE»
+«DEFINE selectedModelFileAsURI FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»«EXPAND selectedModelFileName»«ELSE»org.eclipse.emf.common.util.URI.createPlatformResourceURI(«EXPAND selectedModelFileName».getFullPath().toString(), true)«ENDIF»«ENDDEFINE»
+«DEFINE selectedModelFileAsString FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»«EXPAND selectedModelFileName».toString()«ELSE»«EXPAND selectedModelFileName».getFullPath().toString()«ENDIF»«ENDDEFINE»
+
+«DEFINE selectedModelFile FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «EXPAND selectedModelFileType» «EXPAND selectedModelFileName»;
+«ENDDEFINE»
+
+«DEFINE selection FOR gmfgen::GenDiagram-»
+«IF !isRichClientPlatform()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.IStructuredSelection mySelection;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE targetPart FOR gmfgen::GenDiagram-»
+«IF !isRichClientPlatform()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.IWorkbenchPart myPart;
+
+«EXPAND xpt::Common::generatedMemberComment»
+public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
+ myPart = targetPart;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE selectionChanged FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
+«IF isRichClientPlatform()-»
+ super.selectionChanged(action, selection);
+«ELSE-»
+ mySelection = org.eclipse.jface.viewers.StructuredSelection.EMPTY;
+ action.setEnabled(false);
+«ENDIF-»
+ «EXPAND selectedModelFileName» = null;
+ if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection == false || selection.isEmpty()) {
+ return;
+ }
+ Object firstElement = ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement();
+ «EXPAND defineModelFile-»
+«IF isRichClientPlatform()-»
+ if (mySelectedModelFileURI != null) {
+ mySelectedModelFileURI = mySelectedModelFileURI.trimFragment();
+ }
+«ELSE-»
+ mySelection = (org.eclipse.jface.viewers.IStructuredSelection) selection;
+«ENDIF-»
+ action.setEnabled(true);
+}
+«ENDDEFINE»
+
+«DEFINE defineModelFile FOR gmfgen::GenDiagram-»
+«EXPAND tryInstanceof-»
+«EXPAND tryAdaptable-»
+«ENDDEFINE»
+
+«DEFINE tryInstanceof FOR gmfgen::GenDiagram-»
+if («EXPAND selectedModelFileName» == null && firstElement instanceof «EXPAND selectedModelFileType») {
+ «EXPAND selectedModelFileName» = («EXPAND selectedModelFileType») firstElement;
+}
+«ENDDEFINE»
+
+«DEFINE tryAdaptable FOR gmfgen::GenDiagram-»
+if («EXPAND selectedModelFileName» == null && firstElement instanceof org.eclipse.core.runtime.IAdaptable) {
+ «EXPAND selectedModelFileName» = («EXPAND selectedModelFileType») ((org.eclipse.core.runtime.IAdaptable) firstElement).getAdapter(«EXPAND selectedModelFileType».class);
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.emf.ecore.EObject diagramRoot = null;
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «EXPAND xpt::editor::Common::createEditingDomain FOR editorGen»;
+«IF isRichClientPlatform()-»
+ if (mySelectedModelFileURI != null) {
+«ENDIF-»
+«IF editorGen.sameFileForDiagramAndModel-»
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl();
+«ELSE-»
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet();
+«ENDIF-»
+ try {
+ org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(«EXPAND selectedModelFileAsURI», true);
+ diagramRoot = (org.eclipse.emf.ecore.EObject) resource.getContents().get(0);
+ } catch (org.eclipse.emf.common.util.WrappedException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to load resource: " + «EXPAND selectedModelFileAsString», ex); «EXPAND xpt::Common::nonNLS»
+ org.eclipse.jface.dialogs.MessageDialog.openError(«EXPAND getShell»,
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileResourceErrorDialog().titleKey()) FOR editorGen»,
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileResourceErrorDialog().messageKey()) FOR editorGen»);
+ return;
+ }
+«IF isRichClientPlatform()-»
+ }
+«ENDIF-»
+ org.eclipse.jface.wizard.Wizard wizard = new «getNewDiagramFileWizardQualifiedClassName()»(«EXPAND selectedModelFileName», «EXPAND additionalWizardParameters»diagramRoot, editingDomain);
+ «EXPAND xpt::editor::Common::wizardDialogSettings("wizard", "InitDiagramFile")-»
+ wizard.setForcePreviousAndNextButtons(«EXPAND needsForceButtons»);
+ wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileWizardTitle()) FOR editorGen»,
+ «EXPAND xpt::editor::VisualIDRegistry::modelID»));
+
+ org.eclipse.jface.wizard.WizardDialog dialog = new org.eclipse.jface.wizard.WizardDialog(«EXPAND getShell», wizard);
+ dialog.create();
+ «EXPAND xpt::editor::Common::setDefaultShellSize("dialog.getShell()")-»
+ dialog.open();
+}
+«ENDDEFINE»
+
+«DEFINE additionalWizardParameters FOR gmfgen::GenDiagram»«IF !isRichClientPlatform()»myPart.getSite().getPage(), mySelection, «ENDIF»«ENDDEFINE»
+
+«DEFINE getShell FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»getWindow().getShell()«ELSE»myPart.getSite().getShell()«ENDIF»«ENDDEFINE»
+
+«DEFINE needsForceButtons FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»mySelectedModelFileURI != null«ELSE»false«ENDIF»«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForInitDiagramFileResourceErrorDialog().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForInitDiagramFileResourceErrorDialog().messageKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForInitDiagramFileWizardTitle())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForInitDiagramFileResourceErrorDialog().titleKey(), "Error")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForInitDiagramFileResourceErrorDialog().messageKey(), "Model file loading failed")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForInitDiagramFileWizardTitle(), "Initialize new {0} diagram file")-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/LoadResourceAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«DEFINE LoadResourceAction FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «loadResourceActionClassName» implements org.eclipse.ui.IObjectActionDelegate {
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «getEditPartQualifiedClassName()» mySelectedElement;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.swt.widgets.Shell myShell;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
+ myShell = targetPart.getSite().getShell();
+ }
+
+«EXPAND run-»
+«EXPAND selectionChanged-»
+«EXPAND getEditingDomain-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog = new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(myShell, getEditingDomain());
+ loadResourceDialog.open();
+ }
+«ENDDEFINE»
+
+«DEFINE getEditingDomain FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.edit.domain.EditingDomain getEditingDomain() {
+ return org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(mySelectedElement.getDiagram());
+}
+«ENDDEFINE»
+
+«DEFINE selectionChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
+ mySelectedElement = null;
+ if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection) {
+ org.eclipse.jface.viewers.IStructuredSelection structuredSelection = (org.eclipse.jface.viewers.IStructuredSelection) selection;
+ if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof «getEditPartQualifiedClassName()») {
+ mySelectedElement = («getEditPartQualifiedClassName()») structuredSelection.getFirstElement();
+ }
+ }
+ action.setEnabled(mySelectedElement != null);
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/MatchingStrategy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE MatchingStrategy FOR GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «matchingStrategyClassName» «EXPAND supertypes» {
+ «EXPAND matches-»
+ «EXPAND getURIFromInput-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR GenDiagram»implements org.eclipse.ui.IEditorMatchingStrategy«ENDDEFINE»
+
+«DEFINE matches FOR GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean matches(org.eclipse.ui.IEditorReference editorRef, org.eclipse.ui.IEditorInput input) {
+ if (editorRef == null || !«editorGen.editor.getQualifiedClassName()».ID.equals(editorRef.getId())) {
+ return false;
+ }
+ org.eclipse.emf.common.util.URI inputURI = getURIFromInput(input);
+ if (inputURI == null) {
+ return false;
+ }
+ try {
+ org.eclipse.ui.IEditorInput editorInput = editorRef.getEditorInput();
+ org.eclipse.emf.common.util.URI editorURI = getURIFromInput(editorInput);
+ if (editorURI == null) {
+ return false;
+ }
+ «EXPAND compareURIs-»
+ } catch (org.eclipse.ui.PartInitException e) {
+ return false;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE getURIFromInput FOR GenDiagram-»
+«EXPAND xpt::editor::Editor::getURIFromInput FOR editorGen.editor-»
+«ENDDEFINE»
+
+«DEFINE compareURIs FOR GenDiagram-»
+if (!editorURI.trimFragment().equals(inputURI.trimFragment())) {
+ return false;
+}
+String editorFragment = editorURI.fragment();
+String inputFragment = inputURI.fragment();
+if (editorFragment != null && inputFragment != null) {
+ return editorFragment.equals(inputFragment);
+}
+String nonNullFragment;
+if (editorFragment != null) {
+ nonNullFragment = editorFragment;
+} else if (inputFragment != null) {
+ nonNullFragment = inputFragment;
+} else {
+ return true;
+}
+org.eclipse.emf.transaction.TransactionalEditingDomain domain = «EXPAND xpt::editor::Common::createEditingDomain FOR editorGen»;
+org.eclipse.emf.ecore.resource.Resource resource = domain.getResourceSet().getResource(editorURI.trimFragment(), true);
+for (java.util.Iterator it = resource.getContents().iterator(); it.hasNext(); ) {
+ org.eclipse.emf.ecore.EObject next = (org.eclipse.emf.ecore.EObject) it.next();
+ if (nonNullFragment.equals(resource.getURIFragment(next))) {
+ return true;
+ }
+ if (next instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ return false;
+ }
+}
+return false;
+«ENDDEFINE»
+
+«DEFINE additions FOR GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/NewDiagramFileWizard.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,438 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::editor::i18n»
+«EXTENSION xpt::editor::Wizard»
+
+«DEFINE NewDiagramFileWizard FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «newDiagramFileWizardClassName» «EXPAND supertypes» {
+ «EXPAND editingDomain-»
+ «EXPAND selectedModelFile-»
+ «EXPAND creationPage-»
+ «EXPAND selection-»
+ «EXPAND workbenchPage-»
+ «EXPAND diagramRoot-»
+
+ «EXPAND ctor-»
+
+ «EXPAND addPages-»
+
+ «EXPAND performFinish-»
+
+«IF isRichClientPlatform()-»
+ «EXPAND SourceURISelectorPage-»
+ «EXPAND DiagramURISelectorPage-»
+«ENDIF-»
+ «EXPAND RootElementSelectorPage-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.jface.wizard.Wizard«ENDDEFINE»
+
+«DEFINE selectedModelFileType FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»org.eclipse.emf.common.util.URI«ELSE»org.eclipse.core.resources.IFile«ENDIF»«ENDDEFINE»
+«DEFINE selectedModelFileName FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»mySelectedModelFileURI«ELSE»mySelectedModelFile«ENDIF»«ENDDEFINE»
+«DEFINE selectedModelFileAsURI FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»«EXPAND selectedModelFileName»«ELSE»org.eclipse.emf.common.util.URI.createPlatformResourceURI(«EXPAND selectedModelFileName».getFullPath().toString(), true)«ENDIF»«ENDDEFINE»
+«DEFINE selectedModelFileAsString FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»«EXPAND selectedModelFileName».toString()«ELSE»«EXPAND selectedModelFileName».getFullPath().toString()«ENDIF»«ENDDEFINE»
+
+«DEFINE editingDomain FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain;
+«ENDDEFINE»
+
+«DEFINE selection FOR gmfgen::GenDiagram-»
+«IF !isRichClientPlatform()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.IStructuredSelection mySelection;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE workbenchPage FOR gmfgen::GenDiagram-»
+«IF !isRichClientPlatform()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.IWorkbenchPage myWorkbenchPage;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE selectedModelFile FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «EXPAND selectedModelFileType» «EXPAND selectedModelFileName»;
+«ENDDEFINE»
+
+«DEFINE creationPage FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Common::generatedMemberComment»
+private DiagramURISelectorPage myDiagramURISelectorPage;
+«ELSE-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.dialogs.WizardNewFileCreationPage myFileCreationPage;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE diagramRoot FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.ecore.EObject myDiagramRoot;
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «newDiagramFileWizardClassName»(org.eclipse.emf.common.util.URI selectedModelFileURI, org.eclipse.emf.ecore.EObject diagramRoot, org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
+«ELSE-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «newDiagramFileWizardClassName»(org.eclipse.core.resources.IFile selectedModelFile, org.eclipse.ui.IWorkbenchPage workbenchPage, org.eclipse.jface.viewers.IStructuredSelection selection, org.eclipse.emf.ecore.EObject diagramRoot, org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
+ «EXPAND assertNotNull("selectedModelFile")-»
+ «EXPAND assertNotNull("workbenchPage")-»
+ «EXPAND assertNotNull("selection")-»
+ «EXPAND assertNotNull("diagramRoot")-»
+«ENDIF-»
+ «EXPAND assertNotNull("editingDomain")-»
+«IF isRichClientPlatform()-»
+ «EXPAND selectedModelFileName» = selectedModelFileURI;
+«ELSE-»
+ «EXPAND selectedModelFileName» = selectedModelFile;
+ myWorkbenchPage = workbenchPage;
+ mySelection = selection;
+«ENDIF-»
+ myDiagramRoot = diagramRoot;
+ myEditingDomain = editingDomain;
+ setDefaultPageImageDescriptor(«editorGen.plugin.getActivatorQualifiedClassName()».getBundledImageDescriptor("«EXPAND xpt::editor::CreationWizard::wizardBannerLocation»")); «EXPAND xpt::Common::nonNLS»
+}
+«ENDDEFINE»
+
+«DEFINE assertNotNull(String var) FOR gmfgen::GenDiagram-»
+assert «var» != null : "Null «var» in «newDiagramFileWizardClassName» constructor"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE addPages FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void addPages() {
+«IF isRichClientPlatform()-»
+ if (mySelectedModelFileURI == null) {
+ addPage(new SourceURISelectorPage());
+ }
+ myDiagramURISelectorPage = new DiagramURISelectorPage();
+ addPage(myDiagramURISelectorPage);
+«ELSE-»
+ myFileCreationPage = new org.eclipse.ui.dialogs.WizardNewFileCreationPage(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardDiagramURISelectorPageName()) FOR editorGen», mySelection) {
+ public void createControl(org.eclipse.swt.widgets.Composite parent) {
+ super.createControl(parent);
+
+ org.eclipse.core.resources.IContainer parentContainer = mySelectedModelFile.getParent();
+ String originalFileName = mySelectedModelFile.getProjectRelativePath().removeFileExtension().lastSegment();
+ String fileExtension = ".«editorGen.diagramFileExtension»"; «EXPAND xpt::Common::nonNLS»
+ String fileName = originalFileName + fileExtension;
+ for (int i = 1; i > 0 && parentContainer.getFile(new org.eclipse.core.runtime.Path(fileName)).exists(); i++) {
+ fileName = originalFileName + i + fileExtension;
+ }
+ if (parentContainer.getFile(new org.eclipse.core.runtime.Path(fileName)).exists()) {
+ return; //failed to set name that does not exist, just leave empty.
+ }
+ setFileName(fileName);
+ }
+ };
+ myFileCreationPage.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardDiagramURISelectorPageTitle()) FOR editorGen»);
+ myFileCreationPage.setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardDiagramURISelectorPageDescription()) FOR editorGen»);
+ addPage(myFileCreationPage);
+«ENDIF-»
+ RootElementSelectorPage diagramRootElementSelectionPage = new RootElementSelectorPage();
+ diagramRootElementSelectionPage.setModelElement(myDiagramRoot);
+ addPage(diagramRootElementSelectionPage);
+}
+«ENDDEFINE»
+
+«DEFINE performFinish FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean performFinish() {
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet();
+ «EXPAND defineDiagramFileURI-»
+ final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.createResource(diagramFileURI);
+ org.eclipse.emf.common.command.AbstractCommand command = new org.eclipse.emf.common.command.AbstractCommand(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardCommandLabel()) FOR editorGen») {
+ private org.eclipse.gmf.runtime.notation.Diagram myCreatedDiagram;
+
+ protected boolean prepare() {
+ int diagramVID = «EXPAND xpt::editor::VisualIDRegistry::getDiagramVisualIDMethodCall»(myDiagramRoot);
+ if (diagramVID != «EXPAND xpt::editor::VisualIDRegistry::visualID») {
+ return false;
+ }
+ return true;
+ }
+ public void execute() {
+ myCreatedDiagram = «getDiagramEditorUtilQualifiedClassName()».createDiagramFor(myDiagramRoot);
+ assert myCreatedDiagram != null;
+ diagramResource.getContents().add(myCreatedDiagram);
+«IF editorGen.sameFileForDiagramAndModel-»
+ diagramResource.getContents().add(myCreatedDiagram.getElement());
+«ENDIF-»
+ }
+ public void redo() {
+ execute();
+ }
+ public boolean canUndo() {
+ return false;
+ }
+ };
+ try {
+ new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(myEditingDomain, command).execute();
+ diagramResource.save(«getDiagramEditorUtilQualifiedClassName()».getSaveOptions());
+ «EXPAND openEditor-»
+ if (editor != null) {
+ «EXPAND layoutEditor-»
+ }
+ } catch (java.io.IOException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Save operation failed for: " + «EXPAND fileString», ex); «EXPAND xpt::Common::nonNLS»
+«IF editorGen.editor.eclipseEditor && !isRichClientPlatform()-»
+ } catch (org.eclipse.ui.PartInitException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to open editor", ex); «EXPAND xpt::Common::nonNLS»
+«ENDIF-»
+ }
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE fileString FOR gmfgen::GenDiagram»«IF isRichClientPlatform()»diagramFileURI.toString()«ELSE»diagramFile.getFullPath().toString()«ENDIF»«ENDDEFINE»
+
+«DEFINE defineDiagramFileURI FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+ org.eclipse.emf.common.util.URI diagramFileURI = myDiagramURISelectorPage.getNewFileURI();
+«ELSE-»
+ org.eclipse.core.resources.IFile diagramFile = myFileCreationPage.createNewFile();
+ «getDiagramEditorUtilQualifiedClassName()».setCharset(diagramFile);
+ org.eclipse.emf.common.util.URI diagramFileURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE openEditor FOR gmfgen::GenDiagram-»
+«IF editorGen.editor.eclipseEditor-»
+ «IF isRichClientPlatform()-»
+org.eclipse.ui.IEditorPart editor = «getDiagramEditorUtilQualifiedClassName()».openEditor(diagramFileURI);
+ «ELSE-»
+org.eclipse.ui.IEditorPart editor = org.eclipse.ui.ide.IDE.openEditor(myWorkbenchPage, diagramFile);
+ «ENDIF-»
+«ELSE-»
+org.eclipse.ui.IViewPart editor = «getDiagramEditorUtilQualifiedClassName()».showView(diagramFileURI);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE layoutEditor FOR gmfgen::GenDiagram-»
+org.eclipse.gmf.runtime.lite.services.IDiagramLayouter layouter = (org.eclipse.gmf.runtime.lite.services.IDiagramLayouter) editor.getAdapter(org.eclipse.gmf.runtime.lite.services.IDiagramLayouter.class);
+if (layouter != null) {
+ org.eclipse.gef.GraphicalViewer graphicalViewer = (org.eclipse.gef.GraphicalViewer) editor.getAdapter(org.eclipse.gef.GraphicalViewer.class);
+ if (graphicalViewer != null) {
+ org.eclipse.emf.common.command.Command layoutCommand = layouter.layout((org.eclipse.gef.GraphicalEditPart) graphicalViewer.getContents());
+ if (layoutCommand != null && layoutCommand.canExecute()) {
+ graphicalViewer.getEditDomain().getCommandStack().execute(new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(myEditingDomain, layoutCommand));
+«IF editorGen.editor.eclipseEditor-»
+ diagramResource.save(«getDiagramEditorUtilQualifiedClassName()».getSaveOptions());
+«ENDIF-»
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE SourceURISelectorPage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedClassComment»
+private class SourceURISelectorPage extends «EXPAND xpt::editor::URISelectorPage::qualifiedClassName» {
+ «EXPAND xpt::Common::generatedMemberComment»
+ public SourceURISelectorPage() {
+ super(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardSourceURISelectorPageName()) FOR editorGen»);
+ setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardSourceURISelectorPageTitle()) FOR editorGen»);
+ setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardSourceURISelectorPageDescription()) FOR editorGen»);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getFileExtension() {
+ return "«editorGen.domainFileExtension»"; «EXPAND xpt::Common::nonNLS»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean validatePage() {
+ if (super.validatePage()) {
+ mySelectedModelFileURI = getFileURI();
+ return true;
+ }
+ return false;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String validateFile(java.io.File file) {
+ if (!file.exists()) {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardNoSourceFile()) FOR editorGen»;
+ }
+ return null;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE DiagramURISelectorPage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedClassComment»
+private class DiagramURISelectorPage extends «EXPAND xpt::editor::URISelectorPage::qualifiedClassName» {
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.common.util.URI myNewFileURI;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public DiagramURISelectorPage() {
+ super(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardDiagramURISelectorPageName()) FOR editorGen»);
+ setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardDiagramURISelectorPageTitle()) FOR editorGen»);
+ setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardDiagramURISelectorPageDescription()) FOR editorGen»);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getFileExtension() {
+ return "«editorGen.diagramFileExtension»"; «EXPAND xpt::Common::nonNLS»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible && mySelectedModelFileURI != null && getFileURI() == null && mySelectedModelFileURI.isFile()) {
+ java.io.File originalFile = new java.io.File(mySelectedModelFileURI.toFileString());
+ String originalFileName = mySelectedModelFileURI.trimFileExtension().lastSegment();
+ java.io.File parentFile = originalFile.getParentFile();
+ java.io.File newFile = new java.io.File(parentFile, originalFileName + getFileExtension());
+ for(int i = 1; i > 0 && newFile.exists(); i++) {
+ newFile = new java.io.File(parentFile, originalFileName + i + getFileExtension());
+ }
+ if (newFile.exists()) {
+ return; //failed to set name that does not exist, just leave empty.
+ }
+ setFile(newFile);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean validatePage() {
+ myNewFileURI = null;
+ if (super.validatePage()) {
+ myNewFileURI = getFileURI();
+ return true;
+ }
+ return false;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.common.util.URI getNewFileURI() {
+ return myNewFileURI;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String validateFile(java.io.File file) {
+ if (file.exists()) {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardDiagramFileExists()) FOR editorGen»;
+ }
+ return null;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE RootElementSelectorPage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedClassComment»
+private class RootElementSelectorPage extends «EXPAND xpt::editor::ModelElementSelectionPage::qualifiedClassName» {
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected RootElementSelectorPage() {
+ super(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardRootElementSelectorPageName()) FOR editorGen»);
+ setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardRootElementSelectorPageTitle()) FOR editorGen»);
+ setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardRootElementSelectorPageDescription()) FOR editorGen»);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getSelectionTitle() {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardRootElementSelectorPageLabelText()) FOR editorGen»;
+ }
+
+«IF isRichClientPlatform()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setVisible(boolean visible) {
+ if (visible) {
+ if (myDiagramRoot != null) {
+ setModelElement(myDiagramRoot);
+ } else {
+ org.eclipse.emf.ecore.resource.Resource resource;
+ try {
+ resource = myEditingDomain.getResourceSet().getResource(mySelectedModelFileURI, true);
+ } catch (org.eclipse.emf.common.util.WrappedException e) {
+ resource = null;
+ }
+ setModelResource(resource);
+ }
+ }
+ super.setVisible(visible);
+ }
+
+«ENDIF-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean validatePage() {
+ myDiagramRoot = getModelElement();
+ if (myDiagramRoot == null) {
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardRootElementSelectorPageNoRootSelected()) FOR editorGen»);
+ return false;
+ }
+ boolean result = «EXPAND xpt::editor::VisualIDRegistry::visualID FOR getDiagram()» == «EXPAND xpt::editor::VisualIDRegistry::getDiagramVisualIDMethodCall»(myDiagramRoot);
+ if (result) {
+ setErrorMessage(null);
+ } else {
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardRootElementSelectorPageInvalidRootSelected()) FOR editorGen»);
+ }
+ return result;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardNoSourceFile())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardSourceURISelectorPageName())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardSourceURISelectorPageTitle())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardSourceURISelectorPageDescription())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardDiagramFileExists())-»
+«ENDIF-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardDiagramURISelectorPageName())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardDiagramURISelectorPageTitle())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardDiagramURISelectorPageDescription())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardRootElementSelectorPageName())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardRootElementSelectorPageTitle())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardRootElementSelectorPageDescription())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardRootElementSelectorPageLabelText())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardRootElementSelectorPageNoRootSelected())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardRootElementSelectorPageInvalidRootSelected())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardCommandLabel())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardNoSourceFile(), "Source file does not exist")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardSourceURISelectorPageName(), "Select source file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardSourceURISelectorPageTitle(), "Source file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardSourceURISelectorPageDescription(), "Select file with semantic model element to be depicted on diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardDiagramFileExists(), "Diagram file already exists")-»
+«ENDIF-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardDiagramURISelectorPageName(), "Initialize new " + editorGen.diagramFileExtension + " file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardDiagramURISelectorPageTitle(), "Diagram file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardDiagramURISelectorPageDescription(), "Create new diagram based on " + editorGen.domainGenModel.modelName + " model content")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardRootElementSelectorPageName(), "Select diagram root element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardRootElementSelectorPageTitle(), "Diagram root element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardRootElementSelectorPageDescription(), "Select semantic model element to be depicted on diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardRootElementSelectorPageLabelText(), "&Select diagram root element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardRootElementSelectorPageNoRootSelected(), "No diagram root element selected")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardRootElementSelectorPageInvalidRootSelected(), "Invalid diagram root element is selected")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardCommandLabel(), "Initializing diagram contents")-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/OpenDiagramInViewAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::Util»
+«EXTENSION xpt::editor::i18n»
+
+«DEFINE OpenDiagramInViewAction FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND attrs-»
+ «EXPAND setActivePart-»
+ «EXPAND selectionChanged-»
+ «EXPAND run-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenEditorView»«packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE className FOR gmfgen::GenEditorView»«validJavaIdentifier("OpenDiagramIn" + editorGen.modelID + "DiagramViewAction")»«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenEditorView»implements org.eclipse.ui.IObjectActionDelegate«ENDDEFINE»
+
+«DEFINE attrs FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.IWorkbenchPart myPart;
+
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.core.resources.IFile mySelectedModelFile;
+«ENDDEFINE»
+
+«DEFINE setActivePart FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
+ myPart = targetPart;
+}
+«ENDDEFINE»
+
+«DEFINE selectionChanged FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
+ mySelectedModelFile = null;
+ action.setEnabled(false);
+ if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection == false || selection.isEmpty()) {
+ return;
+ }
+ mySelectedModelFile = (org.eclipse.core.resources.IFile) ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement();
+ action.setEnabled(mySelectedModelFile != null && mySelectedModelFile.exists());
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.gmf.runtime.notation.Diagram diagram = null;
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «EXPAND createEditingDomain»;
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet();
+ try {
+ org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(org.eclipse.emf.common.util.URI.createPlatformResourceURI(mySelectedModelFile.getFullPath().toString()), true);
+ if (resource.getContents().isEmpty() || false == resource.getContents().get(0) instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(myPart.getSite().getShell(), «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenDiagramInViewActionErrorTitle(editorGen)) FOR editorGen»,
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenDiagramInViewActionCannotLoad(editorGen)) FOR editorGen»);
+ return;
+ }
+ diagram = (org.eclipse.gmf.runtime.notation.Diagram) resource.getContents().get(0);
+ } catch (org.eclipse.emf.common.util.WrappedException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Unable to load resource: " + mySelectedModelFile.getFullPath().toString(), ex); «EXPAND xpt::Common::nonNLS»
+ org.eclipse.jface.dialogs.MessageDialog.openError(myPart.getSite().getShell(), «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenDiagramInViewActionErrorTitle(editorGen)) FOR editorGen»,
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenDiagramInViewActionExceptionLoading(editorGen)) FOR editorGen»);
+ return;
+ }
+ try {
+ org.eclipse.gmf.runtime.lite.parts.DiagramViewPart part = (org.eclipse.gmf.runtime.lite.parts.DiagramViewPart) myPart.getSite().getPage().showView(«getQualifiedClassName()».ID);
+ part.showDiagram(editingDomain, org.eclipse.emf.ecore.util.EcoreUtil.getURI(diagram));
+ } catch (org.eclipse.ui.PartInitException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to load resource: " + mySelectedModelFile.getFullPath().toString(), ex);
+ org.eclipse.jface.dialogs.MessageDialog.openError(myPart.getSite().getShell(), «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenDiagramInViewActionErrorTitle(editorGen)) FOR editorGen»,
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenDiagramInViewActionPartInitException(editorGen)) FOR editorGen»);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE createEditingDomain FOR gmfgen::GenEditorView»«EXPAND xpt::editor::Common::createEditingDomain FOR editorGen»«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenEditorView»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenDiagramInViewActionErrorTitle(editorGen))-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenDiagramInViewActionCannotLoad(editorGen))-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenDiagramInViewActionExceptionLoading(editorGen))-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenDiagramInViewActionPartInitException(editorGen))-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenDiagramInViewActionErrorTitle(editorGen), "Error")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenDiagramInViewActionCannotLoad(editorGen), "Diagram file failed to load or is corrupted")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenDiagramInViewActionExceptionLoading(editorGen), "Diagram file failed to load")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenDiagramInViewActionPartInitException(editorGen), "Unable to open diagram")-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/Plugin.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,298 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::providers::ValidationUtils»
+
+«DEFINE Plugin FOR gmfgen::GenPlugin-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «activatorClassName» extends org.eclipse.ui.plugin.AbstractUIPlugin {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String ID = "«iD»"; «EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static «activatorClassName» instance;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «activatorClassName»() {
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void start(org.osgi.framework.BundleContext context) throws Exception {
+ super.start(context);
+ instance = this;
+«EXPAND initDebugOptions-»
+«EXPAND hookServices-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void stop(org.osgi.framework.BundleContext context) throws Exception {
+«EXPAND unhookServices-»
+ instance = null;
+ super.stop(context);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static «activatorClassName» getInstance() {
+ return instance;
+ }
+
+«EXPAND adapterFactory-»
+«EXPAND validationStateManager-»
+«EXPAND validationMarkerProvider-»
+«EXPAND itemImages-»
+«EXPAND bundledImages-»
+«EXPAND bundleString-»
+«EXPAND logging-»
+«EXPAND debugOptions-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE hookServices FOR gmfgen::GenPlugin-»
+«EXPAND hookAdapterFactory-»
+«EXPAND hookValidationStateManager-»
+«EXPAND hookValidationMarkerProvider-»
+«ENDDEFINE»
+
+«DEFINE hookAdapterFactory FOR gmfgen::GenPlugin-»
+ adapterFactory = createAdapterFactory();
+«ENDDEFINE»
+
+«DEFINE hookValidationStateManager FOR gmfgen::GenPlugin-»
+«IF editorGen.diagram.validationNeeded()-»
+ myValidationStateManager = new org.eclipse.gmf.runtime.lite.validation.ValidationStateManager();
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE hookValidationMarkerProvider FOR gmfgen::GenPlugin-»
+«IF editorGen.diagram.validationNeeded() && null == editorGen.application-»
+ myMarkerNavigationProvider = new «editorGen.diagram.getMarkerNavigationProviderQualifiedClassName()»();
+ myValidationStateManager.addValidationStateListener(myMarkerNavigationProvider);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE unhookServices FOR gmfgen::GenPlugin-»
+«EXPAND unhookAdapterFactory-»
+«EXPAND unhookValidationMarkerProvider-»
+«EXPAND unhookValidationStateManager-»
+«ENDDEFINE»
+
+«DEFINE unhookAdapterFactory FOR gmfgen::GenPlugin-»
+ adapterFactory.dispose();
+ adapterFactory = null;
+«ENDDEFINE»
+
+«DEFINE unhookValidationMarkerProvider FOR gmfgen::GenPlugin-»
+«IF editorGen.diagram.validationNeeded() && null == editorGen.application-»
+ myValidationStateManager.removeValidationStateListener(myMarkerNavigationProvider);
+ myMarkerNavigationProvider = null;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE unhookValidationStateManager FOR gmfgen::GenPlugin-»
+«IF editorGen.diagram.validationNeeded()-»
+ myValidationStateManager = null;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE adapterFactory FOR gmfgen::GenPlugin-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.edit.provider.ComposedAdapterFactory adapterFactory;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.edit.provider.ComposedAdapterFactory createAdapterFactory() {
+ java.util.List factories = new java.util.ArrayList();
+ fillItemProviderFactories(factories);
+ return new org.eclipse.emf.edit.provider.ComposedAdapterFactory(factories);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void fillItemProviderFactories(java.util.List factories) {
+«EXPAND MetaModel::PopulateItemProviderFactories("factories") FOR editorGen-»
+ factories.add(new org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory());
+ factories.add(new org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.common.notify.AdapterFactory getItemProvidersAdapterFactory() {
+ return adapterFactory;
+ }
+«ENDDEFINE»
+
+«DEFINE validationStateManager FOR gmfgen::GenPlugin-»
+«IF editorGen.diagram.validationNeeded()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.lite.validation.ValidationStateManager myValidationStateManager;
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.lite.validation.ValidationStateManager getValidationStateManager() {
+ return myValidationStateManager;
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE validationMarkerProvider FOR gmfgen::GenPlugin-»
+«IF editorGen.diagram.validationNeeded() && null == editorGen.application-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «editorGen.diagram.getMarkerNavigationProviderQualifiedClassName()» myMarkerNavigationProvider;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE itemImages FOR gmfgen::GenPlugin-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.jface.resource.ImageDescriptor getItemImageDescriptor(Object item) {
+ org.eclipse.emf.edit.provider.IItemLabelProvider labelProvider = (org.eclipse.emf.edit.provider.IItemLabelProvider) adapterFactory.adapt(item, org.eclipse.emf.edit.provider.IItemLabelProvider.class);
+ if (labelProvider != null) {
+«REM»
+ // XXX dependency org.eclipse.emf.edit.ui is for ExtendedImageRegistry only.
+ // FIXME move image registry to plugin class code
+«ENDREM-»
+ return org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getInstance().getImageDescriptor(labelProvider.getImage(item));
+ }
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.swt.graphics.Image getItemImage(Object item) {
+ org.eclipse.emf.edit.provider.IItemLabelProvider labelProvider = (org.eclipse.emf.edit.provider.IItemLabelProvider) adapterFactory.adapt(item, org.eclipse.emf.edit.provider.IItemLabelProvider.class);
+ if (labelProvider != null) {
+ return org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getInstance().getImage(labelProvider.getImage(item));
+ }
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE bundledImages FOR gmfgen::GenPlugin-»
+ «EXPAND xpt::Common::generatedMemberComment("Returns an image descriptor for the image file at the given plug-in relative path.\n\n" +
+ "@param path the path\n" +
+ "@return the image descriptor")»
+ public static org.eclipse.jface.resource.ImageDescriptor getBundledImageDescriptor(String path) {
+ return org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment("Respects images residing in any plug-in. If path is relative,\n" +
+ "then this bundle is looked up for the image, otherwise, for absolute \n" +
+ "path, first segment is taken as id of plug-in with image\n" +
+ "\n" +
+ "@param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images\n" +
+ "@return the image descriptor")»
+ public static org.eclipse.jface.resource.ImageDescriptor findImageDescriptor(String path) {
+ final org.eclipse.core.runtime.IPath p = new org.eclipse.core.runtime.Path(path);
+ if (p.isAbsolute() && p.segmentCount() > 1) {
+ return org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
+ } else {
+ return getBundledImageDescriptor(p.makeAbsolute().toString());
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment("Returns an image for the image file at the given plug-in relative path.\n" +
+ "Client do not need to dispose this image. Images will be disposed automatically.\n\n" +
+ "@param path the path\n" +
+ "@return image instance")»
+ public org.eclipse.swt.graphics.Image getBundledImage(String path) {
+ org.eclipse.swt.graphics.Image image = getImageRegistry().get(path);
+ if (image == null) {
+ getImageRegistry().put(path, getBundledImageDescriptor(path));
+ image = getImageRegistry().get(path);
+ }
+ return image;
+ }
+«ENDDEFINE»
+
+«DEFINE bundleString FOR gmfgen::GenPlugin-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getBundleString(String key) {
+ try {
+ return org.eclipse.core.runtime.Platform.getResourceBundle(getBundle()).getString(key);
+ } catch (java.util.MissingResourceException e) {
+ return "!" + key + "!"; «EXPAND xpt::Common::nonNLS» «EXPAND xpt::Common::nonNLS(2)»
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE logging FOR gmfgen::GenPlugin-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void logError(String error) {
+ logError(error, null);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment("@param throwable actual error or null could be passed")»
+ public void logError(String error, Throwable throwable) {
+ if (error == null && throwable != null) {
+ error = throwable.getMessage();
+ }
+ getLog().log(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «activatorClassName».ID, org.eclipse.core.runtime.IStatus.OK, error, throwable));
+ debug(error, throwable);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void logInfo(String message) {
+ logInfo(message, null);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment("@param throwable actual error or null could be passed")»
+ public void logInfo(String message, Throwable throwable) {
+ if (message == null && message != null) {
+ message = throwable.getMessage();
+ }
+ getLog().log(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.INFO, «activatorClassName».ID, org.eclipse.core.runtime.IStatus.OK, message, throwable));
+ debug(message, throwable);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void debug(String message, Throwable throwable) {
+ if (!isDebugging()) {
+ return;
+ }
+ if (message != null) {
+ System.err.println(message);
+ }
+ if (throwable != null) {
+ throwable.printStackTrace();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE debugOptions FOR gmfgen::GenPlugin-»
+«EXPAND strictFontOption-»
+«ENDDEFINE»
+
+«DEFINE strictFontOption FOR gmfgen::GenPlugin-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static String STRICT_FONT_OPTION = ID + "/strictFont"; «EXPAND xpt::Common::nonNLS»
+
+«EXPAND xpt::Common::generatedMemberComment»
+private boolean myIsStrictFont;
+
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean isStrictFont() {
+ return myIsStrictFont;
+}
+«ENDDEFINE»
+
+«DEFINE initDebugOptions FOR gmfgen::GenPlugin-»
+«EXPAND initStrictFontOption-»
+«ENDDEFINE»
+
+«DEFINE initStrictFontOption FOR gmfgen::GenPlugin-»
+myIsStrictFont = Boolean.valueOf(org.eclipse.core.runtime.Platform.getDebugOption(STRICT_FONT_OPTION)).booleanValue();
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenPlugin-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/ShortcutCreationWizard.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::editor::Wizard»
+«EXTENSION xpt::editor::i18n»
+
+«DEFINE className FOR gmfgen::GenDiagram»«defaultShortcutCreationWizardName()»«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE ShortcutCreationWizard FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment("Allows to add a shortcut to an element from a foreign model")»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND editingDomain-»
+ «EXPAND graphicalViewer-»
+ «EXPAND parentView-»
+ «EXPAND shortcutDomainModelURI-»
+ «EXPAND shortcutDomainModelElement-»
+ «EXPAND ctor-»
+ «EXPAND addPages-»
+ «EXPAND performFinish-»
+ «EXPAND getCreateShortcutCommand-»
+ «EXPAND SourceURISelectorPage-»
+ «EXPAND ShortcutElementSelectorPage-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.jface.wizard.Wizard«ENDDEFINE»
+
+«DEFINE editingDomain FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain;
+«ENDDEFINE»
+
+«DEFINE graphicalViewer FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gef.GraphicalViewer myGraphicalViewer;
+«ENDDEFINE»
+
+«DEFINE parentView FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.notation.View myParentView;
+«ENDDEFINE»
+
+«DEFINE shortcutDomainModelURI FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.common.util.URI myShortcutDomainModelURI;
+«ENDDEFINE»
+
+«DEFINE shortcutDomainModelElement FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.ecore.EObject myShortcutDomainModelElement;
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND className»(org.eclipse.gmf.runtime.notation.View parentView, org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.gef.GraphicalViewer graphicalViewer) {
+ myParentView = parentView;
+ myEditingDomain = editingDomain;
+ myGraphicalViewer = graphicalViewer;
+}
+«ENDDEFINE»
+
+«DEFINE addPages FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void addPages() {
+ addPage(new SourceURISelectorPage());
+ addPage(new ShortcutElementSelectorPage());
+}
+«ENDDEFINE»
+
+«DEFINE performFinish FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean performFinish() {
+ org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand createShortcutCommand = getCreateShortcutCommand();
+ if (createShortcutCommand != null && createShortcutCommand.canExecute()) {
+ if (myGraphicalViewer.getEditDomain() != null && myGraphicalViewer.getEditDomain().getCommandStack() != null) {
+ myGraphicalViewer.getEditDomain().getCommandStack().execute(new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(myEditingDomain, createShortcutCommand));
+ } else {
+ new org.eclipse.gmf.runtime.lite.commands.WrappingCommand(myEditingDomain, createShortcutCommand).execute();
+ }
+ return true;
+ }
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE getCreateShortcutCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand getCreateShortcutCommand() {
+ «FOREACH containsShortcutsTo AS nextModelID ITERATOR it-»
+ «IF it.isFirstIteration()»org.eclipse.gmf.runtime.lite.shortcuts.IShortcutProvider «ENDIF»shortcutProvider = org.eclipse.gmf.runtime.lite.shortcuts.ShortcutProvidersRegistry.INSTANCE.getShortcutProvider(«IF nextModelID == editorGen.modelID»«getEditPartQualifiedClassName()».MODEL_ID«ELSE»"«nextModelID»"«ENDIF»);«IF nextModelID != editorGen.modelID» «EXPAND xpt::Common::nonNLS»«ENDIF»
+ if (shortcutProvider != null) {
+ org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand result = shortcutProvider.getCreateShortcutCommand(myParentView, myShortcutDomainModelElement);
+ if (result != null && result.canExecute()) {
+ return result;
+ }
+ }
+ «ENDFOREACH-»
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE SourceURISelectorPage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedClassComment»
+private class SourceURISelectorPage extends «EXPAND xpt::editor::URISelectorPage::qualifiedClassName» {
+ «EXPAND xpt::Common::generatedMemberComment»
+ public SourceURISelectorPage() {
+ super(«EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardSourceURISelectorPageName()) FOR editorGen»);
+ setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardSourceURISelectorPageTitle()) FOR editorGen»);
+ setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardSourceURISelectorPageDescription()) FOR editorGen»);
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getFileExtension() {
+ return null;
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean validatePage() {
+ if (super.validatePage()) {
+ myShortcutDomainModelURI = getFileURI();
+ return true;
+ }
+ return false;
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String validateFile(java.io.File file) {
+ if (!file.exists()) {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardNoSourceFile()) FOR editorGen»;
+ }
+ return null;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE ShortcutElementSelectorPage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedClassComment»
+private class ShortcutElementSelectorPage extends «EXPAND xpt::editor::ModelElementSelectionPage::qualifiedClassName» {
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected ShortcutElementSelectorPage() {
+ super(«EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardShortcutElementSelectorPageName()) FOR editorGen»);
+ setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardShortcutElementSelectorPageTitle()) FOR editorGen»);
+ setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardShortcutElementSelectorPageDescription()) FOR editorGen»);
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getSelectionTitle() {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardShortcutElementSelectorPageLabelText()) FOR editorGen»;
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setVisible(boolean visible) {
+ if (visible) {
+ org.eclipse.emf.ecore.resource.Resource resource;
+ try {
+ resource = myEditingDomain.getResourceSet().getResource(myShortcutDomainModelURI, true);
+ } catch (org.eclipse.emf.common.util.WrappedException e) {
+ resource = null;
+ }
+ setModelResource(resource);
+ }
+ super.setVisible(visible);
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean validatePage() {
+ myShortcutDomainModelElement = getModelElement();
+ if (myShortcutDomainModelElement == null) {
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardShortcutElementSelectorPageNoElementSelected()) FOR editorGen»);
+ return false;
+ }
+ if (myGraphicalViewer.getEditPartRegistry().get(myShortcutDomainModelElement) != null) {
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardShortcutElementSelectorPageDuplicateShortcut()) FOR editorGen»);
+ myShortcutDomainModelElement = null;
+ return false;
+ }
+ org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand createShortcutCommand = getCreateShortcutCommand();
+ if (createShortcutCommand == null || !createShortcutCommand.canExecute()) {
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nForNewShortcutWizardShortcutElementSelectorPageCannotCreateShortcut()) FOR editorGen»);
+ return false;
+ } else {
+ setErrorMessage(null);
+ return true;
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform() && generateCreateShortcutAction()-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardSourceURISelectorPageName())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardSourceURISelectorPageTitle())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardSourceURISelectorPageDescription())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardNoSourceFile())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardShortcutElementSelectorPageName())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardShortcutElementSelectorPageTitle())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardShortcutElementSelectorPageDescription())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardShortcutElementSelectorPageLabelText())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardShortcutElementSelectorPageNoElementSelected())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardShortcutElementSelectorPageDuplicateShortcut())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewShortcutWizardShortcutElementSelectorPageCannotCreateShortcut())-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform() && generateCreateShortcutAction()-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardNoSourceFile(), "Source file does not exist")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardSourceURISelectorPageName(), "Select source file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardSourceURISelectorPageTitle(), "Source file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardSourceURISelectorPageDescription(), "Select file with semantic model element to be depicted as shortcut")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardShortcutElementSelectorPageName(), "Select shortcut element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardShortcutElementSelectorPageTitle(), "Shortcut element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardShortcutElementSelectorPageDescription(), "Select semantic model element to be depicted as shortcut")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardShortcutElementSelectorPageLabelText(), "&Select shortcut element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardShortcutElementSelectorPageNoElementSelected(), "No shortcut element selected")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardShortcutElementSelectorPageDuplicateShortcut(), "Cannot create shortcut: the given semantic model element is already present on the diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewShortcutWizardShortcutElementSelectorPageCannotCreateShortcut(), "Cannot create shortcut with the given semantic model element")-»
+«ENDIF-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/URISelectorPage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::editor::Wizard»
+«EXTENSION xpt::editor::i18n»
+
+«DEFINE className FOR gmfgen::GenDiagram»URISelectorPage«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE URISelectorPage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public abstract class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND fileField-»
+
+ «EXPAND validator-»
+
+ «EXPAND ctor-»
+
+ «EXPAND createControl-»
+
+ «EXPAND setFile-»
+
+ «EXPAND validatePage-»
+
+ «EXPAND validateFile-»
+
+ «EXPAND getFileExtension-»
+
+ «EXPAND getFileURI-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.jface.wizard.WizardPage«ENDDEFINE»
+
+«DEFINE fileField FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.swt.widgets.Text fileField;
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected «EXPAND className»(String name) {
+ super(name);
+}
+«ENDDEFINE»
+
+«DEFINE createControl FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void createControl(org.eclipse.swt.widgets.Composite parent) {
+ org.eclipse.swt.widgets.Composite composite = new org.eclipse.swt.widgets.Composite(parent, org.eclipse.swt.SWT.NONE);
+ {
+ org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 12;
+ composite.setLayout(layout);
+
+ org.eclipse.swt.layout.GridData data = new org.eclipse.swt.layout.GridData();
+ data.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ data.grabExcessVerticalSpace = true;
+ data.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ composite.setLayoutData(data);
+ }
+ org.eclipse.swt.widgets.Label resourceURILabel = new org.eclipse.swt.widgets.Label(composite, org.eclipse.swt.SWT.LEFT);
+ {
+ resourceURILabel.setText(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardFileLabel()) FOR editorGen»);
+
+ org.eclipse.swt.layout.GridData data = new org.eclipse.swt.layout.GridData();
+ data.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ resourceURILabel.setLayoutData(data);
+ }
+
+ org.eclipse.swt.widgets.Composite fileComposite = new org.eclipse.swt.widgets.Composite(composite, org.eclipse.swt.SWT.NONE);
+ {
+ org.eclipse.swt.layout.GridData data = new org.eclipse.swt.layout.GridData();
+ data.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ fileComposite.setLayoutData(data);
+
+ org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ fileComposite.setLayout(layout);
+ }
+
+ fileField = new org.eclipse.swt.widgets.Text(fileComposite, org.eclipse.swt.SWT.BORDER);
+ {
+ org.eclipse.swt.layout.GridData data = new org.eclipse.swt.layout.GridData();
+ data.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalSpan = 1;
+ fileField.setLayoutData(data);
+ }
+
+ fileField.addModifyListener(validator);
+ org.eclipse.swt.widgets.Button resourceURIBrowseFileSystemButton = new org.eclipse.swt.widgets.Button(fileComposite, org.eclipse.swt.SWT.PUSH);
+ resourceURIBrowseFileSystemButton.setText(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardBrowseButton()) FOR editorGen»);
+
+ resourceURIBrowseFileSystemButton.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent event) {
+ String fileExtension = getFileExtension();
+ String extensionFilter;
+ if (fileExtension == null) {
+ extensionFilter = "*.*"; «EXPAND xpt::Common::nonNLS»
+ } else {
+ extensionFilter = "*." + fileExtension; «EXPAND xpt::Common::nonNLS»
+ }
+ String filePath = «getDiagramEditorUtilQualifiedClassName()».openFilePathDialog(getShell(), extensionFilter, org.eclipse.swt.SWT.OPEN);
+ if (filePath != null) {
+ if (fileExtension != null && !filePath.endsWith("." + fileExtension)) { «EXPAND xpt::Common::nonNLS»
+ filePath = filePath + "." + fileExtension; «EXPAND xpt::Common::nonNLS»
+ }
+ fileField.setText(filePath);
+ }
+ }
+ });
+ setPageComplete(validatePage());
+ setControl(composite);
+}
+«ENDDEFINE»
+
+«DEFINE validator FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.events.ModifyListener validator = new org.eclipse.swt.events.ModifyListener() {
+ public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+};
+«ENDDEFINE»
+
+«DEFINE setFile FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected final void setFile(java.io.File file) {
+ fileField.setText(file.getPath());
+}
+«ENDDEFINE»
+
+«DEFINE validatePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected boolean validatePage() {
+ org.eclipse.emf.common.util.URI fileURI = getFileURI();
+ if (fileURI == null || fileURI.isEmpty()) {
+ setErrorMessage(null);
+ return false;
+ }
+ if (fileURI.isFile()) {
+ java.io.File file = new java.io.File(fileURI.toFileString());
+ String fileProblem = validateFile(file);
+ if (fileProblem != null) {
+ setErrorMessage(fileProblem);
+ return false;
+ }
+ }
+ String requiredExt = getFileExtension();
+ if (requiredExt != null) {
+ String enteredExt = fileURI.fileExtension();
+ if (enteredExt == null || !enteredExt.equals(requiredExt)) {
+ setErrorMessage(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nForNewDiagramFileWizardIncorrectExtension()) FOR editorGen», requiredExt));
+ return false;
+ }
+ }
+ setErrorMessage(null);
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE validateFile FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment("Checks the given file and returns the error message if there are problems or <code>null</code> if the file is OK.")»
+protected abstract String validateFile(java.io.File file);
+«ENDDEFINE»
+
+«DEFINE getFileExtension FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment("Returns the file extension the opened file should conform to or <code>null</code>\n" +
+"if there are no restrictions on file extension")»
+protected abstract String getFileExtension();
+«ENDDEFINE»
+
+«DEFINE getFileURI FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.common.util.URI getFileURI() {
+ try {
+ return org.eclipse.emf.common.util.URI.createFileURI(fileField.getText());
+ } catch (Exception exception) {
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardIncorrectExtension())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardBrowseButton())-»
+«EXPAND xpt::Externalizer::accessorField(i18nForNewDiagramFileWizardFileLabel())-»
+«ENDIF-»
+«ENDDEFINE»
+
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF isRichClientPlatform()-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardIncorrectExtension(), "The file name must end in {0}")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardBrowseButton(), "&Browse...")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nForNewDiagramFileWizardFileLabel(), "&File")-»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/Wizard.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+boolean isRichClientPlatform(gmfgen::GenDiagram diagram) :
+ diagram.editorGen.application != null
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE extensions FOR gmfgen::GenEditorGenerator-»
+«IF editor.eclipseEditor-»
+«EXPAND editor FOR editor-»
+«ELSE-»
+«EXPAND view FOR editor-»
+«ENDIF-»
+«IF null == application-»
+«EXPAND wizard-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE editor FOR gmfgen::GenEditorView-»
+ <extension point="org.eclipse.ui.editors">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <editor
+ id="«iD»"
+ name="%editorName"
+ icon="«iconPathX»"
+ extensions="«editorGen.diagramFileExtension»"
+ default="true"
+ class="«getQualifiedClassName()»"
+ matchingStrategy="«editorGen.diagram.getMatchingStrategyQualifiedClassName()»"
+ contributorClass="«getActionBarContributorQualifiedClassName()»">
+ </editor>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE view FOR gmfgen::GenEditorView-»
+ <extension point="org.eclipse.ui.views">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <view
+ allowMultiple="false"
+ category="«editorGen.diagram.creationWizardCategoryID»"
+ class="«getQualifiedClassName()»"
+ icon="«iconPathX»"
+ id="«iD»"
+ name="%viewerName"/>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE wizard FOR gmfgen::GenEditorGenerator-»
+ <extension point="org.eclipse.ui.newWizards">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <wizard
+ name="%wizardName"
+ icon="«diagram.creationWizardIconPathX»"
+ category="«diagram.creationWizardCategoryID»"
+ class="«diagram.getCreationWizardQualifiedClassName()»"
+ id="«diagram.getCreationWizardQualifiedClassName()»ID">
+ <description>%newWizardDesc</description>
+ </wizard>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE i18n FOR gmfgen::GenEditorGenerator-»
+«IF editor.eclipseEditor-»
+editorName=«modelID» Diagram Editor
+«ELSE-»
+viewerName=«modelID» Diagram View
+«ENDIF-»
+«IF null == application-»
+wizardName=«modelID» Diagram
+newWizardDesc=Creates «modelID» diagram.
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/i18n.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+String i18nKeyForActionBarContributorViewMenu(gmfgen::GenEditorView editor) :
+editor.actionBarContributorClassName + ".viewMenu"
+;
+
+private String getOpenDiagramInViewActionPrefix(gmfgen::GenEditorGenerator editorGen) :
+"OpenDiagramIn" + editorGen.modelID + "DiagramViewAction"
+;
+
+String i18nKeyForOpenDiagramInViewActionErrorTitle(gmfgen::GenEditorGenerator editorGen) :
+editorGen.getOpenDiagramInViewActionPrefix() + ".errorTitle"
+;
+
+String i18nKeyForOpenDiagramInViewActionCannotLoad(gmfgen::GenEditorGenerator editorGen) :
+editorGen.getOpenDiagramInViewActionPrefix() + ".cannotLoad"
+;
+
+String i18nKeyForOpenDiagramInViewActionExceptionLoading(gmfgen::GenEditorGenerator editorGen) :
+editorGen.getOpenDiagramInViewActionPrefix() + ".exceptionLoading"
+;
+
+String i18nKeyForOpenDiagramInViewActionPartInitException(gmfgen::GenEditorGenerator editorGen) :
+editorGen.getOpenDiagramInViewActionPrefix() + ".partInitException"
+;
+
+String i18nKeyForEditorErrorDuringSave(gmfgen::GenEditorView editor) :
+editor.className + ".errorSaving"
+;
+
+String i18nKeyForEditorLoadDiagramLabel(gmfgen::GenEditorView editor) :
+editor.className + ".LoadDiagram"
+;
+
+String i18nKeyForEditorFailedLoadDiagramMsg(gmfgen::GenEditorView editor) :
+editor.className + ".FailedToLoadDiagramMsg"
+;
+
+String i18nKeyForEditorInvalidInputMsg(gmfgen::GenEditorView editor) :
+editor.className + ".InvalidInputMsg"
+;
+
+String i18nKeyForEditorAlignMenu(gmfgen::GenEditorView editor) :
+editor.className + ".Align"
+;
+
+String titleKey(String dialogKey) :
+ dialogKey+"Title"
+;
+
+String messageKey(String dialogKey) :
+ dialogKey+"Message"
+;
+
+String i18nKeyForDiagramEditorUtilErrorNoDescriptor(gmfgen::GenDiagram diagram) :
+diagram.diagramEditorUtilClassName + ".ErrorNoDescriptor"
+;
+
+String i18nKeyForDiagramEditorUtilErrorOpeningEditor(gmfgen::GenDiagram diagram) :
+diagram.diagramEditorUtilClassName + ".ErrorOpeningEditor"
+;
+
+String i18nKeyForDiagramEditorUtilErrorOpeningView(gmfgen::GenDiagram diagram) :
+diagram.diagramEditorUtilClassName + ".ErrorOpeningView"
+;
+
+String i18nKeyForCreationWizardWindowTitle(gmfgen::GenDiagram diagram) :
+diagram.creationWizardClassName + ".WindowTitle"
+;
+
+String i18nKeyForCreationWizardPagePageName(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".PageName"
+;
+
+String i18nKeyForCreationWizardPageTitle(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".Title"
+;
+
+String i18nKeyForCreationWizardPageDescription(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".Description"
+;
+
+String i18nKeyForCreationWizardPageResourceURILabel(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".ResourceURILabel"
+;
+
+String i18nKeyForCreationWizardPageBrowseButtonLabel(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".BrowseButtonLabel"
+;
+
+String i18nKeyForCreationWizardPageDiagramFileExists(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".DiagramFileExists"
+;
+
+String i18nKeyForCreationWizardPageIncorrectExtension(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".IncorrectExtension"
+;
+
+String i18nKeyForCreationWizardPageModelFileExists(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".ModelFileExists"
+;
+
+String i18nKeyForCreationWizardPageCreationFailed(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".CreationFailed"
+;
+
+String i18nKeyForCreationWizardPageCommandLabel(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".CommandLabel"
+;
+
+String i18nKeyForCreationWizardPageTaskName(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".TaskName"
+;
+
+String i18nKeyForCreationWizardPageSaveFailed(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName + ".SaveFailed"
+;
+
+String i18nKeyForInitDiagramFileResourceErrorDialog(gmfgen::GenDiagram diagram) :
+diagram.initDiagramFileActionClassName + ".ResourceErrorDialog"
+;
+
+String i18nKeyForInitDiagramFileWizardTitle(gmfgen::GenDiagram diagram) :
+diagram.initDiagramFileActionClassName + ".WizardTitle"
+;
+
+String i18nForNewDiagramFileWizardIncorrectExtension(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".IncorrectExtension"
+;
+
+String i18nForNewDiagramFileWizardBrowseButton(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".BrowseButton"
+;
+
+String i18nForNewDiagramFileWizardFileLabel(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".FileLabel"
+;
+
+String i18nForNewDiagramFileWizardNoSourceFile(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".NoSourceFile"
+;
+
+String i18nForNewDiagramFileWizardSourceURISelectorPageName(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".SourceURISelectorPageName"
+;
+
+String i18nForNewDiagramFileWizardSourceURISelectorPageTitle(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".SourceURISelectorPageTitle"
+;
+
+String i18nForNewDiagramFileWizardSourceURISelectorPageDescription(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".SourceURISelectorPageDescription"
+;
+
+String i18nForNewDiagramFileWizardDiagramFileExists(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".DiagramFileExists"
+;
+
+String i18nForNewDiagramFileWizardDiagramURISelectorPageName(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".DiagramURISelectorPageName"
+;
+
+String i18nForNewDiagramFileWizardDiagramURISelectorPageTitle(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".DiagramURISelectorPageTitle"
+;
+
+String i18nForNewDiagramFileWizardDiagramURISelectorPageDescription(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".DiagramURISelectorPageDescription"
+;
+
+String i18nForNewDiagramFileWizardRootElementSelectorPageName(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".RootElementSelectorPageName"
+;
+
+String i18nForNewDiagramFileWizardRootElementSelectorPageTitle(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".RootElementSelectorPageTitle"
+;
+
+String i18nForNewDiagramFileWizardRootElementSelectorPageDescription(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".RootElementSelectorPageDescription"
+;
+
+String i18nForNewDiagramFileWizardRootElementSelectorPageLabelText(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".RootElementSelectorPageLabelText"
+;
+
+String i18nForNewDiagramFileWizardRootElementSelectorPageNoRootSelected(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".RootElementSelectorPageNoRootSelected"
+;
+
+String i18nForNewDiagramFileWizardRootElementSelectorPageInvalidRootSelected(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".RootElementSelectorPageInvalidRootSelected"
+;
+
+String i18nForNewDiagramFileWizardCommandLabel(gmfgen::GenDiagram diagram) :
+diagram.newDiagramFileWizardClassName + ".CommandLabel"
+;
+
+String defaultShortcutCreationWizardName(gmfgen::GenDiagram diagram) :
+"ShortcutCreationWizard"
+;
+
+String i18nForNewShortcutWizardSourceURISelectorPageName(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".URISelector.PageName"
+;
+
+String i18nForNewShortcutWizardSourceURISelectorPageTitle(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".URISelector.Title"
+;
+
+String i18nForNewShortcutWizardSourceURISelectorPageDescription(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".URISelector.Description"
+;
+
+String i18nForNewShortcutWizardNoSourceFile(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".URISelector.NoSourceFile"
+;
+
+String i18nForNewShortcutWizardShortcutElementSelectorPageName(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".ShortcutElementSelector.PageName"
+;
+
+String i18nForNewShortcutWizardShortcutElementSelectorPageTitle(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".ShortcutElementSelector.PageTitle"
+;
+
+String i18nForNewShortcutWizardShortcutElementSelectorPageDescription(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".ShortcutElementSelector.Description"
+;
+
+String i18nForNewShortcutWizardShortcutElementSelectorPageLabelText(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".ShortcutElementSelector.LabelText"
+;
+
+String i18nForNewShortcutWizardShortcutElementSelectorPageNoElementSelected(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".ShortcutElementSelector.NoElementSelected"
+;
+
+String i18nForNewShortcutWizardShortcutElementSelectorPageDuplicateShortcut(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".ShortcutElementSelector.DuplicateShortcut"
+;
+
+String i18nForNewShortcutWizardShortcutElementSelectorPageCannotCreateShortcut(gmfgen::GenDiagram diagram) :
+diagram.defaultShortcutCreationWizardName() + ".ShortcutElementSelector.CannotCreateShortcut"
+;
+
+String i18nForCreateShortcutActionLabel(gmfgen::GenDiagram diagram) :
+diagram.createShortcutActionClassName + ".ActionLabel"
+;
+
+String i18nForCreateShortcutActionTooltip(gmfgen::GenDiagram diagram) :
+diagram.createShortcutActionClassName + ".ActionTooltip"
+;
+
+String i18nForCreateShortcutActionWizardWindowTitle(gmfgen::GenDiagram diagram) :
+diagram.createShortcutActionClassName + ".WizardWindowTitle"
+;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/palette/LinkToolEntry.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+/**
+ * TODO: Move to lite runtime (will need an extra param in constructor for model id)
+ */
+«DEFINE LinkToolEntry FOR gmfgen::Palette-»
+«EXPAND xpt::Common::generatedClassComment»
+private static class LinkToolEntry «EXPAND supertypes» {
+ «EXPAND attrs-»
+
+ «EXPAND ctor-»
+
+ «EXPAND createTool-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::Palette»extends org.eclipse.gef.palette.ConnectionCreationToolEntry«ENDDEFINE»
+
+«DEFINE attrs FOR gmfgen::Palette-»
+«EXPAND xpt::Common::generatedMemberComment»
+private final int[] myVisualIDs;
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::Palette-»
+«EXPAND xpt::Common::generatedMemberComment»
+private LinkToolEntry(String title, String description, int[] visualIDs) {
+ super(title, description, new org.eclipse.gmf.runtime.lite.requests.ModelCreationFactory(org.eclipse.gmf.runtime.notation.Edge.class), null, null);
+ myVisualIDs = visualIDs;
+}
+«ENDDEFINE»
+
+«DEFINE createTool FOR gmfgen::Palette-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gef.Tool createTool() {
+ org.eclipse.gef.Tool result = new org.eclipse.gef.tools.ConnectionCreationTool() {
+ {
+ setUnloadWhenFinished(true);
+ }
+ protected org.eclipse.gef.Request createTargetRequest() {
+ org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx request = new org.eclipse.gmf.runtime.lite.requests.CreateConnectionRequestEx(«EXPAND xpt::editor::VisualIDRegistry::modelID FOR diagram», myVisualIDs);
+ request.setFactory(getFactory());
+ return request;
+ }
+ };
+ result.setProperties(getToolProperties());
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::Palette»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/editor/palette/NodeToolEntry.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+/**
+ * TODO: Move to lite runtime (will need an extra param in constructor for model id)
+ */
+«DEFINE NodeToolEntry FOR gmfgen::Palette-»
+«EXPAND xpt::Common::generatedClassComment»
+private static class NodeToolEntry «EXPAND supertypes» {
+ «EXPAND attrs-»
+
+ «EXPAND ctor-»
+
+ «EXPAND createTool-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::Palette»extends org.eclipse.gef.palette.CombinedTemplateCreationEntry«ENDDEFINE»
+
+«DEFINE attrs FOR gmfgen::Palette-»
+«EXPAND xpt::Common::generatedMemberComment»
+private final int[] myVisualIDs;
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::Palette-»
+«EXPAND xpt::Common::generatedMemberComment»
+private NodeToolEntry(String title, String description, int[] visualIDs) {
+ super(title, description, new org.eclipse.gmf.runtime.lite.requests.ModelCreationFactory(org.eclipse.gmf.runtime.notation.Node.class), null, null);
+ myVisualIDs = visualIDs;
+}
+«ENDDEFINE»
+
+«DEFINE createTool FOR gmfgen::Palette-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gef.Tool createTool() {
+ org.eclipse.gef.Tool result = new org.eclipse.gef.tools.CreationTool() {
+ protected org.eclipse.gef.Request createTargetRequest() {
+ org.eclipse.gmf.runtime.lite.requests.CreateRequestEx request = new org.eclipse.gmf.runtime.lite.requests.CreateRequestEx(«EXPAND xpt::editor::VisualIDRegistry::modelID FOR diagram», myVisualIDs);
+ request.setFactory(getFactory());
+ return request;
+ }
+ protected void performCreation(int button) {
+ super.performCreation(button);
+ final org.eclipse.gef.EditPart createdEditPart = (org.eclipse.gef.EditPart)getCurrentViewer().getEditPartRegistry().get(getCreateRequest().getNewObject());
+ if (createdEditPart != null) {
+ getCurrentViewer().getControl().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (createdEditPart.isActive()) {
+ createdEditPart.performRequest(new org.eclipse.gef.Request(org.eclipse.gef.RequestConstants.REQ_DIRECT_EDIT));
+ }
+ }
+ });
+ }
+ }
+ };
+ result.setProperties(getToolProperties());
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::Palette»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/expressions/OCLExpressionFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE OCLExpressionFactory FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::copyright FOR container.editorGen»
+package «container.expressionsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» «EXPAND supertypes» {
+ «EXPAND ctor-»
+
+ «EXPAND getExpression-»
+
+ «EXPAND additions-»
+
+ «EXPAND ExpressionClass-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «className»() {
+}
+«ENDDEFINE»
+
+«DEFINE getExpression FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static «container.getAbstractExpressionQualifiedClassName()» getExpression(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
+ return new «EXPAND ExpressionClassName»(body, context, environment);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public static «container.getAbstractExpressionQualifiedClassName()» getExpression(String body, org.eclipse.emf.ecore.EClassifier context) {
+ return getExpression(body, context, java.util.Collections.EMPTY_MAP);
+}
+«ENDDEFINE»
+
+«DEFINE ExpressionClassName FOR gmfgen::GenExpressionInterpreter»Expression«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
+«DEFINE ExpressionClass FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedClassComment»
+private static class «EXPAND ExpressionClassName» «EXPAND ExpressionClass_supertypes» {
+ «EXPAND ExpressionClass_oclInstance-»
+
+ «EXPAND ExpressionClass_ctor-»
+
+ «EXPAND ExpressionClass_query-»
+
+ «EXPAND ExpressionClass_doEvaluate-»
+
+ «EXPAND ExpressionClass_initExtentMap-»
+
+ «EXPAND ExpressionClass_initCustomEnv-»
+
+ «EXPAND ExpressionClass_createVar-»
+
+ «EXPAND ExpressionClass_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE ExpressionClass_supertypes FOR gmfgen::GenExpressionInterpreter»extends «container.getAbstractExpressionQualifiedClassName()»«ENDDEFINE»
+
+«DEFINE ExpressionClass_oclInstance FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+private final org.eclipse.ocl.ecore.OCL oclInstance;
+«ENDDEFINE»
+
+«DEFINE ExpressionClass_ctor FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND ExpressionClassName»(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
+ super(body, context);
+ oclInstance = org.eclipse.ocl.ecore.OCL.newInstance();
+ initCustomEnv(oclInstance.getEnvironment(), environment);
+}
+«ENDDEFINE»
+
+«DEFINE ExpressionClass_query FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+private java.lang.ref.WeakReference queryRef;
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.ocl.Query getQuery() {
+ org.eclipse.ocl.Query oclQuery = null;
+ if(this.queryRef != null) {
+ oclQuery = (org.eclipse.ocl.Query)this.queryRef.get();
+ }
+ if(oclQuery == null) {
+ org.eclipse.ocl.helper.OCLHelper oclHelper = oclInstance.createOCLHelper();
+ oclHelper.setContext(context());
+ try {
+ org.eclipse.ocl.expressions.OCLExpression oclExpression = oclHelper.createQuery(body());
+ oclQuery = oclInstance.createQuery(oclExpression);
+ this.queryRef = new java.lang.ref.WeakReference(oclQuery);
+ setStatus(org.eclipse.core.runtime.IStatus.OK, null, null);
+ } catch (org.eclipse.ocl.ParserException e) {
+ setStatus(org.eclipse.core.runtime.IStatus.ERROR, e.getMessage(), e);
+ }
+ }
+ return oclQuery;
+}
+«ENDDEFINE»
+
+«DEFINE ExpressionClass_doEvaluate FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected Object doEvaluate(Object context, java.util.Map env) {
+ org.eclipse.ocl.Query oclQuery = getQuery();
+ if (oclQuery == null) {
+ return null;
+ }
+ org.eclipse.ocl.EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();
+ // init environment
+ for (java.util.Iterator it = env.entrySet().iterator(); it.hasNext();) {
+ java.util.Map.Entry nextEntry = (java.util.Map.Entry) it.next();
+ evalEnv.replace((String)nextEntry.getKey(), nextEntry.getValue());
+ }
+
+ try {
+ initExtentMap(context);
+ Object result = oclQuery.evaluate(context);
+ return (result != oclInstance.getEnvironment().getOCLStandardLibrary().getOclInvalid()) ? result : null;
+ } finally {
+ evalEnv.clear();
+ oclQuery.getExtentMap().clear();
+ }
+}
+«ENDDEFINE»
+
+«DEFINE ExpressionClass_initExtentMap FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+private void initExtentMap(Object context) {
+ if (!getStatus().isOK() || context == null) {
+ return;
+ }
+ final org.eclipse.ocl.Query queryToInit = getQuery();
+ final Object extentContext = context;
+
+ queryToInit.getExtentMap().clear();
+ if (queryToInit.queryText() != null && queryToInit.queryText().indexOf(org.eclipse.ocl.utilities.PredefinedType.ALL_INSTANCES_NAME) >= 0) {
+ org.eclipse.ocl.utilities.AbstractVisitor visitior = new org.eclipse.ocl.utilities.AbstractVisitor() {
+ private boolean usesAllInstances = false;
+
+ public Object visitOperationCallExp(org.eclipse.ocl.expressions.OperationCallExp oc) {
+ if(!usesAllInstances) {
+ usesAllInstances = org.eclipse.ocl.utilities.PredefinedType.ALL_INSTANCES == oc.getOperationCode();
+ if(usesAllInstances) {
+ queryToInit.getExtentMap().putAll(oclInstance.getEvaluationEnvironment().createExtentMap(extentContext));
+ }
+ }
+ return super.visitOperationCallExp(oc);
+ }
+ };
+ queryToInit.getExpression().accept(visitior);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE ExpressionClass_initCustomEnv FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static void initCustomEnv(org.eclipse.ocl.Environment ecoreEnv, java.util.Map environment) {
+ for (java.util.Iterator it = environment.keySet().iterator(); it.hasNext();) {
+ String varName = (String)it.next();
+ org.eclipse.emf.ecore.EClassifier varType = (org.eclipse.emf.ecore.EClassifier) environment.get(varName);
+ ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE ExpressionClass_createVar FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.ocl.expressions.Variable createVar(org.eclipse.ocl.Environment ecoreEnv, String name, org.eclipse.emf.ecore.EClassifier type) {
+ org.eclipse.ocl.expressions.Variable var = org.eclipse.ocl.ecore.EcoreFactory.eINSTANCE.createVariable(); // or ecoreEnv.getOCLFactory().createVariable()?
+ var.setName(name);
+ var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
+ return var;
+}
+«ENDDEFINE»
+
+«DEFINE ExpressionClass_additions FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/expressions/RegexpExpressionFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE RegexpExpressionFactory FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::copyright FOR container.editorGen»
+package «container.expressionsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» «EXPAND supertypes» {
+ «EXPAND ctor-»
+
+ «EXPAND getExpression-»
+
+ «EXPAND additions-»
+
+ «EXPAND Expression-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+private «className»() {
+}
+«ENDDEFINE»
+
+«DEFINE getExpression FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static «container.getAbstractExpressionQualifiedClassName()» getExpression(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
+ return new «EXPAND ExpressionClassName»(body, context, environment);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public static «container.getAbstractExpressionQualifiedClassName()» getExpression(String body, org.eclipse.emf.ecore.EClassifier context) {
+ return getExpression(body, context, java.util.Collections.EMPTY_MAP);
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
+
+«DEFINE ExpressionClassName FOR gmfgen::GenExpressionInterpreter»Expression«ENDDEFINE»
+
+«DEFINE Expression FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedClassComment»
+private static class «EXPAND ExpressionClassName» extends «container.getAbstractExpressionQualifiedClassName()» {
+ «EXPAND Expression_pattern-»
+
+ «EXPAND Expression_ctor-»
+
+ «EXPAND Expression_doEvaluate-»
+
+ «EXPAND Expression_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE Expression_pattern FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+private final java.util.regex.Pattern pattern;
+«ENDDEFINE»
+
+«DEFINE Expression_ctor FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND ExpressionClassName»(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
+ super(body, context);
+ java.util.regex.Pattern p;
+ try {
+ p = java.util.regex.Pattern.compile(body);
+ } catch (java.util.regex.PatternSyntaxException e) {
+ setStatus(org.eclipse.core.runtime.IStatus.ERROR, e.getMessage(), e);
+ p = null;
+ }
+ this.pattern = p;
+}
+«ENDDEFINE»
+
+«DEFINE Expression_doEvaluate FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected Object doEvaluate(Object contextInstance, java.util.Map env) {
+ if (pattern == null) {
+ return null;
+ }
+
+ if(context() instanceof org.eclipse.emf.ecore.EDataType) {
+ contextInstance = org.eclipse.emf.ecore.util.EcoreUtil.convertToString((org.eclipse.emf.ecore.EDataType)context(), contextInstance);
+ }
+
+ java.util.regex.Matcher matcher = this.pattern.matcher(String.valueOf(contextInstance));
+ return Boolean.valueOf(«EXPAND possibleNegation»matcher.matches());
+}
+«ENDDEFINE»
+
+«DEFINE possibleNegation FOR gmfgen::GenExpressionInterpreter»«IF language.literal != gmfgen::GenLanguage::regexp.literal»!«ENDIF»«ENDDEFINE»
+
+«DEFINE Expression_additions FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/manifest.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«DEFINE manifest FOR gmfgen::GenPlugin-»
+Manifest-Version: «EXPAND manifestVersion»
+Bundle-ManifestVersion: «EXPAND bundleManifestVersion»
+Bundle-Name: «EXPAND bundleName»
+Bundle-SymbolicName: «EXPAND bundleSymbolicName»
+Bundle-Version: «EXPAND bundleVersion»
+Bundle-ClassPath: «EXPAND bundleClassPath»
+Bundle-Activator: «EXPAND bundleActivator»
+Bundle-Vendor: «EXPAND bundleVendor»
+Bundle-Localization: «EXPAND bundleLocalization»
+Export-Package: «EXPAND exportedPackages»
+Require-Bundle: «EXPAND requiredBundles»
+Eclipse-LazyStart: «EXPAND eclipseLazyStart»
+«ENDDEFINE»
+
+«DEFINE manifestVersion FOR gmfgen::GenPlugin»1.0«ENDDEFINE»
+
+«DEFINE bundleManifestVersion FOR gmfgen::GenPlugin»2«ENDDEFINE»
+
+«DEFINE bundleName FOR gmfgen::GenPlugin»%pluginName«ENDDEFINE»
+
+«DEFINE bundleSymbolicName FOR gmfgen::GenPlugin»«iD»; singleton:=true«ENDDEFINE»
+
+«DEFINE bundleVersion FOR gmfgen::GenPlugin»«version»«ENDDEFINE»
+
+«DEFINE bundleClassPath FOR gmfgen::GenPlugin».«ENDDEFINE»
+
+«DEFINE bundleActivator FOR gmfgen::GenPlugin»«getActivatorQualifiedClassName()»«ENDDEFINE»
+
+«DEFINE bundleVendor FOR gmfgen::GenPlugin»%providerName«ENDDEFINE»
+
+«DEFINE bundleLocalization FOR gmfgen::GenPlugin»plugin«ENDDEFINE»
+
+«DEFINE exportedPackages FOR gmfgen::GenPlugin-»
+«editorGen.editor.packageName-»
+«ENDDEFINE»
+
+«DEFINE requiredBundles FOR gmfgen::GenPlugin-»
+org.eclipse.core.runtime,
+«IF null == editorGen.application-»
+ org.eclipse.core.resources,
+«IF null != editorGen.navigator-»
+ org.eclipse.ui.navigator,
+«IF editorGen.navigator.generateDomainModelNavigator-»
+ org.eclipse.core.expressions,
+«ENDIF-»
+«ENDIF-»
+ org.eclipse.ui.ide,
+«ENDIF-»
+«IF null != editorGen.propertySheet-»
+ org.eclipse.ui.views.properties.tabbed,
+«ENDIF-»
+ org.eclipse.jface,
+ org.eclipse.ui.views,
+ org.eclipse.ui.workbench,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.emf.workspace,«REM» XXX: introduces dependency on org.eclipse.core.resources which may be problematic for RCP*/«ENDREM»
+ org.eclipse.gef;visibility:=reexport,
+«FOREACH getAllRequiredPlugins() AS id-»
+ «id»;visibility:=reexport,
+«ENDFOREACH-»
+ org.eclipse.gmf.runtime.notation,
+ org.eclipse.gmf.runtime.notation.edit,
+ org.eclipse.gmf.runtime.lite«-»
+«ENDDEFINE»
+
+«DEFINE eclipseLazyStart FOR gmfgen::GenPlugin»true«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/navigator/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2007 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:
+ * blajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE extensions FOR gmfgen::GenNavigator-»
+ «EXPAND editorInputPropertyTester("URIEditorInput", "org.eclipse.emf.common.ui.URIEditorInput", getUriInputTesterQualifiedClassName())-»
+«IF editorGen.diagram.generateShortcutIcon()-»
+
+ «EXPAND editorInputPropertyTester("Shortcut", "org.eclipse.gmf.runtime.notation.View", editorGen.diagram.getShortcutPropertyTesterQualifiedClassName())-»
+«ENDIF-»
+«IF generateDomainModelNavigator && null != editorGen.domainGenModel-»
+ «EXPAND editorInputPropertyTester("DomainModelElement", "org.eclipse.emf.ecore.EObject", getDomainModelElementTesterQualifiedClassName())-»
+«ENDIF-»
+
+ «EXPAND registerBindings-»
+
+ «EXPAND registerNavigatorContent-»
+
+ «EXPAND registerLinkHelper-»
+«ENDDEFINE»
+
+«DEFINE i18n FOR gmfgen::GenNavigator-»
+navigatorContentName=*.«editorGen.diagramFileExtension» diagram contents
+«IF generateDomainModelNavigator-»
+domainNavigatorContentName=*.«editorGen.domainFileExtension» model contents
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE editorInputPropertyTester(String property, String type, String testerClass) FOR gmfgen::GenNavigator-»
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <propertyTester
+ id="«editorGen.plugin.iD».«property»PropertyTester"
+ type="«type»"
+ namespace="«editorGen.plugin.iD»"
+ properties="is«property»"
+ class="«testerClass»">
+ </propertyTester>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE registerBindings FOR gmfgen::GenNavigator-»
+ <extension point="org.eclipse.ui.navigator.viewer">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension pattern="«contentExtensionID»"/>
+«IF generateDomainModelNavigator && null != editorGen.domainGenModel-»
+ <contentExtension pattern="«domainContentExtensionID»"/>
+«ENDIF-»
+«IF editorGen.editor.eclipseEditor-»
+ <contentExtension pattern="«linkHelperExtensionID»"/>
+«ENDIF-»
+ </includes>
+ </viewerContentBinding>
+ <viewerActionBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <actionExtension pattern="«actionProviderID»"/>
+ </includes>
+ </viewerActionBinding>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE registerNavigatorContent FOR gmfgen::GenNavigator-»
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ «EXPAND diagramNavigatorContent-»
+ «EXPAND domainModelNavigatorContent-»
+ «EXPAND actionProvider-»
+ </extension>
+«ENDDEFINE»
+
+«DEFINE diagramNavigatorContent FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <navigatorContent
+ id="«contentExtensionID»"
+ name="«contentExtensionName»"
+ priority="«contentExtensionPriority»"
+ contentProvider="«getContentProviderQualifiedClassName()»"
+ labelProvider="«getLabelProviderQualifiedClassName()»"
+ icon="«editorGen.editor.iconPathX»"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="«editorGen.diagramFileExtension»"/>
+ </and>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+«IF editorGen.diagram.generateShortcutIcon()-»
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="«editorGen.plugin.iD».isShortcut"/>
+ </adapt>
+«ENDIF-»
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+«IF editorGen.diagram.generateShortcutIcon()-»
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="«editorGen.plugin.iD».isShortcut"/>
+ </adapt>
+«ENDIF-»
+ </or>
+ </possibleChildren>
+ <commonSorter
+ id="«sorterExtensionID»"
+ class="«getSorterQualifiedClassName()»">
+ <parentExpression>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="«editorGen.diagramFileExtension»"/>
+ </and>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+ </or>
+ </parentExpression>
+ </commonSorter>
+ </navigatorContent>
+«ENDDEFINE»
+
+«DEFINE domainModelNavigatorContent FOR gmfgen::GenNavigator-»
+«IF generateDomainModelNavigator && null != editorGen.domainGenModel-»
+ <navigatorContent
+ id="«domainContentExtensionID»"
+ name="«domainContentExtensionName»"
+ priority="«domainContentExtensionPriority»"
+ contentProvider="«getDomainContentProviderQualifiedClassName()»"
+ labelProvider="«getDomainLabelProviderQualifiedClassName()»"
+ icon="«editorGen.editor.iconPathX»"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="«editorGen.domainFileExtension»"/>
+ </and>
+ <and>
+ <instanceof value="org.eclipse.emf.ecore.EObject"/>
+ <test property="«editorGen.plugin.iD».isDomainModelElement"/>
+ </and>
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <and>
+ <instanceof value="org.eclipse.emf.ecore.EObject"/>
+ <test property="«editorGen.plugin.iD».isDomainModelElement"/>
+ </and>
+ </possibleChildren>
+ </navigatorContent>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE actionProvider FOR gmfgen::GenNavigator-»
+ <actionProvider
+ id="«actionProviderID»"
+ class="«getActionProviderQualifiedClassName()»">
+ <enablement>
+ <or>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+«IF editorGen.diagram.generateShortcutIcon()-»
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="«editorGen.plugin.iD».isShortcut"/>
+ </adapt>
+«ENDIF-»
+ </or>
+ </enablement>
+ </actionProvider>
+«ENDDEFINE»
+
+«DEFINE registerLinkHelper FOR gmfgen::GenNavigator-»
+«IF editorGen.editor.eclipseEditor-»
+ <extension point="org.eclipse.ui.navigator.linkHelper">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <linkHelper
+ id="«linkHelperExtensionID»"
+ class="«getLinkHelperQualifiedClassName()»">
+ <editorInputEnablement>
+ <or>
+ <instanceof value="org.eclipse.ui.IFileEditorInput"/>
+ <and>
+ <instanceof value="org.eclipse.emf.common.ui.URIEditorInput"/>
+ <test property="«editorGen.plugin.iD».isURIEditorInput"/>
+ </and>
+ <instanceof value="org.eclipse.gmf.runtime.lite.parts.DiagramEditorInput"/>
+ </or>
+ </editorInputEnablement>
+ <selectionEnablement>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+ </selectionEnablement>
+ </linkHelper>
+ </extension>
+«ENDIF-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/plugin.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE plugin FOR gmfgen::GenPlugin-»
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+«EXPAND xpt::Common::xcopyright FOR editorGen-»
+<plugin>
+«EXPAND fileTypes-»
+«EXPAND xpt::editor::extensions::extensions FOR editorGen-»
+«EXPAND xpt::application::extensions::extensions FOR editorGen.application-»
+«EXPAND menu-»
+«EXPAND xpt::navigator::extensions::extensions FOR editorGen.navigator-»
+«EXPAND xpt::propsheet::extensions::extensions FOR editorGen.propertySheet-»
+«EXPAND xpt::providers::extensions::extensions FOR editorGen-»
+«EXPAND xpt::ConstraintProviders::extensions FOR editorGen-»
+«EXPAND xpt::diagram::preferences::extensions::extensions FOR editorGen.diagram-»
+
+«EXPAND additions-»
+</plugin>
+«ENDDEFINE»
+
+«DEFINE fileTypes FOR gmfgen::GenPlugin-»
+ <extension point="org.eclipse.team.core.fileTypes">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <fileTypes
+ type="text"
+ extension="«editorGen.diagramFileExtension»">
+ </fileTypes>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE menu FOR gmfgen::GenPlugin-»
+ <extension point="org.eclipse.ui.popupMenus">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+«IF null == editorGen.application-»
+ <objectContribution
+ id="«iD».ui.objectContribution.IFile1"
+ nameFilter="*.«editorGen.domainFileExtension»"
+ objectClass="org.eclipse.core.resources.IFile">
+ <action
+ label="%_UI_Menu_InitDiagramFile_label"
+ class="«editorGen.diagram.getInitDiagramFileActionQualifiedClassName()»"
+ menubarPath="additions"
+ enablesFor="1"
+ id="«editorGen.diagram.getInitDiagramFileActionQualifiedClassName()»ID">
+ </action>
+ </objectContribution>
+ «IF !editorGen.editor.eclipseEditor-»
+ <objectContribution
+ id="«iD».ui.objectContribution.IFile2"
+ nameFilter="*.«editorGen.diagramFileExtension»"
+ objectClass="org.eclipse.core.resources.IFile">
+ <action
+ label="%_UI_Menu_OpenDiagramView_label"
+ class="«EXPAND xpt::editor::OpenDiagramInViewAction::qualifiedClassName FOR editorGen.editor»"
+ menubarPath="additions"
+ enablesFor="1"
+ id="«EXPAND xpt::editor::OpenDiagramInViewAction::qualifiedClassName FOR editorGen.editor»ID">
+ </action>
+ </objectContribution>
+ «ENDIF-»
+«ENDIF-»
+ <objectContribution
+ adaptable="false"
+ id="«iD».ui.objectContribution.«editorGen.diagram.editPartClassName»2"
+ objectClass="«editorGen.diagram.getEditPartQualifiedClassName()»">
+ <action
+ class="«editorGen.diagram.getLoadResourceActionQualifiedClassName()»"
+ enablesFor="1"
+ id="«editorGen.diagram.getLoadResourceActionQualifiedClassName()»ID"
+ label="%loadResourceActionLabel"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenPlugin-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/properties.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE properties FOR gmfgen::GenPlugin-»
+pluginName=«name»
+providerName=«provider»
+
+«EXPAND xpt::editor::extensions::i18n FOR editorGen-»
+«EXPAND xpt::application::extensions::i18n FOR editorGen.application-»
+«EXPAND xpt::propsheet::extensions::i18n FOR editorGen.propertySheet-»
+«EXPAND xpt::providers::extensions::i18n FOR editorGen-»
+
+«EXPAND menu-»
+«EXPAND xpt::navigator::extensions::i18n FOR editorGen.navigator-»
+«EXPAND xpt::diagram::preferences::extensions::i18n FOR editorGen.diagram-»
+
+«EXPAND additions-»
+«ENDDEFINE»
+
+«DEFINE menu FOR gmfgen::GenPlugin-»
+«IF null == editorGen.application-»
+_UI_Menu_InitDiagramFile_label=Initialize «editorGen.diagramFileExtension» diagram file
+«IF !editorGen.editor.eclipseEditor-»
+_UI_Menu_OpenDiagramView_label=Open diagram in «editorGen.modelID» Diagram View
+«ENDIF-»
+«ENDIF-»
+loadResourceActionLabel=Load Resource...
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenPlugin-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/propsheet/PropertySection.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,32 @@
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE PropertySection FOR gmfgen::GenCustomPropertyTab-»
+«EXPAND xpt::Common::copyright FOR sheet.editorGen»
+package «sheet.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» extends org.eclipse.gmf.runtime.lite.properties.AdvancedPropertySection {
+ «EXPAND xpt::Common::generatedMemberComment("Modify/unwrap selection.")»
+ protected Object transformSelection(Object selected) {
+ if (selected instanceof org.eclipse.gef.EditPart) {
+ Object model = ((org.eclipse.gef.EditPart) selected).getModel();
+ return model instanceof org.eclipse.gmf.runtime.notation.View ? ((org.eclipse.gmf.runtime.notation.View) model).getElement() : null;
+ }
+ if (selected instanceof org.eclipse.gmf.runtime.notation.View) {
+ return ((org.eclipse.gmf.runtime.notation.View) selected).getElement();
+ }
+ if (selected instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) selected).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null) {
+ return view.getElement();
+ }
+ }
+ return selected;
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.common.notify.AdapterFactory getItemProvidersAdapterFactory() {
+ return «sheet.editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory();
+ }
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/propsheet/SheetLabelProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,71 @@
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE SheetLabelProvider FOR gmfgen::GenPropertySheet-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «labelProviderClassName» extends org.eclipse.jface.viewers.DecoratingLabelProvider {
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «labelProviderClassName»() {
+ super(new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory()), null);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getText(Object element) {
+ Object selected = unwrap(element);
+«IF null != editorGen.navigator && null != editorGen.application»
+ if (selected instanceof «editorGen.navigator.getNavigatorGroupQualifiedClassName()») {
+ return ((«editorGen.navigator.getNavigatorGroupQualifiedClassName()») selected).getGroupName();
+ }
+«ENDIF»
+ return super.getText(selected);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.swt.graphics.Image getImage(Object element) {
+ return super.getImage(unwrap(element));
+ }
+
+ «EXPAND unwrap-»
+ «EXPAND unwrapView-»
+ «EXPAND unwrapEditPart-»
+}
+«ENDDEFINE»
+
+«DEFINE unwrap FOR gmfgen::GenPropertySheet-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private Object unwrap(Object element) {
+ if (element instanceof org.eclipse.jface.viewers.IStructuredSelection) {
+ return unwrap(((org.eclipse.jface.viewers.IStructuredSelection) element).getFirstElement());
+ }
+ if (element instanceof org.eclipse.gef.EditPart) {
+ return unwrapEditPart((org.eclipse.gef.EditPart) element);
+ }
+ if (element instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null) {
+ return unwrapView(view);
+ }
+ }
+ return element;
+ }
+«ENDDEFINE»
+
+«DEFINE unwrapView FOR gmfgen::GenPropertySheet-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private Object unwrapView(org.eclipse.gmf.runtime.notation.View view) {
+ return view.getElement() == null ? view : view.getElement();
+ }
+«ENDDEFINE»
+
+«DEFINE unwrapEditPart FOR gmfgen::GenPropertySheet-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private Object unwrapEditPart(org.eclipse.gef.EditPart p) {
+ if (p.getModel() instanceof org.eclipse.gmf.runtime.notation.View) {
+ return unwrapView((org.eclipse.gmf.runtime.notation.View) p.getModel());
+ }
+ return p.getModel();
+ }
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/propsheet/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE extensions FOR gmfgen::GenPropertySheet-»
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <propertyContributor contributorId="«editorGen.plugin.iD»"«IF needsCaption» labelProvider="«getLabelProviderQualifiedClassName()»"«ENDIF»>
+ <propertyCategory category="domain"/>
+ <propertyCategory category="visual"/>
+ <propertyCategory category="extra"/>
+ </propertyContributor>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <propertyTabs contributorId="«editorGen.plugin.iD»">
+«EXPAND tab FOREACH tabs-»
+ </propertyTabs>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <propertySections contributorId="«editorGen.plugin.iD»">
+«EXPAND section FOREACH tabs-»
+ </propertySections>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE tab FOR gmfgen::GenPropertyTab-»
+«ERROR "Unknown property tab: " + this»
+«ENDDEFINE»
+
+«DEFINE tab FOR gmfgen::GenStandardPropertyTab-»
+«IF iD == "appearance"-»
+ <propertyTab
+ category="visual"
+ id="property.tab.AppearancePropertySection"
+ label="%tab.appearance"/>
+«ELSEIF iD == "diagram"-»
+ <propertyTab
+ category="visual"
+ id="property.tab.DiagramPropertySection"
+ label="%tab.diagram"/>
+«ELSEIF iD == "advanced"-»
+ <propertyTab
+ category="extra"
+ id="property.tab.AdvancedPropertySection"
+ label="%tab.advanced"/>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE tab FOR gmfgen::GenCustomPropertyTab-»
+ <propertyTab
+«IF iD == "domain"-»
+ category="domain"
+«ELSE-»
+ category="extra"
+«ENDIF-»
+ id="property.tab.«iD»"
+ label="%tab.«iD»"/>
+«ENDDEFINE»
+
+«DEFINE section FOR gmfgen::GenPropertyTab-»
+«ERROR "Unknown property tab: " + this»
+«ENDDEFINE»
+
+«DEFINE section FOR gmfgen::GenStandardPropertyTab-»
+«IF iD == "appearance"-»
+ <propertySection id="property.section.ShapeColorAndFontPropertySection"
+ filter="org.eclipse.gmf.runtime.lite.properties.filters.FontColorHolderEditPartPropertySectionFilter"
+ class="org.eclipse.gmf.runtime.lite.properties.ColorsAndFontsPropertySection"
+ tab="property.tab.AppearancePropertySection">
+ </propertySection>
+«ELSEIF iD == "advanced"-»
+ <propertySection id="property.section.AdvancedPropertySection"
+ class="org.eclipse.gmf.runtime.lite.properties.AdvancedPropertySection"
+ filter="org.eclipse.gmf.runtime.lite.properties.filters.EditPartPropertySectionFilter"
+ tab="property.tab.AdvancedPropertySection">
+ </propertySection>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE section FOR gmfgen::GenCustomPropertyTab-»
+ <propertySection
+ id="property.section.«iD»"
+ tab="property.tab.«iD»"
+«EXPAND filter FOR filter-»
+ class="«getQualifiedClassName()»">
+«EXPAND input FOR filter-»
+ </propertySection>
+«ENDDEFINE»
+
+«DEFINE filter FOR gmfgen::GenPropertyTabFilter»«ENDDEFINE»
+
+«DEFINE filter FOR gmfgen::CustomTabFilter-»
+ filter="«getQualifiedClassName()»"
+«ENDDEFINE»
+
+«DEFINE input FOR gmfgen::GenPropertyTabFilter»«ENDDEFINE»
+
+«DEFINE input FOR gmfgen::TypeTabFilter-»
+«FOREACH getAllTypes() AS type-»
+ <input type="«type»"/>
+«ENDFOREACH-»
+«ENDDEFINE»
+«DEFINE i18n FOR gmfgen::GenPropertySheet-»
+
+# Property Sheet
+«FOREACH tabs AS tab-»
+tab.«tab.iD»=«tab.label»
+«ENDFOREACH-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/DomainElementInitializer.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE className FOR gmfgen::GenDiagram»DomainElementInitializer«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«notationViewFactoriesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE DomainElementInitializer FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND xpt::providers::ElementInitializers::Initializers»
+ «EXPAND xpt::providers::ElementInitializers::JavaSupport»
+
+ «EXPAND xpt::diagram::editpolicies::BaseItemSemanticEditPolicy::linkConstraints-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/ElementTypes.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE ElementTypes FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «elementTypesClassName» {
+
+ «EXPAND constructor-»
+
+ «EXPAND attributes-»
+
+ «EXPAND getImageRegistry-»
+
+ «EXPAND getImageRegistryKey-»
+
+ «EXPAND getProvidedImageDescriptor-»
+
+ «EXPAND getNamedElementImageDescriptor-»
+
+ «EXPAND getNamedElementImage-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private «elementTypesClassName»() {
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.jface.resource.ImageRegistry imageRegistry;
+«ENDDEFINE»
+
+
+«DEFINE getImageRegistry FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.jface.resource.ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ imageRegistry = new org.eclipse.jface.resource.ImageRegistry();
+ }
+ return imageRegistry;
+}
+«ENDDEFINE»
+
+«DEFINE getImageRegistryKey FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static String getImageRegistryKey(org.eclipse.emf.ecore.ENamedElement element) {
+ return element.getName();
+}
+«ENDDEFINE»
+
+«DEFINE getProvidedImageDescriptor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.jface.resource.ImageDescriptor getProvidedImageDescriptor(org.eclipse.emf.ecore.ENamedElement element) {
+ if (element instanceof org.eclipse.emf.ecore.EStructuralFeature) {
+ org.eclipse.emf.ecore.EStructuralFeature feature = ((org.eclipse.emf.ecore.EStructuralFeature) element);
+ org.eclipse.emf.ecore.EClass eContainingClass = feature.getEContainingClass();
+ org.eclipse.emf.ecore.EClassifier eType = feature.getEType();
+ if (eContainingClass != null && !eContainingClass.isAbstract()){
+ element = eContainingClass;
+ } else if (eType instanceof org.eclipse.emf.ecore.EClass && !((org.eclipse.emf.ecore.EClass)eType).isAbstract()){
+ element = eType;
+ }
+ }
+ if (element instanceof org.eclipse.emf.ecore.EClass) {
+ org.eclipse.emf.ecore.EClass eClass = (org.eclipse.emf.ecore.EClass) element;
+ if (!eClass.isAbstract()) {
+ return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemImageDescriptor(
+ eClass.getEPackage().getEFactoryInstance().create(eClass));
+ }
+ }
+ // TODO : support structural features
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getNamedElementImageDescriptor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(org.eclipse.emf.ecore.ENamedElement element) {
+ String key = getImageRegistryKey(element);
+ org.eclipse.jface.resource.ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(key);
+ if (imageDescriptor == null) {
+ «EXPAND loadProvidedImageDescriptor-»
+ }
+ return imageDescriptor;
+}
+«ENDDEFINE»
+
+«DEFINE loadProvidedImageDescriptor FOR gmfgen::GenDiagram-»
+imageDescriptor = getProvidedImageDescriptor(element);
+if (imageDescriptor == null) {
+ imageDescriptor = org.eclipse.jface.resource.ImageDescriptor.getMissingImageDescriptor();
+}
+getImageRegistry().put(key, imageDescriptor);
+«ENDDEFINE»
+
+«DEFINE getNamedElementImage FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.swt.graphics.Image getImage(org.eclipse.emf.ecore.ENamedElement element) {
+ String key = getImageRegistryKey(element);
+ org.eclipse.swt.graphics.Image image = getImageRegistry().get(key);
+ if (image == null) {
+ org.eclipse.jface.resource.ImageDescriptor «EXPAND loadProvidedImageDescriptor-»
+ image = getImageRegistry().get(key);
+ }
+ return image;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/MarkerNavigationProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::providers::i18n»
+«EXTENSION xpt::providers::ValidationUtils»
+
+«DEFINE MarkerNavigationProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «markerNavigationProviderClassName» implements org.eclipse.gmf.runtime.lite.validation.IValidationStateListener {
+«EXPAND markerType-»
+«EXPAND validationStateChanged-»
+«EXPAND adjustMarker-»
+«EXPAND adjustDiagnosticMarker-»
+«EXPAND adjustConstraintMarker-»
+«EXPAND addMarker-»
+
+«EXPAND ReplaceMarkersJob-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE markerType FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String MARKER_TYPE = «editorGen.plugin.getActivatorQualifiedClassName()».ID + ".diagnostic"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE validationStateChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void validationStateChanged(org.eclipse.gmf.runtime.lite.validation.ValidationStateEvent event) {
+ org.eclipse.emf.common.util.URI diagramUri = event.getSourceValidationState().getDiagramUri();
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(new org.eclipse.emf.ecore.resource.impl.ResourceImpl(diagramUri));
+ if (file != null && file.exists()) {
+ new ReplaceMarkersJob(file, event).schedule();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE adjustMarker FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void adjustMarker(org.eclipse.core.resources.IMarker marker, Object referent) {
+ if (referent instanceof org.eclipse.emf.common.util.Diagnostic) {
+ adjustMarker(marker, (org.eclipse.emf.common.util.Diagnostic) referent);
+ } else if (referent instanceof org.eclipse.emf.validation.model.IConstraintStatus) {
+ adjustMarker(marker, (org.eclipse.emf.validation.model.IConstraintStatus) referent);
+ } else {
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE adjustDiagnosticMarker FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void adjustMarker(org.eclipse.core.resources.IMarker marker, org.eclipse.emf.common.util.Diagnostic sourceDiagnostic) {
+ assert marker != null && sourceDiagnostic != null;
+ }
+«ENDDEFINE»
+
+«DEFINE adjustConstraintMarker FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void adjustMarker(org.eclipse.core.resources.IMarker marker, org.eclipse.emf.validation.model.IConstraintStatus sourceStatus) {
+ assert marker != null && sourceStatus != null;
+ }
+«ENDDEFINE»
+
+«DEFINE addMarker FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static org.eclipse.core.resources.IMarker addMarker(org.eclipse.core.resources.IFile file, org.eclipse.emf.common.util.URI diagramUri, org.eclipse.emf.common.util.URI viewUri, String message, int statusSeverity) {
+ org.eclipse.core.resources.IMarker marker = null;
+ try {
+ marker = file.createMarker(MARKER_TYPE);
+ marker.setAttribute(org.eclipse.core.resources.IMarker.MESSAGE, message);
+ marker.setAttribute(org.eclipse.core.resources.IMarker.LOCATION, diagramUri.toString());
+ marker.setAttribute(org.eclipse.emf.ecore.EValidator.URI_ATTRIBUTE, viewUri.toString());
+ int markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_INFO;
+ if (statusSeverity == org.eclipse.core.runtime.IStatus.WARNING) {
+ markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_WARNING;
+ } else if (statusSeverity == org.eclipse.core.runtime.IStatus.ERROR || statusSeverity == org.eclipse.core.runtime.IStatus.CANCEL) {
+ markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_ERROR;
+ }
+ marker.setAttribute(org.eclipse.core.resources.IMarker.SEVERITY, markerSeverity);
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Failed to create validation marker", e); «EXPAND xpt::Common::nonNLS»
+ }
+ return marker;
+ }
+«ENDDEFINE»
+
+«DEFINE ReplaceMarkersJob FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+ private static class ReplaceMarkersJob extends org.eclipse.core.resources.WorkspaceJob {
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final java.util.Collection myDescriptorsToAdd;
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.core.resources.IFile myFile;
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.common.util.URI myDiagramUri;
+ «EXPAND xpt::Common::generatedMemberComment»
+ public ReplaceMarkersJob(org.eclipse.core.resources.IFile file, org.eclipse.gmf.runtime.lite.validation.ValidationStateEvent event) {
+ super(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForMarkerNavigationProviderReplaceMarkersJobName()) FOR editorGen»);
+ setRule(file.getWorkspace().getRuleFactory().markerRule(file));
+ myFile = file;
+ myDiagramUri = event.getSourceValidationState().getDiagramUri();
+ myDescriptorsToAdd = new java.util.ArrayList();
+ for (java.util.Iterator it = event.getViolationKeys().iterator(); it.hasNext(); ) {
+ org.eclipse.emf.common.util.URI next = (org.eclipse.emf.common.util.URI) it.next();
+ myDescriptorsToAdd.addAll(event.getNewViolations(next));
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.core.runtime.IStatus runInWorkspace(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException {
+ String expectedLocation = myDiagramUri.toString();
+ org.eclipse.core.resources.IMarker[] markers = myFile.findMarkers(MARKER_TYPE, false, org.eclipse.core.resources.IResource.DEPTH_INFINITE);
+ for (int i = 0; i < markers.length; i++) {
+ org.eclipse.core.resources.IMarker next = markers[i];
+ if (expectedLocation.equals(next.getAttribute(org.eclipse.core.resources.IMarker.LOCATION))) {
+ next.delete();
+ }
+ }
+ for (java.util.Iterator it = myDescriptorsToAdd.iterator(); it.hasNext(); ) {
+ org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor next = (org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor) it.next();
+ org.eclipse.core.resources.IMarker nextMarker = addMarker(myFile, myDiagramUri, next.getUri(), next.getMessage(), next.getSeverity().toStatusSeverity());
+ if (nextMarker != null) {
+ adjustMarker(nextMarker, next.getReferent());
+ }
+ }
+ return org.eclipse.core.runtime.Status.OK_STATUS;
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF validationNeeded() && editorGen.application == null-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForMarkerNavigationProviderReplaceMarkersJobName())-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF validationNeeded() && editorGen.application == null-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMarkerNavigationProviderReplaceMarkersJobName(), "Replace markers")-»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/MetricProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - refactoring (https://bugs.eclipse.org/230014)
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::providers::ValidationUtils»
+«EXTENSION xpt::providers::Metrics»
+«EXTENSION xpt::providers::i18n»
+
+«DEFINE MetricProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «metricProviderClassName» {
+
+«EXPAND calculateMetricsMethods-»
+
+«EXPAND formatNotationElementNameMethod-»
+«EXPAND formatSemanticElementNameMethod-»
+
+«EXPAND metricsClasses»
+
+«EXPAND keysAndToolTipsMethods FOR editorGen.metrics»
+
+«EXPAND metricCalcField FOREACH editorGen.metrics.metrics.select(m | m.rule != null && m.target != null && m.target.getContext() != null)»
+«EXPAND metricCalcMethod FOREACH editorGen.metrics.metrics.select(m | m.rule != null && m.target != null && m.target.getContext() != null)»
+
+«EXPAND xpt::providers::MetricsResultView::Class»
+
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+// @Override
+«DEFINE getImageAccessor(String imageClassVar) FOR gmfgen::GenDiagram»«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemImage(«imageClassVar»)«ENDDEFINE»
+
+// @Override
+«DEFINE formatSemanticElementNameMethod FOR GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static String formatElementName(org.eclipse.emf.ecore.EObject object) {
+ if (object == null) {
+ return String.valueOf((Object)null);
+ }
+ org.eclipse.emf.common.notify.AdapterFactory adapterFactory = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory();
+ org.eclipse.emf.edit.provider.IItemLabelProvider labelProvider = (org.eclipse.emf.edit.provider.IItemLabelProvider) adapterFactory.adapt(object, org.eclipse.emf.edit.provider.IItemLabelProvider.class);
+ if (labelProvider != null) {
+ return object.eClass().getName() + " " + labelProvider.getText(object);«EXPAND xpt::Common::nonNLS»
+ }
+ return object.toString();
+}
+«ENDDEFINE»
+
+
+// @Override
+«DEFINE calculateMetricsMethods FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+static java.util.List calculateMetrics(«editorGen.editor.getQualifiedClassName()» diagramPart) {
+ org.eclipse.gef.GraphicalViewer viewer = (org.eclipse.gef.GraphicalViewer) diagramPart.getAdapter(org.eclipse.gef.GraphicalViewer.class);
+ final org.eclipse.gmf.runtime.notation.Diagram diagram = diagramPart.getDiagram();
+ if (viewer == null || diagram == null) {
+ return java.util.Collections.EMPTY_LIST;
+ }
+ final org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService = new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.EditPartRegistryBasedViewService(viewer);
+ try {
+ return (java.util.List)diagramPart.getEditingDomain().runExclusive(
+ new org.eclipse.emf.transaction.RunnableWithResult.Impl() {
+ public void run() {
+ java.util.ArrayList/*<ElementMetrics>*/ metrics = new java.util.ArrayList/*<ElementMetrics>*/(50);
+«IF !getNotationMetrics(editorGen.metrics).isEmpty()-»
+ calculateNotationElementMetrics(diagram, metrics);
+«ENDIF-»
+«IF !getDiagramMetrics(editorGen.metrics).isEmpty()-»
+ calculateDiagramElementMetrics(diagram, metrics);
+«ENDIF-»
+«IF !getDomainMetrics(editorGen.metrics).isEmpty()-»
+ calculateSemanticElementMetrics(viewService, diagram, metrics);
+«ENDIF-»
+ setResult(metrics);
+ }
+ });
+ } catch(InterruptedException e) {
+ return java.util.Collections.EMPTY_LIST;
+ }
+}
+
+«IF !getNotationMetrics(editorGen.metrics).isEmpty()»«EXPAND calcNotationMetricsMethod FOR editorGen»«ENDIF»
+«IF !getDiagramMetrics(editorGen.metrics).isEmpty()»«EXPAND calcDiagramMetricsMethod FOR editorGen»«ENDIF»
+«IF !getDomainMetrics(editorGen.metrics).isEmpty()»«EXPAND calcDomainMetricsMethod FOR editorGen»«ENDIF»
+«ENDDEFINE»
+
+// @Override
+«DEFINE calcDomainMetricsMethod FOR GenEditorGenerator»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static void calculateSemanticElementMetrics(org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService, org.eclipse.gmf.runtime.notation.Diagram diagram, java.util.List/*<ElementMetrics>*/ metricsList) {
+ org.eclipse.emf.ecore.EObject next = diagram.getElement();
+ java.util.Iterator/*<EObject>*/ it = next != null ? next.eAllContents() : java.util.Collections.EMPTY_LIST.iterator();
+ java.util.HashMap/*<EObject, ElementMetrics>*/ target2row = new java.util.HashMap/*<EObject, ElementMetrics>*/();
+ while (next != null) {
+ java.util.ArrayList/*<Metric>*/ res = new java.util.ArrayList/*<Metric>*/(5);
+«FOREACH metrics.metrics.target.typeSelect(GenDomainElementTarget).element.purgeDups().typeSelect(GenClass) AS e-»
+ if («EXPAND MetaModel::MetaClass FOR e».isInstance(next)) {
+«FOREACH metrics.metrics.select(m | m.target.getContext() == e) AS m-»
+ res.add(«EXPAND metricResult("next", true) FOR m»);
+«ENDFOREACH-»
+ }
+«ENDFOREACH-»
+ if (!res.isEmpty()) {
+ ElementMetrics row = new ElementMetrics(next, formatElementName(next), (Metric[]) res.toArray(new Metric[res.size()]));
+ metricsList.add(row);
+ target2row.put(next, row);
+ }
+ next = it.hasNext() ? (org.eclipse.emf.ecore.EObject) it.next() : null;
+ }
+ if (!target2row.isEmpty()) { // list was modified, need to process only semantic metrics
+ // bind semantic elements to notation
+ for (java.util.Iterator it2 = target2row.entrySet().iterator(); it2.hasNext();) {
+ java.util.Map.Entry entry = (java.util.Map.Entry) it2.next();
+ org.eclipse.emf.ecore.EObject semanticElement = (org.eclipse.emf.ecore.EObject) entry.getKey();
+ org.eclipse.gmf.runtime.notation.View targetView = viewService.findView(semanticElement);
+ if (targetView != null) {
+ ElementMetrics elementMetrics = (ElementMetrics) entry.getValue();
+ elementMetrics.diagramElementID = targetView.eResource().getURIFragment(targetView);
+ }
+ }
+ }
+ }
+«ENDDEFINE»
+
+/*
+ F I X M E ! ! !
+ move i18n accessors into base template
+ F I X M E ! ! !
+ */
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF editorGen.metrics != null-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForMetricProviderResultViewElementColumnName())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForMetricProviderResultViewElementColumnTooltip())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForMetricProviderMetricDefToolTipLow())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForMetricProviderMetricDefToolTipHigh())-»
+«EXPAND nameAccessorField FOREACH getMetricRules().select(e| e.name != null)-»
+«EXPAND descriptionAccessorField FOREACH getMetricRules().select(e| e.description != null)-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF editorGen.metrics != null-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMetricProviderResultViewElementColumnName(), "Element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMetricProviderResultViewElementColumnTooltip(), "Measurement element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMetricProviderMetricDefToolTipLow(), " Low: ")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMetricProviderMetricDefToolTipHigh(), " High: ")-»
+«EXPAND nameAccessorValue FOREACH getMetricRules().select(e| e.name != null)-»
+«EXPAND descriptionAccessorValue FOREACH getMetricRules().select(e| e.description != null)-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE nameAccessorField FOR gmfgen::GenMetricRule-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForMetric().nameKey())-»
+«ENDDEFINE»
+
+«DEFINE descriptionAccessorField FOR gmfgen::GenMetricRule-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForMetric().descriptionKey())-»
+«ENDDEFINE»
+
+«DEFINE nameAccessorValue FOR gmfgen::GenMetricRule-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMetric().nameKey(), name)-»
+«ENDDEFINE»
+
+«DEFINE descriptionAccessorValue FOR gmfgen::GenMetricRule-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMetric().descriptionKey(), description)-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/MetricsAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::providers::i18n»
+
+«DEFINE className FOR gmfgen::GenDiagram»MetricsAction«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«providersPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE actionKey FOR gmfgen::GenDiagram»«EXPAND qualifiedClassName».«EXPAND keyConstant»«ENDDEFINE»
+
+«DEFINE MetricsAction FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND KEY-»
+
+ «EXPAND part-»
+
+ «EXPAND ctor-»
+
+ «EXPAND run-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.jface.action.Action«ENDDEFINE»
+
+«DEFINE KEY FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static final String «EXPAND keyConstant» = "metricsAction"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE keyConstant FOR gmfgen::GenDiagram»ACTION_KEY«ENDDEFINE»
+
+«DEFINE part FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.IWorkbenchPart myWorkbenchPart;
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public MetricsAction(org.eclipse.ui.IWorkbenchPart workbenchPart) {
+ setId(«EXPAND keyConstant»);
+ setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForMetricsActionActionName()) FOR editorGen»);
+ myWorkbenchPart = workbenchPart;
+ setEnabled(myWorkbenchPart instanceof «editorGen.editor.getQualifiedClassName()»);
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void run() {
+ org.eclipse.ui.IViewPart metricsView = null;
+ try {
+ metricsView = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(«EXPAND xpt::providers::MetricProvider::resultViewID»);
+ if(metricsView == null) {
+ metricsView = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(«EXPAND xpt::providers::MetricProvider::resultViewID»);
+«IF editorGen.editor.eclipseEditor-»
+ } else {
+«ELSE-»
+ }
+ if (metricsView != null) {
+«ENDIF-»
+ final «editorGen.editor.getQualifiedClassName()» part = («editorGen.editor.getQualifiedClassName()») myWorkbenchPart;
+ ((«EXPAND xpt::providers::MetricProvider::resultViewQualifiedClassName»)metricsView).setInput(part);
+ }
+ myWorkbenchPart.getSite().getPage().activate(metricsView);
+ } catch (org.eclipse.ui.PartInitException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Diagram metric view failure", e); «EXPAND xpt::Common::nonNLS»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForMetricsActionActionName())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMetricsActionActionName(), "&Metrics")-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/MetricsResultView.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2008 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:
+ * Artem Tikhomirov (Borland) - refactoring (https://bugs.eclipse.org/230014)
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+
+«DEFINE inputField FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+«IF editorGen.editor.eclipseEditor-»
+ private org.eclipse.ui.IEditorInput editorInput;
+«ELSE-»
+ private org.eclipse.emf.common.util.URI diagramURI;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setInputMethod FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+void setInput(«editorGen.editor.getQualifiedClassName()» diagramPart) {
+ org.eclipse.emf.ecore.resource.Resource resource = diagramPart.getDiagram().eResource();
+«IF editorGen.editor.eclipseEditor-»
+ this.editorInput = diagramPart.getEditorInput();
+«ELSE-»
+ this.diagramURI = resource.getURI();
+«ENDIF-»
+ setTitleToolTip(resource.getURI().path());
+
+ java.util.List metrics = calculateMetrics(diagramPart);
+ adjustLayout(metrics);
+ viewer.setInput(metrics);
+}
+«ENDDEFINE»
+
+«DEFINE createPartControlMethod_refreshInput FOR GenEditorView-»
+«IF eclipseEditor-»
+ org.eclipse.ui.IEditorPart editor = getSite().getPage().getActiveEditor();
+ if(editor instanceof «getQualifiedClassName()») {
+ setInput((«getQualifiedClassName()») editor);
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE handleOpenMethod FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void open(org.eclipse.jface.viewers.OpenEvent event) {
+«IF editorGen.editor.eclipseEditor-»
+ «editorGen.editor.getQualifiedClassName()» diagramPart;
+ try {
+ if (editorInput == null) {
+ return;
+ }
+ org.eclipse.ui.IEditorPart editorPart = getSite().getPage().openEditor(editorInput, «editorGen.editor.getQualifiedClassName()».ID);
+ if(false == editorPart instanceof «editorGen.editor.getQualifiedClassName()») {
+ return;
+ }
+ diagramPart = («editorGen.editor.getQualifiedClassName()») editorPart;
+ } catch (org.eclipse.ui.PartInitException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Can't open diagram editor", e); «EXPAND xpt::Common::nonNLS»
+ return;
+ }
+«ELSE-»
+ if (diagramURI == null) {
+ return;
+ }
+ org.eclipse.ui.IViewPart viewPart = «getDiagramEditorUtilQualifiedClassName()».showView(diagramURI);
+ if(false == viewPart instanceof «editorGen.editor.getQualifiedClassName()») {
+ return;
+ }
+ «editorGen.editor.getQualifiedClassName()» diagramPart = («editorGen.editor.getQualifiedClassName()») viewPart;
+«ENDIF-»
+ org.eclipse.gef.GraphicalViewer graphicalViewer = (org.eclipse.gef.GraphicalViewer) diagramPart.getAdapter(org.eclipse.gef.GraphicalViewer.class);
+ ElementMetrics selection = (ElementMetrics)((org.eclipse.jface.viewers.IStructuredSelection)event.getSelection()).getFirstElement();
+ String viewID = selection.diagramElementID;
+ if(viewID != null) {
+ org.eclipse.gmf.runtime.notation.View targetView = (org.eclipse.gmf.runtime.notation.View)diagramPart.getDiagram().eResource().getEObject(viewID);
+ if(targetView != null) {
+ org.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart)graphicalViewer.getEditPartRegistry().get(targetView);
+ if(targetEditPart != null) {
+ graphicalViewer.setSelection(new org.eclipse.jface.viewers.StructuredSelection(targetEditPart));
+ }
+ }
+ }
+}
+«ENDDEFINE»
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/ShortcutProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::commands::CommandUtils»
+
+«DEFINE className FOR gmfgen::GenDiagram»ShortcutProvider«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«providersPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE ShortcutProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND createShortcutEditPart-»
+ «EXPAND getCreateShortcutCommand-»
+ «EXPAND getRefreshShortcutCommand-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»implements org.eclipse.gmf.runtime.lite.shortcuts.IShortcutProvider«ENDDEFINE»
+
+«DEFINE createShortcutEditPart FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gef.EditPart createShortcutEditPart(org.eclipse.gef.EditPart context, org.eclipse.gmf.runtime.notation.View view) {
+ String modelID = «EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view);
+ if (!«EXPAND xpt::editor::VisualIDRegistry::modelID».equals(modelID)) {
+ return null;
+ }
+ int viewVisualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view);
+ switch (viewVisualID) {
+ «EXPAND xpt::diagram::parts::EditPartFactory::doCreate FOREACH getAllContainers()-»
+ «EXPAND xpt::diagram::parts::EditPartFactory::doCreate FOREACH links-»
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getCreateShortcutCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand getCreateShortcutCommand(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain elementEditingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(domainElement);
+ if (elementEditingDomain == null) {
+ return null;
+ }
+ org.eclipse.emf.transaction.TransactionalEditingDomain containerEditingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(containerView);
+ if (containerEditingDomain == null) {
+ return null;
+ }
+ if (!elementEditingDomain.equals(containerEditingDomain)) {
+ domainElement = containerEditingDomain.getResourceSet().getEObject(org.eclipse.emf.ecore.util.EcoreUtil.getURI(domainElement), true);
+ }
+ int visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(containerView, domainElement);
+ switch (visualID) {
+ «EXPAND xpt::commands::createNotationalElementCommand::createNotationalNodeCommandForChild(this, "containerView", "domainElement", getCreateShortcutNodeCommandQualifiedClassName()) FOREACH topLevelNodes.select(e|e.modelFacet != null && e.modelFacet.metaClass != null)-»
+ default:
+ return null;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE getRefreshShortcutCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.common.command.Command getRefreshShortcutCommand(org.eclipse.gmf.runtime.notation.View shortcut) {
+ String modelID = «EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(shortcut);
+ if (!«EXPAND xpt::editor::VisualIDRegistry::modelID».equals(modelID)) {
+ return null;
+ }
+ org.eclipse.emf.ecore.EObject underlyingElement = shortcut.getElement();
+ org.eclipse.gmf.runtime.notation.View parentView = (org.eclipse.gmf.runtime.notation.View) shortcut.eContainer();
+ int oldVisualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(shortcut);
+ int newVisualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(parentView, underlyingElement);
+ if (newVisualID == -1) {
+ return new org.eclipse.gmf.runtime.lite.commands.RemoveNotationalElementCommand(parentView, shortcut);
+ } else if (oldVisualID == newVisualID) {
+ return null;
+ } else {
+ org.eclipse.gmf.runtime.lite.commands.CreateNotationalElementCommand notationalCommand = getCreateShortcutCommand(parentView, underlyingElement);
+ if (notationalCommand != null) {
+ return new org.eclipse.gmf.runtime.lite.commands.ReplaceNotationalElementCommand(parentView, notationalCommand, shortcut);
+ } else {
+ return new org.eclipse.gmf.runtime.lite.commands.RemoveNotationalElementCommand(parentView, shortcut);
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/ValidateAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,253 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::providers::i18n»
+«EXTENSION xpt::providers::ValidationUtils»
+
+«DEFINE className FOR gmfgen::GenDiagram»ValidateAction«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«providersPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE actionKey FOR gmfgen::GenDiagram»«EXPAND qualifiedClassName».«EXPAND keyConstant»«ENDDEFINE»
+
+«DEFINE ValidateAction FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» «EXPAND supertypes» {
+ «EXPAND KEY-»
+
+ «EXPAND part-»
+
+ «EXPAND ctor-»
+
+ «EXPAND run-»
+
+ «EXPAND runValidation-»
+
+ «EXPAND EMFValidation-»
+
+ «EXPAND validate-»
+
+ «EXPAND updateEMFStatus-»
+
+ «EXPAND updateConstraintStatus-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.jface.action.Action«ENDDEFINE»
+
+«DEFINE KEY FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static final String «EXPAND keyConstant» = "validateAction"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE keyConstant FOR gmfgen::GenDiagram»VALIDATE_ACTION_KEY«ENDDEFINE»
+
+«DEFINE part FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.IWorkbenchPart myWorkbenchPart;
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public ValidateAction(org.eclipse.ui.IWorkbenchPart part) {
+ setId(«EXPAND keyConstant»);
+ setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForValidateActionActionName()) FOR editorGen»);
+ myWorkbenchPart = part;
+ setEnabled(myWorkbenchPart instanceof «editorGen.editor.getQualifiedClassName()»);
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void run() {
+ if (!isEnabled()) {
+ return;
+ }
+ final «editorGen.editor.getQualifiedClassName()» part = («editorGen.editor.getQualifiedClassName()») myWorkbenchPart;
+ try {
+ new org.eclipse.jface.operation.IRunnableWithProgress() {
+ public void run(org.eclipse.core.runtime.IProgressMonitor monitor) throws InterruptedException, java.lang.reflect.InvocationTargetException {
+ org.eclipse.gef.GraphicalViewer viewer = (org.eclipse.gef.GraphicalViewer) part.getAdapter(org.eclipse.gef.GraphicalViewer.class);
+ org.eclipse.gmf.runtime.notation.Diagram diagram = part.getDiagram();
+ org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService;
+ if (viewer == null) {
+ viewService = new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.NaiveViewService(diagram);
+ } else {
+ viewService = new org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.EditPartRegistryBasedViewService(viewer);
+ }
+ runValidation(diagram, viewService);
+ }
+ }
+ .run(new org.eclipse.core.runtime.NullProgressMonitor());
+ } catch (Exception e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Validation action failed", e); «EXPAND xpt::Common::nonNLS»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE runValidation FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static void runValidation(org.eclipse.gmf.runtime.notation.View view, org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService service) {
+ final org.eclipse.gmf.runtime.notation.View target = view;
+ final org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService = service;
+ org.eclipse.emf.transaction.TransactionalEditingDomain txDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(target);
+ «getValidationProviderQualifiedClassName()».runWithConstraints(txDomain, new Runnable() {
+ public void run() {
+ validate(target, viewService);
+ }
+ });
+}
+«ENDDEFINE»
+
+«DEFINE EMFValidation FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.emf.common.util.Diagnostic runEMFValidator(org.eclipse.gmf.runtime.notation.View target) {
+ if(target.isSetElement() && target.getElement() != null) {
+ return new org.eclipse.emf.ecore.util.Diagnostician().validate(target.getElement());
+ }
+ return org.eclipse.emf.common.util.Diagnostic.OK_INSTANCE;
+}
+«ENDDEFINE»
+
+«DEFINE validate FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static void validate(org.eclipse.gmf.runtime.notation.View target, org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService) {
+ org.eclipse.emf.common.util.URI diagramUri = (target.getDiagram() != null) ? org.eclipse.emf.ecore.util.EcoreUtil.getURI(target.getDiagram()) : null;
+ if (diagramUri != null) {
+ org.eclipse.gmf.runtime.lite.validation.ValidationState validationState = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getValidationStateManager().getValidationState(diagramUri);
+ org.eclipse.gmf.runtime.lite.validation.IValidationStateUpdater updater = validationState.startUpdate();
+ try {
+ org.eclipse.emf.common.util.Diagnostic diagnostic = runEMFValidator(target);
+ update(updater, diagnostic, viewService);
+ org.eclipse.emf.validation.service.IBatchValidator validator = (org.eclipse.emf.validation.service.IBatchValidator)org.eclipse.emf.validation.service.ModelValidationService.getInstance().newValidator(org.eclipse.emf.validation.model.EvaluationMode.BATCH);
+ validator.setIncludeLiveConstraints(true);
+ if (target.isSetElement() && target.getElement() != null) {
+ org.eclipse.core.runtime.IStatus status = validator.validate(target.getElement());
+ update(updater, status, viewService);
+ }
+
+«IF shouldRunValidateOnDiagram(editorGen.audits)-»
+«IF hasDiagramElementTargetRule(editorGen.audits)-»
+ validator.setTraversalStrategy(«getValidationProviderQualifiedClassName()».getNotationTraversalStrategy(validator));
+«ENDIF-»
+ org.eclipse.core.runtime.IStatus status = validator.validate(target);
+ update(updater, status, viewService);
+«ENDIF-»
+ updater.commitChanges();
+ } catch (Exception e) {
+ updater.discardChanges();
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE updateEMFStatus FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static void update(org.eclipse.gmf.runtime.lite.validation.IValidationStateUpdater updater, org.eclipse.emf.common.util.Diagnostic emfValidationStatus, org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService) {
+ if (emfValidationStatus.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK) {
+ return;
+ }
+ final org.eclipse.emf.common.util.Diagnostic rootStatus = emfValidationStatus;
+ java.util.List allDiagnostics = new java.util.ArrayList();
+ collectTargetElements(rootStatus, new java.util.HashSet(), allDiagnostics);
+ for (java.util.Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
+ org.eclipse.emf.common.util.Diagnostic nextDiagnostic = (org.eclipse.emf.common.util.Diagnostic) it.next();
+ java.util.List data = nextDiagnostic.getData();
+ if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
+ org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) data.get(0);
+ org.eclipse.gmf.runtime.notation.View view = viewService.findView(element);
+ if (view != null) {
+ org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor next = org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor.create(view, nextDiagnostic);
+ if (next != null) {
+ updater.addViolation(next);
+ }
+ }
+ }
+ }
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private static java.util.Set collectTargetElements(org.eclipse.emf.common.util.Diagnostic diagnostic, java.util.Set targetElementCollector, java.util.List allDiagnostics) {
+ java.util.List data = diagnostic.getData();
+ org.eclipse.emf.ecore.EObject target = null;
+ if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
+ target = (org.eclipse.emf.ecore.EObject) data.get(0);
+ targetElementCollector.add(target);
+ allDiagnostics.add(diagnostic);
+ }
+ if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
+ for (java.util.Iterator it = diagnostic.getChildren().iterator(); it.hasNext();) {
+ collectTargetElements((org.eclipse.emf.common.util.Diagnostic) it.next(), targetElementCollector, allDiagnostics);
+ }
+ }
+ return targetElementCollector;
+}
+«ENDDEFINE»
+
+«DEFINE updateConstraintStatus FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static void update(org.eclipse.gmf.runtime.lite.validation.IValidationStateUpdater updater, org.eclipse.core.runtime.IStatus validationStatus, org.eclipse.gmf.runtime.lite.edit.parts.update.canonical.IViewService viewService) {
+ if (validationStatus.isOK()) {
+ return;
+ }
+ final org.eclipse.core.runtime.IStatus rootStatus = validationStatus;
+ java.util.List allStatuses = new java.util.ArrayList();
+ collectTargetElements(rootStatus, new java.util.HashSet(), allStatuses);
+ for (java.util.Iterator it = allStatuses.iterator(); it.hasNext();) {
+ org.eclipse.emf.validation.model.IConstraintStatus nextStatus = (org.eclipse.emf.validation.model.IConstraintStatus) it.next();
+ org.eclipse.gmf.runtime.notation.View view = viewService.findView(nextStatus.getTarget());
+ if (view != null) {
+ org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor next = org.eclipse.gmf.runtime.lite.validation.ViolationDescriptor.create(view, nextStatus);
+ if (next != null) {
+ updater.addViolation(next);
+ }
+ }
+ }
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private static java.util.Set collectTargetElements(org.eclipse.core.runtime.IStatus status, java.util.Set targetElementCollector, java.util.List allConstraintStatuses) {
+ if (status instanceof org.eclipse.emf.validation.model.IConstraintStatus) {
+ targetElementCollector.add(((org.eclipse.emf.validation.model.IConstraintStatus) status).getTarget());
+ allConstraintStatuses.add(status);
+ }
+ if (status.isMultiStatus()) {
+ org.eclipse.core.runtime.IStatus[] children = status.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ collectTargetElements(children[i], targetElementCollector, allConstraintStatuses);
+ }
+ }
+ return targetElementCollector;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF validationNeeded()-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForValidateActionActionName())-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF validationNeeded()-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForValidateActionActionName(), "&Validate")-»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/ValidationProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - refactored to reuse code from FullRT version.
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::providers::ValidationUtils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE ValidationProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «validationProviderClassName» «EXPAND supertypes» {
+ «EXPAND constraintsActive-»
+
+ «EXPAND shouldConstraintsBePrivate-»
+
+ «EXPAND runWithActiveConstraints-»
+
+ «EXPAND isInDefaultEditorContext-»
+
+ «EXPAND selectors FOR editorGen.audits-»
+
+ «EXPAND strategy_support»
+
+ «EXPAND constraintAdapters(this) FOR editorGen.audits-»
+
+ «EXPAND additions-»
+} //«validationProviderClassName»
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+// override the one from FullRT
+«DEFINE constraintAdapters_formatMethod FOR GenAuditRoot-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static String formatElement(org.eclipse.emf.ecore.EObject object) {
+ if (object == null) {
+ return String.valueOf(object);
+ }
+ org.eclipse.emf.common.notify.AdapterFactory adapterFactory = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory();
+ org.eclipse.emf.edit.provider.IItemLabelProvider labelProvider = (org.eclipse.emf.edit.provider.IItemLabelProvider) adapterFactory.adapt(object, org.eclipse.emf.edit.provider.IItemLabelProvider.class);
+ if (labelProvider != null) {
+ return object.eClass() + " " + labelProvider.getText(object);
+ }
+ return object.toString();
+ }
+«ENDDEFINE»
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/ValidationUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2007, 2008 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+extension xpt::GenAuditRoot reexport;
+
+boolean validationNeeded(gmfgen::GenDiagram diagram) :
+ diagram.validationEnabled || diagram.editorGen.hasAudits()
+;
+
+//TODO: introduce into the gmfgen model
+String getConstraintAdapterLocalClassName(gmfgen::GenAuditRule rule) :
+ "Adapter" + (rule.root.rules.indexOf(rule) + 1)
+;
+
+String toStringLiteral(String strValue) :
+JAVA org.eclipse.gmf.internal.common.codegen.Conversions.toStringLiteral(java.lang.String)
+;
+
+List[gmfgen::GenMetricRule] getMetricRules(gmfgen::GenDiagram diagram) :
+ diagram.editorGen.metrics.metrics.select(e| e.rule != null && e.target != null && e.target.getContext() != null)
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2007 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::providers::ValidationUtils»
+
+«DEFINE extensions FOR gmfgen::GenEditorGenerator-»
+«EXPAND markers-»
+«EXPAND metrics FOR metrics-»
+«EXPAND shortcutProviders-»
+«ENDDEFINE»
+
+«DEFINE i18n FOR gmfgen::GenEditorGenerator-»
+«EXPAND markersi18n-»
+«EXPAND metricsi18n FOR metrics-»
+«ENDDEFINE»
+
+«DEFINE markers FOR gmfgen::GenEditorGenerator-»
+«IF null == application && diagram.validationNeeded()-»
+ <extension
+ id="diagnostic"
+ name="%_UI_Diagnostic_marker"
+ point="org.eclipse.core.resources.markers">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <super
+ type="org.eclipse.emf.validation.problem">
+ </super>
+ <persistent
+ value="false">
+ </persistent>
+ <attribute
+ name="message"/>
+ <attribute
+ name="location"/>
+ <attribute
+ name="severity"/>
+ </extension>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE metrics FOR gmfgen::GenMetricContainer-»
+«IF metrics.size() > 0-»
+ <extension point="org.eclipse.ui.views">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <view class="«editorGen.diagram.getMetricProviderQualifiedClassName()»$ResultView"
+ id="«editorGen.diagram.getMetricViewID()»"
+ name="%UI_Metrics_View_name"/>
+ </extension>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE shortcutProviders FOR gmfgen::GenEditorGenerator-»
+«IF diagram.generateShortcutIcon()-»
+<extension point="org.eclipse.gmf.runtime.lite.shortcutProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <shortcutProvider
+ class="«EXPAND xpt::providers::ShortcutProvider::qualifiedClassName FOR diagram»"
+ modelID="«modelID»">
+ </shortcutProvider>
+</extension>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE markersi18n FOR gmfgen::GenEditorGenerator-»
+«IF null == application && diagram.validationNeeded()-»
+_UI_Diagnostic_marker=«modelID» Diagnostics Markers
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE metricsi18n FOR gmfgen::GenMetricContainer-»
+«IF metrics.size() > 0-»
+UI_Metrics_View_name=«editorGen.modelID» Diagram Metrics
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/providers/i18n.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+String i18nKeyForMarkerNavigationProviderReplaceMarkersJobName(gmfgen::GenDiagram diagram) :
+diagram.markerNavigationProviderClassName + ".ReplaceMarkersJobName"
+;
+
+String i18nKeyForValidateActionActionName(gmfgen::GenDiagram diagram) :
+"ValidateAction" + ".ActionName"
+;
+
+String i18nKeyForMetricsActionActionName(gmfgen::GenDiagram diagram) :
+"MetricsAction" + ".ActionName"
+;
+
+String i18nKeyForMetricProviderResultViewElementColumnName(gmfgen::GenDiagram diagram) :
+diagram.metricProviderClassName + ".ResultViewElementColumnName"
+;
+
+String i18nKeyForMetricProviderResultViewElementColumnTooltip(gmfgen::GenDiagram diagram) :
+diagram.metricProviderClassName + ".ResultViewElementColumnTooltip"
+;
+
+String i18nKeyForMetricProviderMetricDefToolTipLow(gmfgen::GenDiagram diagram) :
+diagram.metricProviderClassName + ".MetricDefToolTipLow"
+;
+
+String i18nKeyForMetricProviderMetricDefToolTipHigh(gmfgen::GenDiagram diagram) :
+diagram.metricProviderClassName + ".MetricDefToolTipHigh"
+;
+
+String nameKey(String baseKey) :
+baseKey + "Name"
+;
+
+String descriptionKey(String baseKey) :
+baseKey + "Description"
+;
+
+String i18nKeyForMetric(gmfgen::GenMetricRule rule) :
+rule.container.editorGen.diagram.metricProviderClassName + ".MetricDef." + rule.key
+;
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/viewfactories/BehaviourUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2007 Borland Software Corp.
+ *
+ * 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+List[gmfgen::OpenDiagramBehaviour] openDiagramBehaviours(gmfgen::GenCommonBase e) :
+ e.behaviour.typeSelect(gmfgen::OpenDiagramBehaviour).addAll(e.behaviour.typeSelect(gmfgen::SharedBehaviour).delegate.typeSelect(gmfgen::OpenDiagramBehaviour))
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.lite.templates/xpt/viewfactories/ViewFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * bblajer (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::viewfactories::BehaviourUtils»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE ViewFactory FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» «EXPAND supertypes» {
+«EXPAND instanceDeclaration-»
+«EXPAND decorateView-»
+«EXPAND predefinedChildren-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenCommonBase»implements org.eclipse.gmf.runtime.lite.services.IViewDecorator«ENDDEFINE»
+
+«DEFINE instanceDeclaration FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static «notationViewFactoryClassName» INSTANCE = new «notationViewFactoryClassName»();
+«ENDDEFINE»
+
+«DEFINE decorateView FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void decorateView(org.eclipse.gmf.runtime.notation.View view) {
+ if (view.eIsSet(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getView_Type())) {
+ return;
+ }
+«EXPAND setViewType-»
+«EXPAND initStyles-»
+«EXPAND addCustomStyle FOREACH styles-»
+«EXPAND instantiatePredefinedChildren-»
+«EXPAND createOpenDiagramAnnotation-»
+}
+«ENDDEFINE»
+
+«DEFINE addCustomStyle FOR genmodel::GenClass-»
+view.getStyles().add(«EXPAND MetaModel::NewInstance»);
+«ENDDEFINE»
+
+«DEFINE setViewType FOR gmfgen::GenCommonBase-»
+view.setType(«getDiagram().getVisualIDRegistryQualifiedClassName()».getType(«getEditPartQualifiedClassName()».VISUAL_ID));
+«ENDDEFINE»
+
+«DEFINE setViewType FOR gmfgen::GenDiagram-»
+ view.setType(«getDiagram().getEditPartQualifiedClassName()».MODEL_ID);
+«ENDDEFINE»
+
+«DEFINE initStyles FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
+
+«DEFINE initStyles FOR gmfgen::GenDiagram-»
+ org.eclipse.gmf.runtime.notation.DiagramStyle style = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle();
+ view.getStyles().add(style);
+«ENDDEFINE»
+
+«DEFINE initStyles FOR gmfgen::GenNode-»
+«IF viewmap.isFixedFont() || viewmap.isFixedForeground() || viewmap.isFixedBackground()-»
+ «IF !viewmap.isFixedFont()-»
+ org.eclipse.gmf.runtime.notation.FontStyle fontStyle = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle();
+ «EXPAND initFontStyle("fontStyle")-»
+ view.getStyles().add(fontStyle);
+ «ENDIF-»
+ «IF !viewmap.isFixedForeground()-»
+ org.eclipse.gmf.runtime.notation.LineStyle lineStyle = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLineStyle();
+ «EXPAND initLineStyle("lineStyle")-»
+ view.getStyles().add(lineStyle);
+ «ENDIF-»
+ «IF !viewmap.isFixedBackground()-»
+ org.eclipse.gmf.runtime.notation.FillStyle fillStyle = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFillStyle();
+ «EXPAND initFillStyle("fillStyle")-»
+ view.getStyles().add(fillStyle);
+ «ENDIF-»
+«ELSE-»
+ org.eclipse.gmf.runtime.notation.ShapeStyle style = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShapeStyle();
+ «EXPAND initFontStyle("style")-»
+ «EXPAND initLineStyle("style")-»
+ «EXPAND initFillStyle("style")-»
+ view.getStyles().add(style);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE initStyles FOR gmfgen::GenChildLabelNode-»
+«IF !viewmap.isFixedFont()-»
+ org.eclipse.gmf.runtime.notation.FontStyle style = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle();
+ «EXPAND initFontStyle("style")-»
+ view.getStyles().add(style);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE initStyles FOR gmfgen::GenCompartment-»
+ org.eclipse.gmf.runtime.notation.DrawerStyle drawerStyle = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDrawerStyle();
+ view.getStyles().add(drawerStyle);
+ org.eclipse.gmf.runtime.notation.TitleStyle titleStyle = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createTitleStyle();
+ view.getStyles().add(titleStyle);
+«ENDDEFINE»
+
+«DEFINE initStyles FOR gmfgen::GenLink-»
+«IF !viewmap.isFixedFont()-»
+ org.eclipse.gmf.runtime.notation.FontStyle fontStyle = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle();
+ «EXPAND initFontStyle("fontStyle")-»
+ view.getStyles().add(fontStyle);
+«ENDIF-»
+«IF !viewmap.isFixedForeground()-»
+ org.eclipse.gmf.runtime.notation.LineStyle lineStyle = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLineStyle();
+ «EXPAND initLineStyle("lineStyle")-»
+ view.getStyles().add(lineStyle);
+«ENDIF-»
+«IF !viewmap.isFixedBackground()-»
+ org.eclipse.gmf.runtime.notation.FillStyle fillStyle = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFillStyle();
+ «EXPAND initFillStyle("fillStyle")-»
+ view.getStyles().add(fillStyle);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE initStyles FOR gmfgen::GenLinkLabel-»
+«EXPAND initLocation-»
+«ENDDEFINE»
+
+«DEFINE initStyles FOR gmfgen::GenExternalNodeLabel-»
+«EXPAND initLocation-»
+«ENDDEFINE»
+
+«DEFINE initLocation FOR gmfgen::GenLabel-»
+ org.eclipse.gmf.runtime.notation.Location location = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLocation();
+«LET viewmap.labelOffsetX(0) AS x-»
+«IF x != 0-»
+ location.setX(«x»);
+«ENDIF»
+«ENDLET-»
+«LET viewmap.labelOffsetY(0) AS y-»
+«IF y != 0-»
+ location.setY(«y»);
+«ENDIF»
+«ENDLET-»
+ ((org.eclipse.gmf.runtime.notation.Node)view).setLayoutConstraint(location);
+«ENDDEFINE»
+
+«DEFINE instantiatePredefinedChildren FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
+
+«DEFINE instantiatePredefinedChildren FOR gmfgen::GenNode-»
+«EXPAND instantiatePredefinedChildLabel FOREACH labels-»
+«EXPAND instantiatePredefinedChildCompartment FOREACH compartments-»
+«ENDDEFINE»
+
+«DEFINE instantiatePredefinedChildCompartment FOR gmfgen::GenCompartment-»
+ create«visualID»Compartment(view);
+«ENDDEFINE»
+
+«DEFINE instantiatePredefinedChildLabel FOR gmfgen::GenLabel-»
+ create«visualID»Label(view);
+«ENDDEFINE»
+
+«DEFINE instantiatePredefinedChildren FOR gmfgen::GenChildLabelNode-»
+«ENDDEFINE»
+
+«DEFINE instantiatePredefinedChildren FOR gmfgen::GenLink-»
+«EXPAND instantiatePredefinedChildLabel FOREACH labels-»
+«ENDDEFINE»
+
+«DEFINE predefinedChildren FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
+
+«DEFINE predefinedChildren FOR gmfgen::GenNode-»
+«EXPAND predefinedChildLabel FOREACH labels-»
+«EXPAND predefinedChildCompartment FOREACH compartments-»
+«ENDDEFINE»
+
+«DEFINE predefinedChildren FOR gmfgen::GenChildLabelNode-»
+«ENDDEFINE»
+
+«DEFINE predefinedChildCompartment FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void create«visualID»Compartment(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gmf.runtime.notation.Node compartment = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createNode();
+ view.getPersistedChildren().add(compartment);
+ «getNotationViewFactoryQualifiedClassName()».INSTANCE.decorateView(compartment);
+ }
+«ENDDEFINE»
+
+«DEFINE predefinedChildLabel FOR gmfgen::GenLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void create«visualID»Label(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gmf.runtime.notation.Node label = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createNode();
+ view.getPersistedChildren().add(label);
+ «getNotationViewFactoryQualifiedClassName()».INSTANCE.decorateView(label);
+ }
+«ENDDEFINE»
+
+«DEFINE predefinedChildren FOR gmfgen::GenLink-»
+«EXPAND predefinedChildLabel FOREACH labels-»
+«ENDDEFINE»
+
+«DEFINE createOpenDiagramAnnotation FOR gmfgen::GenCommonBase-»
+«LET openDiagramBehaviours() AS openDiagramBehaviours-»
+«IF openDiagramBehaviours.size() == 1-»
+ org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle diagramFacet = org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+«IF openDiagramBehaviours.diagramKind.first() != null-»
+ diagramFacet.setHint("«openDiagramBehaviours.diagramKind.first()»"); «EXPAND xpt::Common::nonNLS»
+«ENDIF-»
+ view.getStyles().add(diagramFacet);
+«ENDIF-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE createOpenDiagramAnnotation FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE initFontStyle(String styleVar) FOR gmfgen::GenCommonBase-»
+org.eclipse.swt.graphics.FontData defaultFontData = org.eclipse.jface.preference.PreferenceConverter.getFontData(«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(), org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.DEFAULT_FONT);
+«styleVar».setFontName(defaultFontData.getName());
+«styleVar».setFontHeight(defaultFontData.getHeight());
+«styleVar».setBold((defaultFontData.getStyle() & org.eclipse.swt.SWT.BOLD) != 0);
+«styleVar».setItalic((defaultFontData.getStyle() & org.eclipse.swt.SWT.ITALIC) != 0);
+org.eclipse.swt.graphics.RGB defaultFontColor = org.eclipse.jface.preference.PreferenceConverter.getColor(«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(), org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.FONT_COLOR);
+«styleVar».setFontColor((defaultFontColor.blue << 16) | (defaultFontColor.green << 8) | defaultFontColor.red);
+«ENDDEFINE»
+
+«DEFINE initLineStyle(String styleVar) FOR gmfgen::GenCommonBase-»
+org.eclipse.swt.graphics.RGB defaultLineColor = org.eclipse.jface.preference.PreferenceConverter.getColor(«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(), org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.LINE_COLOR);
+«styleVar».setLineColor((defaultLineColor.blue << 16) | (defaultLineColor.green << 8) | defaultLineColor.red);
+«ENDDEFINE»
+
+«DEFINE initFillStyle(String styleVar) FOR gmfgen::GenCommonBase-»
+org.eclipse.swt.graphics.RGB defaultFillColor = org.eclipse.jface.preference.PreferenceConverter.getColor(«getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore(), org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants.FILL_COLOR);
+«styleVar».setFillColor((defaultFillColor.blue << 16) | (defaultFillColor.green << 8) | defaultFillColor.red);
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates-dynmodel/Facility.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/gmf/2008/GenModel";
+
+String getNameToken(GenPackage gp) : gp.prefix ;
+
+String fieldName(GenPackage gp) : "instance" + getNameToken(gp) ;
+
+// This is a hack, internal use only
+DynamicModelAccess getDMA() : GLOBALVAR DynamicModelAccess ;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates-dynmodel/Facility.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION Facility»
+
+«DEFINE Main FOR DynamicModelAccess-»
+package «packageName»;
+
+public class «className» {
+
+ «EXPAND field(this) FOREACH editorGen.getAllDomainGenPackages(false)-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.ecore.EPackage ePackage;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «className»(org.eclipse.emf.ecore.EPackage ePackage) {
+ this.ePackage = ePackage;
+ }
+
+ «EXPAND getMethod(this) FOREACH editorGen.getAllDomainGenPackages(false)-»
+
+ «EXPAND getRegistryMethod»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean isInstance(Object obj, String metaClassName) {
+ org.eclipse.emf.ecore.EClass metaClass = getEClass(metaClassName);
+ return obj instanceof org.eclipse.emf.ecore.EObject && metaClass.isSuperTypeOf(((org.eclipse.emf.ecore.EObject) obj).eClass());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EObject newInstance(String metaClassName) {
+ return this.ePackage.getEFactoryInstance().create(getEClass(metaClassName));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EClass getEClass(String metaClassName) {
+ assert metaClassName != null;
+ org.eclipse.emf.ecore.EClass metaClass = findMetaClass(metaClassName);
+ assertMetaClass(metaClass, metaClassName);
+ return metaClass;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EStructuralFeature getEFeature(String metaClassName, String metaFeatureName) {
+ assert metaFeatureName != null;
+ org.eclipse.emf.ecore.EClass metaClass = getEClass(metaClassName);
+ org.eclipse.emf.ecore.EStructuralFeature f = metaClass.getEStructuralFeature(metaFeatureName);
+ assertMetaFeature(f, metaClass, metaFeatureName);
+ return f;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EAttribute getEAttribute(String metaClassName, String metaFeatureName) {
+ return (org.eclipse.emf.ecore.EAttribute) getEFeature(metaClassName, metaFeatureName);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EReference getEReference(String metaClassName, String metaFeatureName) {
+ return (org.eclipse.emf.ecore.EReference) getEFeature(metaClassName, metaFeatureName);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EDataType getEDataType(String metaClassName) {
+ assert metaClassName != null;
+ org.eclipse.emf.ecore.EClassifier c = this.ePackage.getEClassifier(metaClassName);
+ if (false == c instanceof org.eclipse.emf.ecore.EDataType) {
+ return null;
+ }
+ return (org.eclipse.emf.ecore.EDataType) c;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EEnum getEEnum(String metaClassName) {
+ assert metaClassName != null;
+ org.eclipse.emf.ecore.EClassifier c = this.ePackage.getEClassifier(metaClassName);
+ if (false == c instanceof org.eclipse.emf.ecore.EEnum) {
+ return null;
+ }
+ return (org.eclipse.emf.ecore.EEnum) c;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.ecore.EClass findMetaClass(String name) {
+ org.eclipse.emf.ecore.EClassifier c = this.ePackage.getEClassifier(name);
+ if (false == c instanceof org.eclipse.emf.ecore.EClass) {
+ return null;
+ }
+ return (org.eclipse.emf.ecore.EClass) c;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment("Default implementation throws IllegalStateException if metaclass is null")»
+ private void assertMetaClass(org.eclipse.emf.ecore.EClass metaClass, String metaClassName) {
+ if (metaClass == null) {
+ throw new IllegalStateException(java.text.MessageFormat.format("Can't find class {0} in the package {1}", new Object[] {metaClassName, this.ePackage.getName()}));
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment("Default implementation throws IllegalStateException if meta-feature is null")»
+ private void assertMetaFeature(org.eclipse.emf.ecore.EStructuralFeature metaFeature, org.eclipse.emf.ecore.EClass metaClass, String featureName) {
+ if (metaFeature == null) {
+ throw new IllegalStateException(java.text.MessageFormat.format("Can't find feature {0} of class {1} in the package {2}", new Object[] {featureName, metaClass.getName(), this.ePackage.getName()}));
+ }
+ }
+
+ «EXPAND initMethod FOREACH editorGen.getAllDomainGenPackages(false)-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR DynamicModelAccess»«ENDDEFINE»
+
+«DEFINE field(DynamicModelAccess dma) FOR GenPackage-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static «dma.className» «fieldName()»;
+«ENDDEFINE»
+
+«DEFINE getMethod(DynamicModelAccess dma) FOR GenPackage-»
+ «EXPAND xpt::Common::generatedMemberComment("@throws IllegalStateException if no EPackage with given URI is registered.")»
+ public static «dma.className» get«getNameToken()»() {
+ if («fieldName()» == null) {
+ org.eclipse.emf.ecore.EPackage pkg = getRegistry().getEPackage("«ecorePackage.nsURI»");
+ if (pkg == null) {
+ throw new IllegalStateException("Package «ecorePackage.name»(«ecorePackage.nsURI») not found");
+ }
+ «fieldName()» = new «dma.className»(pkg);
+ «fieldName()».init«getNameToken()»();
+ }
+ return «fieldName()»;
+ }
+«ENDDEFINE»
+
+«DEFINE initMethod FOR GenPackage-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void init«getNameToken()»() {
+ }
+«ENDDEFINE»
+
+«DEFINE getRegistryMethod FOR DynamicModelAccess»
+ «EXPAND xpt::Common::generatedMemberComment("Default implementation returns global registry, clients that need another may redefine.")»
+ private static org.eclipse.emf.ecore.EPackage.Registry getRegistry() {
+ return org.eclipse.emf.ecore.EPackage.Registry.INSTANCE;
+ }
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates-dynmodel/MetaModel.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION Facility»
+«EXTENSION xpt::GenModelUtils»
+
+// XXX is isExternalInterface use valid here, won't all objects be just EObject?
+
+«DEFINE IsInstance(String accessor) FOR GenClass-»
+«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().isInstance(«accessor», "«ecoreClass.name»")«ENDDEFINE»
+
+«DEFINE NotInstance(String accessor) FOR GenClass»!«EXPAND IsInstance(accessor)»«ENDDEFINE»
+
+«DEFINE IsContainerInstance(String object, GenClass metaClass) FOR GenClass-»
+«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().isInstance(«IF isExternalInterface()»((org.eclipse.emf.ecore.EObject) «object»)«ELSE»«object»«ENDIF».eContainer(), "«ecoreClass.name»")«ENDDEFINE»
+
+«DEFINE getFeatureValue(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
+((«EXPAND featureTargetType») «IF isExternalInterface(containerClass)-»
+((org.eclipse.emf.ecore.EObject) «containerVar»)«ELSE-»
+«containerVar»«ENDIF-»
+.eGet(«EXPAND MetaFeature»))«ENDDEFINE»
+
+«DEFINE featureTargetType FOR GenFeature-»
+«EXPAND _featureTargetType(this) FOR ecoreFeature-»
+«ENDDEFINE»
+
+«DEFINE _featureTargetType(GenFeature gf) FOR EStructuralFeature»NO-OP«ENDDEFINE»
+«DEFINE _featureTargetType(GenFeature gf) FOR EReference-»
+«IF isListType(gf)»java.util.List«ELSE»org.eclipse.emf.ecore.EObject«ENDIF-»
+«ENDDEFINE»
+«DEFINE _featureTargetType(GenFeature gf) FOR EAttribute-»
+«IF isListType(gf)»java.util.List«ELSE»«getObjectCompatibleClassName(eAttributeType)»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getFeatureValue(String containerVar, genmodel::GenClass container, boolean needsCastToResultType) FOR genmodel::GenFeature-»
+// ??? FIXME
+«ENDDEFINE»
+
+«DEFINE setFeatureValue(String containerVar, genmodel::GenClass containerClass, String valueVar) FOR genmodel::GenFeature-»
+«IF isExternalInterface(containerClass)-»
+((org.eclipse.emf.ecore.EObject) «containerVar»)«ELSE-»
+«containerVar»«ENDIF-»
+.eSet(«EXPAND MetaFeature», «valueVar»)«ENDDEFINE»
+
+«DEFINE setFeatureValue(String containerVar, genmodel::GenClass containerClass, String valueVar, boolean isPlainObjectValue) FOR genmodel::GenFeature-»
+«EXPAND setFeatureValue(containerVar, containerClass, valueVar)»«ENDDEFINE»
+
+«DEFINE MetaClass FOR genmodel::GenDataType»«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().getEDataType("«ecoreDataType.name»")«ENDDEFINE»
+«DEFINE MetaClass FOR genmodel::GenEnum»«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().getEEnum("«ecoreEnum.name»")«ENDDEFINE»
+«DEFINE MetaClass FOR genmodel::GenClass»«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().getEClass("«ecoreClass.name»")«ENDDEFINE»
+
+«DEFINE MetaFeature FOR genmodel::GenFeature»«EXPAND _metaFeature(ecoreFeature)»«ENDDEFINE»
+
+«DEFINE _metaFeature(EStructuralFeature f) FOR GenFeature»no-op«ENDDEFINE»
+«DEFINE _metaFeature(EReference eRef) FOR GenFeature»«getDMA().getQualifiedClassName()».get«getNameToken(genClass.genPackage)»().getEReference("«genClass.ecoreClass.name»", "«ecoreFeature.name»")«ENDDEFINE»
+«DEFINE _metaFeature(EAttribute eAttr) FOR GenFeature»«getDMA().getQualifiedClassName()».get«getNameToken(genClass.genPackage)»().getEAttribute("«genClass.ecoreClass.name»", "«ecoreFeature.name»")«ENDDEFINE»
+
+«DEFINE NewInstance FOR genmodel::GenClass-»
+«getDMA().getQualifiedClassName()».get«getNameToken(genPackage)»().newInstance("«ecoreClass.name»")«ENDDEFINE»
+
+«DEFINE NewInstance(String varName) FOR genmodel::GenClass-»
+org.eclipse.emf.ecore.EObject «varName» = «EXPAND NewInstance»;«ENDDEFINE»
+
+«DEFINE DowncastToEObject(String value) FOR genmodel::GenClass»«IF isExternalInterface()»(org.eclipse.emf.ecore.EObject) «ENDIF»«value»«ENDDEFINE»
+
+«DEFINE DeclareAndAssign(String assignee, String value) FOR GenClass-»
+org.eclipse.emf.ecore.EObject «assignee» = «value»;«ENDDEFINE»
+
+«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClass-»
+org.eclipse.emf.ecore.EObject «assignee» = «IF isPlainObjectValue»(org.eclipse.emf.ecore.EObject)«ENDIF»«value»;«ENDDEFINE»
+
+«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClassifier»NO-OP«ENDDEFINE»
+
+«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenDataType-»
+«EXPAND QualifiedClassName» «assignee» = («EXPAND QualifiedClassName») «value»;«ENDDEFINE»
+
+
+«DEFINE DeclareAndAssignContainer(String assignee, String object, GenClass metaClass) FOR GenClass-»
+org.eclipse.emf.ecore.EObject «assignee» = «IF isExternalInterface(metaClass)»((org.eclipse.emf.ecore.EObject) «object»)«ELSE»«object»«ENDIF».eContainer();«ENDDEFINE»
+
+// FIXME - feature value is not necessarily of EObject type
+«DEFINE DeclareAndAssign(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature) FOR GenClass-»
+org.eclipse.emf.ecore.EObject «assignee» = «EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature»;«ENDDEFINE»
+
+«DEFINE DeclareAndAssign2(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature, String srcExt, boolean needCast) FOR GenClass-»
+org.eclipse.emf.ecore.EObject «assignee» = «EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature».«srcExt»;«ENDDEFINE»
+
+«DEFINE CastEObject(String eObjectValue) FOR GenClass»«eObjectValue»«ENDDEFINE»
+
+«DEFINE QualifiedClassName FOR GenClassifier»NO-OP«ENDDEFINE»
+«DEFINE QualifiedClassName FOR GenClass»org.eclipse.emf.ecore.EObject«ENDDEFINE»
+«DEFINE QualifiedClassName FOR GenEnum»org.eclipse.emf.common.util.Enumerator«ENDDEFINE»
+«DEFINE QualifiedClassName FOR GenDataType»«getObjectCompatibleClassName(ecoreDataType)»«ENDDEFINE»
+
+«DEFINE PopulateItemProviderFactories(String factoryListVar) FOR GenEditorGenerator-»
+«REM»
+ NO-OP since ReflectiveItemProviderAdapterFactory should
+ get added anyway.
+«ENDREM»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/MetaModel.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+extension xpt::GenModelUtils reexport;
+
+/*
+ * NOTE: Extensions from this file are supposed to be used
+ * ONLY from MetaModel.xpt. No other .xpt or .ext should import
+ * this file. Common GenModel functionality, unrelated to meta-model
+ * access and access to generated model code should go into GenModelUtils.ext.
+ */
+
+
+//
+// GenPackageImpl#getQualifiedPackageInterfaceName()
+//
+String getQualifiedPackageInterfaceName(genmodel::GenPackage gp) :
+ gp.genModel.suppressEMFMetaData ? getQualifiedPackageClassName(gp) : getReflectionPackageName(gp) + "." + getPackageInterfaceName(gp)
+;
+
+//
+// GenPackageImpl#getQualifiedFactoryInterfaceName()
+//
+String getQualifiedFactoryInterfaceName(genmodel::GenPackage gp) :
+ getReflectionPackageName(gp) + "." + getPrefixedName(gp, "Factory")
+;
+
+//
+// GenPackage#getFactoryInstanceName
+//
+String getFactoryInstanceName(genmodel::GenPackage gp) :
+ gp.genModel.suppressEMFMetaData ? "INSTANCE" : "eINSTANCE"
+;
+
+//
+// GenPackageImpl#getQualifiedItemProviderAdapterFactoryClassName()
+//
+String getQualifiedItemProviderAdapterFactoryClassName(genmodel::GenPackage gp) :
+ getQualifiedPackageName(gp, gp.providerPackageSuffix) + "." + getItemProviderAdapterFactoryClassName(gp)
+;
+
+//
+// GenPackageImpl#getItemProviderAdapterFactoryClassName()
+//
+private String getItemProviderAdapterFactoryClassName(genmodel::GenPackage gp) :
+ getPrefixedName(gp, "ItemProviderAdapterFactory")
+;
+
+//
+// GenClass#getQualifiedInterfaceName
+//
+String getQualifiedInterfaceName(genmodel::GenClass gc) :
+ null != gc.ecoreClass.instanceClassName
+ ? gc.ecoreClass.instanceClassName.replaceAll('\\$', '\\.')
+ : (getInterfacePackageName(gc.genPackage) + "." + gc.ecoreClass.name)
+;
+
+//
+// GenPackageImpl#getInterfacePackageName()
+//
+private String getInterfacePackageName(GenPackage gp) :
+ getQualifiedPackageName(gp, gp.interfacePackageSuffix)
+;
+
+String getQualifiedClassName(GenClassifier dt) : null ;
+// NOTE GenDataType#getQualifiedInstanceClassName returns primitive types as is,
+// while we return their java.lang wrappers
+String getQualifiedClassName(GenDataType dt) : getObjectCompatibleClassName(dt.ecoreDataType) ;
+String getQualifiedClassName(GenEnum e) : getInterfacePackageName(e.genPackage) + "." + e.ecoreEnum.name
+;
+
+//
+// GenClass#getClassifierAccessorName
+//
+String getClassifierAccessorName(genmodel::GenClassifier gc) :
+ switch (gc.getEcoreClassifier().name) {
+ case "Class" : "Class_"
+ case "Name" : "Name_"
+ default : gc.getEcoreClassifier().name
+ }
+;
+
+//
+// GenFeature#getFeatureAccessorName
+//
+String getFeatureAccessorName(genmodel::GenFeature gf) :
+ gf.genClass.ecoreClass.name + "_" + gf.ecoreFeature.name.toFirstUpper()
+;
+
+// GenFeatureImpl#getAccessorName
+String getAccessorName(genmodel::GenFeature gf) :
+ isMapEntryFeature(gf) ? "Typed" + gf.ecoreFeature.name.toFirstUpper() : gf.ecoreFeature.name.toFirstUpper()
+;
+
+// GenFeature#getGetAccessor()
+String getGetAccessor(genmodel::GenFeature gf) :
+JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.getGetAccessor(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)
+;
+
+// GenClassImpl#isMapEntry
+boolean isMapEntry(genmodel::GenClass gc) :
+ ("java.util.Map.Entry" == gc.ecoreClass.instanceClassName || "java.util.Map$Entry" == gc.ecoreClass.instanceClassName)
+ && gc.ecoreClass.getEStructuralFeature("key") != null
+ && gc.ecoreClass.getEStructuralFeature("value") != null
+;
+
+
+/*
+ * Casts the argument (which is assumed to be of the given source class) to the given target class.
+ * A null value may be used for both source and target class to specify the EObject class.
+ * If the cast is required, it will be parenthesized as a whole, producing, e.g., ((EObject) o).
+ * If the parentheses are not required, use unparenthesizedCast() extension.
+ */
+String parenthesizedCast(String what, genmodel::GenClass source, genmodel::GenClass target) :
+ needsCast(source, target) ? "(" + unparenthesizedCast(what, source, target) + ")" : what
+;
+
+/*
+ * Casts the argument (which is assumed to be of the given source class) to the given target class.
+ * A null value may be used for both source and target class to specify the EObject class.
+ * If the cast is required, it will NOT be parenthesized as a whole, producing, e.g., (EObject) o.
+ * If the parentheses are required, use parenthesizedCast() extension.
+ */
+String unparenthesizedCast(String what, genmodel::GenClass source, genmodel::GenClass target) :
+ needsCast(source, target) ?
+ (target == null ? "(org.eclipse.emf.ecore.EObject)" + what : "(" + target.getQualifiedInterfaceName() + ")" + what)
+ : what
+;
+
+//See cast()
+private boolean needsCast(genmodel::GenClass source, genmodel::GenClass target) :
+ source == target ? false :
+ (target == null ?
+ (source != null && source.isExternalInterface()) :
+ source == null || target.isExternalInterface() || source.isExternalInterface() || !target.ecoreClass.isSuperTypeOf(source.ecoreClass))
+;
+
+private ecore::EClassifier getEcoreClassifier(genmodel::GenClassifier gc) : null ;
+private ecore::EClassifier getEcoreClassifier(genmodel::GenClass gc) : gc.ecoreClass ;
+private ecore::EClassifier getEcoreClassifier(genmodel::GenDataType gc) : gc.ecoreDataType ;
+
+// GenPackageImpl#getReflectionPackageName()
+private String getReflectionPackageName(genmodel::GenPackage gp) :
+ getQualifiedPackageName(gp, gp.metaDataPackageSuffix)
+;
+
+// GenPackageImpl#getQualifiedPackageClassName()
+private String getQualifiedPackageClassName(genmodel::GenPackage gp) :
+ getReflectionClassPackageName(gp) + "." + getPackageClassName(gp)
+;
+
+
+// GenPackageImpl#getReflectionClassPackageName()
+private String getReflectionClassPackageName(genmodel::GenPackage gp) :
+ getQualifiedPackageName(gp, gp.genModel.suppressInterfaces ? gp.metaDataPackageSuffix : gp.classPackageSuffix)
+;
+
+// GenPackageImpl#getPackageClassName()
+private string getPackageClassName(genmodel::GenPackage gp) :
+ !gp.genModel.suppressEMFMetaData && !gp.genModel.suppressInterfaces ? getPackageInterfaceName(gp) + "Impl" : getPackageInterfaceName(gp)
+;
+
+// GenPackageImpl#getPackageInterfaceName()
+private string getPackageInterfaceName(genmodel::GenPackage gp) :
+ gp.genModel.suppressEMFMetaData && !gp.genModel.suppressInterfaces ? getPrefixedName(gp, "PackageImpl") : getPrefixedName(gp, "Package")
+;
+
+// GenPackageImpl#getPrefixedName()
+private string getPrefixedName(genmodel::GenPackage gp, String name) :
+ null != gp.prefix ? gp.prefix + name : name
+;
+
+// GenPackageImpl#getQualifiedPackageName(String)
+private String getQualifiedPackageName(genmodel::GenPackage gp, String suffix) :
+ isBlank(suffix) ? getQualifiedPackageName(gp) : getQualifiedPackageName(gp) + "." + suffix
+;
+
+// GenPackageImpl#getQualifiedPackageName()
+private String getQualifiedPackageName(genmodel::GenPackage gp) :
+ isBlank(gp.basePackage) ? safeName(gp.ecorePackage.name) : gp.basePackage + "." + safeName(gp.ecorePackage.name)
+;
+
+// GenFeatureImpl#isMapEntryFeature
+private boolean isMapEntryFeature(genmodel::GenFeature gf) :
+ gf.genClass.isMapEntry() && ("key" == gf.ecoreFeature.name || "value" == gf.ecoreFeature.name)
+;
+
+private boolean isBlank(String s) :
+ null == s || s.length() == 0
+;
+
+private String safeName(String name) :
+JAVA org.eclipse.emf.codegen.util.CodeGenUtil.safeName(java.lang.String)
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/MetaModel.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION MetaModel»
+
+/*
+ * Does instanceof check.
+ */
+«DEFINE IsInstance(String accessor) FOR GenClass-»
+«accessor» instanceof «getQualifiedInterfaceName()»«ENDDEFINE»
+
+// Shorthand, negates IsInstance - handy if you consider
+// different approaches for generated and dynamic models: false == instanceof
+// vs. !MetaModelFacility.isInstance
+«DEFINE NotInstance(String accessor) FOR GenClass-»
+false == «EXPAND IsInstance(accessor)»«ENDDEFINE»
+
+/**
+ * Special kind of instanceof check, that compares eContainer() of the object.
+ * Since metaClass may be an external interface, eContainer() might need cast to EObject
+ */
+«DEFINE IsContainerInstance(String object, GenClass metaClass) FOR GenClass-»
+«EXPAND _getEObjectFeature(object, "eContainer()") FOR metaClass» instanceof «getQualifiedInterfaceName()»«ENDDEFINE»
+
+«DEFINE _getEObjectFeature(String object, String feature) FOR GenClass-»
+«IF isExternalInterface()»((org.eclipse.emf.ecore.EObject) «object»).«feature»«ELSE»«object».«feature»«ENDIF-»
+«ENDDEFINE»
+
+// Public/API-sort templates are named with first letter capitalized.
+// FIXME getFeatureValue* and setFeatureValue start with lowercase to indicate pending refactoring
+
+«DEFINE getFeatureValue(String containerVar, genmodel::GenClass containerClass) FOR genmodel::GenFeature-»
+«IF isExternalInterface(containerClass)-»
+((«EXPAND featureTargetType») ((org.eclipse.emf.ecore.EObject) «containerVar»).eGet(«EXPAND MetaFeature»))«-»
+«ELSE-»
+«containerVar».«getGetAccessor()»()«-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE featureTargetType FOR GenFeature»«IF isListType()»java.util.List«ELSE»«EXPAND QualifiedClassName FOR findGenClassifier(genClass.genPackage.genModel, ecoreFeature.eType)»«ENDIF»«ENDDEFINE»
+
+/*
+ * FIXME leave only one version of these two getFeatureValue
+ *
+ * A slightly more sophisticated version of getFeatureValue().
+ * @param containerName the name of the container
+ * @param feature the feature whose value is in interest
+ * @param containerMetaClass the <code>GenClass</code> of the container, or <code>null</code>, if the container is declared as an <code>org.eclipse.emf.ecore.EObject</code>.
+ * @param needsCastToResultType whether the cast to the result type is required (this parameter is only used if the <code>org.eclipse.emf.ecore.EClass</code> this feature belongs to is an external interface).
+ */
+«DEFINE getFeatureValue(String containerVar, genmodel::GenClass container, boolean needsCastToResultType) FOR genmodel::GenFeature-»
+«IF isExternalInterface(genClass)-»
+«IF needsCastToResultType»((«EXPAND featureTargetType») «ENDIF»«containerVar.parenthesizedCast(container, null)».eGet(«EXPAND MetaFeature»)«IF needsCastToResultType»)«ENDIF-»
+«ELSE-»
+«containerVar.parenthesizedCast(container, genClass)».«getGetAccessor()»()«-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setFeatureValue(String containerVar, genmodel::GenClass containerGenClass, String valueVar) FOR genmodel::GenFeature-»
+«EXPAND setFeatureValue(containerVar, containerGenClass, valueVar, false)»«ENDDEFINE»
+
+// FIXME support list features as well, i.e. do .add() instead of eSet
+«DEFINE setFeatureValue(String containerVar, genmodel::GenClass containerGenClass, String valueVar, boolean isPlainObjectValue) FOR genmodel::GenFeature-»
+«IF isExternalInterface(containerGenClass)-»
+((org.eclipse.emf.ecore.EObject) «containerVar»).eSet(«EXPAND MetaFeature», «valueVar»)«-»
+«ELSE-»
+«containerVar».set«getAccessorName(this)»(«IF !isPlainObjectValue»«valueVar»«ELSE»«IF isPrimitiveType()»«EXPAND _unwrapObjectToPrimitiveValue(valueVar)»«ELSE»(«EXPAND featureTargetType») «valueVar»«ENDIF»«ENDIF»)«-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE _unwrapObjectToPrimitiveValue(String valueVar) FOR GenFeature-»
+((«EXPAND featureTargetType») «valueVar»).«ecoreFeature.eType.instanceClassName»Value()«ENDDEFINE»
+
+«DEFINE MetaClass FOR genmodel::GenClassifier»«getQualifiedPackageInterfaceName(genPackage)».eINSTANCE.get«getClassifierAccessorName(this)»()«ENDDEFINE»
+
+«DEFINE MetaFeature FOR genmodel::GenFeature»«getQualifiedPackageInterfaceName(genClass.genPackage)».eINSTANCE.get«getFeatureAccessorName(this)»()«ENDDEFINE»
+
+// SomeFactory.eINSTANCE.createBlaBla();
+//NB: for map entries, the resulting type is EObject, not the qualified interface name. If cast is needed, use (un)parenthesizedCast() extension.
+//see GenClassImpl#hasFactoryInterfaceCreateMethod() for details why map entries should be treated differently
+«DEFINE NewInstance FOR genmodel::GenClass-»
+«IF isMapEntry()-»
+«genPackage.getQualifiedFactoryInterfaceName()».«genPackage.getFactoryInstanceName()».create(«EXPAND MetaClass»)«ELSE-»
+«genPackage.getQualifiedFactoryInterfaceName()».«genPackage.getFactoryInstanceName()».create«ecoreClass.name»()«ENDIF-»
+«ENDDEFINE»
+
+// XXX Need to take into account possible GenClass from generated and always available code
+// e.g. Notation or Ecore
+
+«DEFINE NewInstance(String varName) FOR genmodel::GenClass-»
+«getQualifiedInterfaceName()» «varName» = «IF isMapEntry()»(«getQualifiedInterfaceName()») «ENDIF»«EXPAND NewInstance»;
+«ENDDEFINE»
+
+/*
+ * Ensures value is of type EObject, may be no-op if context GenClass is compatible with EObject.
+ * Note, injected value is not surrounded with parenthesis, may need to introduce another
+ * template to accomplish that if needed.
+ */
+«DEFINE DowncastToEObject(String value) FOR genmodel::GenClass»«IF isExternalInterface()»(org.eclipse.emf.ecore.EObject) «ENDIF»«value»«ENDDEFINE»
+
+/*
+ * Declares new variable of appropriate type and assigns casted value to it.
+ */
+«DEFINE DeclareAndAssign(String assignee, String value) FOR GenClass-»
+«getQualifiedInterfaceName()» «assignee» = («getQualifiedInterfaceName()») «value»;«ENDDEFINE»
+
+/*
+ * third boolean parameter is to indicate the value is not EObject, so may
+ * need extra cast in case dynamic model instances are in use.
+ */
+«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClass-»
+«EXPAND DeclareAndAssign(assignee, value)»«ENDDEFINE»
+
+«DEFINE DeclareAndAssign(String assignee, String value, boolean isPlainObjectValue) FOR GenClassifier-»
+«getQualifiedClassName()» «assignee» = («getQualifiedClassName()») «value»;«ENDDEFINE»
+
+// @see IsContainerInstance
+«DEFINE DeclareAndAssignContainer(String assignee, String object, GenClass metaClass) FOR GenClass-»
+«getQualifiedInterfaceName()» «assignee» = («getQualifiedInterfaceName()») «EXPAND _getEObjectFeature(object, "eContainer()") FOR metaClass»;«ENDDEFINE»
+
+/*
+ * Declares new variable of context type and assignes a value obtained from 'src',
+ * which is of type 'srcMetaClass', via 'srcFeature'
+ *
+ * XXX in certain scenarions may need extra cast of the feature value
+ */
+«DEFINE DeclareAndAssign(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature) FOR GenClass-»
+«getQualifiedInterfaceName()» «assignee» = «EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature»;«ENDDEFINE»
+
+/*
+ * Same as DeclareAndAssign, with extra operation applied to source object
+ */
+«DEFINE DeclareAndAssign2(String assignee, String src, GenClass srcMetaClass, GenFeature srcFeature, String srcExt, boolean needCast) FOR GenClass-»
+«getQualifiedInterfaceName()» «assignee» = «IF needCast»(«getQualifiedInterfaceName()») «ENDIF»«EXPAND getFeatureValue(src, srcMetaClass) FOR srcFeature».«srcExt»;«ENDDEFINE»
+
+/*
+ * Cast value of type EObject to specific type. Would be no-op with dynamic model instances,
+ * therefore, the fact eObjectValue is actually EObject is essential
+ */
+«DEFINE CastEObject(String eObjectValue) FOR GenClass»(«getQualifiedInterfaceName()») «eObjectValue»«ENDDEFINE»
+
+/**
+ * Qualified interface name of the generated EClass, or EObject for dynamic models.
+ * Use whenever class name is inevitable (e.g. method arguments)
+ * SHOULD NEVER APPEAR in instanceof or any other similar comparison operation
+ */
+«DEFINE QualifiedClassName FOR GenClass»«getQualifiedInterfaceName()»«ENDDEFINE»
+«DEFINE QualifiedClassName FOR GenClassifier»«getQualifiedClassName()»«ENDDEFINE»
+
+«DEFINE PopulateItemProviderFactories(String factoryListVar) FOR GenEditorGenerator-»
+«FOREACH getAllDomainGenPackages(true) AS genPackage-»
+ «factoryListVar».add(new «genPackage.getQualifiedItemProviderAdapterFactoryClassName()»());
+«ENDFOREACH-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/diagram/editparts/ChildNodeLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE Main FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
+
+ «EXPAND attributes-»
+
+ «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::contsructor-»
+
+ «EXPAND getDragTracker-»
+
+ «EXPAND createDefaultEditPolicies-»
+
+ «EXPAND impl::diagram::editparts::TextAware::methods(false, labelReadOnly, labelElementIcon, viewmap, labelModelFacet, this, getDiagram()) FOR this-»
+
+ «EXPAND xpt::diagram::editparts::Common::notationalListeners FOR this-»
+
+ «EXPAND handleNotificationEvent-»
+
+ «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenChildLabelNode»extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart«ENDDEFINE»
+
+«DEFINE implementsList FOR gmfgen::GenChildLabelNode»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenChildLabelNode-»
+ «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
+
+ «EXPAND impl::diagram::editparts::TextAware::fields FOR this-»
+«ENDDEFINE»
+
+«DEFINE getDragTracker FOR gmfgen::GenChildLabelNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gef.DragTracker getDragTracker(org.eclipse.gef.Request request) {
+ «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::getDragTrackerBody-»
+}
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPolicies FOR gmfgen::GenChildLabelNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void createDefaultEditPolicies() {
+ «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::createDefaultEditPoliciesBody-»
+}
+«ENDDEFINE»
+
+«DEFINE handleNotificationEvent FOR gmfgen::GenChildLabelNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
+ «EXPAND impl::diagram::editparts::ChildNodeLabelEditPart::handleNotificationEventBody-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenChildLabelNode»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/diagram/editparts/CompartmentEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE Main FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
+
+ «EXPAND attributes-»
+
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::contsructor-»
+
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::hasModelChildrenChanged-»
+
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::getCompartmentName-»
+
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::createFigure-»
+
+ «EXPAND createDefaultEditPolicies-»
+
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::refreshVisuals-»
+
+ «EXPAND handleNotificationEvent-»
+
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::refreshBounds-»
+
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::setRatio-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenCompartment-»
+extends «IF listLayout»org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE implementsList FOR gmfgen::GenCompartment»«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPolicies FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void createDefaultEditPolicies() {
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::createDefaultEditPoliciesBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEvent FOR gmfgen::GenCompartment-»
+ «IF isStoringChildPositions(node)-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification notification) {
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::handleNotificationEventBody-»
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCompartment»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/diagram/editparts/DiagramEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE Main FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
+
+ «EXPAND attributes-»
+
+ «EXPAND impl::diagram::editparts::DiagramEditPart::constructor-»
+
+ «EXPAND createDefaultEditPolicies-»
+
+ «EXPAND impl::diagram::editparts::DiagramEditPart::createFigure-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenDiagram»extends org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart«ENDDEFINE»
+
+«DEFINE implementsList FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public final static String MODEL_ID = "«editorGen.modelID»"; «EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPolicies FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void createDefaultEditPolicies() {
+ «EXPAND impl::diagram::editparts::DiagramEditPart::createDefaultEditPoliciesBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE definionName FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE definionName FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE definionName FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE definionName FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/diagram/editparts/ExternalNodeLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE Main FOR gmfgen::GenExternalNodeLabel-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
+
+ «EXPAND attributes-»
+
+ «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::initializer-»
+
+ «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::constructor-»
+
+ «EXPAND createDefaultEditPolicies-»
+
+ «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::getBorderItemLocator-»
+
+ «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::refreshBounds-»
+
+ «EXPAND impl::diagram::editparts::TextAware::methods(false, readOnly, elementIcon, viewmap, modelFacet, node, getDiagram())-»
+
+ «EXPAND handleNotificationEvent-»
+
+ «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::createFigure-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenExternalNodeLabel»extends org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart«ENDDEFINE»
+
+«DEFINE implementsList FOR gmfgen::GenExternalNodeLabel»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
+
+ «EXPAND impl::diagram::editparts::TextAware::fields FOR this-»
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPolicies FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void createDefaultEditPolicies() {
+ «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::createDefaultEditPoliciesBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEvent FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
+ «EXPAND impl::diagram::editparts::ExternalNodeLabelEditPart::handleNotificationEventBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenExternalNodeLabel»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/diagram/editparts/LinkEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE Main FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
+
+ «EXPAND attributes-»
+
+ «EXPAND impl::diagram::editparts::LinkEditPart::constructor-»
+
+ «EXPAND createDefaultEditPolicies-»
+ «EXPAND impl::diagram::editparts::LinkEditPart::addFixedChild-»
+ «EXPAND impl::diagram::editparts::LinkEditPart::addChildVisual-»
+
+ «EXPAND impl::diagram::editparts::LinkEditPart::createLinkFigure-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenLink»extends org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart«ENDDEFINE»
+
+«DEFINE implementsList FOR gmfgen::GenLink-»
+ «IF treeBranch»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITreeBranchEditPart«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenLink-»
+ «EXPAND xpt::diagram::editparts::Common::visualIDConstant-»
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPolicies FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void createDefaultEditPolicies() {
+ «EXPAND impl::diagram::editparts::LinkEditPart::createDefaultEditPoliciesBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/diagram/editparts/LinkLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE Main FOR gmfgen::GenLinkLabel-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
+
+ «EXPAND attributes-»
+
+ «EXPAND impl::diagram::editparts::LinkLabelEditPart::initializer-»
+
+ «EXPAND impl::diagram::editparts::LinkLabelEditPart::constructor-»
+
+ «EXPAND createDefaultEditPolicies-»
+
+ «EXPAND impl::diagram::editparts::LinkLabelEditPart::getKeyPoint-»
+
+ «EXPAND impl::diagram::editparts::TextAware::methods(false, readOnly, elementIcon, viewmap, modelFacet, link, getDiagram())-»
+
+ «EXPAND handleNotificationEvent-»
+
+ «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenLinkLabel»extends org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart«ENDDEFINE»
+
+«DEFINE implementsList FOR gmfgen::GenLinkLabel»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenLinkLabel-»
+ «EXPAND xpt::diagram::editparts::Common::visualIDConstant-»
+
+ «EXPAND impl::diagram::editparts::TextAware::fields-»
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPolicies FOR gmfgen::GenLinkLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void createDefaultEditPolicies() {
+ «EXPAND impl::diagram::editparts::LinkLabelEditPart::createDefaultEditPoliciesBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEvent FOR gmfgen::GenLinkLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
+ «EXPAND impl::diagram::editparts::LinkLabelEditPart::handleNotificationEventBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLinkLabel-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/diagram/editparts/NodeEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE Main FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
+
+ «EXPAND attributes-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::constructor-»
+
+ «EXPAND createDefaultEditPolicies-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::createLayoutEditPolicy-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::createNodeShape(this) FOR viewmap-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::addFixedChild-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::removeFixedChild-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::addChildVisual-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::removeChildVisual-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::getContentPaneFor-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::addBorderItem-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::createNodePlate-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::getPrimaryDragEditPolicy-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::createFigure-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::setupContentPane-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::getContentPane-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::getPrimaryChildEditPart-»
+
+ «EXPAND handleNotificationEvent-»
+
+ «EXPAND impl::diagram::editparts::NodeEditPart::innerClassDeclaration FOR viewmap-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenNode»extends «EXPAND impl::diagram::editparts::NodeEditPart::extendsListContents»«ENDDEFINE»
+
+«DEFINE implementsList FOR gmfgen::GenNode»«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNode-»
+ «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure contentPane;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure primaryShape;
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPolicies FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void createDefaultEditPolicies() {
+ «EXPAND impl::diagram::editparts::NodeEditPart::createDefaultEditPoliciesBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEvent FOR gmfgen::GenNode-»
+«ENDDEFINE»
+
+«DEFINE handleNotificationEvent FOR gmfgen::GenTopLevelNode-»
+ «REM»This code is important for refreshing shortcut decoration
+ on adding corresponding annotation to the View instance.«ENDREM»
+ «IF getDiagram().generateShortcutIcon()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
+ «EXPAND impl::diagram::editparts::NodeEditPart::handleNotificationEventBody-»
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/diagram/editparts/NodeLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE Main FOR gmfgen::GenNodeLabel-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartClassName» «EXPAND extendsList» «EXPAND implementsList» {
+
+ «EXPAND attributes-»
+
+ «EXPAND impl::diagram::editparts::NodeLabelEditPart::constructor-»
+
+ «EXPAND createDefaultEditPolicies-»
+
+ «EXPAND impl::diagram::editparts::TextAware::methods(isStoringChildPositions(node), readOnly, elementIcon, viewmap, modelFacet, node, getDiagram())-»
+
+ «EXPAND xpt::diagram::editparts::Common::notationalListeners-»
+
+ «EXPAND impl::diagram::editparts::NodeLabelEditPart::refreshBounds-»
+
+ «EXPAND handleNotificationEvent-»
+
+ «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenNodeLabel»extends org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart«ENDDEFINE»
+
+«DEFINE implementsList FOR gmfgen::GenNodeLabel»implements org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNodeLabel-»
+ «EXPAND xpt::diagram::editparts::Common::visualIDConstant FOR this-»
+
+ «EXPAND impl::diagram::editparts::TextAware::fields FOR this-»
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPolicies FOR gmfgen::GenNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void createDefaultEditPolicies() {
+ «EXPAND impl::diagram::editparts::NodeLabelEditPart::createDefaultEditPoliciesBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEvent FOR gmfgen::GenNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void handleNotificationEvent(org.eclipse.emf.common.notify.Notification event) {
+ «EXPAND impl::diagram::editparts::NodeLabelEditPart::handleNotificationEventBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNodeLabel-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/emf-merge.xml Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,233 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<merge:options
+ indent=" "
+ braceStyle="matching"
+ redirect="Gen"
+ block="\s*@\s*generated\s*NOT\s*(?:\n\r?|\r\n?)"
+ noImport="\s*//\s*import\s+([\w.*]*)\s*;\s*(?:\n\r?|\r\n?)"
+ xmlns:merge="http://www.eclipse.org/org/eclipse/emf/codegen/jmerge/Options">
+
+<!-- Tabbed Standard
+
+ indent="	"
+ braceStyle="standard"
+
+-->
+
+ <!-- this accepts both new and old style markup. -->
+
+ <merge:dictionaryPattern
+ name="modelMembers"
+ select="Member/getComment"
+ match="@\s*(model)"/>
+
+ <merge:dictionaryPattern
+ name="generatedUnmodifiableMembers"
+ select="Member/getComment"
+ match="@\s*(gen)erated\s*(This field/method[^(?:\n\r?|\r\n?)]*)*(?:\n\r?|\r\n?)"/>
+
+ <merge:dictionaryPattern
+ name="generatedModifiableMembers"
+ select="Member/getComment"
+ match="@\s*generated\s*(modifiable)\s*(?:\n\r?|\r\n?)"/>
+
+ <!-- This is like the above, but for backward compatibility -->
+ <merge:dictionaryPattern
+ name="generatedLastGenMembers"
+ select="Member/getComment"
+ match="@\s*(lastgen).*(?:\n\r?|\r\n?)"/>
+
+ <merge:dictionaryPattern
+ name="orderedMembers"
+ select="Member/getComment"
+ match="@\s*(ordered)\s*(?:\n\r?|\r\n?)"/>
+
+ <!-- Only push Annotations for the Members marked by gen-->
+ <merge:push targetParentMarkup="^gen$" select="Annotation"/>
+
+ <merge:pull
+ sourceMarkup="^modifiable$"
+ sourceGet="Member/getComment"
+ sourceTransfer="(\s*<!--\s*begin-user-doc.*?end-user-doc\s*-->\s*)(?:\n\r?|\r\n?)"
+ targetMarkup="^modifiable$"
+ targetPut="Member/setComment"/>
+ <merge:pull
+ sourceMarkup="^gen$"
+ sourceGet="Member/getComment"
+ sourceTransfer="(\s*<!--\s*begin-user-doc.*?end-user-doc\s*-->\s*)(?:\n\r?|\r\n?)"
+ targetMarkup="^gen$"
+ targetPut="Member/setComment"/>
+ <merge:pull
+ sourceGet="Member/getFlags"
+ targetMarkup="^gen$"
+ equals="Member/getName"
+ targetPut="Member/setFlags"/>
+
+ <merge:pull
+ sourceMarkup="^gen$"
+ sourceGet="AbstractType/getComment"
+ sourceTransfer="(\s*<!--\s*begin-user-doc.*?end-user-doc\s*-->\s*)(?:\n\r?|\r\n?)"
+ targetMarkup="^modifiable$"
+ targetPut="AbstractType/setComment"/>
+
+ <merge:pull
+ sourceGet="Type/getTypeParameters"
+ targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
+ targetPut="Type/setTypeParameters"/>
+ <merge:pull
+ sourceGet="Type/getSuperclass"
+ targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
+ targetPut="Type/setSuperclass"/>
+ <merge:pull
+ sourceGet="Type/getSuperInterfaces"
+ sourceTransfer="(\s*@\s*extends|\s*@\s*implements)(.*?)(?:<!--|(?:\n\r?|\r\n?))"
+ targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
+ targetPut="Type/addSuperInterface"/>
+
+ <merge:pull
+ sourceGet="Enum/getSuperInterfaces"
+ sourceTransfer="(\s*@\s*extends|\s*@\s*implements)(.*?)(?:<!--|(?:\n\r?|\r\n?))"
+ targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
+ targetPut="Enum/addSuperInterface"/>
+
+ <merge:pull
+ sourceGet="EnumConstant/getArguments"
+ targetMarkup="^lastgen$|^gen$|^modifiable$|^model$"
+ targetPut="EnumConstant/setArguments"/>
+ <merge:pull
+ sourceGet="EnumConstant/getBody"
+ targetMarkup="^lastgen$|^gen$|^modifiable$|^model$$"
+ targetPut="EnumConstant/setBody"/>
+
+ <merge:pull
+ sourceGet="AnnotationTypeMember/getType"
+ targetMarkup="^gen$"
+ targetPut="AnnotationTypeMember/setType"/>
+ <merge:pull
+ sourceGet="AnnotationTypeMember/getDefaultValue"
+ targetMarkup="^gen$"
+ targetPut="AnnotationTypeMember/setDefaultValue"/>
+
+ <merge:pull
+ sourceGet="Initializer/getBody"
+ targetMarkup="^gen$"
+ targetPut="Initializer/setBody"/>
+
+ <merge:pull
+ sourceGet="Field/getType"
+ targetMarkup="^gen$"
+ targetPut="Field/setType"/>
+ <merge:pull
+ sourceGet="Field/getInitializer"
+ targetMarkup="^gen$"
+ targetPut="Field/setInitializer"/>
+
+ <merge:pull
+ sourceGet="Method/getTypeParameters"
+ targetMarkup="^gen$"
+ targetPut="Method/setTypeParameters"/>
+ <merge:pull
+ sourceGet="Method/getReturnType"
+ targetMarkup="^gen$|^model$"
+ targetPut="Method/setReturnType"/>
+ <merge:pull
+ sourceGet="Method/getParameters"
+ targetMarkup="^gen$"
+ targetPut="Method/setParameters"/>
+ <merge:pull
+ sourceGet="Method/getBody"
+ targetMarkup="^gen$"
+ targetPut="Method/setBody"/>
+ <merge:pull
+ sourceGet="Method/getExceptions"
+ targetMarkup="^gen$"
+ targetPut="Method/addException"/>
+
+ <merge:sweep markup="^gen$" select="Member"/>
+ <merge:sweep markup="^org.eclipse.emf.ecore.EMetaObject$" select="Import"/>
+ <merge:sweep markup="^org.eclipse.emf.ecore.impl.EMetaObjectImpl$" select="Import"/>
+ <merge:sweep markup="^org.eclipse.emf.ecore.util.EObjectCompositeEList$" select="Import"/>
+ <merge:sweep markup="^org.eclipse.emf.ecore.util.EObjectCompositeWithInverseEList$" select="Import"/>
+ <merge:sweep markup="^org.eclipse.emf.common.util.AbstractEnumerator$" select="Import"/>
+
+ <merge:sort markup="^ordered$" select="Field"/>
+ <merge:sort markup="^ordered$" select="EnumConstant"/>
+
+<!-- Basic Rules
+
+ <merge:pull
+ sourceGet="CompilationUnit/getHeader"
+ targetPut="CompilationUnit/setHeader"/>
+
+ <merge:pull
+ sourceGet="Package/getName"
+ targetPut="Package/setName"/>
+
+ <merge:pull
+ sourceGet="Member/getFlags"
+ targetPut="Member/setFlags"/>
+ <merge:pull
+ sourceGet="Member/getComment"
+ targetPut="Member/setComment"/>
+
+ <merge:pull
+ sourceGet="Type/getSuperclass"
+ targetPut="Type/setSuperclass"/>
+ <merge:pull
+ sourceGet="Type/getSuperInterfaces"
+ targetPut="Type/addSuperInterface"/>
+
+ <merge:pull
+ sourceGet="Initializer/getBody"
+ targetPut="Initializer/setBody"/>
+
+ <merge:pull
+ sourceGet="Field/getType"
+ targetPut="Field/setType"/>
+ <merge:pull
+ sourceGet="Field/getInitializer"
+ targetPut="Field/setInitializer"/>
+
+ <merge:pull
+ sourceGet="Method/getBody"
+ targetPut="Method/setBody"/>
+ <merge:pull
+ sourceGet="Method/getReturnType"
+ targetPut="Method/setReturnType"/>
+ <merge:pull
+ sourceGet="Method/getExceptions"
+ targetPut="Method/addException"/>
+-->
+
+<!-- Push Enum Constants only for generated Enums -->
+<!--
+ <merge:push targetParentMarkup="^gen$" select="EnumConstant"/>
+-->
+
+<!-- Push Annotation Type Members only for generated Annotation Types -->
+<!--
+ <merge:push targetParentMarkup="^gen$" select="AnnotationTypeMember"/>
+-->
+
+<!-- Sets the content of annotations if the parent is marked with gen -->
+<!--
+ <merge:pull
+ sourceGet="Annotation/getContents"
+ targetParentMarkup="^gen$"
+ targetPut="Annotation/setContents"/>
+-->
+
+<!-- Remove annotations of generated target nodes if the annotation is not in the source -->
+<!--
+ <merge:sweep parentMarkup="^gen$" select="Annotation"/>
+-->
+
+<!--
+ <merge:pull
+ sourceMarkup="^modifiable$"
+ sourceGet="Member/getComment"
+ targetMarkup="^gen$"
+ targetPut="Member/setComment"/>
+-->
+
+</merge:options>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/impl/diagram/editparts/ChildNodeLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE contsructor FOR gmfgen::GenChildLabelNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE getDragTrackerBody FOR gmfgen::GenChildLabelNode-»
+ if (request instanceof org.eclipse.gef.requests.SelectionRequest && ((org.eclipse.gef.requests.SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx(this);
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenChildLabelNode-»
+ super.createDefaultEditPolicies();
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «getItemSemanticEditPolicyQualifiedClassName()»());
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new «getDiagram().getTextNonResizableEditPolicyQualifiedClassName()»());
+ installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy());
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenChildLabelNode-»
+ Object feature = event.getFeature();
+ «EXPAND xpt::diagram::editparts::Common::handleText FOR this-»
+ super.handleNotificationEvent(event);
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/impl/diagram/editparts/CompartmentEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE contsructor FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE hasModelChildrenChanged FOR gmfgen::GenCompartment-»
+ «IF listLayout-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean hasModelChildrenChanged(org.eclipse.emf.common.notify.Notification evt) {
+ return false;
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getCompartmentName FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getCompartmentName() {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCompartmentTitle()) FOR getDiagram().editorGen»;
+ }
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenCompartment-»
+ «IF !needsTitle-»
+ «REM»By default titles are shown even if there are no TitleStyle, we need to switch it off«ENDREM»«-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure result = (org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenCompartment-»
+ super.createDefaultEditPolicies();
+ «IF canCollapse-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy());
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
+ «IF childNodes.size() > 0-»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy());
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy());
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
+ «EXPAND xpt::diagram::editparts::Common::behaviour-»
+«ENDDEFINE»
+
+«DEFINE refreshVisuals FOR gmfgen::GenCompartment-»
+ «IF isStoringChildPositions(node)-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshBounds();
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenCompartment-»
+ super.handleNotificationEvent(notification);
+ Object feature = notification.getFeature();
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature)
+ || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature)
+ || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature)
+ || org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+«ENDDEFINE»
+
+«DEFINE refreshBounds FOR gmfgen::GenCompartment-»
+ «IF isStoringChildPositions(node)-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshBounds() {
+ int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setRatio FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setRatio(Double ratio) {
+ «IF gmfgen::ViewmapLayoutType::UNKNOWN.value == node.getLayoutType().value-»
+ if (getFigure().getParent().getLayoutManager() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout) {
+ super.setRatio(ratio);
+ }
+ «ELSE-»
+ // nothing to do -- parent layout does not accept Double constraints as ratio
+ // super.setRatio(ratio);
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND internal_i18nAccessors FOREACH compartments»
+«ENDDEFINE»
+
+«DEFINE internal_i18nAccessors FOR gmfgen::GenCompartment-»
+«IF null != title»«EXPAND xpt::Externalizer::accessorField(i18nKeyForCompartmentTitle())»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND internal_i18nValues FOREACH compartments»
+«ENDDEFINE»
+
+«DEFINE internal_i18nValues FOR gmfgen::GenCompartment-»
+«IF null != title»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCompartmentTitle(), title)»«ENDIF-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/impl/diagram/editparts/DiagramEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenDiagram-»
+ super.createDefaultEditPolicies();
+ «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
+ «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
+ «IF generateCreateShortcutAction() && null == editorGen.application-»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy() {
+ public org.eclipse.gef.commands.Command getDropObjectsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest) {
+ java.util.List viewDescriptors = new java.util.ArrayList();
+ for (java.util.Iterator it = dropRequest.getObjects().iterator(); it.hasNext();) {
+ Object nextObject = it.next();
+ if (false == nextObject instanceof org.eclipse.emf.ecore.EObject) {
+ continue;
+ }
+ viewDescriptors.add(new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter((org.eclipse.emf.ecore.EObject) nextObject), org.eclipse.gmf.runtime.notation.Node.class, null, getDiagramPreferencesHint()));
+ }
+ return createShortcutsCommand(dropRequest, viewDescriptors);
+ }
+
+ private org.eclipse.gef.commands.Command createShortcutsCommand(org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest dropRequest, java.util.List viewDescriptors) {
+ org.eclipse.gef.commands.Command command = createViewsAndArrangeCommand(dropRequest, viewDescriptors);
+ if (command != null) {
+ return command.chain(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new «getCreateShortcutDecorationsCommandQualifiedClassName()»(getEditingDomain(), (org.eclipse.gmf.runtime.notation.View) getModel(), viewDescriptors)));
+ }
+ return null;
+ }
+ });
+ «ENDIF-»
+ «IF shouldGenerateDiagramViewmap()-»
+ // diagram figure does layout; need to install child editpolicy to show selection feedback
+ installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, new org.eclipse.gef.editpolicies.LayoutEditPolicy() {
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ final org.eclipse.gef.editpolicies.NonResizableEditPolicy p = new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
+ p.setDragAllowed(false);
+ return p;
+ }
+ protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
+ return null;
+ }
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
+ return null;
+ }
+ });
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenDiagram-»
+ «IF shouldGenerateDiagramViewmap()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.draw2d.FreeformLayer l = new org.eclipse.draw2d.FreeformLayer();
+ l.setBorder(new org.eclipse.draw2d.MarginBorder(50));
+ «EXPAND initLayout("lm") FOR viewmap.layoutType-»
+ l.setLayoutManager(lm);
+ return l;
+ }
+ «ENDIF»
+«ENDDEFINE»
+
+«DEFINE initLayout(String varName) FOR gmfgen::ViewmapLayoutType-»
+ «IF value == gmfgen::ViewmapLayoutType::TOOLBAR_LAYOUT.value-»
+ org.eclipse.draw2d.ToolbarLayout «varName» = new org.eclipse.draw2d.ToolbarLayout();
+ «varName».setSpacing(10);
+ «ELSEIF value == gmfgen::ViewmapLayoutType::FLOW_LAYOUT.value-»
+ org.eclipse.draw2d.FlowLayout «varName» = new org.eclipse.draw2d.FlowLayout();
+ «varName».setMajorSpacing(10);
+ «varName».setMinorSpacing(10);
+ «ELSE-»
+ org.eclipse.draw2d.LayoutManager «varName» = null; /*FIXME - unknown layout type*/
+ «ENDIF-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/impl/diagram/editparts/ExternalNodeLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE initializer FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static {
+ registerSnapBackPosition(«EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR getDiagram()»(«EXPAND xpt::editor::VisualIDRegistry::visualID»), new org.eclipse.draw2d.geometry.Point(0, 0));
+ }
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenExternalNodeLabel-»
+ super.createDefaultEditPolicies();
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
+«ENDDEFINE»
+
+«DEFINE getBorderItemLocator FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator getBorderItemLocator() {
+ org.eclipse.draw2d.IFigure parentFigure = getFigure().getParent();
+ if (parentFigure != null && parentFigure.getLayoutManager() != null) {
+ Object constraint = parentFigure.getLayoutManager().getConstraint(getFigure());
+ return (org.eclipse.gmf.runtime.diagram.ui.figures.IBorderItemLocator) constraint;
+ }
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE refreshBounds FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void refreshBounds() {
+ int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ getBorderItemLocator().setConstraint(new org.eclipse.draw2d.geometry.Rectangle(x, y, width, height));
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenExternalNodeLabel-»
+ Object feature = event.getFeature();
+ «EXPAND xpt::diagram::editparts::Common::handleText FOR this-»
+ super.handleNotificationEvent(event);
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND xpt::diagram::editparts::Common::labelFigure FOR viewmap-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/impl/diagram/editparts/LinkEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE constructor FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenLink-»
+ super.createDefaultEditPolicies();
+ «IF null == modelFacet-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.COMPONENT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ViewComponentEditPolicy());
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
+«ENDDEFINE»
+
+«DEFINE addFixedChild FOR gmfgen::GenLink-»
+ «IF labels.size() > 0-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
+ «FOREACH labels AS label-»
+ «EXPAND addLabel(label) FOR label.viewmap-»
+ «ENDFOREACH-»
+ return false;
+ }
+ «ENDIF»
+«ENDDEFINE»
+
+«DEFINE addLabel(gmfgen::GenLinkLabel label) FOR gmfgen::Viewmap-»
+«ENDDEFINE»
+
+«DEFINE addLabel(gmfgen::GenLinkLabel label) FOR gmfgen::ParentAssignedViewmap-»
+ if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
+ ((«label.getEditPartQualifiedClassName()») childEditPart).«EXPAND impl::diagram::editparts::TextAware::labelSetterName»(
+ getPrimaryShape().«getterName»());
+ return true;
+ }
+«ENDDEFINE»
+
+«DEFINE addChildVisual FOR gmfgen::GenLink-»
+ «IF labels.size() > 0-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+ «ENDIF»
+«ENDDEFINE»
+
+«DEFINE createLinkFigure FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::generatedMemberComment(
+ "Creates figure for this edit part.\n" +
+ "\n" +
+ "Body of this method does not depend on settings in generation model\n" +
+ "so you may safely remove <i>generated</i> tag and modify it.\n"
+ )»
+ «EXPAND createLinkFigure(this) FOR viewmap-»
+«ENDDEFINE»
+
+«DEFINE createLinkFigure(gmfgen::GenLink link) FOR gmfgen::Viewmap-»
+ «ERROR "Unknown viewmap: " + this-»
+«ENDDEFINE»
+
+«DEFINE createLinkFigure(gmfgen::GenLink link) FOR gmfgen::FigureViewmap-»
+ «LET figureQualifiedClassName == null ? "org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx" : figureQualifiedClassName AS fqn-»
+ protected org.eclipse.draw2d.Connection createConnectionFigure() {
+ return new «fqn»();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «fqn» getPrimaryShape() {
+ return («fqn») getFigure();
+ }
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE createLinkFigure(gmfgen::GenLink link) FOR gmfgen::SnippetViewmap»
+ protected org.eclipse.draw2d.Connection createConnectionFigure() {
+ return «body»;
+ }
+«ENDDEFINE»
+
+«DEFINE createLinkFigure(gmfgen::GenLink link) FOR gmfgen::InnerClassViewmap»
+ protected org.eclipse.draw2d.Connection createConnectionFigure() {
+ return new «className»();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «className» getPrimaryShape() {
+ return («className») getFigure();
+ }
+
+ «classBody»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/impl/diagram/editparts/LinkLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE initializer FOR gmfgen::GenLinkLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static {
+ registerSnapBackPosition(«EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR getDiagram()»(«EXPAND xpt::editor::VisualIDRegistry::visualID»),
+ new org.eclipse.draw2d.geometry.Point(«labelOffsetX(viewmap, 0)», «labelOffsetY(viewmap, 0)»));
+ }
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenLinkLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenLinkLabel-»
+ super.createDefaultEditPolicies();
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
+«ENDDEFINE»
+
+«DEFINE getKeyPoint FOR gmfgen::GenLinkLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public int getKeyPoint() {
+ return org.eclipse.draw2d.ConnectionLocator.«alignment»;
+ }
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenLinkLabel-»
+ Object feature = event.getFeature();
+ «EXPAND xpt::diagram::editparts::Common::handleText FOR this-»
+ super.handleNotificationEvent(event);
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/impl/diagram/editparts/NodeEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,476 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE extendsListContents FOR gmfgen::GenNode-»
+«IF hasBorderItems()»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderedShapeEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE extendsListContents FOR gmfgen::GenChildSideAffixedNode-»
+«IF hasBorderItems()»org.eclipse.gmf.runtime.diagram.ui.editparts.BorderedBorderItemEditPart«ELSE»org.eclipse.gmf.runtime.diagram.ui.editparts.AbstractBorderItemEditPart«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenNode-»
+ «EXPAND installCreationRolePolicy-»
+ super.createDefaultEditPolicies();
+ «EXPAND installPrimaryDragEditPolicy-»
+ «EXPAND xpt::diagram::editparts::Common::installSemanticEditPolicy-»
+ «IF needsGraphicalNodeEditPolicy()-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.GRAPHICAL_NODE_ROLE, new «getGraphicalNodeEditPolicyQualifiedClassName()»());
+ «ENDIF-»
+ «IF !childNodes.isEmpty()-»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.DRAG_DROP_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy());
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::installCanonicalEditPolicy-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
+ // XXX need an SCR to runtime to have another abstract superclass that would let children add reasonable editpolicies
+ // removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CONNECTION_HANDLES_ROLE);
+«ENDDEFINE»
+
+«DEFINE installCreationRolePolicy FOR gmfgen::GenNode-»
+ «IF hasChildren() || hasChildrenInListCompartments()-»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CREATION_ROLE,
+ new org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy()«IF hasChildrenInListCompartments()» {
+ public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest) {
+ org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter adapter =
+ ((org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest) request).
+ getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ org.eclipse.gmf.runtime.emf.type.core.IElementType type =
+ (org.eclipse.gmf.runtime.emf.type.core.IElementType) adapter.getAdapter(
+ org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
+ «FOREACH compartments AS compartment-»
+ «IF listCompartmentHasChildren(compartment)-»
+ «FOREACH compartment.childNodes AS childNode-»
+ if (type == «getDiagram().getElementTypesQualifiedClassName()».«childNode.getUniqueIdentifier()») {
+ org.eclipse.gef.EditPart compartmentEditPart =
+ getChildBySemanticHint(«EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR getDiagram()»(
+ «EXPAND xpt::editor::VisualIDRegistry::visualID FOR compartment»));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ «ENDFOREACH-»
+ «ENDIF-»
+ «ENDFOREACH-»
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ }
+ «ENDIF»);
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE installPrimaryDragEditPolicy FOR gmfgen::GenNode»«ENDDEFINE»
+
+«DEFINE installPrimaryDragEditPolicy FOR gmfgen::GenChildSideAffixedNode-»
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, getPrimaryDragEditPolicy());
+«ENDDEFINE»
+
+«DEFINE createLayoutEditPolicy FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gef.editpolicies.LayoutEditPolicy createLayoutEditPolicy() {
+ «EXPAND createLayoutEditPolicyBody-»
+ }
+«ENDDEFINE»
+
+«DEFINE createLayoutEditPolicyBody FOR gmfgen::GenNode-»
+ «IF gmfgen::ViewmapLayoutType::XY_LAYOUT.value == getLayoutType().value-»
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.XYLayoutEditPolicy() {
+
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ «IF hasBorderItems()-»
+ if (child instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart) {
+ return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy();
+ }
+ «ENDIF-»
+ org.eclipse.gef.EditPolicy result = super.createChildEditPolicy(child);
+ if (result == null) {
+ return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableShapeEditPolicy();
+ }
+ return result;
+ }
+ };
+ return lep;
+ «ELSEIF gmfgen::ViewmapLayoutType::TOOLBAR_LAYOUT.value == getLayoutType().value»
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy lep = new org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy() {
+
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ «IF hasBorderItems()-»
+ if (child instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart) {
+ return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy();
+ }
+ «ENDIF-»
+ if (child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart) {
+ return new «getDiagram().getTextSelectionEditPolicyQualifiedClassName()»();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ «ELSEIF gmfgen::ViewmapLayoutType::FLOW_LAYOUT.value == getLayoutType().value»
+ org.eclipse.gef.editpolicies.FlowLayoutEditPolicy lep = new org.eclipse.gef.editpolicies.FlowLayoutEditPolicy() {
+
+ «IF hasBorderItems()-»
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ if (child instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart) {
+ return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy();
+ }
+ return super.createChildEditPolicy(child);
+ }
+ «ENDIF-»
+
+ protected org.eclipse.gef.commands.Command createAddCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
+ return null;
+ }
+
+ protected org.eclipse.gef.commands.Command createMoveChildCommand(org.eclipse.gef.EditPart child, org.eclipse.gef.EditPart after) {
+ return null;
+ }
+
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ «ELSE-»
+ org.eclipse.gef.editpolicies.LayoutEditPolicy lep = new org.eclipse.gef.editpolicies.LayoutEditPolicy() {
+
+ protected org.eclipse.gef.EditPolicy createChildEditPolicy(org.eclipse.gef.EditPart child) {
+ «IF hasBorderItems()-»
+ if (child instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart) {
+ return new org.eclipse.gmf.runtime.diagram.ui.editpolicies.BorderItemSelectionEditPolicy();
+ }
+ «ENDIF-»
+ org.eclipse.gef.EditPolicy result = child.getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
+ if (result == null) {
+ result = new org.eclipse.gef.editpolicies.NonResizableEditPolicy();
+ }
+ return result;
+ }
+
+ protected org.eclipse.gef.commands.Command getMoveChildrenCommand(org.eclipse.gef.Request request) {
+ return null;
+ }
+
+ protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gef.requests.CreateRequest request) {
+ return null;
+ }
+ };
+ return lep;
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::Viewmap-»
+ «ERROR "Unknown viewmap: " + this-»
+«ENDDEFINE»
+
+«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::FigureViewmap-»
+ «LET figureQualifiedClassName == null ? "org.eclipse.draw2d.RectangleFigure" : figureQualifiedClassName AS fqn-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createNodeShape() {
+ return primaryShape = new «fqn»()«IF node.getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value»{
+ protected boolean useLocalCoordinates() {
+ return true;
+ }
+ }«ENDIF»;
+ }
+
+ «EXPAND getPrimaryShapeMethod FOR fqn-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::SnippetViewmap-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createNodeShape() {
+ return «body»;
+ }
+«ENDDEFINE»
+
+«DEFINE createNodeShape(gmfgen::GenNode node) FOR gmfgen::InnerClassViewmap-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createNodeShape() {
+ «className» figure = new «className»();
+ «IF node.childNodes.size() > 0 && node.getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value-»
+ figure.setUseLocalCoordinates(true);
+ «ENDIF-»
+ return primaryShape = figure;
+ }
+
+ «EXPAND getPrimaryShapeMethod FOR className-»
+«ENDDEFINE»
+
+«DEFINE getPrimaryShapeMethod FOR String-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «this» getPrimaryShape() {
+ return («this») primaryShape;
+ }
+«ENDDEFINE»
+
+«DEFINE addFixedChild FOR gmfgen::GenNode-»
+ «IF hasFixedChildren()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean addFixedChild(org.eclipse.gef.EditPart childEditPart) {
+ «FOREACH getInnerFixedLabels() AS label-»
+ «LET (gmfgen::ParentAssignedViewmap) label.viewmap AS childViewmap-»
+ if (childEditPart instanceof «label.getEditPartQualifiedClassName()») {
+ ((«label.getEditPartQualifiedClassName()») childEditPart).«EXPAND impl::diagram::editparts::TextAware::labelSetterName FOR childViewmap»(getPrimaryShape().«childViewmap.getterName»());
+ return true;
+ }
+ «ENDLET-»
+ «ENDFOREACH-»
+ «FOREACH getPinnedCompartments() AS compartment-»
+ «LET (gmfgen::ParentAssignedViewmap) compartment.viewmap AS childViewmap-»
+ if (childEditPart instanceof «compartment.getEditPartQualifiedClassName()») {
+ org.eclipse.draw2d.IFigure pane = getPrimaryShape().«childViewmap.getterName»();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.add(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure());
+ return true;
+ }
+ «ENDLET-»
+ «ENDFOREACH-»
+ «FOREACH getSideAffixedChildren() AS child-»
+ if (childEditPart instanceof «child.getEditPartQualifiedClassName()») {
+ org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.«child.preferredSideName»);
+ getBorderedFigure().getBorderItemContainer().add(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure(), locator);
+ return true;
+ }
+ «ENDFOREACH-»
+ return false;
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE removeFixedChild FOR gmfgen::GenNode-»
+ «IF hasFixedChildren()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean removeFixedChild(org.eclipse.gef.EditPart childEditPart) {
+ «REM»ignore labels assuming that they never may be removed«ENDREM»
+ «FOREACH getPinnedCompartments() AS compartment-»
+ «LET (gmfgen::ParentAssignedViewmap) compartment.viewmap AS childViewmap-»
+ if (childEditPart instanceof «compartment.getEditPartQualifiedClassName()») {
+ org.eclipse.draw2d.IFigure pane = getPrimaryShape().«childViewmap.getterName»();
+ setupContentPane(pane); // FIXME each comparment should handle his content pane in his own way
+ pane.remove(((«compartment.getEditPartQualifiedClassName()») childEditPart).getFigure());
+ return true;
+ }
+ «ENDLET-»
+ «ENDFOREACH-»
+ «FOREACH getSideAffixedChildren() AS child-»
+ if (childEditPart instanceof «child.getEditPartQualifiedClassName()») {
+ getBorderedFigure().getBorderItemContainer().remove(((«child.getEditPartQualifiedClassName()») childEditPart).getFigure());
+ return true;
+ }
+ «ENDFOREACH-»
+ return false;
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addChildVisual FOR gmfgen::GenNode-»
+ «IF hasFixedChildren()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addChildVisual(org.eclipse.gef.EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE removeChildVisual FOR gmfgen::GenNode-»
+ «IF hasFixedChildren()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void removeChildVisual(org.eclipse.gef.EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)){
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getContentPaneFor FOR gmfgen::GenNode-»
+ «IF hasFixedChildren()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure getContentPaneFor(org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart) {
+ «REM»it is unclear what we should return for labels here«ENDREM»
+ «FOREACH getPinnedCompartments() AS compartment-»
+ «LET (gmfgen::ParentAssignedViewmap) compartment.viewmap AS childViewmap-»
+ if (editPart instanceof «compartment.getEditPartQualifiedClassName()») {
+ return getPrimaryShape().«childViewmap.getterName»();
+ }
+ «ENDLET-»
+ «ENDFOREACH-»
+ «FOREACH getSideAffixedChildren() AS child-»
+ if (editPart instanceof «child.getEditPartQualifiedClassName()») {
+ return getBorderedFigure().getBorderItemContainer();
+ }
+ «ENDFOREACH-»
+ return super.getContentPaneFor(editPart);
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addBorderItem FOR gmfgen::GenNode-»
+ «IF getExternalLabels().size() > 0-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addBorderItem(org.eclipse.draw2d.IFigure borderItemContainer, org.eclipse.gmf.runtime.diagram.ui.editparts.IBorderItemEditPart borderItemEditPart) {
+ if («FOREACH getExternalLabels() AS label SEPARATOR ' || '»borderItemEditPart instanceof «label.getEditPartQualifiedClassName()»«ENDFOREACH») {
+ org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator locator = new org.eclipse.gmf.runtime.diagram.ui.figures.BorderItemLocator(getMainFigure(), org.eclipse.draw2d.PositionConstants.SOUTH);
+ locator.setBorderItemOffset(new org.eclipse.draw2d.geometry.Dimension(-20, -20));
+ borderItemContainer.add(borderItemEditPart.getFigure(), locator);
+ } else {
+ super.addBorderItem(borderItemContainer, borderItemEditPart);
+ }
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createNodePlate FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure createNodePlate() {
+ org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure result =
+ new org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure(getMapMode().DPtoLP(«defaultSizeWidth(viewmap, 40)»), getMapMode().DPtoLP(«defaultSizeHeight(viewmap, 40)»));
+ «EXPAND setupNodePlate-»
+ return result;
+ }
+«ENDDEFINE»
+
+«DEFINE setupNodePlate FOR gmfgen::GenNode»«ENDDEFINE»
+
+«DEFINE setupNodePlate FOR gmfgen::GenChildSideAffixedNode»
+ //FIXME: workaround for #154536
+ result.getBounds().setSize(result.getPreferredSize());
+«ENDDEFINE»
+
+«DEFINE getPrimaryDragEditPolicy FOR gmfgen::GenNode-»
+ «LET getResizeConstraints(viewmap) AS rc-»
+ «IF null != primaryDragEditPolicyQualifiedClassName || null != rc-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gef.EditPolicy getPrimaryDragEditPolicy() {
+ «IF null != primaryDragEditPolicyQualifiedClassName-»
+ return new «primaryDragEditPolicyQualifiedClassName»();
+ «ELSE-»
+ org.eclipse.gef.EditPolicy result = super.getPrimaryDragEditPolicy();
+ if (result instanceof org.eclipse.gef.editpolicies.ResizableEditPolicy) {
+ org.eclipse.gef.editpolicies.ResizableEditPolicy ep = (org.eclipse.gef.editpolicies.ResizableEditPolicy) result;
+ ep.setResizeDirections(
+ «IF rc.resizeHandleNames.size() > 0-»
+ «FOREACH rc.resizeHandleNames AS name SEPARATOR ' | '»org.eclipse.draw2d.PositionConstants.«name»«ENDFOREACH-»
+ «ELSE»org.eclipse.draw2d.PositionConstants.NONE«ENDIF»);
+ }
+ return result;
+ «ENDIF-»
+ }
+ «ENDIF-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE createFigure FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment(
+ "Creates figure for this edit part.\n" +
+ "\n" +
+ "Body of this method does not depend on settings in generation model\n" +
+ "so you may safely remove <i>generated</i> tag and modify it.\n"
+ )»
+ protected org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure create«IF hasBorderItems()»Main«ELSE»Node«ENDIF»Figure() {
+ org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new org.eclipse.draw2d.StackLayout());
+ org.eclipse.draw2d.IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+«ENDDEFINE»
+
+«DEFINE setupContentPane FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment(
+ "Default implementation treats passed figure as content pane.\n" +
+ "Respects layout one may have set for generated figure.\n" +
+ "@param nodeShape instance of generated figure class"
+ )»
+ protected org.eclipse.draw2d.IFigure setupContentPane(org.eclipse.draw2d.IFigure nodeShape) {
+ «IF !childNodes.isEmpty() || !compartments.isEmpty() || !labels.without(labels.typeSelect(GenExternalNodeLabel)).isEmpty()-»
+ if (nodeShape.getLayoutManager() == null) {
+ «IF getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value-»
+ nodeShape.setLayoutManager(new org.eclipse.draw2d.FreeformLayout() {
+
+ public Object getConstraint(org.eclipse.draw2d.IFigure figure) {
+ Object result = constraints.get(figure);
+ if (result == null) {
+ result = new org.eclipse.draw2d.geometry.Rectangle(0, 0, -1, -1);
+ }
+ return result;
+ }
+ });
+ «ELSE-»
+ org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout layout =new org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ «ENDIF-»
+ }
+ «ENDIF-»
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+«ENDDEFINE»
+
+«DEFINE getContentPane FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.draw2d.IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+«ENDDEFINE»
+
+«DEFINE getPrimaryChildEditPart FOR gmfgen::GenNode-»
+ «IF !labels.isEmpty()-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gef.EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(«EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR getDiagram()»(«EXPAND xpt::editor::VisualIDRegistry::visualID FOR (GenLabel) labels.toList().first()»));
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenTopLevelNode-»
+ if (event.getNotifier() == getModel() && org.eclipse.emf.ecore.EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
+ handleMajorSemanticChange();
+ } else {
+ super.handleNotificationEvent(event);
+ }
+«ENDDEFINE»
+
+«DEFINE innerClassDeclaration FOR gmfgen::Viewmap»
+«ENDDEFINE»
+
+«DEFINE innerClassDeclaration FOR gmfgen::InnerClassViewmap»
+ «classBody»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/impl/diagram/editparts/NodeLabelEditPart.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::diagram::editparts::Utils»
+
+«DEFINE constructor FOR gmfgen::GenNodeLabel-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartClassName»(org.eclipse.gmf.runtime.notation.View view) {
+ super(view);
+ }
+«ENDDEFINE»
+
+«DEFINE createDefaultEditPoliciesBody FOR gmfgen::GenNodeLabel-»
+ super.createDefaultEditPolicies();
+ installEditPolicy(org.eclipse.gef.EditPolicy.DIRECT_EDIT_ROLE, new org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy());
+ installEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE, new org.eclipse.gef.editpolicies.NonResizableEditPolicy() {
+
+ protected java.util.List createSelectionHandles() {
+ java.util.List handles = new java.util.ArrayList();
+ org.eclipse.gef.handles.NonResizableHandleKit.addMoveHandle((org.eclipse.gef.GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(org.eclipse.gef.Request request) {
+ return false;
+ }
+ });
+ «EXPAND xpt::diagram::editparts::Common::behaviour FOR this-»
+«ENDDEFINE»
+
+«DEFINE refreshBounds FOR gmfgen::GenNodeLabel-»
+ «IF isStoringChildPositions(node)-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshBounds() {
+ int width = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width())).intValue();
+ int height = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height())).intValue();
+ org.eclipse.draw2d.geometry.Dimension size = new org.eclipse.draw2d.geometry.Dimension(width, height);
+ int x = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X())).intValue();
+ int y = ((Integer) getStructuralFeatureValue(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y())).intValue();
+ org.eclipse.draw2d.geometry.Point loc = new org.eclipse.draw2d.geometry.Point(x, y);
+ ((org.eclipse.gef.GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), new org.eclipse.draw2d.geometry.Rectangle(loc, size));
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE handleNotificationEventBody FOR gmfgen::GenNodeLabel-»
+ Object feature = event.getFeature();
+ «IF isStoringChildPositions(node)-»
+ «EXPAND xpt::diagram::editparts::Common::handleBounds FOR this-»
+ «ENDIF-»
+ «EXPAND xpt::diagram::editparts::Common::handleText FOR this-»
+ super.handleNotificationEvent(event);
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/impl/diagram/editparts/TextAware.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,545 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE fields FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gef.tools.DirectEditManager manager;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.util.List parserElements;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String defaultText;
+«ENDDEFINE»
+
+«DEFINE methods(Boolean needsRefreshBounds, Boolean readOnly, Boolean useElementIcon, gmfgen::Viewmap viewmap,
+ gmfgen::LabelModelFacet modelFacet, gmfgen::GenCommonBase host, gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND getLabelTextHelper-»
+
+ «EXPAND setLabelTextHelper-»
+
+ «EXPAND getLabelIconHelper-»
+
+ «EXPAND setLabelIconHelper-»
+
+ «EXPAND labelSetter-»
+
+ «EXPAND getModelChildren-»
+
+ «EXPAND getChildBySemanticHint-»
+
+ «EXPAND getParserElement(modelFacet)-»
+
+ «EXPAND getLabelIcon(useElementIcon, diagram)-»
+
+ «EXPAND getLabelText-»
+
+ «EXPAND setLabelText(diagram)-»
+
+ «EXPAND getEditText-»
+
+ «EXPAND isEditable(readOnly)-»
+
+ «EXPAND getEditTextValidator-»
+
+ «EXPAND getCompletionProcessor-»
+
+ «EXPAND getParserOptions-»
+
+ «EXPAND getParser(modelFacet, diagram, host)-»
+
+ «EXPAND getManager(diagram)-»
+
+ «EXPAND setManager-»
+
+ «EXPAND performDirectEdit-»
+
+ «EXPAND performDirectEditAtPoint-»
+
+ «EXPAND performDirectEditWithInitialChar-»
+
+ «EXPAND performDirectEditRequest-»
+
+ «EXPAND refreshVisuals(needsRefreshBounds)-»
+
+ «EXPAND refreshLabel(diagram)-»
+
+ «EXPAND refreshUnderline-»
+
+ «EXPAND refreshStrikeThrough-»
+
+ «EXPAND refreshFont-»
+
+ «EXPAND setFontColor-»
+
+ «EXPAND addSemanticListeners-»
+
+ «EXPAND removeSemanticListeners-»
+
+ «EXPAND getAccessibleEditPart-»
+
+ «EXPAND getFontStyleOwnerView(viewmap)-»
+«ENDDEFINE»
+
+«DEFINE labelSetterName FOR gmfgen::ParentAssignedViewmap-»
+«IF setterName != null»«setterName»«ELSE»setLabel«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE labelSetterName FOR gmfgen::Viewmap»setLabel«ENDDEFINE»
+
+«DEFINE getLabelTextHelper FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getLabelTextHelper(org.eclipse.draw2d.IFigure figure) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getText();
+ } else {
+ return ((org.eclipse.draw2d.Label) figure).getText();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setLabelTextHelper FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setLabelTextHelper(org.eclipse.draw2d.IFigure figure, String text) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setText(text);
+ } else {
+ ((org.eclipse.draw2d.Label) figure).setText(text);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getLabelIconHelper FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.swt.graphics.Image getLabelIconHelper(org.eclipse.draw2d.IFigure figure) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ return ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).getIcon();
+ } else {
+ return ((org.eclipse.draw2d.Label) figure).getIcon();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setLabelIconHelper FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setLabelIconHelper(org.eclipse.draw2d.IFigure figure, org.eclipse.swt.graphics.Image icon) {
+ if (figure instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((org.eclipse.draw2d.Label) figure).setIcon(icon);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE labelSetter FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void «EXPAND labelSetterName FOR viewmap»(«EXPAND labelSetterFigureClassName FOR viewmap» figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+«ENDDEFINE»
+
+«DEFINE labelSetterFigureClassName FOR gmfgen::ParentAssignedViewmap-»
+ «IF figureQualifiedClassName != null-»
+ «figureQualifiedClassName»
+ «ELSE-»
+ org.eclipse.draw2d.IFigure
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE labelSetterFigureClassName FOR gmfgen::Viewmap-»
+ org.eclipse.draw2d.IFigure
+«ENDDEFINE»
+
+«DEFINE getModelChildren FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List getModelChildren() {
+ return java.util.Collections.EMPTY_LIST;
+ }
+«ENDDEFINE»
+
+«DEFINE getChildBySemanticHint FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE getParserElement(gmfgen::LabelModelFacet modelFacet) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.ecore.EObject getParserElement() {
+«IF modelFacet == null»
+ org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
+ return element != null ? element : (org.eclipse.gmf.runtime.notation.View) getModel();
+«ELSE»«EXPAND getParserElement FOR modelFacet»«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE getParserElement FOR gmfgen::LabelModelFacet-»
+ return resolveSemanticElement();
+«ENDDEFINE»
+
+«DEFINE getParserElement FOR gmfgen::DesignLabelModelFacet-»
+ return (org.eclipse.gmf.runtime.notation.View) getModel();
+«ENDDEFINE»
+
+«DEFINE getLabelIcon(Boolean useElementIcon, gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.swt.graphics.Image getLabelIcon() {
+ «IF useElementIcon-»
+ org.eclipse.emf.ecore.EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return «diagram.getElementTypesQualifiedClassName()».getImage(parserElement.eClass());
+ «ELSE-»
+ return null;
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE getLabelText FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getLabelText() {
+ String text = null;
+ org.eclipse.emf.ecore.EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(
+ new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(parserElement),
+ getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+«ENDDEFINE»
+
+«DEFINE setLabelText(gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getEditText FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; «EXPAND xpt::Common::nonNLS»
+ }
+ return getParser().getEditString(
+ new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()),
+ getParserOptions().intValue());
+ }
+«ENDDEFINE»
+
+«DEFINE isEditable(Boolean readOnly) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean isEditable() {
+ «IF readOnly-»
+ return false;
+ «ELSE-»
+ return getParser() != null;
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE getEditTextValidator FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.jface.viewers.ICellEditorValidator getEditTextValidator() {
+ return new org.eclipse.jface.viewers.ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final org.eclipse.emf.ecore.EObject element = getParserElement();
+ final org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = getParser();
+ try {
+ org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus valid =
+ (org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus) getEditingDomain().runExclusive(
+ new org.eclipse.emf.transaction.RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+«ENDDEFINE»
+
+«DEFINE getCompletionProcessor FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(getParserElement()));
+ }
+«ENDDEFINE»
+
+«DEFINE getParserOptions FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions getParserOptions() {
+ return org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE;
+ }
+«ENDDEFINE»
+
+«DEFINE getParser(gmfgen::LabelModelFacet modelFacet, gmfgen::GenDiagram diagram, gmfgen::GenCommonBase host) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser() {
+ if (parser == null) {
+ String parserHint =
+ «IF null == modelFacet-»
+ ((org.eclipse.gmf.runtime.notation.View) getModel()).getType();
+ «ELSE-»
+ «EXPAND parserHint FOR modelFacet-»
+ «ENDIF-»
+ org.eclipse.core.runtime.IAdaptable hintAdapter = new «diagram.getParserProviderQualifiedClassName()».HintAdapter(
+ «diagram.getElementTypesQualifiedClassName()».«host.getUniqueIdentifier()», getParserElement(), parserHint);
+ parser = org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+«ENDDEFINE»
+
+«DEFINE parserHint FOR gmfgen::LabelModelFacet-»
+ ((org.eclipse.gmf.runtime.notation.View) getModel()).getType();
+«ENDDEFINE»
+
+«DEFINE parserHint FOR gmfgen::DesignLabelModelFacet-»
+ org.eclipse.gmf.runtime.common.ui.services.parser.CommonParserHint.DESCRIPTION;
+«ENDDEFINE»
+
+«DEFINE getManager(gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gef.tools.DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager(this,
+ org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.getTextCellEditorClass(this),
+ «diagram.getEditPartFactoryQualifiedClassName()».getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+«ENDDEFINE»
+
+«DEFINE setManager FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setManager(org.eclipse.gef.tools.DirectEditManager manager) {
+ this.manager = manager;
+ }
+«ENDDEFINE»
+
+«DEFINE performDirectEdit FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+«ENDDEFINE»
+
+«DEFINE performDirectEditAtPoint FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void performDirectEdit(org.eclipse.draw2d.geometry.Point eventLocation) {
+ if (getManager().getClass() == org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager.class) {
+ ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE performDirectEditWithInitialChar FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) {
+ ((org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE performDirectEditRequest FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void performDirectEditRequest(org.eclipse.gef.Request request) {
+ final org.eclipse.gef.Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof org.eclipse.gef.requests.DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ org.eclipse.gef.requests.DirectEditRequest editRequest = (org.eclipse.gef.requests.DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE refreshVisuals(Boolean needsRefreshBounds) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ «IF needsRefreshBounds-»
+ refreshBounds();
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE refreshLabel(gmfgen::GenDiagram diagram) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(org.eclipse.gef.EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof «diagram.getTextSelectionEditPolicyQualifiedClassName()») {
+ ((«diagram.getTextSelectionEditPolicyQualifiedClassName()») pdEditPolicy).refreshFeedback();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE refreshUnderline FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshUnderline() {
+ org.eclipse.gmf.runtime.notation.FontStyle style =
+ (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE refreshStrikeThrough FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshStrikeThrough() {
+ org.eclipse.gmf.runtime.notation.FontStyle style =
+ (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE refreshFont FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshFont() {
+ org.eclipse.gmf.runtime.notation.FontStyle style =
+ (org.eclipse.gmf.runtime.notation.FontStyle) getFontStyleOwnerView().getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ org.eclipse.swt.graphics.FontData fontData = new org.eclipse.swt.graphics.FontData(
+ style.getFontName(), style.getFontHeight(),
+ (style.isBold() ? org.eclipse.swt.SWT.BOLD : org.eclipse.swt.SWT.NORMAL) |
+ (style.isItalic() ? org.eclipse.swt.SWT.ITALIC : org.eclipse.swt.SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setFontColor FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setFontColor(org.eclipse.swt.graphics.Color color) {
+ getFigure().setForegroundColor(color);
+ }
+«ENDDEFINE»
+
+«DEFINE addSemanticListeners FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addSemanticListeners() {
+ if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
+ org.eclipse.emf.ecore.EObject element = resolveSemanticElement();
+ parserElements = ((org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (org.eclipse.emf.ecore.EObject) parserElements.get(i)); «EXPAND xpt::Common::nonNLS»
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE removeSemanticListeners FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); «EXPAND xpt::Common::nonNLS»
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getAccessibleEditPart FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gef.AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(org.eclipse.swt.accessibility.AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+«ENDDEFINE»
+
+«DEFINE getFontStyleOwnerView(gmfgen::Viewmap viewmap) FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.View getFontStyleOwnerView() {
+ «IF isFixedFont(viewmap)-»
+ return (org.eclipse.gmf.runtime.notation.View) getModel();
+ «ELSE-»
+ return getPrimaryView();
+ «ENDIF-»
+ }
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/Common.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2006, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE copyright FOR gmfgen::GenEditorGenerator-»
+«IF copyrightText != null-»
+/*
+ * «copyrightText.replaceAll("\n", "\n * ")»
+ */
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE xcopyright FOR gmfgen::GenEditorGenerator-»
+«IF copyrightText != null-»
+<!--
+«copyrightText»
+-->
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE generatedClassComment FOR Object-»
+ «EXPAND generatedClassComment("")-»
+«ENDDEFINE»
+
+«DEFINE generatedClassComment(String comment) FOR Object-»
+/**
+«IF comment.length() > 0-»
+ * «comment.replaceAll("\n", "\n * ")»
+«ENDIF-»
+ * @generated
+ */«ENDDEFINE»
+
+«DEFINE generatedMemberComment FOR Object-»
+ «EXPAND generatedMemberComment("")-»
+«ENDDEFINE»
+
+«DEFINE generatedMemberComment(String comment) FOR Object-»
+/**
+«IF comment.length() > 0-»
+ * «comment.replaceAll("\n", "\n * ")»
+«ENDIF-»
+ * @generated
+ */«ENDDEFINE»
+
+«DEFINE xmlGeneratedTag FOR Object»<?gmfgen generated="true"?>«ENDDEFINE»
+
+«DEFINE getSaveOptions FOR gmfgen::GenDiagram»«getDiagramEditorUtilQualifiedClassName()».getSaveOptions()«ENDDEFINE»
+
+«DEFINE setCharset(String varName) FOR gmfgen::GenDiagram-»
+«getDiagramEditorUtilQualifiedClassName()».setCharset(«varName»);
+«ENDDEFINE»
+
+«DEFINE nonNLS FOR Object»«EXPAND nonNLS(1)»«ENDDEFINE»
+
+«DEFINE nonNLS(Collection[Object] indexes) FOR Object» «EXPAND nonNLS(indexes.add(this).size())»«ENDDEFINE»
+
+«DEFINE nonNLS(int i) FOR Object»//$NON-NLS-«i»$«ENDDEFINE»
+
+«DEFINE caseVisualID FOR gmfgen::GenCommonBase»case «EXPAND xpt::editor::VisualIDRegistry::visualID»:«ENDDEFINE»
+
+«DEFINE addShortcutAnnotation(String viewVar) FOR gmfgen::GenDiagram-»
+ org.eclipse.emf.ecore.EAnnotation shortcutAnnotation = org.eclipse.emf.ecore.EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); «EXPAND xpt::Common::nonNLS»
+ shortcutAnnotation.getDetails().put("modelID", «getEditPartQualifiedClassName()».MODEL_ID); «EXPAND xpt::Common::nonNLS»
+ «viewVar».getEAnnotations().add(shortcutAnnotation);
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/ConstraintProviders.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::GenAuditRoot»
+
+«DEFINE extensions FOR gmfgen::GenEditorGenerator-»
+«IF hasAudits()»«EXPAND extensions FOR audits»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE extensions FOR gmfgen::GenAuditRoot-»
+«EXPAND extensions_emfv_constraintProviders»
+«EXPAND extensions_emfv_constraintBindings»
+«EXPAND extensions_emfv_uiContexts»
+«ENDDEFINE»
+
+//
+// Extension point: org.eclipse.emf.validation.constraintProviders
+//
+«DEFINE extensions_emfv_constraintProviders FOR GenAuditRoot-»
+ <extension point="org.eclipse.emf.validation.constraintProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ «EXPAND declareCategory FOREACH categories-»
+ <constraintProvider cache="true">
+«FOREACH getAllTargetedModelPackages() AS p-»
+ <package namespaceUri="«p.ecorePackage.nsURI»"/>
+«ENDFOREACH-»
+ «EXPAND defineCategory FOREACH categories-»
+ </constraintProvider>
+ </extension>
+«ENDDEFINE»
+
+//
+// Extension point: org.eclipse.emf.validation.constraintBindings
+//
+«DEFINE extensions_emfv_constraintBindings FOR GenAuditRoot-»
+ <extension point="org.eclipse.emf.validation.constraintBindings">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+«FOREACH clientContexts AS ctx-»
+ <clientContext default="false" id="«getQualifiedIdentity(ctx)»">
+ <selector class="«ctx.getQualifiedClassName()»"/>
+ </clientContext>
+ <binding context="«getQualifiedIdentity(ctx)»">
+ «FOREACH rules.select(r | r.target != null && r.target.contextSelector == ctx) /*alternative: ctx.ruleTargets.contains(r.target)*/ AS rule-»
+ <constraint ref="«editorGen.plugin.iD».«escapeXML(rule.id)»"/>
+ «ENDFOREACH-»
+ </binding>
+
+«ENDFOREACH-»
+ </extension>
+«ENDDEFINE»
+
+//
+// Extension point: org.eclipse.emf.validation.ui.UIRegisteredClientContext
+//
+«DEFINE extensions_emfv_uiContexts FOR GenAuditRoot-»
+«IF editorGen.diagram.liveValidationUIFeedback»
+ <extension point="org.eclipse.emf.validation.ui.UIRegisteredClientContext">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+«FOREACH clientContexts AS ctx-»
+ <clientContext id="«getQualifiedIdentity(ctx)»"/>
+«ENDFOREACH-»
+ </extension>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE declareCategory FOR gmfgen::GenAuditContainer-»
+ <category id="«EXPAND _pathMap»" mandatory="false" name="«IF name != null»«escapeXML(name)»«ELSE»«EXPAND _pathMap»«ENDIF»">
+ <![CDATA[«description != null ? description : ""»]]>
+ </category>
+«ENDDEFINE»
+
+«DEFINE defineCategory FOR gmfgen::GenAuditContainer-»
+ <constraints categories="«EXPAND _pathMap»">
+ «FOREACH audits.select(a | a.target != null && a.target.getTargetClass() != null) AS audit-»
+ <constraint id="«escapeXML(audit.id)»"
+ «IF audit.requiresConstraintAdapter»lang="Java" class="«audit.getConstraintAdapterQualifiedClassName()»"«ELSE»lang="OCL"«ENDIF»
+ name="«escapeXML(audit.name != null ? audit.name : audit.id)»"
+ mode="«IF audit.useInLiveMode»Live«ELSE»Batch«ENDIF»"
+ severity="«audit.severity.name»" statusCode="200">
+ «IF !audit.requiresConstraintAdapter»<![CDATA[«audit.rule != null ? audit.rule.body : ""»]]>«ENDIF»
+ <description><![CDATA[«audit.description != null ? audit.description : ""»]]></description>
+ <message><![CDATA[«IF audit.message != null»«audit.message»«ELSE»«audit.name != null ? audit.name : audit.id» audit violated«ENDIF»]]></message>
+ <target class="«audit.target.getTargetClassModelQualifiedName()»"/>
+ </constraint>
+ «ENDFOREACH-»
+ </constraints>
+«ENDDEFINE»
+
+«DEFINE _pathMap FOR gmfgen::GenAuditContainer»«FOREACH path AS p SEPARATOR "/" »«escapeXML(p.id)»«ENDFOREACH»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/EMFUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+List[Object] getReferencingObjects(Object target) :
+ JAVA org.eclipse.gmf.internal.codegen.util.EmfUtils.getReferencingObjects(org.eclipse.emf.ecore.EObject)
+;
+
+String toStringLiteral(String strValue) :
+ JAVA org.eclipse.gmf.internal.codegen.util.EmfUtils.toStringLiteral(java.lang.String)
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/Externalizer.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2006, 2008 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:
+ * Anna Karjakina (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::ExternalizerUtils»
+
+«DEFINE Access FOR gmfgen::GenEditorGenerator-»
+«EXPAND xpt::Common::copyright-»
+package «getExternalizerPackageName()»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «getExternalizerClassName()» extends org.eclipse.osgi.util.NLS {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ static {
+ org.eclipse.osgi.util.NLS.initializeMessages("«getExternalizerClassName().toLowerCase()»", «getExternalizerClassName()».class); «EXPAND xpt::Common::nonNLS»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «getExternalizerClassName()»() {
+ }
+
+ «EXPAND Fields»
+ //TODO: put accessor fields manually
+}
+«ENDDEFINE»
+
+«DEFINE Fields FOR gmfgen::GenEditorGenerator»
+ «EXPAND xpt::editor::CreateShortcutAction::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::CreationWizard::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::CreationWizardPage::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::DiagramEditorUtil::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::DocumentProvider::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::InitDiagramFileAction::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::NewDiagramFileWizard::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::Editor::i18nAccessors FOR editor-»
+ «EXPAND xpt::editor::ElementChooser::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::ShortcutCreationWizard::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::ModelElementSelectionPage::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::ValidateAction::i18nAccessors FOR diagram-»
+ «EXPAND xpt::editor::palette::PaletteFactory::i18nAccessors FOR diagram.palette-»
+ «EXPAND xpt::application::ActionBarAdvisor::i18nAccessors FOR application-»
+ «EXPAND xpt::application::WorkbenchWindowAdvisor::i18nAccessors FOR application-»
+ «EXPAND xpt::application::WizardNewFileCreationPage::i18nAccessors FOR application-»
+ «EXPAND impl::diagram::editparts::CompartmentEditPart::i18nAccessors FOR diagram-»
+ «EXPAND xpt::diagram::editpolicies::OpenDiagram::i18nAccessors FOR diagram-»
+ «EXPAND xpt::navigator::NavigatorContentProvider::i18nAccessors FOR navigator-»
+ «EXPAND xpt::navigator::NavigatorActionProvider::i18nAccessors FOR navigator-»
+ «EXPAND xpt::parsers::AbstractParser::i18nAccessors FOR diagram-»
+ «EXPAND xpt::parsers::MessageFormatParser::i18nAccessors FOR diagram-»
+ «EXPAND xpt::providers::ModelingAssistantProvider::i18nAccessors FOR diagram-»
+«ENDDEFINE»
+
+«DEFINE Values FOR gmfgen::GenEditorGenerator»
+# TODO: manually put keys and values
+«EXPAND xpt::editor::CreateShortcutAction::i18nValues FOR diagram-»
+«EXPAND xpt::editor::CreationWizard::i18nValues FOR diagram-»
+«EXPAND xpt::editor::CreationWizardPage::i18nValues FOR diagram-»
+«EXPAND xpt::editor::DiagramEditorUtil::i18nValues FOR diagram-»
+«EXPAND xpt::editor::DocumentProvider::i18nValues FOR diagram-»
+«EXPAND xpt::editor::InitDiagramFileAction::i18nValues FOR diagram-»
+«EXPAND xpt::editor::NewDiagramFileWizard::i18nValues FOR diagram-»
+«EXPAND xpt::editor::Editor::i18nValues FOR editor-»
+«EXPAND xpt::editor::ElementChooser::i18nValues FOR diagram-»
+«EXPAND xpt::editor::ShortcutCreationWizard::i18nValues FOR diagram-»
+«EXPAND xpt::editor::ModelElementSelectionPage::i18nValues FOR diagram-»
+«EXPAND xpt::editor::ValidateAction::i18nValues FOR diagram-»
+«EXPAND xpt::editor::palette::PaletteFactory::i18nValues FOR diagram.palette-»
+«EXPAND xpt::application::ActionBarAdvisor::i18nValues FOR application-»
+«EXPAND xpt::application::WorkbenchWindowAdvisor::i18nValues FOR application-»
+«EXPAND xpt::application::WizardNewFileCreationPage::i18nValues FOR application-»
+«EXPAND impl::diagram::editparts::CompartmentEditPart::i18nValues FOR diagram-»
+«EXPAND xpt::diagram::editpolicies::OpenDiagram::i18nValues FOR diagram-»
+«EXPAND xpt::navigator::NavigatorContentProvider::i18nValues FOR navigator-»
+«EXPAND xpt::navigator::NavigatorActionProvider::i18nValues FOR navigator-»
+«EXPAND xpt::parsers::AbstractParser::i18nValues FOR diagram-»
+«EXPAND xpt::parsers::MessageFormatParser::i18nValues FOR diagram-»
+«EXPAND xpt::providers::ModelingAssistantProvider::i18nValues FOR diagram-»
+«ENDDEFINE»
+
+«DEFINE accessorField(String key) FOR Object»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static String «escapeIllegalKeySymbols(key)»;
+«ENDDEFINE»
+
+«DEFINE messageEntry(String key, String message) FOR Object-»
+«escapeIllegalKeySymbols(key)»=«escapeIllegalMessageSymbols(message)»
+«ENDDEFINE»
+
+«DEFINE accessorCall(String key) FOR gmfgen::GenEditorGenerator-»
+«getExternalizerPackageName()».«getExternalizerClassName()».«escapeIllegalKeySymbols(key)»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/ExternalizerUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,28 @@
+/*
+ * 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:
+ * Anna Karjakina (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+String getExternalizerPackageName(gmfgen::GenEditorGenerator generator) :
+ generator.editor.packageName
+;
+
+String getExternalizerClassName() : "Messages" ;
+
+String escapeIllegalKeySymbols(String key) :
+ key.replaceAll("[=&\"]", "").replaceAll("[ .]", "_")
+;
+
+String escapeIllegalMessageSymbols(String message) :
+ message.replaceAll("!", "\\\\!")
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/GenAuditRoot.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+
+extension xpt::GenEditorGenerator reexport;
+
+List[genmodel::GenPackage] getAllTargetedModelPackages(gmfgen::GenAuditRoot root) :
+ root.rules.select(r | r.target != null && r.target.getTargetClass() != null).collect(r | r.target.getTargetClass().genPackage).toList().purgeDups()
+;
+
+String getQualifiedIdentity(GenAuditContext ctx) :
+ ctx.root.editorGen.plugin.iD + ctx.id
+;
+
+boolean hasDiagramElementTargetRule(gmfgen::GenAuditRoot audits) :
+ audits != null && audits.rules.target.typeSelect(gmfgen::GenDiagramElementTarget).size() > 0
+;
+
+private boolean hasAnyNotationElementTargetRule(gmfgen::GenAuditRoot audits) :
+ audits != null && audits.rules.target.typeSelect(gmfgen::GenNotationElementTarget).size() > 0
+;
+
+// not sure why NotationElementTarget is here - for GenDiagramElementTarget there's special selector,
+// and nothing special for NotationElementTarget (basically, it's just notation.View)
+// Perhaps, the reason is in ValidateAction use of this method - if there are NotationElementTarget, need
+// to run validation on diagram elements.
+// Present method name reflects my understanding at the moment
+boolean shouldRunValidateOnDiagram(gmfgen::GenAuditRoot audits) :
+ hasDiagramElementTargetRule(audits) || hasAnyNotationElementTargetRule(audits)
+;
+
+
+List[GenCommonBase] getTargetDiagramElements(GenAuditContext ctx) :
+ ctx.ruleTargets.typeSelect(GenDiagramElementTarget).element.purgeDups()
+;
+
+List[GenCommonBase] getAllTargetDiagramElements(GenAuditRoot root) :
+ root.clientContexts.getTargetDiagramElements().purgeDups()
+;
+
+
+String escapeXML(String s) :
+JAVA org.eclipse.gmf.internal.common.codegen.Conversions.escapeXML(java.lang.String)
+;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/GenEditorGenerator.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+// FIXME remove java-only GenEditorGenerator#hasAudits or declare it in metamodel
+boolean hasAudits(gmfgen::GenEditorGenerator editorGen) :
+ editorGen.audits != null && !editorGen.audits.rules.isEmpty()
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/GenModelUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2006, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+/*
+ * GenModel functionality unrelated to EMF generated code
+ * or metamodel access only.
+ */
+
+
+// GenPackage#getDocumentRoot
+genmodel::GenClass getDocumentRoot(genmodel::GenPackage gp) :
+JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.getDocumentRoot(org.eclipse.emf.codegen.ecore.genmodel.GenPackage)
+;
+
+// GenModel#findGenClassifier()
+genmodel::GenClassifier findGenClassifier(genmodel::GenModel genModel, ecore::EClassifier eClassifier) :
+JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.findGenClassifier(org.eclipse.emf.codegen.ecore.genmodel.GenModel, org.eclipse.emf.ecore.EClassifier)
+;
+
+//GenFeature#getReverse
+genmodel::GenFeature getReverse(genmodel::GenFeature feature) :
+ let eReverseFeature = ((ecore::EReference) feature.ecoreFeature).eOpposite :
+ eReverseFeature != null ?
+ (let genClass = (genmodel::GenClass) findGenClassifier(feature.genClass.genPackage.genModel, eReverseFeature.eContainingClass) :
+ genClass != null ?
+ genClass.genFeatures.select(e|e.ecoreFeature == eReverseFeature).first()
+ : null)
+ : null
+;
+
+// For primitive types, return their java.lang wrappers, for non-primitive
+// types returns instanceClassName as is
+String getObjectCompatibleClassName(EDataType dt) :
+ dt.instanceClassName.toCharList().contains(".")
+ ? dt.instanceClassName
+ : switch (dt.instanceClassName) {
+ case "boolean" : "java.lang.Boolean"
+ case "byte" : "java.lang.Byte"
+ case "char" : "java.lang.Character"
+ case "double" : "java.lang.Double"
+ case "float" : "java.lang.Float"
+ case "int" : "java.lang.Integer"
+ case "long" : "java.lang.Long"
+ case "short" : "java.lang.Short"
+ default : "java.lang.Object"
+ }
+;
+
+// GenFeature#isListType()
+boolean isListType(genmodel::GenFeature feature) :
+JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.isListType(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)
+;
+
+// GenFeature#isDerived()
+boolean isDerived(genmodel::GenFeature feature) :
+JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.isDerived(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)
+;
+
+// GenFeature#getTypeGenClass()
+genmodel::GenClass getTypeGenClassX(genmodel::GenFeature feature) :
+JAVA org.eclipse.gmf.internal.codegen.util.GenModelUtils.getTypeGenClass(org.eclipse.emf.codegen.ecore.genmodel.GenFeature)
+;
+
+// GenFeature#getTypeGenClassifier()
+genmodel::GenClassifier getTypeGenClassifier(genmodel::GenFeature feature) :
+ findGenClassifier(feature.genClass.genPackage.genModel, feature.ecoreFeature.eType)
+;
+
+// FIXME: for models loaded from generated package (e.g. gmf tests often
+// refer to EClass/EOperation directly from EcorePackage) instanceClassName
+// is always set and thus all metamodel types are treated as external interfaces,
+// with useless casts to EObject
+//
+// GenClass#isExternalInterface()
+boolean isExternalInterface(genmodel::GenClass genClass) :
+ null != genClass.ecoreClass.instanceClassName
+;
+
+
+// GenFeatureImpl#isContains
+boolean isContains(genmodel::GenFeature gf) :
+ isReferenceType(gf) && ((ecore::EReference) gf.ecoreFeature).containment
+;
+
+boolean isPrimitiveType(genmodel::GenFeature gf) :
+ {"boolean", "byte", "char", "double", "float", "int", "long", "short"}.contains(gf.ecoreFeature.eType.instanceClassName)
+;
+
+private boolean isReferenceType(genmodel::GenFeature gf) :
+ !{gf.ecoreFeature}.typeSelect(ecore::EReference).isEmpty()
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/application/ActionBarAdvisor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,266 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::application::i18n»
+
+«DEFINE ActionBarAdvisor FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «actionBarAdvisorClassName» extends org.eclipse.ui.application.ActionBarAdvisor {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.actions.ActionFactory.IWorkbenchAction lockToolBarAction;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.actions.ActionFactory.IWorkbenchAction toggleCoolbarAction;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «actionBarAdvisorClassName»(org.eclipse.ui.application.IActionBarConfigurer configurer) {
+ super(configurer);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.IWorkbenchWindow getWindow() {
+ return getActionBarConfigurer().getWindowConfigurer().getWindow();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void makeActions(org.eclipse.ui.IWorkbenchWindow window) {
+ toggleCoolbarAction = org.eclipse.ui.actions.ActionFactory.TOGGLE_COOLBAR.create(window);
+ register(toggleCoolbarAction);
+ lockToolBarAction = org.eclipse.ui.actions.ActionFactory.LOCK_TOOL_BAR.create(window);
+ register(lockToolBarAction);
+ «EXPAND makeAction("window") FOREACH sharedContributionItems-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void fillMenuBar(org.eclipse.jface.action.IMenuManager menu) {
+ «EXPAND fill("menu") FOR mainMenu-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void fillCoolBar(org.eclipse.jface.action.ICoolBarManager toolBar) {
+ org.eclipse.jface.action.IMenuManager popUpMenu = new org.eclipse.jface.action.MenuManager();
+ popUpMenu.add(new org.eclipse.jface.action.ActionContributionItem(lockToolBarAction));
+ popUpMenu.add(new org.eclipse.jface.action.ActionContributionItem(toggleCoolbarAction));
+ toolBar.setContextMenuManager(popUpMenu);
+ «EXPAND fill("toolBar") FOR mainToolBar-»
+ }
+
+ «EXPAND openEditor FOR editorGen.editor-»
+
+ «EXPAND actions-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE openEditor FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static boolean openEditor(org.eclipse.ui.IWorkbench workbench, org.eclipse.emf.common.util.URI fileURI) {
+ org.eclipse.ui.IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
+ org.eclipse.ui.IWorkbenchPage page = workbenchWindow.getActivePage();
+ org.eclipse.ui.IEditorDescriptor editorDescriptor =
+ workbench.getEditorRegistry().getDefaultEditor(fileURI.toFileString());
+ if (editorDescriptor == null) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(workbenchWindow.getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(editorGen.application.i18nKeyForDefaultFileEditorErrorDialog().titleKey()) FOR editorGen»,
+ org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(editorGen.application.i18nKeyForDefaultFileEditorErrorDialog().messageKey()) FOR editorGen»,
+ fileURI.toFileString()));
+ return false;
+ } else {
+ try {
+ page.openEditor(new org.eclipse.emf.common.ui.URIEditorInput(fileURI), editorDescriptor.getId());
+ } catch (org.eclipse.ui.PartInitException exception) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(
+ workbenchWindow.getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(editorGen.application.i18nKeyForDefaultEditorOpenErrorDialog().titleKey()) FOR editorGen»,
+ exception.getMessage());
+ return false;
+ }
+ }
+ return true;
+ }
+«ENDDEFINE»
+
+«DEFINE makeAction(String windowVar) FOR gmfgen::GenContributionItem»
+ «ERROR "Can not make action for " + this»
+«ENDDEFINE»
+
+«DEFINE makeAction(String windowVar) FOR gmfgen::GenActionFactoryContributionItem»
+ register(org.eclipse.ui.actions.ActionFactory.«name».create(«windowVar»));
+«ENDDEFINE»
+
+«DEFINE fill(String managerVar) FOR gmfgen::GenContributionManager»
+ «EXPAND contribute(managerVar) FOREACH items-»
+«ENDDEFINE»
+
+«DEFINE contribute(String managerVar) FOR gmfgen::GenContributionItem»
+ «ERROR "Can not contribute item: " + this»
+«ENDDEFINE»
+
+«DEFINE contribute(String managerVar) FOR gmfgen::GenGroupMarker»
+ «managerVar».add(new org.eclipse.jface.action.GroupMarker(«groupName»));
+«ENDDEFINE»
+
+«DEFINE contribute(String managerVar) FOR gmfgen::GenSeparator»
+ «managerVar».add(new org.eclipse.jface.action.Separator(«IF null != groupName»«groupName»«ENDIF»));
+«ENDDEFINE»
+
+«DEFINE contribute(String managerVar) FOR gmfgen::GenMenuManager»
+ «LET managerVar + "X" AS menuVar-»
+ {
+ org.eclipse.jface.action.IMenuManager «menuVar» = new org.eclipse.jface.action.MenuManager(
+ «IF null != name»«EXPAND xpt::Externalizer::accessorCall(i18nKeyForMenu()) FOR this.application.editorGen»«ELSE»null«ENDIF»«IF null != iD», «iD»«ENDIF»);
+ «EXPAND contribute(menuVar) FOREACH items-»
+ «managerVar».add(«menuVar»);
+ }
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE contribute(String managerVar) FOR gmfgen::GenToolBarManager»
+ «LET managerVar + "X" AS toolBarVar-»
+ {
+ org.eclipse.jface.action.IToolBarManager «toolBarVar» = new org.eclipse.jface.action.ToolBarManager();
+ «EXPAND contribute(toolBarVar) FOREACH items-»
+ «managerVar».add(new org.eclipse.jface.action.ToolBarContributionItem(«toolBarVar»«IF null != iD», «iD»«ENDIF»));
+ }
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE contribute(String managerVar) FOR gmfgen::GenSharedContributionItem»
+ «EXPAND contributeShared(managerVar) FOR actualItem-»
+«ENDDEFINE»
+
+«DEFINE contributeShared(String managerVar) FOR gmfgen::GenContributionItem»
+ «ERROR "Can not contribute shared item: " + this»
+«ENDDEFINE»
+
+«DEFINE contributeShared(String managerVar) FOR gmfgen::GenActionFactoryContributionItem»
+ «managerVar».add(getAction(org.eclipse.ui.actions.ActionFactory.«name».getId()));
+«ENDDEFINE»
+
+«DEFINE actions FOR gmfgen::GenApplication»
+«EXPAND NewDiagramAction-»
+«EXPAND OpenUriAction-»
+«EXPAND OpenAction-»
+«EXPAND AboutAction-»
+«ENDDEFINE»
+
+«DEFINE NewDiagramAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedClassComment»
+ public static class NewDiagramAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ «editorGen.diagram.getCreationWizardQualifiedClassName()» wizard =
+ new «editorGen.diagram.getCreationWizardQualifiedClassName()»();
+ wizard.init(getWindow().getWorkbench(), org.eclipse.jface.viewers.StructuredSelection.EMPTY);
+ org.eclipse.jface.wizard.WizardDialog wizardDialog =
+ new org.eclipse.jface.wizard.WizardDialog(getWindow().getShell(), wizard);
+ wizardDialog.open();
+ }
+ }
+
+«ENDDEFINE»
+
+«DEFINE OpenUriAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedClassComment»
+ public static class OpenURIAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog =
+ new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(getWindow().getShell());
+ if (org.eclipse.jface.dialogs.Dialog.OK == loadResourceDialog.open()) {
+ for (java.util.Iterator i = loadResourceDialog.getURIs().iterator(); i.hasNext();) {
+ openEditor(getWindow().getWorkbench(), (org.eclipse.emf.common.util.URI) i.next());
+ }
+ }
+ }
+ }
+
+«ENDDEFINE»
+
+«DEFINE OpenAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedClassComment»
+ public static class OpenAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.swt.widgets.FileDialog fileDialog =
+ new org.eclipse.swt.widgets.FileDialog(getWindow().getShell(), org.eclipse.swt.SWT.OPEN);
+ fileDialog.open();
+ if (fileDialog.getFileName() != null && fileDialog.getFileName().length() > 0) {
+ openEditor(getWindow().getWorkbench(), org.eclipse.emf.common.util.URI.createFileURI(
+ fileDialog.getFilterPath() + java.io.File.separator + fileDialog.getFileName()));
+ }
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE AboutAction FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedClassComment»
+ public static class AboutAction extends org.eclipse.emf.common.ui.action.WorkbenchWindowActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.jface.dialogs.MessageDialog.openInformation(getWindow().getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForAboutDialog().titleKey()) FOR editorGen»,
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForAboutDialog().messageKey()) FOR editorGen»
+ );
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForDefaultFileEditorErrorDialog().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForDefaultFileEditorErrorDialog().messageKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForDefaultEditorOpenErrorDialog().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForAboutDialog().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForAboutDialog().messageKey())-»
+«IF null != mainMenu-»
+«EXPAND internal_i18nAccessors FOR mainMenu-»
+«EXPAND internal_i18nAccessors FOREACH mainMenu.items.collectGenMenuManagers()-»
+«ENDIF»
+«EXPAND internal_i18nAccessors FOREACH sharedContributionItems.collectGenMenuManagers()-»
+«ENDDEFINE»
+
+«DEFINE internal_i18nAccessors FOR gmfgen::GenMenuManager-»
+«IF null != name»«EXPAND xpt::Externalizer::accessorField(i18nKeyForMenu())»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDefaultFileEditorErrorDialog().titleKey(), "Error")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDefaultFileEditorErrorDialog().messageKey(), "There is no editor registered for the file \"{0}\"")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDefaultEditorOpenErrorDialog().titleKey(), "Open Editor")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAboutDialog().titleKey(), "About")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAboutDialog().messageKey(), editorGen.modelID+" Diagram Editor")-»
+«IF null != mainMenu-»
+«EXPAND internal_i18nValues FOR mainMenu-»
+«EXPAND internal_i18nValues FOREACH mainMenu.items.collectGenMenuManagers()-»
+«ENDIF»
+«EXPAND internal_i18nValues FOREACH sharedContributionItems.collectGenMenuManagers()-»
+«ENDDEFINE»
+
+«DEFINE internal_i18nValues FOR gmfgen::GenMenuManager-»
+«IF null != name»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMenu(), name)»«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/application/Application.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,46 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE Application FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» implements org.eclipse.core.runtime.IPlatformRunnable {
+
+«EXPAND run-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public Object run(Object args) throws Exception {
+ org.eclipse.swt.widgets.Display display = org.eclipse.ui.PlatformUI.createDisplay();
+ try {
+ int returnCode = org.eclipse.ui.PlatformUI.createAndRunWorkbench(display,
+ new «getWorkbenchAdvisorQualifiedClassName()»());
+ if (returnCode == org.eclipse.ui.PlatformUI.RETURN_RESTART) {
+ return org.eclipse.core.runtime.IPlatformRunnable.EXIT_RESTART;
+ }
+ return org.eclipse.core.runtime.IPlatformRunnable.EXIT_OK;
+ } finally {
+ display.dispose();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/application/Perspective.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,45 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE Perspective FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «perspectiveClassName» implements org.eclipse.ui.IPerspectiveFactory {
+ «EXPAND createInitialLayout-»
+ «EXPAND additions-»
+«ENDDEFINE»
+«DEFINE createInitialLayout FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void createInitialLayout(org.eclipse.ui.IPageLayout layout) {
+ layout.setEditorAreaVisible(true);
+ layout.addPerspectiveShortcut(«getWorkbenchAdvisorQualifiedClassName()».PERSPECTIVE_ID);
+ org.eclipse.ui.IFolderLayout right = layout.createFolder(
+ "right", org.eclipse.ui.IPageLayout.RIGHT, 0.6f, layout.getEditorArea()); «EXPAND xpt::Common::nonNLS»
+ right.addView(org.eclipse.ui.IPageLayout.ID_OUTLINE);
+ org.eclipse.ui.IFolderLayout bottomRight = layout.createFolder(
+ "bottomRight", org.eclipse.ui.IPageLayout.BOTTOM, 0.6f, "right"); «EXPAND xpt::Common::nonNLS» «EXPAND xpt::Common::nonNLS(2)»
+ bottomRight.addView(org.eclipse.ui.IPageLayout.ID_PROP_SHEET);
+ «EXPAND layoutAdditions-»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE layoutAdditions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/application/WizardNewFileCreationPage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,206 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::application::i18n»
+
+«DEFINE WizardNewFileCreationPage FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class WizardNewFileCreationPage extends org.eclipse.jface.wizard.WizardPage {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.jface.viewers.IStructuredSelection currentSelection;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String initialFileName;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.core.runtime.IPath initialContainerFullPath;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.swt.widgets.Text fileNameEditor;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public WizardNewFileCreationPage(String name, org.eclipse.jface.viewers.IStructuredSelection currentSelection) {
+ super(name);
+ this.currentSelection = currentSelection;
+ String home = System.getProperty("user.home"); //$NON-NLS-1$
+ if (home != null) {
+ initialContainerFullPath = new org.eclipse.core.runtime.Path(home);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.jface.viewers.IStructuredSelection getSelection() {
+ return currentSelection;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getFileName() {
+ if (fileNameEditor == null) {
+ return initialFileName;
+ }
+ org.eclipse.core.runtime.IPath path = getFilePath();
+ if (path == null || path.isEmpty() || path.hasTrailingSeparator()) {
+ return null;
+ }
+ return path.lastSegment();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setFileName(String fileName) {
+ if (fileNameEditor == null) {
+ initialFileName = fileName;
+ return;
+ }
+ setFilePath(getContainerFullPath(), fileName);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.core.runtime.IPath getContainerFullPath() {
+ if (fileNameEditor == null) {
+ return initialContainerFullPath;
+ }
+ org.eclipse.core.runtime.IPath path = getFilePath();
+ if (path == null || path.isEmpty()) {
+ return null;
+ }
+ if (path.hasTrailingSeparator()) {
+ return path;
+ }
+ path = path.removeLastSegments(1);
+ if (path.isEmpty()) {
+ return null;
+ }
+ return path.addTrailingSeparator();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setContainerFullPath(org.eclipse.core.runtime.IPath containerPath) {
+ if (fileNameEditor == null) {
+ initialContainerFullPath = containerPath;
+ return;
+ }
+ setFilePath(containerPath, getFileName());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.core.runtime.IPath getFilePath() {
+ String fileName = fileNameEditor.getText().trim();
+ if (fileName.length() == 0) {
+ return null;
+ }
+ return new org.eclipse.core.runtime.Path(fileNameEditor.getText());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setFilePath(org.eclipse.core.runtime.IPath containerPath, String fileName) {
+ if (fileName == null) {
+ fileName = ""; //$NON-NLS-1$
+ } else {
+ fileName = fileName.trim();
+ }
+ if (containerPath == null) {
+ fileNameEditor.setText(fileName);
+ } else {
+ if (!containerPath.hasTrailingSeparator()) {
+ containerPath = containerPath.addTrailingSeparator();
+ }
+ org.eclipse.core.runtime.IPath path = fileName.length() == 0 ? containerPath : containerPath.append(fileName);
+ fileNameEditor.setText(path.toOSString());
+ }
+ setPageComplete(validatePage());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void createControl(org.eclipse.swt.widgets.Composite parent) {
+ org.eclipse.swt.widgets.Composite plate = new org.eclipse.swt.widgets.Composite(parent, org.eclipse.swt.SWT.NONE);
+ plate.setLayout(new org.eclipse.swt.layout.GridLayout(2, false));
+ org.eclipse.swt.widgets.Label label = new org.eclipse.swt.widgets.Label(plate, org.eclipse.swt.SWT.NONE);
+ label.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardFileLabel()) FOR editorGen»);
+ label.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.SWT.BEGINNING, org.eclipse.swt.SWT.CENTER, false, false, 2, 1));
+ fileNameEditor = new org.eclipse.swt.widgets.Text(plate, org.eclipse.swt.SWT.SINGLE | org.eclipse.swt.SWT.BORDER);
+ fileNameEditor.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.SWT.FILL, org.eclipse.swt.SWT.CENTER, true, false));
+ org.eclipse.swt.widgets.Button button = new org.eclipse.swt.widgets.Button(plate, org.eclipse.swt.SWT.PUSH);
+ button.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardBrowseButton()) FOR editorGen»);
+ button.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.SWT.BEGINNING, org.eclipse.swt.SWT.CENTER, false, false));
+
+ // logic
+ fileNameEditor.addModifyListener(new org.eclipse.swt.events.ModifyListener() {
+
+ public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
+ setPageComplete(validatePage());
+ }
+ });
+ button.addSelectionListener(new org.eclipse.swt.events.SelectionListener() {
+
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
+ org.eclipse.swt.widgets.FileDialog dialog = new org.eclipse.swt.widgets.FileDialog(getShell(), org.eclipse.swt.SWT.SAVE);
+ dialog.setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardSelectDialog()) FOR editorGen»);
+ dialog.setFileName(getFileName());
+ String fileName = dialog.open();
+ if (fileName != null) {
+ fileNameEditor.setText(fileName);
+ setPageComplete(validatePage());
+ }
+ }
+
+ public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
+ }
+ });
+
+ // init
+ setFilePath(initialContainerFullPath, initialFileName);
+ setControl(plate);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean validatePage() {
+ String fileName = fileNameEditor.getText().trim();
+ if (fileName.length() == 0) {
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardEmpty()) FOR editorGen»);
+ return false;
+ }
+ if (!new org.eclipse.core.runtime.Path("").isValidPath(fileName)) { //$NON-NLS-1$
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewFileWizardInvalid()) FOR editorGen»);
+ return false;
+ }
+ setErrorMessage(null);
+ return true;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardFileLabel(), "File:")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardBrowseButton(), "Browse")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardSelectDialog(), "Select new file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardEmpty(), "Specify file name")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewFileWizardInvalid(), "Invalid file name")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardFileLabel())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardBrowseButton())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardSelectDialog())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardEmpty())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForNewFileWizardInvalid())-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/application/WorkbenchAdvisor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE WorkbenchAdvisor FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «workbenchAdvisorClassName» extends org.eclipse.ui.application.WorkbenchAdvisor {
+«EXPAND perspectiveId-»
+
+«EXPAND getInitialWindowPerspectiveId-»
+
+«EXPAND initialize-»
+
+«EXPAND createWorkbenchWindowAdvisor-»
+
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE perspectiveId FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String PERSPECTIVE_ID = "«perspectiveId»"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE getInitialWindowPerspectiveId FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getInitialWindowPerspectiveId() {
+ return PERSPECTIVE_ID;
+ }
+«ENDDEFINE»
+
+«DEFINE initialize FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void initialize(org.eclipse.ui.application.IWorkbenchConfigurer configurer) {
+ super.initialize(configurer);
+ configurer.setSaveAndRestore(true);
+ }
+«ENDDEFINE»
+
+«DEFINE createWorkbenchWindowAdvisor FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.ui.application.WorkbenchWindowAdvisor createWorkbenchWindowAdvisor(
+ org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer) {
+ return new «getWorkbenchWindowAdvisorQualifiedClassName()»(configurer);
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/application/WorkbenchWindowAdvisor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,63 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::application::i18n»
+
+«DEFINE WorkbenchWindowAdvisor FOR gmfgen::GenApplication-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «workbenchWindowAdvisorClassName» extends org.eclipse.ui.application.WorkbenchWindowAdvisor {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «workbenchWindowAdvisorClassName»(org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer) {
+ super(configurer);
+ }
+
+ «EXPAND createActionBarAdvisor-»
+
+ «EXPAND preWindowOpen-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE createActionBarAdvisor FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.ui.application.ActionBarAdvisor createActionBarAdvisor(org.eclipse.ui.application.IActionBarConfigurer configurer) {
+ return new «getActionBarAdvisorQualifiedClassName()»(configurer);
+ }
+«ENDDEFINE»
+
+«DEFINE preWindowOpen FOR gmfgen::GenApplication-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void preWindowOpen() {
+ org.eclipse.ui.application.IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
+ configurer.setInitialSize(new org.eclipse.swt.graphics.Point(1000, 700));
+ configurer.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForWindowTitle()) FOR editorGen»);
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenApplication-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForWindowTitle())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenApplication-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForWindowTitle(), title)-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/application/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE extensions FOR gmfgen::GenApplication-»
+
+ <extension id="«iD»" point="org.eclipse.core.runtime.applications">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <application>
+ <run class="«getQualifiedClassName()»"/>
+ </application>
+ </extension>
+
+ <extension point="org.eclipse.ui.perspectives">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <perspective
+ id="«perspectiveId»"
+ name="%perspectiveName"
+ class="«getPerspectiveQualifiedClassName()»">
+ </perspective>
+ </extension>
+
+ <extension point="org.eclipse.ui.commands">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <command
+ name="%openURIActionLabel"
+ description="%openURIActionDescription"
+ categoryId="org.eclipse.ui.category.file"
+ id="«editorGen.plugin.iD».OpenURICommand"/>
+ <command
+ name="%openActionLabel"
+ description="%openActionDescription"
+ categoryId="org.eclipse.ui.category.file"
+ id="«editorGen.plugin.iD».OpenCommand"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <key
+ commandId="«editorGen.plugin.iD».OpenURICommand"
+ sequence="M1+U"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ <key
+ commandId="«editorGen.plugin.iD».OpenCommand"
+ sequence="M1+O"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.actionSets">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <actionSet
+ label="%applicationActionSetLabel"
+ visible="true"
+ id="«editorGen.plugin.iD».ActionSet">
+ <action
+ label="%newDiagramActionLabel"
+ class="«getActionBarAdvisorQualifiedClassName()»$NewDiagramAction"
+ menubarPath="file/new/additions"
+ id="«editorGen.plugin.iD».NewDiagramAction">
+ </action>
+ <action
+ label="%aboutActionLabel"
+ class="«getActionBarAdvisorQualifiedClassName()»$AboutAction"
+ menubarPath="help/additions"
+ id="«editorGen.plugin.iD».AboutAction">
+ </action>
+ <action
+ label="%openURIActionLabel"
+ definitionId="«editorGen.plugin.iD».OpenURICommand"
+ class="«getActionBarAdvisorQualifiedClassName()»$OpenURIAction"
+ menubarPath="file/additions"
+ id="«editorGen.plugin.iD».OpenURIAction">
+ </action>
+ <action
+ label="%openActionLabel"
+ definitionId="«editorGen.plugin.iD».OpenCommand"
+ class="«getActionBarAdvisorQualifiedClassName()»$OpenAction"
+ menubarPath="file/additions"
+ id="«editorGen.plugin.iD».OpenAction">
+ </action>
+ </actionSet>
+ </extension>
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/application/i18n.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2007 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:
+ * Anna Karjakina (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+String i18nKeyForDefaultFileEditorErrorDialog(gmfgen::GenApplication app) :
+ app.actionBarAdvisorClassName+".DefaultFileEditor"
+;
+
+String i18nKeyForDefaultEditorOpenErrorDialog(gmfgen::GenApplication app) :
+ app.actionBarAdvisorClassName+".DefaultEditorOpenError"
+;
+
+String i18nKeyForWindowTitle(gmfgen::GenApplication app) :
+ app.workbenchWindowAdvisorClassName+".Title"
+;
+
+String i18nKeyForAboutDialog(gmfgen::GenApplication app) :
+ app.actionBarAdvisorClassName+".AboutDialog"
+;
+
+String titleKey(String dialogKey) :
+ dialogKey+"Title"
+;
+
+String messageKey(String dialogKey) :
+ dialogKey+"Message"
+;
+
+String i18nKeyForMenu(gmfgen::GenMenuManager menuManager) :
+ "ApplicationMenuName."+menuManager.name
+;
+
+List[gmfgen::GenMenuManager] collectGenMenuManagers(Collection[gmfgen::GenContributionItem] allItems) :
+ collectAllContributionItems(allItems).typeSelect(gmfgen::GenMenuManager)
+;
+
+List[gmfgen::GenContributionManager] collectAllContributionItems(Collection[gmfgen::GenContributionItem] allItems) :
+ let managers = allItems.typeSelect(gmfgen::GenContributionManager) :
+ managers.addAll(managers.collect(item| collectAllContributionItems(item.items)).flatten())
+;
+
+String i18nKeyForNewFileWizardFileLabel(gmfgen::GenApplication app) :
+app.wizardNewFileCreationPageClassName()+".FileLabel"
+;
+
+String i18nKeyForNewFileWizardBrowseButton(gmfgen::GenApplication app) :
+app.wizardNewFileCreationPageClassName()+".BrowseButton"
+;
+
+String i18nKeyForNewFileWizardSelectDialog(gmfgen::GenApplication app) :
+app.wizardNewFileCreationPageClassName()+".SelectNewFileDialog"
+;
+
+String i18nKeyForNewFileWizardEmpty(gmfgen::GenApplication app) :
+app.wizardNewFileCreationPageClassName()+".EmptyFileNameError"
+;
+
+String i18nKeyForNewFileWizardInvalid(gmfgen::GenApplication app) :
+app.wizardNewFileCreationPageClassName()+".InvalidFileNameError"
+;
+
+private String wizardNewFileCreationPageClassName(gmfgen::GenApplication app) :
+"WizardNewFileCreationPage"
+;
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/Utils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,39 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+
+extension xpt::GenModelUtils;
+
+// all diagram nodes
+List[gmfgen::GenNode] getNodes(gmfgen::GenDiagram diagram) :
+ {}.addAll(diagram.topLevelNodes).addAll(diagram.childNodes)
+;
+
+// all elements that may have element type: diagram, nodes and links
+List[gmfgen::GenCommonBase] getElements(gmfgen::GenDiagram diagram) :
+ { diagram }.addAll(diagram.topLevelNodes).addAll(diagram.childNodes).addAll(diagram.links)
+;
+
+boolean hasExplicitChildFeature(gmfgen::TypeModelFacet facet) :
+ !isDerived(facet.childMetaFeature) && facet.childMetaFeature != facet.containmentMetaFeature
+;
+
+List[gmfgen::GenLink] getOutgoingLinks(gmfgen::GenNode node) :
+ node.getDiagram().links.select(link | link.getAssistantSources().contains(node))
+;
+
+List[gmfgen::GenLink] getIncomingLinks(gmfgen::GenNode node) :
+ node.getDiagram().links.select(link | link.getAssistantTargets().contains(node))
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/ViewmapAttributesUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,62 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+Boolean isStoringChildPositions(gmfgen::ViewmapLayoutType layoutType) :
+ gmfgen::ViewmapLayoutType::XY_LAYOUT.literal == layoutType.literal
+;
+
+Boolean isFixedFont(gmfgen::Viewmap viewmap) :
+ null != viewmap && viewmap.attributes.typeSelect(gmfgen::StyleAttributes).exists(e | e.fixedFont)
+;
+
+Boolean isFixedForeground(gmfgen::Viewmap viewmap) :
+ null != viewmap && viewmap.attributes.typeSelect(gmfgen::StyleAttributes).exists(e | e.fixedForeground)
+;
+
+Boolean isFixedBackground(gmfgen::Viewmap viewmap) :
+ null != viewmap && viewmap.attributes.typeSelect(gmfgen::StyleAttributes).exists(e | e.fixedBackground)
+;
+
+gmfgen::ResizeConstraints getResizeConstraints(gmfgen::Viewmap viewmap) :
+ null == viewmap ? null : ((gmfgen::ResizeConstraints) viewmap.attributes.typeSelect(gmfgen::ResizeConstraints).first())
+;
+
+gmfgen::DefaultSizeAttributes getDefaultSizeAttributes(gmfgen::Viewmap viewmap) :
+ null == viewmap ? null : ((gmfgen::DefaultSizeAttributes) viewmap.attributes.typeSelect(gmfgen::DefaultSizeAttributes).first())
+;
+
+Integer defaultSizeWidth(gmfgen::Viewmap viewmap, Integer defaultValue) :
+ let a = getDefaultSizeAttributes(viewmap) :
+ (null == a ? defaultValue : a.width)
+;
+
+Integer defaultSizeHeight(gmfgen::Viewmap viewmap, Integer defaultValue) :
+ let a = getDefaultSizeAttributes(viewmap) :
+ (null == a ? defaultValue : a.height)
+;
+
+gmfgen::LabelOffsetAttributes getLabelOffsetAttributes(gmfgen::Viewmap viewmap) :
+ null == viewmap ? null : ((gmfgen::LabelOffsetAttributes) viewmap.attributes.typeSelect(gmfgen::LabelOffsetAttributes).first())
+;
+
+Integer labelOffsetX(gmfgen::Viewmap viewmap, Integer defaultValue) :
+ let a = getLabelOffsetAttributes(viewmap) :
+ (null == a ? defaultValue : a.x)
+;
+
+Integer labelOffsetY(gmfgen::Viewmap viewmap, Integer defaultValue) :
+ let a = getLabelOffsetAttributes(viewmap) :
+ (null == a ? defaultValue : a.y)
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/commands/CreateLinkCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::Utils»
+
+«DEFINE CreateLinkCommand FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
+package «diagram.editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «createCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand {
+ «EXPAND xpt::diagram::commands::CreateLinkUtils::fields FOR modelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest request,
+ org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) {
+ super(request);
+ «EXPAND xpt::diagram::commands::CreateLinkUtils::init FOR modelFacet-»
+ }
+ «EXPAND xpt::diagram::commands::CreateLinkUtils::canCreate(this) FOR modelFacet-»
+ «EXPAND body(this) FOR modelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(
+ org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info)
+ throws org.eclipse.core.commands.ExecutionException {
+ if (!canExecute()) {
+ throw new org.eclipse.core.commands.ExecutionException("Invalid arguments in create link command"); «EXPAND xpt::Common::nonNLS»
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest createConfigureRequest() {
+ org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setElementToEdit(org.eclipse.emf.ecore.EObject element) {
+ throw new UnsupportedOperationException();
+ }
+ «EXPAND xpt::diagram::commands::CreateLinkUtils::accessors FOR modelFacet-»
+}
+«ENDDEFINE»
+
+«DEFINE body(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE body(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.ecore.EObject doDefaultElementCreation() {
+ «EXPAND MetaModel::NewInstance("newElement") FOR metaClass-»
+ «EXPAND CreateLinkUtils::addValue(sourceMetaFeature != null ? "getContainer()" : "getSource()", containmentMetaFeature.genClass, "newElement") FOR containmentMetaFeature-»
+ «IF sourceMetaFeature != null-»
+ «EXPAND CreateLinkUtils::addValue("newElement", metaClass, "getSource()") FOR sourceMetaFeature-»
+ «ENDIF-»
+ «EXPAND CreateLinkUtils::addValue("newElement", metaClass, "getTarget()") FOR targetMetaFeature-»
+ «IF hasExplicitChildFeature()-»
+ «IF sourceMetaFeature != null-»
+ «EXPAND CreateLinkUtils::addValue("getContainer()", containmentMetaFeature.genClass, "newElement") FOR childMetaFeature-»
+ «ELSE-»
+ «EXPAND CreateLinkUtils::addValue("getSource()", getSourceType(), "newElement") FOR childMetaFeature-»
+ «ENDIF-»
+ «ENDIF-»
+ «EXPAND initialize(link, "newElement")-»
+ return «EXPAND MetaModel::DowncastToEObject("newElement") FOR metaClass»;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.ecore.EClass getEClassToEdit() {
+ return «EXPAND MetaModel::MetaClass FOR containmentMetaFeature.genClass»;
+ }
+«ENDDEFINE»
+
+«DEFINE initialize(GenLink link, String newElementvVar) FOR TypeModelFacet»«IF modelElementInitializer != null-»
+«link.diagram.getElementTypesQualifiedClassName()».init_«link.getUniqueIdentifier()»(«newElementvVar»);
+«ENDIF»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/commands/CreateLinkUtils.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::Utils»
+
+«REM»
+ Check whether link may be created.
+«ENDREM»
+«DEFINE canCreate(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && «EXPAND MetaModel::NotInstance("source") FOR getSourceType()») {
+ return false;
+ }
+ if (target != null && «EXPAND MetaModel::NotInstance("target") FOR getTargetType()») {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not defined yet
+ }
+ // target may be null here but it's possible to check constraint
+ «EXPAND canCreateElement(link)-»
+ }
+«ENDDEFINE»
+
+«DEFINE canCreateElement(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
+ return «EXPAND validatorInvocation FOR link»(getSource(), getTarget());
+«ENDDEFINE»
+
+«DEFINE canCreateElement(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet-»
+ «IF sourceMetaFeature != null-»
+ if (getContainer() == null) {
+ return false;
+ }
+ «ENDIF-»
+ return «EXPAND validatorInvocation FOR link»(
+ «IF sourceMetaFeature != null»getContainer(), «ENDIF»getSource(), getTarget());
+«ENDDEFINE»
+
+«DEFINE validatorInvocation FOR gmfgen::GenLink-»
+«diagram.getBaseItemSemanticEditPolicyQualifiedClassName()».
+ «diagram.getLinkCreationConstraintsClassName()».canCreate«getUniqueIdentifier()-»
+«ENDDEFINE»
+
+«REM»
+ Fields of command that creates link.
+«ENDREM»
+«DEFINE fields FOR gmfgen::LinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.ecore.EObject source;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.ecore.EObject target;
+ «EXPAND containerField-»
+«ENDDEFINE»
+
+«DEFINE containerField FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE containerField FOR gmfgen::TypeLinkModelFacet-»
+ «IF sourceMetaFeature != null-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container;
+ «ENDIF-»
+«ENDDEFINE»
+
+«REM»
+ Field accessors of command that creates link.
+«ENDREM»
+«DEFINE accessors FOR gmfgen::LinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getSource() {
+ return «EXPAND MetaModel::CastEObject("source") FOR getSourceType()»;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» getTarget() {
+ return «EXPAND MetaModel::CastEObject("target") FOR getTargetType()»;
+ }
+ «EXPAND containerAccessor-»
+«ENDDEFINE»
+
+«DEFINE containerAccessor FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE containerAccessor FOR gmfgen::TypeLinkModelFacet-»
+ «IF sourceMetaFeature != null-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» getContainer() {
+ return container;
+ }
+ «ENDIF-»
+«ENDDEFINE»
+
+«REM»
+ Part of the constructor that performs initialization.
+«ENDREM»
+«DEFINE init FOR gmfgen::LinkModelFacet-»
+ this.source = source;
+ this.target = target;
+ «EXPAND initContainment-»
+«ENDDEFINE»
+
+«DEFINE initContainment FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE initContainment FOR gmfgen::TypeLinkModelFacet-»
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(«EXPAND MetaModel::MetaFeature FOR containmentMetaFeature»);
+ }
+ «REM»XXX!!!
+ (1) why getContainer() only when sourceMetaFeature is set
+ (2) FIXME - do not need to setElementToEdit unless use doDefaultElementCreation (no) and canExecute from [Create|Edit]ElementCommand (no, IMO)
+ «ENDREM»
+ «IF sourceMetaFeature != null-»
+ // Find container element for the new link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (org.eclipse.emf.ecore.EObject element = source; element != null; element = element.eContainer()) {
+ if («EXPAND MetaModel::IsInstance("element") FOR containmentMetaFeature.genClass») {
+ container = «EXPAND MetaModel::CastEObject("element") FOR containmentMetaFeature.genClass»;
+ super.«EXPAND setElementToEdit("container") FOR containmentMetaFeature-»
+ break;
+ }
+ }
+ «ELSE-»
+ super.«EXPAND setElementToEdit("source") FOR containmentMetaFeature-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setElementToEdit(String elementVar) FOR genmodel::GenFeature-»
+ setElementToEdit(«EXPAND MetaModel::DowncastToEObject(elementVar) FOR genClass»);
+«ENDDEFINE»
+
+«DEFINE addValue(String containerVar, genmodel::GenClass containerClass, String valueVar) FOR genmodel::GenFeature-»
+«IF isListType()-»
+ «EXPAND MetaModel::getFeatureValue(containerVar, containerClass)».add(«valueVar»);
+«ELSE-»
+ «EXPAND MetaModel::setFeatureValue(containerVar, containerClass, valueVar)»;
+«ENDIF-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/commands/CreateNodeCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::Utils»
+
+«DEFINE CreateNodeCommand FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «createCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand {
+
+ «EXPAND constructor-»
+ «IF modelFacet.isPhantomElement() || modelFacet.containmentMetaFeature != null || modelFacet.childMetaFeature != null-»
+
+ «EXPAND getElementToEdit-»
+ «IF modelFacet.isPhantomElement()-»
+
+ «EXPAND canExecute_Phantom-»
+
+ «EXPAND getContainmentFeature-»
+
+ «EXPAND doDefaultElementCreation_Phantom(this) FOR modelFacet-»
+ «ELSE-»
+ «EXPAND canExecute_Normal FOR modelFacet-»
+
+ «EXPAND getEClassToEdit FOR modelFacet-»
+ «EXPAND doDefaultElementCreation_Normal(this) FOR modelFacet-»
+ «ENDIF-»
+ «ENDIF-»
+
+}
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
+ super(req);
+}
+«ENDDEFINE»
+
+«DEFINE getElementToEdit FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.ecore.EObject getElementToEdit() {
+ org.eclipse.emf.ecore.EObject container = ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof org.eclipse.gmf.runtime.notation.View) {
+ container = ((org.eclipse.gmf.runtime.notation.View) container).getElement();
+ }
+ return container;
+}
+«ENDDEFINE»
+
+«REM»
+ TODO: Shouldn't this method just return true?
+«ENDREM»
+«DEFINE canExecute_Phantom FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean canExecute() {
+ if (getEClass() != null) {
+ return getEClass().isSuperTypeOf(getEClassToEdit());
+ }
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE canExecute_Normal FOR gmfgen::TypeModelFacet-»
+ «IF containmentMetaFeature.ecoreFeature.upperBound > 0 || (childMetaFeature != containmentMetaFeature && childMetaFeature.ecoreFeature.upperBound > 0)-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean canExecute() {
+ «EXPAND MetaModel::DeclareAndAssign("container", "getElementToEdit()") FOR containmentMetaFeature.genClass-»
+ «IF containmentMetaFeature.ecoreFeature.upperBound > 0-»
+ «IF containmentMetaFeature.ecoreFeature.upperBound == 1»
+ if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR containmentMetaFeature» != null) {
+ «ELSE-»
+ if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR containmentMetaFeature».size() >= «containmentMetaFeature.ecoreFeature.upperBound») {
+ «ENDIF-»
+ return false;
+ }
+ «ENDIF-»
+ «IF childMetaFeature != containmentMetaFeature && childMetaFeature.ecoreFeature.upperBound > 0-»
+ «IF childMetaFeature.ecoreFeature.upperBound == 1-»
+ if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR childMetaFeature» != null) {
+ «ELSE-»
+ if («EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR childMetaFeature».size() >= «childMetaFeature.ecoreFeature.upperBound») {
+ «ENDIF-»
+ return false;
+ }
+ «ENDIF-»
+ return true;
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getContainmentFeature FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.ecore.EReference getContainmentFeature() {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getEClassToEdit FOR gmfgen::TypeModelFacet-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.ecore.EClass getEClassToEdit() {
+ return «EXPAND MetaModel::MetaClass FOR containmentMetaFeature.genClass»;
+}
+«ENDDEFINE»
+
+«DEFINE doDefaultElementCreation_Phantom(gmfgen::GenNode node) FOR TypeModelFacet-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.ecore.EObject doDefaultElementCreation() {
+ // Uncomment to put "phantom" objects into the diagram file.
+ // org.eclipse.emf.ecore.resource.Resource resource =
+ // ((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) getRequest()).getContainer().eResource();
+ // if (resource == null) {
+ // return null;
+ // }
+ org.eclipse.emf.ecore.resource.Resource resource = getElementToEdit().eResource();
+ «EXPAND MetaModel::NewInstance("newElement") FOR metaClass»
+ resource.getContents().add(«EXPAND MetaModel::DowncastToEObject("newElement") FOR metaClass»);
+ «EXPAND initialize(node, "newElement")-»
+ return «EXPAND MetaModel::DowncastToEObject("newElement") FOR metaClass»;
+}
+«ENDDEFINE»
+
+«DEFINE doDefaultElementCreation_Normal(gmfgen::GenNode node) FOR gmfgen::TypeModelFacet-»
+ «IF modelElementInitializer != null || hasExplicitChildFeature(this)-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.ecore.EObject doDefaultElementCreation() {
+ «EXPAND MetaModel::NewInstance("newElement") FOR metaClass»
+«IF containmentMetaFeature != null-»
+ «EXPAND MetaModel::DeclareAndAssign("owner", "getElementToEdit()") FOR containmentMetaFeature.genClass»
+ «EXPAND CreateLinkUtils::addValue("owner", containmentMetaFeature.genClass, "newElement") FOR containmentMetaFeature-»
+«ENDIF»
+«IF hasExplicitChildFeature(this)-»
+ «EXPAND MetaModel::DeclareAndAssign("childHolder", "getElementToEdit()") FOR childMetaFeature.genClass»
+ «EXPAND CreateLinkUtils::addValue("childHolder", childMetaFeature.genClass, "newElement") FOR childMetaFeature»
+«ENDIF-»
+ «EXPAND initialize(node, "newElement")-»
+ return «EXPAND MetaModel::DowncastToEObject("newElement") FOR metaClass»;
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE initialize(gmfgen::GenNode node, String newElementVar) FOR gmfgen::TypeModelFacet»«IF modelElementInitializer != null-»
+«node.getDiagram().getElementTypesQualifiedClassName()».init_«node.getUniqueIdentifier()»(«newElementVar»);
+«ENDIF»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/commands/CreateRefLinkCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE CreateRefLinkCommand FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
+package «diagram.editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «createCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
+ «EXPAND xpt::diagram::commands::CreateLinkUtils::fields FOR modelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «createCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest request,
+ org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject target) {
+ super(request.getLabel(), null, request);
+ «EXPAND xpt::diagram::commands::CreateLinkUtils::init FOR modelFacet-»
+ }
+ «EXPAND xpt::diagram::commands::CreateLinkUtils::canCreate(this) FOR modelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(
+ org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info)
+ throws org.eclipse.core.commands.ExecutionException {
+ if (!canExecute()) {
+ throw new org.eclipse.core.commands.ExecutionException("Invalid arguments in create link command"); «EXPAND xpt::Common::nonNLS»
+ }
+ if (getSource() != null && getTarget() != null) {
+ «EXPAND setValue FOR modelFacet-»
+ }
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
+ }
+ «EXPAND xpt::diagram::commands::CreateLinkUtils::accessors FOR modelFacet-»
+}
+«ENDDEFINE»
+
+«DEFINE setValue FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«REM»
+ Code to update reference.
+«ENDREM»
+«DEFINE setValue FOR gmfgen::FeatureLinkModelFacet-»
+ «IF metaFeature.ecoreFeature.many-»
+ «EXPAND MetaModel::getFeatureValue("getSource()", getSourceType()) FOR metaFeature».add(getTarget());
+ «ELSE-»
+ «EXPAND MetaModel::setFeatureValue("getSource()", getSourceType(), "getTarget()") FOR metaFeature»;
+ «ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/commands/CreateShortcutDecorationsCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE CreateShortcutDecorationsCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «createShortcutDecorationsCommandClassName»
+ extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.util.List myDescriptors;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «createShortcutDecorationsCommandClassName»(
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
+ org.eclipse.gmf.runtime.notation.View parentView,
+ java.util.List viewDescriptors) {
+ super(editingDomain, "Create Shortcuts", getWorkspaceFiles(parentView)); //$NON-NLS-1$
+ myDescriptors = viewDescriptors;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «createShortcutDecorationsCommandClassName»(
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain,
+ org.eclipse.gmf.runtime.notation.View parentView,
+ org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor viewDescriptor) {
+ this(editingDomain, parentView, java.util.Collections.singletonList(viewDescriptor));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(
+ org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info)
+ throws org.eclipse.core.commands.ExecutionException {
+ for (java.util.Iterator it = myDescriptors.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor nextDescriptor =
+ (org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor) it.next();
+ org.eclipse.gmf.runtime.notation.View view =
+ (org.eclipse.gmf.runtime.notation.View) nextDescriptor.getAdapter(
+ org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null && view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ «EXPAND xpt::Common::addShortcutAnnotation("view")-»
+ }
+ }
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
+ }
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/commands/ReorientLinkCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE ReorientLinkCommand FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
+package «diagram.editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «reorientCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final int reorientDirection;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.ecore.EObject oldEnd;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.ecore.EObject newEnd;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «reorientCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+ «EXPAND xpt::diagram::commands::ReorientLinkUtils::canReorient(this) FOR modelFacet-»
+ «EXPAND xpt::diagram::commands::ReorientLinkUtils::reorient FOR modelFacet-»
+ «EXPAND xpt::diagram::commands::ReorientLinkUtils::accessors-»
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/commands/ReorientLinkUtils.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::Utils»
+
+«REM»
+ Expands to all accessor methods for link and it's ends.
+«ENDREM»
+«DEFINE accessors FOR gmfgen::GenLink-»
+ «EXPAND linkAccessor FOR modelFacet-»
+ «EXPAND oldSourceAccessor FOR modelFacet-»
+ «EXPAND newSourceAccessor FOR modelFacet-»
+ «EXPAND oldTargetAccessor FOR modelFacet-»
+ «EXPAND newTargetAccessor FOR modelFacet-»
+«ENDDEFINE»
+
+«DEFINE linkAccessor FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE linkAccessor FOR gmfgen::TypeLinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «EXPAND MetaModel::QualifiedClassName FOR metaClass» getLink() {
+ return «EXPAND MetaModel::CastEObject("getElementToEdit()") FOR metaClass»;
+ }
+«ENDDEFINE»
+
+«DEFINE oldSourceAccessor FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE oldSourceAccessor FOR gmfgen::TypeLinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getOldSource() {
+ return «EXPAND MetaModel::CastEObject("oldEnd") FOR getSourceType()»;
+ }
+«ENDDEFINE»
+
+«DEFINE oldSourceAccessor FOR gmfgen::FeatureLinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getOldSource() {
+ return «EXPAND MetaModel::CastEObject("referenceOwner") FOR getSourceType()»;
+ }
+«ENDDEFINE»
+
+«DEFINE newSourceAccessor FOR gmfgen::LinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «EXPAND MetaModel::QualifiedClassName FOR getSourceType()» getNewSource() {
+ return «EXPAND MetaModel::CastEObject("newEnd") FOR getSourceType()»;
+ }
+«ENDDEFINE»
+
+«DEFINE oldTargetAccessor FOR gmfgen::LinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» getOldTarget() {
+ return «EXPAND MetaModel::CastEObject("oldEnd") FOR getTargetType()»;
+ }
+«ENDDEFINE»
+
+«DEFINE newTargetAccessor FOR gmfgen::LinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» getNewTarget() {
+ return «EXPAND MetaModel::CastEObject("newEnd") FOR getTargetType()»;
+ }
+«ENDDEFINE»
+
+«REM»
+ Generates canExecute() method for the command that reorients link.
+ Implementation should perform all static checks that command can be executed.
+«ENDREM»
+«DEFINE canReorient(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean canExecute() {
+ «EXPAND checkLinkValidity-»
+ if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean canReorientSource() {
+ «EXPAND checkSourceRequestValidity(link)-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean canReorientTarget() {
+ «EXPAND checkTargetRequestValidity(link)-»
+ }
+«ENDDEFINE»
+
+«DEFINE checkLinkValidity FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE checkLinkValidity FOR gmfgen::TypeLinkModelFacet-»
+ if («EXPAND MetaModel::NotInstance("getElementToEdit()") FOR metaClass») {
+ return false;
+ }
+«ENDDEFINE»
+
+«DEFINE checkLinkValidity FOR gmfgen::FeatureLinkModelFacet-»
+ if («EXPAND MetaModel::NotInstance("referenceOwner") FOR getSourceType()») {
+ return false;
+ }
+«ENDDEFINE»
+
+«DEFINE checkSourceRequestValidity(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE checkSourceRequestValidity(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet-»
+ if (!(«EXPAND MetaModel::IsInstance("oldEnd") FOR getSourceType()» && «EXPAND MetaModel::IsInstance("newEnd") FOR getSourceType()»)) {
+ return false;
+ }
+ «EXPAND extractFeatureWithCheck("getLink()", metaClass, "target", getTargetType()) FOR targetMetaFeature-»
+ «EXPAND checkLinkConstraint(link, "getNewSource()", "target")-»
+«ENDDEFINE»
+
+«REM»
+ When feature source is being reoriented oldEnd is the link target.
+«ENDREM»
+«DEFINE checkSourceRequestValidity(gmfgen::GenLink link) FOR gmfgen::FeatureLinkModelFacet-»
+ if (!(«EXPAND MetaModel::IsInstance("oldEnd") FOR getTargetType()» && «EXPAND MetaModel::IsInstance("newEnd") FOR getSourceType()»)) {
+ return false;
+ }
+ return «EXPAND checkLinkConstraintInvocation FOR link»(getNewSource(), getOldTarget());
+«ENDDEFINE»
+
+«DEFINE checkTargetRequestValidity(gmfgen::GenLink link) FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE checkTargetRequestValidity(gmfgen::GenLink link) FOR gmfgen::TypeLinkModelFacet-»
+ if (!(«EXPAND MetaModel::IsInstance("oldEnd") FOR getTargetType()» && «EXPAND MetaModel::IsInstance("newEnd") FOR getTargetType()»)) {
+ return false;
+ }
+ «IF sourceMetaFeature != null-»
+ «EXPAND extractFeatureWithCheck("getLink()", metaClass, "source", getSourceType()) FOR sourceMetaFeature-»
+ «ELSE-»
+ if (!(«EXPAND MetaModel::IsContainerInstance("getLink()", metaClass) FOR getSourceType()»)) {
+ return false;
+ }
+ «EXPAND MetaModel::DeclareAndAssignContainer("source", "getLink()", metaClass) FOR getSourceType()»
+ «ENDIF-»
+ «EXPAND checkLinkConstraint(link, "source", "getNewTarget()")-»
+«ENDDEFINE»
+
+«DEFINE checkTargetRequestValidity(gmfgen::GenLink link) FOR gmfgen::FeatureLinkModelFacet-»
+ if (!(«EXPAND MetaModel::IsInstance("oldEnd") FOR getTargetType()» && «EXPAND MetaModel::IsInstance("newEnd") FOR getTargetType()»)) {
+ return false;
+ }
+ return «EXPAND checkLinkConstraintInvocation FOR link»(getOldSource(), getNewTarget());
+«ENDDEFINE»
+
+«DEFINE extractFeatureWithCheck(String containerVar, GenClass containerMetaClass, String var, GenClass varMetaClass) FOR genmodel::GenFeature-»
+ «IF ecoreFeature.many-»
+ if («EXPAND MetaModel::getFeatureValue(containerVar, containerMetaClass)».size() != 1) {
+ return false;
+ }
+ «EXPAND MetaModel::DeclareAndAssign2(var, containerVar, containerMetaClass, this, "get(0)", true) FOR varMetaClass»
+ «ELSE-»
+ «EXPAND MetaModel::DeclareAndAssign(var, containerVar, containerMetaClass, this) FOR varMetaClass»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkLinkConstraint(gmfgen::GenLink link, String sourceVar, String targetVar) FOR gmfgen::TypeLinkModelFacet-»
+ «IF sourceMetaFeature != null-»
+ if (!(«EXPAND MetaModel::IsContainerInstance("getLink()", metaClass) FOR containmentMetaFeature.genClass»)) {
+ return false;
+ }
+ «EXPAND MetaModel::DeclareAndAssignContainer("container", "getLink()", metaClass) FOR containmentMetaFeature.genClass»
+ return «EXPAND checkLinkConstraintInvocation FOR link»(container, «sourceVar», «targetVar»);
+ «ELSE-»
+ return «EXPAND checkLinkConstraintInvocation FOR link»(«sourceVar», «targetVar»);
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkLinkConstraintInvocation FOR gmfgen::GenLink-»
+ «diagram.getBaseItemSemanticEditPolicyQualifiedClassName()».«diagram.getLinkCreationConstraintsClassName()».canExist«getUniqueIdentifier()»
+«ENDDEFINE»
+
+«REM»
+ Generates doExecuteWithResult() method for the command that reorients link.
+ Implementation should throw ExecutionException if it can't execute the command.
+«ENDREM»
+«DEFINE reorient FOR gmfgen::LinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(
+ org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info)
+ throws org.eclipse.core.commands.ExecutionException {
+ if (!canExecute()) {
+ throw new org.eclipse.core.commands.ExecutionException("Invalid arguments in reorient link command"); «EXPAND xpt::Common::nonNLS»
+ }
+ if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientSource() throws org.eclipse.core.commands.ExecutionException {
+ «EXPAND reorientSource-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult reorientTarget() throws org.eclipse.core.commands.ExecutionException {
+ «EXPAND reorientTarget-»
+ }
+«ENDDEFINE»
+
+«DEFINE reorientSource FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«REM»
+ Shouldn't we change link container here?
+«ENDREM»
+«DEFINE reorientSource FOR gmfgen::TypeLinkModelFacet-»
+ «IF sourceMetaFeature != null-»
+ «EXPAND changeTarget("getLink()", metaClass, "getOldSource()", "getNewSource()") FOR sourceMetaFeature-»
+ «ELSE-»
+ «EXPAND changeSource("getLink()", "getOldSource()", "getNewSource()", getSourceType()) FOR containmentMetaFeature-»
+ «ENDIF-»
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(getLink());
+«ENDDEFINE»
+
+«REM»
+ When feature source is being reoriented oldEnd is the link target.
+«ENDREM»
+«DEFINE reorientSource FOR gmfgen::FeatureLinkModelFacet-»
+ «EXPAND changeSource("getOldTarget()", "getOldSource()", "getNewSource()", getSourceType()) FOR metaFeature-»
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(referenceOwner);
+«ENDDEFINE»
+
+«DEFINE reorientTarget FOR gmfgen::LinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE reorientTarget FOR gmfgen::TypeLinkModelFacet-»
+ «EXPAND changeTarget("getLink()", metaClass, "getOldTarget()", "getNewTarget()") FOR targetMetaFeature-»
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(getLink());
+«ENDDEFINE»
+
+«DEFINE reorientTarget FOR gmfgen::FeatureLinkModelFacet-»
+ «EXPAND changeTarget("getOldSource()", getSourceType(), "getOldTarget()", "getNewTarget()") FOR metaFeature-»
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult(referenceOwner);
+«ENDDEFINE»
+
+«REM»
+ Replace old target with the new one in the source.
+«ENDREM»
+«DEFINE changeTarget(String sourceVar, genmodel::GenClass sourceVarGenClass, String oldTargetVar, String newTargetVar) FOR genmodel::GenFeature-»
+ «IF isListType()-»
+ «EXPAND MetaModel::getFeatureValue(sourceVar, sourceVarGenClass)».remove(«oldTargetVar»);
+ «EXPAND MetaModel::getFeatureValue(sourceVar, sourceVarGenClass)».add(«newTargetVar»);
+ «ELSE-»
+ «EXPAND MetaModel::setFeatureValue(sourceVar, sourceVarGenClass, newTargetVar)»;
+ «ENDIF-»
+«ENDDEFINE»
+
+«REM»
+ Move target from old source to the new one.
+«ENDREM»
+«DEFINE changeSource(String targetVar, String oldSourceVar, String newSourceVar, genmodel::GenClass sourceVarGenClass) FOR genmodel::GenFeature-»
+ «IF isListType()-»
+ «EXPAND MetaModel::getFeatureValue(oldSourceVar, sourceVarGenClass)».remove(«targetVar»);
+ «EXPAND MetaModel::getFeatureValue(newSourceVar, sourceVarGenClass)».add(«targetVar»);
+ «ELSE-»
+ «EXPAND MetaModel::setFeatureValue(oldSourceVar, sourceVarGenClass, "null")»;
+ «EXPAND MetaModel::setFeatureValue(newSourceVar, sourceVarGenClass, targetVar)»;
+ «ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/commands/ReorientLinkViewCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE ReorientLinkViewCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «reorientConnectionViewCommandClassName»
+ extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.core.runtime.IAdaptable edgeAdaptor;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «reorientConnectionViewCommandClassName»(
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, String label) {
+ super(editingDomain, label, null);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List getAffectedFiles() {
+ org.eclipse.gmf.runtime.notation.View view =
+ (org.eclipse.gmf.runtime.notation.View) edgeAdaptor.getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null) {
+ return getWorkspaceFiles(view);
+ }
+ return super.getAffectedFiles();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.core.runtime.IAdaptable getEdgeAdaptor() {
+ return edgeAdaptor;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setEdgeAdaptor(org.eclipse.core.runtime.IAdaptable edgeAdaptor) {
+ this.edgeAdaptor = edgeAdaptor;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(
+ org.eclipse.core.runtime.IProgressMonitor progressMonitor, org.eclipse.core.runtime.IAdaptable info) {
+ assert null != edgeAdaptor : "Null child in «reorientConnectionViewCommandClassName»"; //$NON-NLS-1$
+ org.eclipse.gmf.runtime.notation.Edge edge =
+ (org.eclipse.gmf.runtime.notation.Edge) getEdgeAdaptor().getAdapter(org.eclipse.gmf.runtime.notation.Edge.class);
+ assert null != edge : "Null edge in «reorientConnectionViewCommandClassName»"; //$NON-NLS-1$
+ org.eclipse.gmf.runtime.notation.View tempView = edge.getSource();
+ edge.setSource(edge.getTarget());
+ edge.setTarget(tempView);
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
+ }
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/commands/ReorientRefLinkCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE ReorientRefLinkCommand FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
+package «diagram.editCommandsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «reorientCommandClassName» extends org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final int reorientDirection;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.ecore.EObject referenceOwner;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.ecore.EObject oldEnd;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.ecore.EObject newEnd;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «reorientCommandClassName»(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+ «EXPAND xpt::diagram::commands::ReorientLinkUtils::canReorient(this) FOR modelFacet-»
+ «EXPAND xpt::diagram::commands::ReorientLinkUtils::reorient FOR modelFacet-»
+ «EXPAND xpt::diagram::commands::ReorientLinkUtils::accessors-»
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/edithelpers/BaseEditHelper.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,72 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE BaseEditHelper FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editHelpersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «baseEditHelperClassName» extends org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.ICommand getInsteadCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
+ org.eclipse.gmf.runtime.common.core.command.ICommand epCommand =
+ (org.eclipse.gmf.runtime.common.core.command.ICommand) req.getParameter(EDIT_POLICY_COMMAND);
+ req.setParameter(EDIT_POLICY_COMMAND, null);
+ org.eclipse.gmf.runtime.common.core.command.ICommand ehCommand = super.getInsteadCommand(req);
+ if (epCommand == null) {
+ return ehCommand;
+ }
+ if (ehCommand == null) {
+ return epCommand;
+ }
+ org.eclipse.gmf.runtime.common.core.command.CompositeCommand command =
+ new org.eclipse.gmf.runtime.common.core.command.CompositeCommand(null);
+ command.add(epCommand);
+ command.add(ehCommand);
+ return command;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.ICommand getCreateCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.ICommand getCreateRelationshipCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.ICommand getDestroyElementCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.ICommand getDestroyReferenceCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
+ return null;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/edithelpers/EditHelper.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,25 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE EditHelper FOR gmfgen::MetamodelType-»
+«EXPAND xpt::Common::copyright FOR diagramElement.getDiagram().editorGen-»
+package «diagramElement.getDiagram().editHelpersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editHelperClassName» extends «diagramElement.getDiagram().getBaseEditHelperQualifiedClassName()» {
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::MetamodelType»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/edithelpers/EditHelperAdvice.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,25 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE EditHelperAdvice FOR gmfgen::SpecializationType-»
+«EXPAND xpt::Common::copyright FOR diagramElement.getDiagram().editorGen-»
+package «diagramElement.getDiagram().editHelpersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editHelperAdviceClassName» extends org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelperAdvice {
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::SpecializationType»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editparts/Common.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,154 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE visualIDConstant FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final int VISUAL_ID = «visualID»;
+«ENDDEFINE»
+
+«DEFINE behaviour FOR gmfgen::GenCommonBase-»
+ «EXPAND behaviour FOREACH behaviour-»
+«ENDDEFINE»
+
+«DEFINE behaviour FOR gmfgen::Behaviour-»
+«ENDDEFINE»
+
+«DEFINE behaviour FOR gmfgen::CustomBehaviour-»
+«IF editPolicyQualifiedClassName == null || editPolicyQualifiedClassName.trim().length() == 0-»
+ removeEditPolicy(«key»); «IF key.startsWith('\"') && key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
+«ELSE-»
+ installEditPolicy(«key», new «getEditPolicyQualifiedClassName()»()); «IF key.startsWith('\"') && key.endsWith('\"')»«EXPAND xpt::Common::nonNLS»«ENDIF»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE behaviour FOR gmfgen::OpenDiagramBehaviour-»
+ installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.OPEN_ROLE,
+ new «getEditPolicyQualifiedClassName()»());
+«ENDDEFINE»
+
+«DEFINE labelFigure FOR gmfgen::ParentAssignedViewmap-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createFigure() {
+ // Parent should assign one using «EXPAND impl::diagram::editparts::TextAware::labelSetterName»() method
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE labelFigure FOR gmfgen::Viewmap-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createFigure() {
+ org.eclipse.draw2d.IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createFigurePrim() {
+ «EXPAND labelFigurePrim FOR this-»
+«ENDDEFINE»
+
+«DEFINE labelFigurePrim FOR gmfgen::FigureViewmap-»
+«IF figureQualifiedClassName == null-»
+ return new org.eclipse.draw2d.Label();
+«ELSE-»
+ return new «figureQualifiedClassName»();
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE labelFigurePrim FOR gmfgen::SnippetViewmap-»
+ return «body»;
+ }
+«ENDDEFINE»
+
+«DEFINE labelFigurePrim FOR gmfgen::InnerClassViewmap-»
+ return new «className»();
+ }
+
+ «classBody»
+«ENDDEFINE»
+
+«DEFINE labelFigurePrim FOR gmfgen::Viewmap-»
+ «ERROR "Unknown viewmap: " + this-»
+ }
+«ENDDEFINE»
+
+«DEFINE notationalListeners FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); «EXPAND xpt::Common::nonNLS»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); «EXPAND xpt::Common::nonNLS»
+ }
+«ENDDEFINE»
+
+«DEFINE handleBounds FOR gmfgen::GenCommonBase-»
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Width().equals(feature) ||
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getSize_Height().equals(feature) ||
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_X().equals(feature) ||
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLocation_Y().equals(feature)) {
+ refreshBounds();
+ }
+«ENDDEFINE»
+
+«DEFINE handleText FOR gmfgen::GenCommonBase-»
+ if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry.getInstance().getColor(c));
+ } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) ||
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature) ||
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) ||
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) {
+ org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser modelParser =
+ (org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE installSemanticEditPolicy FOR gmfgen::GenCommonBase-»
+ «IF sansDomain-»
+removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE);
+ «ELSE-»
+installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.SEMANTIC_ROLE, new «getItemSemanticEditPolicyQualifiedClassName()»());
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE installCanonicalEditPolicy FOR gmfgen::GenContainerBase-»
+ «IF needsCanonicalEditPolicy()-»
+installEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.CANONICAL_ROLE, new «getCanonicalEditPolicyQualifiedClassName()»());
+ «ENDIF-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editparts/EditPartFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,135 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE EditPartFactory FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «editPartsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartFactoryClassName» implements org.eclipse.gef.EditPartFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gef.EditPart createEditPart(org.eclipse.gef.EditPart context, Object model) {
+ if (model instanceof org.eclipse.gmf.runtime.notation.View) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) model;
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view)) {
+ «EXPAND createEditPart FOR this-»
+ «FOREACH (List[gmfgen::GenNode]) {}.addAll(topLevelNodes).addAll(childNodes) AS node-»
+ «EXPAND createEditPart FOR node-»
+ «FOREACH node.labels AS label-»
+ «EXPAND createEditPart FOR label-»
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ «FOREACH compartments AS compartment-»
+ «EXPAND createEditPart FOR compartment-»
+ «ENDFOREACH-»
+ «FOREACH links AS link-»
+ «EXPAND createEditPart FOR link-»
+ «FOREACH link.labels AS label-»
+ «EXPAND createEditPart FOR label-»
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ }
+ }
+ return createUnrecognizedEditPart(context, model);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gef.EditPart createUnrecognizedEditPart(org.eclipse.gef.EditPart context, Object model) {
+ // Handle creation of unrecognized child node EditParts here
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator(
+ org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart source) {
+ if (source.getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)
+ return new TextCellEditorLocator((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) source.getFigure());
+ else {
+ return new LabelCellEditorLocator((org.eclipse.draw2d.Label) source.getFigure());
+ }
+ }
+
+ «EXPAND xpt::Common::generatedClassComment»
+ static private class TextCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel wrapLabel;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public TextCellEditorLocator(org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel wrapLabel) {
+ this.wrapLabel = wrapLabel;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getWrapLabel() {
+ return wrapLabel;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) {
+ org.eclipse.swt.widgets.Text text = (org.eclipse.swt.widgets.Text) celleditor.getControl();
+ org.eclipse.draw2d.geometry.Rectangle rect = getWrapLabel().getTextBounds().getCopy();
+ getWrapLabel().translateToAbsolute(rect);
+ if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
+ rect.setSize(new org.eclipse.draw2d.geometry.Dimension(
+ text.computeSize(rect.width, org.eclipse.swt.SWT.DEFAULT)));
+ } else {
+ int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new org.eclipse.draw2d.geometry.Dimension(
+ text.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
+ }
+ if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+ }
+
+ «EXPAND xpt::Common::generatedClassComment»
+ private static class LabelCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.draw2d.Label label;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public LabelCellEditorLocator(org.eclipse.draw2d.Label label) {
+ this.label = label;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.draw2d.Label getLabel() {
+ return label;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) {
+ org.eclipse.swt.widgets.Text text = (org.eclipse.swt.widgets.Text) celleditor.getControl();
+ org.eclipse.draw2d.geometry.Rectangle rect = getLabel().getTextBounds().getCopy();
+ getLabel().translateToAbsolute(rect);
+ int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new org.eclipse.draw2d.geometry.Dimension(
+ text.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
+ if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE createEditPart FOR gmfgen::GenCommonBase»
+ «EXPAND xpt::Common::caseVisualID»
+ return new «getEditPartQualifiedClassName()»(view);
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editparts/Utils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,68 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+Boolean isStoringChildPositions(gmfgen::GenNode node) :
+ node.getLayoutType().value == gmfgen::ViewmapLayoutType::XY_LAYOUT.value
+;
+
+List[gmfgen::GenExternalNodeLabel] getExternalLabels(gmfgen::GenNode node) :
+ node.labels.typeSelect(gmfgen::GenExternalNodeLabel)
+;
+
+List[gmfgen::GenChildSideAffixedNode] getSideAffixedChildren(gmfgen::GenNode node) :
+ node.childNodes.typeSelect(gmfgen::GenChildSideAffixedNode)
+;
+
+List[gmfgen::GenLabel] getInnerFixedLabels(gmfgen::GenNode node) :
+ node.labels.without(node.labels.typeSelect(gmfgen::GenExternalNodeLabel)).
+ select(e | { ((gmfgen::GenLabel) e).viewmap }.typeSelect(gmfgen::ParentAssignedViewmap).size() > 0)
+;
+
+List[gmfgen::GenCompartment] getPinnedCompartments(gmfgen::GenNode node) :
+ node.compartments.select(e | { e.viewmap }.typeSelect(gmfgen::ParentAssignedViewmap).size() > 0)
+;
+
+Boolean hasFixedChildren(gmfgen::GenNode node) :
+ getInnerFixedLabels(node).size() > 0 || getPinnedCompartments(node).size() > 0
+;
+
+Boolean hasChildren(gmfgen::GenNode node) :
+ !node.childNodes.isEmpty()
+;
+
+Boolean listCompartmentHasChildren(gmfgen::GenCompartment compartment) :
+ compartment.listLayout && compartment.childNodes.size() > 0
+;
+
+Boolean hasChildrenInListCompartments(gmfgen::GenNode node) :
+ node.compartments.exists(e | listCompartmentHasChildren(e))
+;
+
+Boolean hasBorderItems(gmfgen::GenNode node) :
+ getSideAffixedChildren(node).size() > 0 || getExternalLabels(node).size() > 0
+;
+
+Boolean needsGraphicalNodeEditPolicy(gmfgen::GenNode node) :
+ null != node.modelFacet && node.reorientedIncomingLinks.size() > 0
+;
+
+String i18nKeyForCompartmentTitle(gmfgen::GenCompartment compartment) :
+ compartment.editPartClassName+".title"
+;
+
+
+boolean shouldGenerateDiagramViewmap(gmfgen::GenDiagram genDiagram) :
+ !{gmfgen::ViewmapLayoutType::UNKNOWN.value, gmfgen::ViewmapLayoutType::XY_LAYOUT.value}.contains(genDiagram.viewmap.layoutType.value)
+;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/BaseItemSemanticEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,484 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::diagram::editpolicies::Utils»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::expressions::ValueExpression»
+
+«DEFINE BaseItemSemanticEditPolicy FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «baseItemSemanticEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy {
+
+ «EXPAND xpt::Common::generatedMemberComment("Extended request data key to hold editpart visual id.\n")»
+ public static final String VISUAL_ID_KEY = "visual_id"; «EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::Common::generatedMemberComment(
+ "Extended request data key to hold editpart visual id.\n" +
+ "Add visual id of edited editpart to extended data of the request\n" +
+ "so command switch can decide what kind of diagram element is being edited.\n" +
+ "It is done in those cases when it\'s not possible to deduce diagram\n" +
+ "element kind from domain element.\n"
+ )»
+ public org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) {
+ if (request instanceof org.eclipse.gef.requests.ReconnectRequest) {
+ Object view = ((org.eclipse.gef.requests.ReconnectRequest) request).getConnectionEditPart().getModel();
+ if (view instanceof org.eclipse.gmf.runtime.notation.View) {
+ Integer id = new Integer(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»((org.eclipse.gmf.runtime.notation.View) view));
+ request.getExtendedData().put(VISUAL_ID_KEY, id);
+ }
+ }
+ return super.getCommand(request);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment("Returns visual id from request parameters.\n")»
+ protected int getVisualID(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
+ Object id = request.getParameter(VISUAL_ID_KEY);
+ return id instanceof Integer ? ((Integer) id).intValue() : -1;
+ }
+
+ «EXPAND semanticPart-»
+
+ «EXPAND xpt::Common::generatedMemberComment("Returns editing domain from the host edit part.\n")»
+ protected org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
+ return ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment("Creates command to destroy the link.\n")»
+ protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
+ org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest request =
+ new org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest(getEditingDomain(), false);
+ return editPart.getCommand(
+ new org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper(request, java.util.Collections.EMPTY_MAP));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment("Creates commands to destroy all host incoming and outgoing links.\n")»
+ protected org.eclipse.gef.commands.CompoundCommand getDestroyEdgesCommand() {
+ org.eclipse.gef.commands.CompoundCommand cmd = new org.eclipse.gef.commands.CompoundCommand();
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
+ for (java.util.Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
+ cmd.add(getDestroyElementCommand((org.eclipse.gmf.runtime.notation.Edge) it.next()));
+ }
+ for (java.util.Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
+ cmd.add(getDestroyElementCommand((org.eclipse.gmf.runtime.notation.Edge) it.next()));
+ }
+ return cmd;
+ }
+
+ «EXPAND addDestroyShortcutsCommand-»
+
+ «EXPAND linkConstraints-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE addDestroyShortcutsCommand FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void addDestroyShortcutsCommand(org.eclipse.gef.commands.CompoundCommand command) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
+ return;
+ }
+ for (java.util.Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
+ if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { «EXPAND xpt::Common::nonNLS»
+ continue;
+ }
+ command.add(getDestroyElementCommand(nextView));
+ }
+}
+«ENDDEFINE»
+
+«DEFINE semanticPart FOR gmfgen::GenDiagram-»
+ «EXPAND getSemanticCommand-»
+
+ «EXPAND getSemanticCommandSwitch-»
+
+ «EXPAND getConfigureCommand-»
+
+ «EXPAND getCreateRelationshipCommand-»
+
+ «EXPAND getCreateCommand-»
+
+ «EXPAND getSetCommand-»
+
+ «EXPAND getEditContextCommand-»
+
+ «EXPAND getDestroyElementCommand-»
+
+ «EXPAND getDestroyReferenceCommand-»
+
+ «EXPAND getDuplicateCommand-»
+
+ «EXPAND getMoveCommand-»
+
+ «EXPAND getReorientReferenceRelationshipCommand-»
+
+ «EXPAND getReorientRelationshipCommand-»
+
+ «EXPAND getGEFWrapper-»
+ «EXPAND getMSLWrapper-»
+
+ «EXPAND getSemanticElement-»
+«ENDDEFINE»
+
+«DEFINE getSemanticCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getSemanticCommand(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest request) {
+ org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest completedRequest = completeRequest(request);
+ Object editHelperContext = completedRequest.getEditHelperContext();
+ if (editHelperContext instanceof org.eclipse.gmf.runtime.notation.View || (editHelperContext instanceof org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext && ((org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext) editHelperContext).getEObject() instanceof org.eclipse.gmf.runtime.notation.View)) {
+ // no semantic commands are provided for pure design elements
+ return null;
+ }
+ if (editHelperContext == null) {
+ editHelperContext = org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.resolveSemanticElement((org.eclipse.gmf.runtime.notation.View) getHost().getModel());
+ }
+ org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getElementType(editHelperContext);
+ if (elementType == org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getType("org.eclipse.gmf.runtime.emf.type.core.default")) { «EXPAND xpt::Common::nonNLS»
+ «REM»< % = importManager.getImportedName(genDiagram.getEditorGen().getPlugin().getActivatorQualifiedClassName()) % >.getInstance().logInfo("Failed to get element type for " + editHelperContext); / / $NON-NLS-1$«ENDREM»«-»
+ elementType = null;
+ }
+ org.eclipse.gef.commands.Command semanticCommand = getSemanticCommandSwitch(completedRequest);
+ if (elementType != null) {
+ if (semanticCommand != null) {
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = semanticCommand instanceof org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy ? ((org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) semanticCommand).getICommand() : new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(semanticCommand);
+ completedRequest.setParameter(«getBaseEditHelperQualifiedClassName()».EDIT_POLICY_COMMAND, command);
+ }
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = elementType.getEditCommand(completedRequest);
+ if (command != null) {
+ if (!(command instanceof org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand)) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
+ command = new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(editingDomain, command.getLabel()).compose(command);
+ }
+ semanticCommand = new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
+ }
+ }
+ boolean shouldProceed = true;
+ if (completedRequest instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) {
+ shouldProceed = shouldProceed((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) completedRequest);
+ }
+ if (shouldProceed) {
+ if (completedRequest instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
+ org.eclipse.gef.commands.Command deleteViewCommand = new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand(editingDomain, (org.eclipse.gmf.runtime.notation.View) getHost().getModel()));
+ semanticCommand = semanticCommand == null ? deleteViewCommand : semanticCommand.chain(deleteViewCommand);
+ }
+ return semanticCommand;
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getSemanticCommandSwitch FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getSemanticCommandSwitch(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
+ if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest) {
+ return getCreateRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) {
+ return getCreateCommand((org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest) {
+ return getConfigureCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) {
+ return getDestroyElementCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest) {
+ return getDestroyReferenceCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest) {
+ return getDuplicateCommand((org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest) {
+ return getEditContextCommand((org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest) {
+ return getMoveCommand((org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest) {
+ return getReorientReferenceRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest) {
+ return getReorientRelationshipCommand((org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest) req);
+ } else if (req instanceof org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) {
+ return getSetCommand((org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest) req);
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getConfigureCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getConfigureCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest req) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getCreateRelationshipCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getCreateCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getSetCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getSetCommand(org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest req) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getEditContextCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getEditContextCommand(org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest req) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getDestroyElementCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getDestroyReferenceCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getDestroyReferenceCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getDuplicateCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getDuplicateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getMoveCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getMoveCommand(org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest req) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getReorientReferenceRelationshipCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getReorientReferenceRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest req) {
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+}
+«ENDDEFINE»
+
+«DEFINE getReorientRelationshipCommand FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) {
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+}
+«ENDDEFINE»
+
+«DEFINE getGEFWrapper FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected final org.eclipse.gef.commands.Command getGEFWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) {
+ return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(cmd);
+ }
+«ENDDEFINE»
+
+«DEFINE getMSLWrapper FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment("@deprecated use getGEFWrapper() instead")»
+ protected final org.eclipse.gef.commands.Command getMSLWrapper(org.eclipse.gmf.runtime.common.core.command.ICommand cmd) {
+ // XXX deprecated: use getGEFWrapper() instead
+ return getGEFWrapper(cmd);
+ }
+«ENDDEFINE»
+
+«DEFINE getSemanticElement FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.ecore.EObject getSemanticElement() {
+ return org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.resolveSemanticElement((org.eclipse.gmf.runtime.notation.View) getHost().getModel());
+}
+«ENDDEFINE»
+
+
+
+«DEFINE linkConstraints FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedClassComment»
+public static class «getLinkCreationConstraintsClassName()» {
+
+«IF null != editorGen.expressionProviders-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static final String OPPOSITE_END_VAR = "oppositeEnd"; «EXPAND xpt::Common::nonNLS»
+
+«FOREACH getValidLinkConstraints(this) AS lc-»
+«IF lc.sourceEnd != null-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static «editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()» «sourceConstraintFieldName(lc.link)»;
+«ENDIF-»
+«IF lc.targetEnd != null-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static «editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()» «targetConstraintFieldName(lc.link)»;
+«ENDIF-»
+«ENDFOREACH»
+«ENDIF-»
+
+ «EXPAND canCreate FOREACH links-»
+ «EXPAND canExist FOREACH links-»
+}
+«ENDDEFINE»
+
+«DEFINE canCreate FOR gmfgen::GenLink»
+
+«EXPAND xpt::Common::generatedMemberComment»
+public static boolean canCreate«getUniqueIdentifier()»(«EXPAND canCreateParameters FOR modelFacet») {
+ «EXPAND checkEMFConstraints FOR modelFacet-»
+ return canExist«getUniqueIdentifier()»(«EXPAND canCreateValues FOR modelFacet»);
+}
+«ENDDEFINE»
+
+«REM»
+ XXX for now, both constraints are injected into single method
+ which may nob be suitable for modification especially when mixing
+ java and ocl constraints (former requires manual code).
+ Better approach would be:
+ if either is non-null and providers are not the same - introduce two methods,
+ to check source and target separately. Otherwize, do it inplace.
+«ENDREM»
+«DEFINE canExist FOR gmfgen::GenLink»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static boolean canExist«getUniqueIdentifier()»(«EXPAND canCreateParameters FOR modelFacet») {
+«IF creationConstraints != null && creationConstraints.isValid() && null != getDiagram().editorGen.expressionProviders-»
+ try {
+«IF null != creationConstraints.sourceEnd-»
+ «EXPAND checkAdditionalConstraint(creationConstraints.sourceEnd, sourceConstraintFieldName(this), "source", "target", creationConstraints.getSourceEndContextClass(), creationConstraints.getTargetEndContextClass()) FOR creationConstraints.sourceEnd.provider-»
+«ENDIF-»
+«IF null != creationConstraints.targetEnd-»
+ «EXPAND checkAdditionalConstraint(creationConstraints.targetEnd, targetConstraintFieldName(this), "target", "source", creationConstraints.getTargetEndContextClass(), creationConstraints.getSourceEndContextClass()) FOR creationConstraints.targetEnd.provider-»
+«ENDIF-»
+ return true;
+ } catch(Exception e) {
+ «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Link constraint evaluation error", e); «EXPAND xpt::Common::nonNLS»
+ return false;
+ }
+«ELSE»
+ return true;
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE canCreateParameters FOR gmfgen::LinkModelFacet»«EXPAND incorrectLinkModelFacet»«ENDDEFINE»
+«DEFINE canCreateParameters FOR gmfgen::TypeLinkModelFacet»«IF null != sourceMetaFeature»«EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container, «ENDIF»«EXPAND sourceTargetParameters»«ENDDEFINE»
+«DEFINE canCreateParameters FOR gmfgen::FeatureLinkModelFacet»«EXPAND sourceTargetParameters»«ENDDEFINE»
+
+«DEFINE sourceTargetParameters FOR gmfgen::LinkModelFacet»«EXPAND MetaModel::QualifiedClassName FOR getSourceType()» source, «EXPAND MetaModel::QualifiedClassName FOR getTargetType()» target«ENDDEFINE»
+
+«DEFINE canCreateValues FOR gmfgen::LinkModelFacet»«EXPAND incorrectLinkModelFacet»«ENDDEFINE»
+«DEFINE canCreateValues FOR gmfgen::TypeLinkModelFacet»«IF null != sourceMetaFeature»container, «ENDIF»source, target«ENDDEFINE»
+«DEFINE canCreateValues FOR gmfgen::FeatureLinkModelFacet»source, target«ENDDEFINE»
+
+
+
+«DEFINE checkEMFConstraints FOR gmfgen::LinkModelFacet»«EXPAND incorrectLinkModelFacet»«ENDDEFINE»
+
+«DEFINE checkEMFConstraints FOR gmfgen::TypeLinkModelFacet-»
+ «LET childMetaFeature != containmentMetaFeature && childMetaFeature.ecoreFeature.upperBound > 0 AS checkChildFeatureUpperBound-»
+ «IF containmentMetaFeature.ecoreFeature.upperBound > 0 || checkChildFeatureUpperBound-»
+if («getContainerVariable()» != null) {
+ «EXPAND checkEMFConstraints(this) FOR containmentMetaFeature-»
+ «IF checkChildFeatureUpperBound-»
+ «EXPAND checkEMFConstraints(this) FOR childMetaFeature-»
+ «ENDIF-»
+}
+ «ENDIF-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE checkEMFConstraints(gmfgen::TypeLinkModelFacet modelFacet) FOR genmodel::GenFeature-»
+«IF ecoreFeature.upperBound > 0-»
+if («EXPAND featureBoundComparator(getContainerVariable(modelFacet), modelFacet.getSourceType())») {
+ return false;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkEMFConstraints FOR gmfgen::FeatureLinkModelFacet-»
+ «LET "source" AS sourceVar-»
+if («sourceVar» != null) {
+ if (
+ «REM»Checking uper bounds if was specified in MM«ENDREM»«-»
+ «IF metaFeature.ecoreFeature.upperBound > 0»«EXPAND featureBoundComparator(sourceVar, getSourceType()) FOR metaFeature»«ENDIF-»
+ «REM»Checking uniqueness in addition if uper bounds > 1«ENDREM»«-»
+ «IF metaFeature.ecoreFeature.upperBound > 1» || «ENDIF-»
+ «REM»Checking uniqueness in if uper bounds > 1 or < 0«ENDREM»«-»
+ «IF metaFeature.ecoreFeature.upperBound != 1»«EXPAND featureUniquenessComparator(sourceVar, getSourceType()) FOR metaFeature»«ENDIF») {
+ return false;
+ }
+ «IF metaFeature.isContains()-»
+ if (source == target) {
+ return false;
+ }
+ «ENDIF-»
+}
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE featureBoundComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass)»«IF ecoreFeature.upperBound == 1» != null«ELSE».size() >= «ecoreFeature.upperBound»«ENDIF»«ENDDEFINE»
+«DEFINE featureUniquenessComparator(String featureVar, genmodel::GenClass featureVarGenClass) FOR genmodel::GenFeature»«EXPAND MetaModel::getFeatureValue(featureVar, featureVarGenClass) FOR this».contains(target)«ENDDEFINE»
+
+
+«DEFINE checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String constraintFieldName, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) FOR gmfgen::GenExpressionProviderBase»
+«ERROR "Have no idea what extra constraints to check for " + this»
+«ENDDEFINE»
+
+«DEFINE checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String constraintFieldName, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) FOR gmfgen::GenExpressionInterpreter-»
+ if («sourceEndVar» == null) {
+ return true;
+ }
+ if («constraintFieldName» == null) {
+ java.util.Map env = java.util.Collections.singletonMap(OPPOSITE_END_VAR, «EXPAND MetaModel::MetaClass FOR oppositeEndContext»);
+ «constraintFieldName» = «getQualifiedClassName()».«getExpressionAccessor(valueExpr)»(«valueExpr.getBodyString()», «EXPAND MetaModel::MetaClass FOR context», env); «EXPAND xpt::Common::nonNLS»
+ }
+ Object «sourceEndVar»Val = «constraintFieldName».evaluate(«sourceEndVar», java.util.Collections.singletonMap(OPPOSITE_END_VAR, «targetEndVar»));
+ if (false == «sourceEndVar»Val instanceof Boolean || !((Boolean) «sourceEndVar»Val).booleanValue()) {
+ return false;
+ } // else fall-through
+«ENDDEFINE»
+
+«DEFINE checkAdditionalConstraint(gmfgen::ValueExpression valueExpr, String constraintFieldName, String sourceEndVar, String targetEndVar, GenClass context, GenClass oppositeEndContext) FOR gmfgen::GenJavaExpressionProvider-»
+«IF injectExpressionBody && valueExpr.body != null && valueExpr.body.length() != 0-»
+ «valueExpr.body»
+«ELSEIF throwException || (injectExpressionBody && (valueExpr.body == null || valueExpr.body.length() == 0))-»
+ // TODO: implement this method, using «sourceEndVar» and «targetEndVar»
+ // to access link source and target, respectively
+ // Ensure that you remove @generated or mark it @generated NOT
+ if (Boolean.TRUE.booleanValue()) {
+ throw new java.lang.UnsupportedOperationException("No java implementation provided");«EXPAND xpt::Common::nonNLS»
+ }
+«ELSE-»
+ if (Boolean.TRUE.booleanValue()) {«REM»just in case there are two consecutive java expression with neither throw nor inject - avoid unreachable code.«ENDREM»
+ return false;
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+
+«DEFINE incorrectLinkModelFacet FOR gmfgen::LinkModelFacet»«ERROR "Unrecognized link model facet: " + this»«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/ChildContainerCanonicalEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE ChildContainerCanonicalEditPolicy FOR gmfgen::GenChildContainer-»
+ «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPoliciesPackageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «canonicalEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy {
+
+ «EXPAND xpt::diagram::updater::containerBaseCanonicalMethods::containerBaseCanonicalMethods-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenChildContainer»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/CompartmentItemSemanticEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2006,2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE CompartmentItemSemanticEditPolicy FOR gmfgen::GenCompartment-»
+ «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPoliciesPackageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «itemSemanticEditPolicyClassName» extends «getDiagram().getBaseItemSemanticEditPolicyQualifiedClassName()» {
+ «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR childNodes-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCompartment-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/DiagramCanonicalEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::diagram::editpolicies::Utils»
+«EXTENSION xpt::diagram::updater::Utils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE DiagramCanonicalEditPolicy FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editPoliciesPackageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «canonicalEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy {
+
+ «EXPAND xpt::diagram::updater::containerBaseCanonicalMethods::containerBaseCanonicalMethods-»
+
+ «EXPAND getSemanticConnectionsList-»
+
+ «EXPAND getSourceElement-»
+
+ «EXPAND getTargetElement-»
+
+ «EXPAND shouldIncludeConnection-»
+
+ «EXPAND refreshSemantic-»
+
+ «EXPAND getDiagram-»
+
+ «EXPAND refreshLinks-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE getSemanticConnectionsList FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getSemanticConnectionsList() {
+ return java.util.Collections.EMPTY_LIST;
+}
+«ENDDEFINE»
+
+«DEFINE getSourceElement FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.ecore.EObject getSourceElement(org.eclipse.emf.ecore.EObject relationship) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getTargetElement FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.ecore.EObject getTargetElement(org.eclipse.emf.ecore.EObject relationship) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE shouldIncludeConnection FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected boolean shouldIncludeConnection(org.eclipse.gmf.runtime.notation.Edge connector, java.util.Collection children) {
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE refreshSemantic FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void refreshSemantic() {
+ java.util.List createdViews = new java.util.LinkedList();
+ createdViews.addAll(refreshSemanticChildren());
+ java.util.List createdConnectionViews = new java.util.LinkedList();
+ createdConnectionViews.addAll(refreshSemanticConnections());
+ «IF !links.isEmpty()-»
+ createdConnectionViews.addAll(refreshConnections());
+ «ENDIF-»
+
+ if (createdViews.size() > 1) {
+ // perform a layout of the container
+ org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand layoutCmd = new org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
+ executeCommand(new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(layoutCmd));
+ }
+
+ createdViews.addAll(createdConnectionViews);
+ makeViewsImmutable(createdViews);
+}
+«ENDDEFINE»
+
+«DEFINE refreshLinks FOR gmfgen::GenDiagram-»
+ «IF !links.isEmpty()-»
+ «EXPAND refreshConnections-»
+
+ «EXPAND collectAllLinks-»
+
+ «EXPAND createConnections-»
+
+ «EXPAND getEditPart-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE refreshConnections FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection refreshConnections() {
+ java.util.Map domain2NotationMap = new java.util.HashMap();
+ java.util.Collection linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
+ java.util.Collection existingLinks = new java.util.LinkedList(getDiagram().getEdges());
+ for (java.util.Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Edge nextDiagramLink = (org.eclipse.gmf.runtime.notation.Edge) linksIterator.next();
+ int diagramLinkVisualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(nextDiagramLink);
+ if (diagramLinkVisualID == -1) {
+ if (nextDiagramLink.getSource() != null && nextDiagramLink.getTarget() != null) {
+ linksIterator.remove();
+ }
+ continue;
+ }
+ org.eclipse.emf.ecore.EObject diagramLinkObject = nextDiagramLink.getElement();
+ org.eclipse.emf.ecore.EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
+ org.eclipse.emf.ecore.EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
+ for (java.util.Iterator LinkDescriptorsIterator = linkDescriptors.iterator(); LinkDescriptorsIterator.hasNext();) {
+ «editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()» nextLinkDescriptor = («editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()») LinkDescriptorsIterator.next();
+ if (diagramLinkObject == nextLinkDescriptor.getModelElement() && diagramLinkSrc == nextLinkDescriptor.getSource() && diagramLinkDst == nextLinkDescriptor.getDestination() && diagramLinkVisualID == nextLinkDescriptor.getVisualID()) {
+ linksIterator.remove();
+ LinkDescriptorsIterator.remove();
+ }
+ }
+ }
+ deleteViews(existingLinks.iterator());
+ return createConnections(linkDescriptors, domain2NotationMap);
+}
+«ENDDEFINE»
+
+«DEFINE collectAllLinks FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection collectAllLinks(org.eclipse.gmf.runtime.notation.View view, java.util.Map domain2NotationMap) {
+ if (!«EXPAND xpt::editor::VisualIDRegistry::modelID».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view))) {
+ return java.util.Collections.EMPTY_LIST;
+ }
+ java.util.Collection result = new java.util.LinkedList();
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view)) {
+ «EXPAND caseSemanticElement FOREACH getAllSemanticElements(this)-»
+ }
+ for (java.util.Iterator children = view.getChildren().iterator(); children.hasNext();) {
+ result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) children.next(), domain2NotationMap));
+ }
+ for (java.util.Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) {
+ result.addAll(collectAllLinks((org.eclipse.gmf.runtime.notation.View) edges.next(), domain2NotationMap));
+ }
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE caseSemanticElement FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::caseVisualID» {
+ if (!domain2NotationMap.containsKey(view.getElement())) {
+«REM»
+ Processing each domain element only once. Prevents us from
+ having duplicated links if a shortcut to one of the "main"
+ diagram elements present on diagram.
+«ENDREM»«-»
+ result.addAll(«EXPAND xpt::diagram::updater::DiagramUpdater::getContainedLinksMethodCall»(view));
+ }
+ if (!domain2NotationMap.containsKey(view.getElement()) || view.getEAnnotation("Shortcut") == null) { «EXPAND xpt::Common::nonNLS»
+«REM»
+ Storing element view or replacing shortcut by the "original" element view.
+«ENDREM»«-»
+ domain2NotationMap.put(view.getElement(), view);
+ }
+ break;
+}
+«ENDDEFINE»
+
+«REM»
+ GMF has no links to "leaf" child nodes.
+«ENDREM»
+«DEFINE caseSemanticElement FOR gmfgen::GenChildLabelNode»«ENDDEFINE»
+
+«DEFINE colectContainedLink FOR gmfgen::GenLink-»
+«EXPAND xpt::diagram::updater::DiagramUpdater::getContainedLinksMethodCall»(modelElement));
+«ENDDEFINE»
+
+«DEFINE createConnections FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection createConnections(java.util.Collection linkDescriptors, java.util.Map domain2NotationMap) {
+ java.util.List adapters = new java.util.LinkedList();
+ for (java.util.Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
+ final «editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()» nextLinkDescriptor = («editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()») linkDescriptorsIterator.next();
+ org.eclipse.gef.EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
+ org.eclipse.gef.EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
+ if (sourceEditPart == null || targetEditPart == null) {
+ continue;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), null, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, false, ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getDiagramPreferencesHint());
+ org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest ccr = new org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest(descriptor);
+ ccr.setType(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_CONNECTION_START);
+ ccr.setSourceEditPart(sourceEditPart);
+ sourceEditPart.getCommand(ccr);
+ ccr.setTargetEditPart(targetEditPart);
+ ccr.setType(org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants.REQ_CONNECTION_END);
+ org.eclipse.gef.commands.Command cmd = targetEditPart.getCommand(ccr);
+ if (cmd != null && cmd.canExecute()) {
+ executeCommand(cmd);
+ org.eclipse.core.runtime.IAdaptable viewAdapter = (org.eclipse.core.runtime.IAdaptable) ccr.getNewObject();
+ if (viewAdapter != null) {
+ adapters.add(viewAdapter);
+ }
+ }
+ }
+ return adapters;
+}
+«ENDDEFINE»
+
+«DEFINE getEditPart FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gef.EditPart getEditPart(org.eclipse.emf.ecore.EObject domainModelElement, java.util.Map domain2NotationMap) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) domain2NotationMap.get(domainModelElement);
+ if (view != null) {
+ return (org.eclipse.gef.EditPart) getHost().getViewer().getEditPartRegistry().get(view);
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getDiagram FOR gmfgen::GenContainerBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.notation.Diagram getDiagram() {
+ return ((org.eclipse.gmf.runtime.notation.View) getHost().getModel()).getDiagram();
+}
+«ENDDEFINE»
+
+«DEFINE incorrectLinkModelFacet FOR gmfgen::LinkModelFacet-»
+ «ERROR "Incorrect LinkModelFacet: " + this»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/DiagramItemSemanticEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2006,2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE DiagramItemSemanticEditPolicy FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «editPoliciesPackageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «itemSemanticEditPolicyClassName» extends «getBaseItemSemanticEditPolicyQualifiedClassName()» {
+ «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR topLevelNodes-»
+
+ «EXPAND getDuplicateCommand-»
+
+ «EXPAND DuplicateAnythingCommand-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE getDuplicateCommand FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getDuplicateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
+ return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));
+}
+«ENDDEFINE»
+
+«DEFINE DuplicateAnythingCommand FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private static class DuplicateAnythingCommand extends org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand {
+
+ «EXPAND DAC_constructor-»
+
+ «EXPAND DAC_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE DAC_constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public DuplicateAnythingCommand(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest req) {
+ super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap());
+}
+«ENDDEFINE»
+
+«DEFINE DAC_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/GraphicalNodeEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE GraphicalNodeEditPolicy FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «graphicalNodeEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.GraphicalNodeEditPolicy {
+
+ «EXPAND xpt::Common::generatedClassComment»
+ protected org.eclipse.gef.commands.Command getConnectionCompleteCommand(
+ org.eclipse.gef.requests.CreateConnectionRequest request) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getElementType(request);
+ «FOREACH reorientedIncomingLinks AS link-»
+ if («getDiagram().getElementTypesQualifiedClassName()».«link.getUniqueIdentifier()» == elementType) {
+ «IF link.outgoingCreationAllowed-»
+ if (request.getSourceEditPart() != getHost()) {
+ «ENDIF-»
+ return getConnectionWithReorientedViewCompleteCommand(request);
+ «IF link.outgoingCreationAllowed-»
+ }
+ «ENDIF-»
+ }
+ «ENDFOREACH-»
+ return super.getConnectionCompleteCommand(request);
+ }
+
+ «EXPAND xpt::Common::generatedClassComment»
+ protected org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(
+ org.eclipse.gef.requests.CreateConnectionRequest request) {
+ if (request instanceof org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest) {
+ org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter requestAdapter =
+ ((org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest) request)
+ .getConnectionViewAndElementDescriptor().getCreateElementRequestAdapter();
+ return (org.eclipse.gmf.runtime.emf.type.core.IElementType) requestAdapter.getAdapter(
+ org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
+ }
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedClassComment»
+ protected org.eclipse.gef.commands.Command getConnectionWithReorientedViewCompleteCommand(
+ org.eclipse.gef.requests.CreateConnectionRequest request) {
+ org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy c =
+ (org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy) super.getConnectionCompleteCommand(request);
+ org.eclipse.gmf.runtime.common.core.command.CompositeCommand cc =
+ (org.eclipse.gmf.runtime.common.core.command.CompositeCommand) c.getICommand();
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
+ ((org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) getHost()).getEditingDomain();
+ «getDiagram().getReorientConnectionViewCommandQualifiedClassName()» rcvCommand =
+ new «getDiagram().getReorientConnectionViewCommandQualifiedClassName()»(editingDomain, null);
+ rcvCommand.setEdgeAdaptor(getViewAdapter());
+ cc.compose(rcvCommand);
+ return c;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/LinkItemSemanticEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE LinkItemSemanticEditPolicy FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::copyright FOR diagram.editorGen-»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «itemSemanticEditPolicyClassName» extends «diagram.getBaseItemSemanticEditPolicyQualifiedClassName()» {
+
+ «EXPAND classBody(getDiagram()) FOR modelFacet-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE classBody(gmfgen::GenDiagram diagram) FOR gmfgen::FeatureLinkModelFacet-»
+ «EXPAND getDestroyReferenceCommand-»
+«ENDDEFINE»
+
+«DEFINE classBody(gmfgen::GenDiagram diagram) FOR gmfgen::TypeLinkModelFacet-»
+ «EXPAND getDestroyElementCommand-»
+ «EXPAND xpt::diagram::editpolicies::linkCommands::linkCommands(diagram)-»
+«ENDDEFINE»
+
+«DEFINE classBody(gmfgen::GenDiagram diagram) FOR gmfgen::LinkModelFacet-»
+ «ERROR "Unsupported model facet: " + this-»
+«ENDDEFINE»
+
+«DEFINE getDestroyReferenceCommand FOR gmfgen::FeatureLinkModelFacet-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getDestroyReferenceCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
+ return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand(req)«IF isContains(metaFeature)» {
+
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor progressMonitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
+ org.eclipse.emf.ecore.EObject referencedObject = getReferencedObject();
+ org.eclipse.emf.ecore.resource.Resource resource = referencedObject.eResource();
+ org.eclipse.gmf.runtime.common.core.command.CommandResult result = super.doExecuteWithResult(progressMonitor, info);
+ resource.getContents().add(referencedObject);
+ return result;
+ }
+
+ }«ENDIF»);
+}
+«ENDDEFINE»
+
+«DEFINE getDestroyElementCommand FOR gmfgen::TypeLinkModelFacet-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
+ return getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req));
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/LinkUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+
+boolean isTypeLink(gmfgen::GenLink link) :
+ {link.modelFacet}.typeSelect(gmfgen::TypeLinkModelFacet).size() > 0
+;
+
+boolean isRefLink(gmfgen::GenLink link) :
+ {link.modelFacet}.typeSelect(gmfgen::FeatureLinkModelFacet).size() > 0
+;
+
+boolean canBeSource(gmfgen::GenLink link, gmfgen::TypeModelFacet modelFacet) :
+ canBeSource(link, modelFacet.metaClass)
+;
+
+boolean canBeSource(gmfgen::GenLink link, genmodel::GenClass metaClass) :
+ null != link.modelFacet && canBeLinkEnd(link.modelFacet.getSourceType(), metaClass)
+;
+
+boolean canBeTarget(gmfgen::GenLink link, gmfgen::TypeModelFacet modelFacet) :
+ canBeTarget(link, modelFacet.metaClass)
+;
+
+boolean canBeTarget(gmfgen::GenLink link, genmodel::GenClass metaClass) :
+ null != link.modelFacet && canBeLinkEnd(link.modelFacet.getTargetType(), metaClass)
+;
+
+boolean canBeContainer(gmfgen::GenLink link, genmodel::GenClass metaClass) :
+ null != link.modelFacet && canBeLinkEnd(getContainerClass(link.modelFacet), metaClass)
+;
+
+private genmodel::GenClass getContainerClass(gmfgen::LinkModelFacet modelFacet) :
+// Should not be called
+ null
+;
+
+private genmodel::GenClass getContainerClass(gmfgen::TypeLinkModelFacet modelFacet) :
+ modelFacet.containmentMetaFeature.genClass
+;
+
+private genmodel::GenClass getContainerClass(gmfgen::FeatureLinkModelFacet modelFacet) :
+ modelFacet.getSourceType()
+;
+
+private boolean canBeLinkEnd(genmodel::GenClass endType, genmodel::GenClass metaClass) :
+ null != endType && endType.ecoreClass.isSuperTypeOf(metaClass.ecoreClass)
+;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/NodeItemSemanticEditPolicy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«REM»
+ This template should be called only for non-design nodes (modelFacet != null)
+ because *ItemSemanticEditPolicy responsible for dealing with semantic model
+ elements and meaningless (should not be generated) for pure design nodes.
+«ENDREM»
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::diagram::editpolicies::Utils»
+
+«DEFINE NodeItemSemanticEditPolicy FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «itemSemanticEditPolicyClassName» extends «getDiagram().getBaseItemSemanticEditPolicyQualifiedClassName()» {
+ «EXPAND xpt::diagram::editpolicies::childContainerCreateCommand::childContainerCreateCommand FOR childNodes-»
+
+ «EXPAND getDestroyElementCommand-»
+ «IF hasChildrenOrCompartments()-»
+ «EXPAND addDestroyChildNodesCommand-»
+ «ENDIF-»
+ «EXPAND xpt::diagram::editpolicies::linkCommands::linkCommands(getDiagram()) FOR modelFacet-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE getDestroyElementCommand FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getDestroyElementCommand(org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
+ org.eclipse.gef.commands.CompoundCommand cc = getDestroyEdgesCommand();
+ «IF hasChildrenOrCompartments()-»
+ addDestroyChildNodesCommand(cc);
+ «ENDIF-»
+ addDestroyShortcutsCommand(cc);
+ «EXPAND destroySemanticElement-»
+ return cc.unwrap();
+}
+«ENDDEFINE»
+
+«DEFINE destroySemanticElement FOR gmfgen::GenNode-»
+ «EXPAND fixElementToDeleteIfShortcut-»
+cc.add(getGEFWrapper(new org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand(req)));
+«ENDDEFINE»
+
+«DEFINE addDestroyChildNodesCommand FOR gmfgen::GenNode-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void addDestroyChildNodesCommand(org.eclipse.gef.commands.CompoundCommand cmd) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
+ org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
+ if (annotation != null) {
+ return;
+ }
+ for (java.util.Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Node node = (org.eclipse.gmf.runtime.notation.Node) it.next();
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(node)) {
+ «EXPAND destroyChildNodes("node")-»
+ «IF !compartments.isEmpty()-»
+ «FOREACH compartments AS compartment-»
+ «EXPAND xpt::Common::caseVisualID FOR compartment»
+ for (java.util.Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Node cnode = (org.eclipse.gmf.runtime.notation.Node) cit.next();
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(cnode)) {
+ «EXPAND destroyChildNodes("cnode") FOR compartment-»
+ }
+ }
+ break;
+ «ENDFOREACH-»
+ «ENDIF-»
+ }
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE destroyChildNodes(String nodeVar) FOR gmfgen::GenChildContainer-»
+ «FOREACH childNodes AS childNode-»
+ «EXPAND xpt::Common::caseVisualID FOR childNode»
+ cmd.add(getDestroyElementCommand(«nodeVar»));
+ break;
+ «ENDFOREACH-»
+«ENDDEFINE»
+
+
+«DEFINE fixElementToDeleteIfShortcut FOR gmfgen::GenTopLevelNode-»
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
+ req.setElementToDestroy(view);
+ }
+«ENDDEFINE»
+
+«REM»Shortcuts supported only for top-level elements«ENDREM»
+«DEFINE fixElementToDeleteIfShortcut FOR gmfgen::GenNode»«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/OpenDiagram.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::editpolicies::Utils»
+
+«DEFINE OpenDiagram FOR gmfgen::OpenDiagramBehaviour»
+«EXPAND xpt::Common::copyright FOR subject.getDiagram().editorGen-»
+package «subject.getDiagram().editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPolicyClassName» extends «EXPAND extendsList» {
+
+«EXPAND getOpenCommand-»
+
+«EXPAND openCommandClass-»
+
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR OpenDiagramBehaviour»org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy«ENDDEFINE»
+
+«DEFINE getOpenCommand FOR OpenDiagramBehaviour»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gef.commands.Command getOpenCommand(org.eclipse.gef.Request request) {
+ org.eclipse.gef.EditPart targetEditPart = getTargetEditPart(request);
+ if (false == targetEditPart.getModel() instanceof org.eclipse.gmf.runtime.notation.View) {
+ return null;
+ }
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) targetEditPart.getModel();
+ org.eclipse.gmf.runtime.notation.Style link = view.getStyle(org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getHintedDiagramLinkStyle());
+ if (false == link instanceof org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle) {
+ return null;
+ }
+ return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(new OpenDiagramCommand((org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle) link));
+ }
+«ENDDEFINE»
+
+«DEFINE openCommandClass FOR OpenDiagramBehaviour»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static class OpenDiagramCommand extends org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle diagramFacet;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ OpenDiagramCommand(org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle linkStyle) {
+ // editing domain is taken for original diagram,
+ // if we open diagram from another file, we should use another editing domain
+ super(org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(linkStyle), «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenCommandName()) FOR subject.getDiagram().editorGen», null);
+ diagramFacet = linkStyle;
+ }
+
+ // FIXME canExecute if !(readOnly && getDiagramToOpen == null), i.e. open works on ro diagrams only when there's associated diagram already
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
+ try {
+ org.eclipse.gmf.runtime.notation.Diagram diagram = getDiagramToOpen();
+ if (diagram == null) {
+ diagram = intializeNewDiagram();
+ }
+ «EXPAND xpt::navigator::getEditorInput::defineURIEditorInput("diagram") FOR subject.getDiagram()-»
+ org.eclipse.ui.IWorkbenchPage page = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ page.openEditor(editorInput, getEditorID());
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
+ } catch (Exception ex) {
+ throw new org.eclipse.core.commands.ExecutionException("Can't open diagram", ex);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.notation.Diagram getDiagramToOpen() {
+ return diagramFacet.getDiagramLink();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.notation.Diagram intializeNewDiagram() throws org.eclipse.core.commands.ExecutionException {
+ org.eclipse.gmf.runtime.notation.Diagram d = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(getDiagramDomainElement(), getDiagramKind(), getPreferencesHint());
+ if (d == null) {
+ throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind");
+ }
+ diagramFacet.setDiagramLink(d);
+ assert diagramFacet.eResource() != null;
+ diagramFacet.eResource().getContents().add(d);
+ org.eclipse.emf.ecore.EObject container = diagramFacet.eContainer();
+ while (container instanceof org.eclipse.gmf.runtime.notation.View) {
+ ((org.eclipse.gmf.runtime.notation.View) container).persist();
+ container = container.eContainer();
+ }
+ try {
+ «IF null == subject.getDiagram().editorGen.application-»
+ new org.eclipse.ui.actions.WorkspaceModifyOperation() {
+ protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException, java.lang.reflect.InvocationTargetException, InterruptedException {
+ try {
+ «ENDIF-»
+ for (java.util.Iterator it = diagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) {
+ nextResource.save(«EXPAND xpt::Common::getSaveOptions FOR subject.getDiagram()»);
+ }
+ }
+ «IF null == subject.getDiagram().editorGen.application-»
+ } catch (java.io.IOException ex) {
+ throw new java.lang.reflect.InvocationTargetException(ex, "Save operation failed");
+ }
+ }
+ }.run(null);
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
+ } catch (InterruptedException e) {
+ throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
+ }
+ «ELSE-»
+ } catch (java.io.IOException ex) {
+ throw new org.eclipse.core.commands.ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", ex);
+ }
+ «ENDIF-»
+ return d;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.ecore.EObject getDiagramDomainElement() {
+ // use same element as associated with EP
+ return ((org.eclipse.gmf.runtime.notation.View) diagramFacet.eContainer()).getElement();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint getPreferencesHint() {
+ // XXX prefhint from target diagram's editor?
+ return «subject.getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getDiagramKind() {
+ return «IF diagramKind == null»«EXPAND xpt::editor::VisualIDRegistry::modelID FOR subject.getDiagram()»«ELSE»"«diagramKind»"«ENDIF»;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getEditorID() {
+ return «IF editorID == null»«subject.getDiagram().editorGen.editor.getQualifiedClassName()».ID«ELSE»"«editorID»"«ENDIF»;
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR OpenDiagramBehaviour»«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenCommandName())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenCommandName(), "Open Diagram")-»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/TextFeedback.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,186 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE TextSelectionEditPolicy FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «textSelectionEditPolicyClassName» extends org.eclipse.gef.editpolicies.SelectionEditPolicy {
+
+ «EXPAND textFeedback FOR this-»
+}
+«ENDDEFINE»
+
+«DEFINE TextNonResizableEditPolicy FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editPoliciesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «textNonResizableEditPolicyClassName» extends org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx {
+
+ «EXPAND textFeedback FOR this-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createSelectionHandles() {
+ org.eclipse.gef.handles.MoveHandle moveHandle =
+ new org.eclipse.gef.handles.MoveHandle((org.eclipse.gef.GraphicalEditPart) getHost());
+ moveHandle.setBorder(null);
+ moveHandle.setDragTracker(new org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx(getHost()));
+ return java.util.Collections.singletonList(moveHandle);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE textFeedback FOR gmfgen::GenDiagram»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.draw2d.IFigure selectionFeedbackFigure;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.draw2d.IFigure focusFeedbackFigure;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setSelected(true);
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void showSelection() {
+ if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setSelected(true);
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void hideSelection() {
+ if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setSelected(false);
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void showFocus() {
+ if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void hideFocus() {
+ if (getHostFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) {
+ ((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.geometry.Rectangle getFeedbackBounds() {
+ org.eclipse.draw2d.geometry.Rectangle bounds;
+ if (getHostFigure() instanceof org.eclipse.draw2d.Label) {
+ bounds = ((org.eclipse.draw2d.Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof org.eclipse.draw2d.Label) {
+ org.eclipse.draw2d.Label feedbackFigure = new org.eclipse.draw2d.Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure.setBackgroundColor(org.eclipse.draw2d.ColorConstants.menuBackgroundSelected);
+ feedbackFigure.setForegroundColor(org.eclipse.draw2d.ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ org.eclipse.draw2d.RectangleFigure feedbackFigure = new org.eclipse.draw2d.RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.draw2d.IFigure createFocusFeedbackFigure() {
+ return new org.eclipse.draw2d.Figure() {
+
+ protected void paintFigure(org.eclipse.draw2d.Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void updateLabel(org.eclipse.draw2d.Label target) {
+ org.eclipse.draw2d.Label source = (org.eclipse.draw2d.Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshSelectionFeedback() {
+ if (selectionFeedbackFigure != null) {
+ if (selectionFeedbackFigure instanceof org.eclipse.draw2d.Label) {
+ updateLabel((org.eclipse.draw2d.Label) selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ }
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/Utils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+extension xpt::diagram::editpolicies::LinkUtils;
+extension xpt::GenModelUtils;
+
+boolean hasChildrenOrCompartments(gmfgen::GenNode node) :
+ !node.childNodes.isEmpty() || !node.compartments.isEmpty()
+;
+
+String getContainerVariable(gmfgen::TypeLinkModelFacet modelFacet) :
+ null != modelFacet.sourceMetaFeature
+ ? "container"
+ : "source"
+;
+
+List[gmfgen::GenLinkConstraints] getValidLinkConstraints(gmfgen::GenDiagram diagram) :
+ diagram.links.select(l | null != l.creationConstraints && l.creationConstraints.isValid()).collect(l | l.creationConstraints)
+;
+
+List[gmfgen::GenLink] getAllPotentialLinks(gmfgen::TypeModelFacet typeModelFacet, gmfgen::GenDiagram diagram) :
+ selectValidLinks(diagram.links).select(l | isSelf(l, typeModelFacet) || isOutgoing(l, typeModelFacet) || isIncoming(l, typeModelFacet))
+;
+
+List[gmfgen::GenLink] getReroutableTypeLinks(gmfgen::TypeModelFacet typeModelFacet, gmfgen::GenDiagram diagram) :
+ diagram.links.select(link | isTypeLink(link) && (canBeSource(link, typeModelFacet) || canBeTarget(link, typeModelFacet)))
+;
+
+List[gmfgen::GenLink] getReroutableRefLinks(gmfgen::TypeModelFacet typeModelFacet, gmfgen::GenDiagram diagram) :
+ diagram.links.select(link | isRefLink(link) && (canBeSource(link, typeModelFacet) || canBeTarget(link, typeModelFacet)))
+;
+
+private List[gmfgen::GenLink] selectValidLinks(List[gmfgen::GenLink] allLinks) :
+ allLinks.select(l | null != l.modelFacet)
+ .select(l | l.outgoingCreationAllowed || l.incomingCreationAllowed)
+;
+
+boolean createStartLinkCommand(gmfgen::GenLink link, gmfgen::TypeModelFacet typeModelFacet) :
+ createStartOutgoingLinkCommand(link, typeModelFacet) || createStartIncomingLinkCommand(link, typeModelFacet)
+;
+
+boolean createStartOutgoingLinkCommand(gmfgen::GenLink link, gmfgen::TypeModelFacet typeModelFacet) :
+ isSelf(link, typeModelFacet) || (isOutgoing(link, typeModelFacet) && link.outgoingCreationAllowed)
+;
+
+boolean createStartIncomingLinkCommand(gmfgen::GenLink link, gmfgen::TypeModelFacet typeModelFacet) :
+ isIncoming(link, typeModelFacet) && link.incomingCreationAllowed
+;
+
+boolean createCompleteLinkCommand(gmfgen::GenLink link, gmfgen::TypeModelFacet typeModelFacet) :
+ createCompleteIncomingLinkCommand(link, typeModelFacet) || createCompleteOutgoingLinkCommand(link, typeModelFacet)
+;
+
+boolean createCompleteIncomingLinkCommand(gmfgen::GenLink link, gmfgen::TypeModelFacet typeModelFacet) :
+ isSelf(link, typeModelFacet) || (isIncoming(link, typeModelFacet) && link.outgoingCreationAllowed)
+;
+
+boolean createCompleteOutgoingLinkCommand(gmfgen::GenLink link, gmfgen::TypeModelFacet typeModelFacet) :
+ isOutgoing(link, typeModelFacet) && link.incomingCreationAllowed
+;
+
+boolean checkSource(boolean reversedRequest, boolean isCompleteCommand) :
+ !reversedRequest || isCompleteCommand
+;
+
+boolean checkTarget(boolean reversedRequest, boolean isCompleteCommand) :
+ reversedRequest || isCompleteCommand
+;
+
+private boolean isSelf(gmfgen::GenLink link, gmfgen::TypeModelFacet typeModelFacet) :
+ canBeSource(link, typeModelFacet) && canBeTarget(link, typeModelFacet)
+;
+
+private boolean isOutgoing(gmfgen::GenLink link, gmfgen::TypeModelFacet typeModelFacet) :
+ canBeSource(link, typeModelFacet) && !isSelf(link, typeModelFacet)
+;
+
+private boolean isIncoming(gmfgen::GenLink link, gmfgen::TypeModelFacet typeModelFacet) :
+ canBeTarget(link, typeModelFacet) && !isSelf(link, typeModelFacet)
+;
+
+String i18nKeyForOpenCommandName() :
+"CommandName.OpenDiagram"
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/childContainerCreateCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE childContainerCreateCommand FOR List[gmfgen::GenNode]-»
+ «IF !isEmpty()-»
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getCreateCommand(org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
+ «EXPAND childNodeCreateCommand FOREACH this-»
+ return super.getCreateCommand(req);
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE childNodeCreateCommand FOR gmfgen::GenNode-»
+ «EXPAND childNodeCreateCommand(this) FOR modelFacet-»
+«ENDDEFINE»
+
+«DEFINE childNodeCreateCommand(gmfgen::GenNode node) FOR gmfgen::TypeModelFacet-»
+if («node.getDiagram().getElementTypesQualifiedClassName()».«node.getUniqueIdentifier()» == req.getElementType()) {
+ «IF !isPhantomElement()-»
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(«IF null != containmentMetaFeature»«EXPAND MetaModel::MetaFeature FOR containmentMetaFeature»«ELSE»/* FIXME no containment feature found in the genmodel, toolsmith need to specify correct one here manually */«ENDIF»);
+ }
+ «ENDIF-»
+ return getGEFWrapper(new «node.getCreateCommandQualifiedClassName()»(req));
+}
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/editpolicies/linkCommands.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Dmitry Stadnik (Borland) - creation logic was moved in commands
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::editpolicies::Utils»
+«EXTENSION xpt::GenModelUtils»
+
+«REM»
+ * Start start of link creation.
+ * User click to this editpart and start dragging with link tool.
+ * Complete end of the command
+ * User points to this editpart as a link target and release mouse button.
+ *
+ * Outgoing the node is link source
+ * This element could be a source for this type of link.
+ * Incoming the node is link destination
+ * This element could be a target for this type of link.
+ *
+ * Parameters:
+ *
+ * diagram GenDiagram used to collect all defined links
+ *
+ * this Instance of TypeModelFacet for the element link could be creates to/from.
+ * This could be TypeModelFacet or TypeLinkModelFacet in case of links to links.
+ *
+«ENDREM»
+
+«DEFINE linkCommands(gmfgen::GenDiagram diagram) FOR gmfgen::TypeModelFacet-»
+ «IF getAllPotentialLinks(diagram).size() > 0-»
+ «EXPAND createLinkCommands(diagram)-»
+ «ENDIF-»
+ «IF getReroutableTypeLinks(diagram).size() > 0-»
+ «EXPAND reorientTypeLinkCommands(diagram)-»
+ «ENDIF-»
+ «IF getReroutableRefLinks(diagram).size() > 0-»
+ «EXPAND reorientRefLinkCommands(diagram)-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createLinkCommands(gmfgen::GenDiagram diagram) FOR gmfgen::TypeModelFacet-»
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getCreateRelationshipCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
+ org.eclipse.gef.commands.Command command = req.getTarget() == null ?
+ getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getStartCreateRelationshipCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
+ «EXPAND startLinkCommands(this) FOREACH getAllPotentialLinks(diagram)-»
+ return null;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.commands.Command getCompleteCreateRelationshipCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
+ «EXPAND completeLinkCommands(this) FOREACH getAllPotentialLinks(diagram)-»
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE startLinkCommands(gmfgen::TypeModelFacet typeModelFacet) FOR gmfgen::GenLink-»
+if («getDiagram().getElementTypesQualifiedClassName()».«getUniqueIdentifier()» == req.getElementType()) {
+ «IF createStartLinkCommand(typeModelFacet)-»
+ return getGEFWrapper(new «getCreateCommandQualifiedClassName()»(req,
+ «IF createStartIncomingLinkCommand(typeModelFacet)-»
+ req.getTarget(), req.getSource()
+ «ELSE-»
+ req.getSource(), req.getTarget()
+ «ENDIF-»
+ ));
+ «ELSE-»
+ return null;
+ «ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE completeLinkCommands(gmfgen::TypeModelFacet typeModelFacet) FOR gmfgen::GenLink-»
+if («getDiagram().getElementTypesQualifiedClassName()».«getUniqueIdentifier()» == req.getElementType()) {
+ «IF createCompleteLinkCommand(typeModelFacet)-»
+ return getGEFWrapper(new «getCreateCommandQualifiedClassName()»(req,
+ «IF createCompleteOutgoingLinkCommand(typeModelFacet)-»
+ req.getTarget(), req.getSource()
+ «ELSE-»
+ req.getSource(), req.getTarget()
+ «ENDIF-»
+ ));
+ «ELSE-»
+ return null;
+ «ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE reorientTypeLinkCommands(gmfgen::GenDiagram diagram) FOR gmfgen::TypeModelFacet-»
+
+«EXPAND xpt::Common::generatedMemberComment(
+ "Returns command to reorient EClass based link. New link target or source\n" +
+ "should be the domain model element associated with this node.\n"
+)»
+protected org.eclipse.gef.commands.Command getReorientRelationshipCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ «EXPAND reorientLinkCommand FOREACH getReroutableTypeLinks(diagram)-»
+ }
+ return super.getReorientRelationshipCommand(req);
+}
+«ENDDEFINE»
+
+«DEFINE reorientRefLinkCommands(gmfgen::GenDiagram diagram) FOR gmfgen::TypeModelFacet-»
+
+«EXPAND xpt::Common::generatedMemberComment(
+ "Returns command to reorient EReference based link. New link target or source\n" +
+ "should be the domain model element associated with this node.\n"
+)»
+protected org.eclipse.gef.commands.Command getReorientReferenceRelationshipCommand(
+ org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ «EXPAND reorientLinkCommand FOREACH getReroutableRefLinks(diagram)-»
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+}
+«ENDDEFINE»
+
+«DEFINE reorientLinkCommand FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::caseVisualID»
+ return getGEFWrapper(new «getReorientCommandQualifiedClassName()»(req));
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/preferences/AppearancePreferencePage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,32 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DiagramAppearancePreferencePage«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«preferencesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE AppearancePreferencePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «preferencesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»() {
+ setPreferenceStore(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore());
+ }
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/preferences/ConnectionsPreferencePage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,32 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DiagramConnectionsPreferencePage«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«preferencesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE ConnectionsPreferencePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «preferencesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»() {
+ setPreferenceStore(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore());
+ }
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/preferences/GeneralPreferencePage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,32 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DiagramGeneralPreferencePage«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«preferencesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE GeneralPreferencePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «preferencesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramsPreferencePage {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»() {
+ setPreferenceStore(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore());
+ }
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/preferences/PreferenceInitializer.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DiagramPreferenceInitializer«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«preferencesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE PreferenceInitializer FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «preferencesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void initializeDefaultPreferences() {
+ org.eclipse.jface.preference.IPreferenceStore store = getPreferenceStore();
+ «EXPAND xpt::diagram::preferences::PrintingPreferencePage::qualifiedClassName».initDefaults(store);
+ «IF null == preferences-»
+ «EXPAND xpt::diagram::preferences::GeneralPreferencePage::qualifiedClassName».initDefaults(store);
+ «EXPAND xpt::diagram::preferences::AppearancePreferencePage::qualifiedClassName».initDefaults(store);
+ «EXPAND xpt::diagram::preferences::ConnectionsPreferencePage::qualifiedClassName».initDefaults(store);
+ «EXPAND xpt::diagram::preferences::RulersAndGridPreferencePage::qualifiedClassName».initDefaults(store);
+ «ELSE-»
+ «EXPAND initDefaults("store") FOR preferences-»
+ «ENDIF-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.jface.preference.IPreferenceStore getPreferenceStore() {
+ return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore();
+ }
+}
+«ENDDEFINE»
+
+«DEFINE initDefaults(String storeVar) FOR gmfgen::GenDiagramPreferences»
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SHOW_CONNECTION_HANDLES, «showConnectionHandles»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SHOW_POPUP_BARS, «showPopupBars»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_ENABLE_ANIMATED_LAYOUT, «enableAnimatedLayout»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_ENABLE_ANIMATED_ZOOM, «enableAnimatedZoom»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_ENABLE_ANTIALIAS, «enableAntiAlias»);
+ «EXPAND initDefaultFont(storeVar, "PREF_DEFAULT_FONT") FOR defaultFont-»
+ «EXPAND initDefaultColor(storeVar, "PREF_FONT_COLOR") FOR fontColor-»
+ «EXPAND initDefaultColor(storeVar, "PREF_FILL_COLOR") FOR fillColor-»
+ «EXPAND initDefaultColor(storeVar, "PREF_LINE_COLOR") FOR lineColor-»
+ «EXPAND initDefaultColor(storeVar, "PREF_NOTE_FILL_COLOR") FOR noteFillColor-»
+ «EXPAND initDefaultColor(storeVar, "PREF_NOTE_LINE_COLOR") FOR noteLineColor-»
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_LINE_STYLE, org.eclipse.gmf.runtime.notation.Routing.«lineStyle»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SHOW_RULERS, «showRulers»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_RULER_UNITS, «showRulers»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SHOW_GRID, org.eclipse.gef.rulers.RulerProvider.UNIT_«rulerUnits»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SNAP_TO_GRID, «snapToGrid»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_SNAP_TO_GEOMETRY, «snapToGeometry»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_GRID_SPACING, «gridSpacing»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_PROMPT_ON_DEL_FROM_MODEL, «promptOnDelFromModel»);
+ «storeVar».setDefault(org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_PROMPT_ON_DEL_FROM_DIAGRAM, «promptOnDelFromDiagram»);
+«ENDDEFINE»
+
+«DEFINE initDefaultColor(String storeVar, String prefName) FOR gmfgen::GenColor»
+ org.eclipse.jface.preference.PreferenceConverter.setDefault(«storeVar»,
+ org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.«prefName», «EXPAND rgb»);
+«ENDDEFINE»
+
+«DEFINE initDefaultFont(String storeVar, String prefName) FOR gmfgen::GenFont»
+ org.eclipse.jface.preference.PreferenceConverter.setDefault(«storeVar»,
+ org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.«prefName», «EXPAND fontData»);
+«ENDDEFINE»
+
+«DEFINE rgb FOR gmfgen::GenColor»
+ «ERROR "Unknown colour: " + this»
+«ENDDEFINE»
+
+«DEFINE rgb FOR gmfgen::GenConstantColor»
+ org.eclipse.gmf.runtime.diagram.ui.figures.DiagramColorConstants.«name».getRGB()
+«ENDDEFINE»
+
+«DEFINE rgb FOR gmfgen::GenRGBColor»
+ new org.eclipse.swt.graphics.RGB(«red», «green», «blue»)
+«ENDDEFINE»
+
+«DEFINE fontData FOR gmfgen::GenFont»
+ «ERROR "Unknown font: " + this»
+«ENDDEFINE»
+
+«DEFINE fontData FOR gmfgen::GenCustomFont»
+ new org.eclipse.swt.graphics.FontData("«name»", «height», org.eclipse.swt.SWT.«style»)
+«ENDDEFINE»
+
+«DEFINE fontData FOR gmfgen::GenStandardFont»
+ org.eclipse.jface.resource.JFaceResources.get«name»Font().getFontData()
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/preferences/PrintingPreferencePage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,32 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DiagramPrintingPreferencePage«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«preferencesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE PrintingPreferencePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «preferencesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»() {
+ setPreferenceStore(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore());
+ }
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/preferences/RulersAndGridPreferencePage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,32 @@
+/*
+ * 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DiagramRulersAndGridPreferencePage«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«preferencesPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE RulersAndGridPreferencePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «preferencesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»() {
+ setPreferenceStore(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getPreferenceStore());
+ }
+}
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/preferences/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE extensions FOR gmfgen::GenDiagram-»
+
+ <extension point="org.eclipse.core.runtime.preferences">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <initializer class="«EXPAND xpt::diagram::preferences::PreferenceInitializer::qualifiedClassName»"/>
+ </extension>
+
+«IF preferencePages.size() > 0-»
+ <extension point="org.eclipse.ui.preferencePages">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+«FOREACH preferencePages AS page-»
+«EXPAND preferencePage FOR page-»
+«ENDFOREACH-»
+ </extension>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE preferencePage FOR gmfgen::GenPreferencePage-»
+ <page
+ id="«iD»"
+ name="%preference.page.title.«iD»"
+«IF null != parent-»
+ category="«parent.iD»"
+«ENDIF-»
+ class="«EXPAND qualifiedClassName»">
+ </page>
+«FOREACH children AS page-»
+«EXPAND preferencePage FOR page-»
+«ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenPreferencePage»
+«ERROR "Unknown preference page: " + this»
+«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenCustomPreferencePage»«qualifiedClassName»«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenStandardPreferencePage-»
+«IF gmfgen::StandardPreferencePages::General.value == kind.value-»
+«EXPAND xpt::diagram::preferences::GeneralPreferencePage::qualifiedClassName FOR getDiagram()-»
+«ELSEIF gmfgen::StandardPreferencePages::Appearance.value == kind.value-»
+«EXPAND xpt::diagram::preferences::AppearancePreferencePage::qualifiedClassName FOR getDiagram()-»
+«ELSEIF gmfgen::StandardPreferencePages::Connections.value == kind.value-»
+«EXPAND xpt::diagram::preferences::ConnectionsPreferencePage::qualifiedClassName FOR getDiagram()-»
+«ELSEIF gmfgen::StandardPreferencePages::Printing.value == kind.value-»
+«EXPAND xpt::diagram::preferences::PrintingPreferencePage::qualifiedClassName FOR getDiagram()-»
+«ELSEIF gmfgen::StandardPreferencePages::RulersAndGrid.value == kind.value-»
+«EXPAND xpt::diagram::preferences::RulersAndGridPreferencePage::qualifiedClassName FOR getDiagram()-»
+«ELSEIF gmfgen::StandardPreferencePages::Pathmaps.value == kind.value-»
+org.eclipse.gmf.runtime.emf.ui.preferences.PathmapsPreferencePage«ELSE-»
+«ERROR "Unknown preference page: " + this»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18n FOR gmfgen::GenDiagram-»
+
+# Preferences
+«EXPAND internal_i18n FOREACH preferencePages»
+«ENDDEFINE»
+
+«DEFINE internal_i18n FOR gmfgen::GenPreferencePage-»
+preference.page.title.«iD»=«name»
+«EXPAND internal_i18n FOREACH children-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/updater/DiagramUpdater.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,486 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::diagram::updater::Utils»
+«EXTENSION xpt::diagram::editpolicies::LinkUtils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE DiagramUpdater FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «diagramUpdaterClassName» {
+ «EXPAND isShortcutOrphaned-»
+«LET editorGen.diagram.getAllContainers().select(container | hasSemanticChildren(container)) AS semanticContainers-»
+
+ «EXPAND getGenericSemanticChildrenOfView(semanticContainers)-»
+ «EXPAND getSemanticChildrenOfView FOREACH semanticContainers-»
+ «EXPAND getPhantomNodesIterator-»
+«ENDLET-»
+
+ «EXPAND getGenericConnectedLinks(getAllSemanticElements(editorGen.diagram), getContainedLinksMethodNameSuffix())-»
+
+ «EXPAND getGenericConnectedLinks(getAllSemanticDiagramElements(editorGen.diagram), getIncomingLinksMethodNameSuffix())-»
+
+ «EXPAND getGenericConnectedLinks(getAllSemanticDiagramElements(editorGen.diagram), getOutgoingLinksMethodNameSuffix())-»
+ «EXPAND getContainedLinks FOREACH getAllSemanticElements(editorGen.diagram)-»
+ «EXPAND getIncomingLinks FOREACH getAllSemanticDiagramElements(editorGen.diagram)-»
+ «EXPAND getOutgoingLinks FOREACH getAllSemanticDiagramElements(editorGen.diagram)-»
+ «EXPAND getContainedLinksByTypeMethod FOREACH getAllContainedLinks(editorGen.diagram)-»
+ «EXPAND getIncomingLinksByTypeMethod FOREACH getAllIncomingLinks(editorGen.diagram)-»
+ «EXPAND getOutgoingLinksByTypeMethod FOREACH getAllOutgoingLinks(editorGen.diagram)-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«REM»
+ Currently shortcuts are supported only for domain-based diagram element.
+ This means, view.isSetElement() == true.
+«ENDREM»
+«DEFINE isShortcutOrphaned FOR gmfgen::GenDiagramUpdater-»
+ «IF !editorGen.diagram.containsShortcutsTo.isEmpty()-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+public static boolean isShortcutOrphaned(org.eclipse.gmf.runtime.notation.View view) {
+ return !view.isSetElement() || view.getElement() == null || view.getElement().eIsProxy();
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getGenericSemanticChildrenOfView(List[gmfgen::GenContainerBase] semanticContainers) FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static java.util.List getSemanticChildren(org.eclipse.gmf.runtime.notation.View view) {
+ «IF !semanticContainers.isEmpty()-»
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
+ «EXPAND getSemanticChildrenCase FOREACH semanticContainers-»
+ }
+ «ENDIF-»
+ return java.util.Collections.EMPTY_LIST;
+}
+«ENDDEFINE»
+
+«DEFINE getSemanticChildrenCase FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::caseVisualID»
+ return «EXPAND getSemanticChildrenMethodName»(view);
+«ENDDEFINE»
+
+«DEFINE getSemanticChildrenOfView FOR gmfgen::GenContainerBase-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+public static java.util.List «EXPAND getSemanticChildrenMethodName»(org.eclipse.gmf.runtime.notation.View view) {
+ «IF getSemanticChildrenChildFeatures(this).size() > 0 || getPhantomNodes(this).size() > 0-»
+ «EXPAND defineModelElement-»
+ java.util.List result = new java.util.LinkedList();
+«REM»childMetaFeature can be null here!«ENDREM»«-»
+ «FOREACH getSemanticChildrenChildFeatures(this) AS childMetaFeature-»
+ «IF null == childMetaFeature-»
+ { /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify Class here manually*/ childElement = /*FIXME no containment/child feature found in the genmodel, toolsmith need to specify correct one here manually*/;
+ «ELSEIF isListType(childMetaFeature)-»
+ for (java.util.Iterator it = «EXPAND MetaModel::getFeatureValue("modelElement", getModelElementType()) FOR childMetaFeature».iterator(); it.hasNext();) {
+ «EXPAND MetaModel::DeclareAndAssign("childElement", "it.next()", true) FOR getTypeGenClassX(childMetaFeature)»
+ «ELSE-»
+ { «EXPAND MetaModel::DeclareAndAssign("childElement", "modelElement", getModelElementType(), childMetaFeature) FOR getTypeGenClassX(childMetaFeature)»
+ «ENDIF-»
+ int visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»(view, «EXPAND MetaModel::DowncastToEObject("childElement") FOR getTypeGenClassX(childMetaFeature)»);
+ «EXPAND checkChildElementVisualID(null != childMetaFeature && isListType(childMetaFeature)) FOREACH getSemanticChildren(this, childMetaFeature)-»
+ }
+ «ENDFOREACH-»
+ «IF !getPhantomNodes(this).isEmpty()-»
+ org.eclipse.emf.ecore.resource.Resource resource = modelElement.eResource();
+ for (java.util.Iterator semanticIterator = getPhantomNodesIterator(resource); semanticIterator.hasNext();) {
+ org.eclipse.emf.ecore.EObject childElement = (org.eclipse.emf.ecore.EObject) semanticIterator.next();
+ if (childElement == modelElement) {
+ continue;
+ }
+ «EXPAND addNextIfPhantom FOREACH getPhantomNodes(this)-»
+ }
+ «ENDIF-»
+ return result;
+ «ELSE-»
+ return java.util.Collections.EMPTY_LIST;
+ «ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE defineModelElement FOR gmfgen::GenContainerBase-»
+if (!view.isSetElement()) {
+ return java.util.Collections.EMPTY_LIST;
+}
+«EXPAND MetaModel::DeclareAndAssign("modelElement", "view.getElement()") FOR getModelElementType()»
+«ENDDEFINE»
+
+«DEFINE defineModelElement FOR gmfgen::GenCompartment-»
+if (false == view.eContainer() instanceof org.eclipse.gmf.runtime.notation.View) {
+ return java.util.Collections.EMPTY_LIST;
+}
+org.eclipse.gmf.runtime.notation.View containerView = (org.eclipse.gmf.runtime.notation.View) view.eContainer();
+if (!containerView.isSetElement()) {
+ return java.util.Collections.EMPTY_LIST;
+}
+«EXPAND MetaModel::DeclareAndAssign("modelElement", "containerView.getElement()") FOR getModelElementType()»
+«ENDDEFINE»
+
+«DEFINE getSemanticChildrenMethodName FOR gmfgen::GenContainerBase»get«getUniqueIdentifier()»SemanticChildren«ENDDEFINE»
+
+«DEFINE getSemanticChildrenMethodCall FOR gmfgen::GenContainerBase»«getDiagram().editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».«EXPAND getSemanticChildrenMethodName»«ENDDEFINE»
+
+«DEFINE checkChildElementVisualID(boolean inLoop) FOR gmfgen::GenNode-»
+if (visualID == «EXPAND xpt::editor::VisualIDRegistry::visualID») {
+ result.add(new «getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(«IF null != modelFacet.childMetaFeature»«EXPAND MetaModel::DowncastToEObject("childElement") FOR getTypeGenClassX(modelFacet.childMetaFeature)»«ENDIF», visualID));
+«IF inLoop-»
+ continue;
+«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE addNextIfPhantom FOR gmfgen::GenNode-»
+if («EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»(view, childElement) == «EXPAND xpt::editor::VisualIDRegistry::visualID») {
+ result.add(new «getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()»(childElement, «EXPAND xpt::editor::VisualIDRegistry::visualID»));
+ continue;
+}
+«ENDDEFINE»
+
+
+«DEFINE getPhantomNodesIterator FOR gmfgen::GenDiagramUpdater-»
+ «IF !getPhantomNodes(editorGen.diagram).isEmpty()-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private static java.util.Iterator getPhantomNodesIterator(org.eclipse.emf.ecore.resource.Resource resource) {
+ return resource.getAllContents();
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getGenericConnectedLinks(List[gmfgen::GenCommonBase] linkContainers, String methodNameSuffix) FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static java.util.List get«methodNameSuffix»Links(org.eclipse.gmf.runtime.notation.View view) {
+ «IF !linkContainers.isEmpty()-»
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
+ «EXPAND getContainedLinksCase(methodNameSuffix) FOREACH linkContainers-»
+ }
+ «ENDIF-»
+ return java.util.Collections.EMPTY_LIST;
+}
+«ENDDEFINE»
+
+«DEFINE getContainedLinksCase(String methodNameSuffix) FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::caseVisualID»
+ return «EXPAND linkGetterName(methodNameSuffix)»(view);
+«ENDDEFINE»
+
+«REM»This DEFING can be used from other templates to inject call to the corresponding method«ENDREM»
+«DEFINE getContainedLinksMethodCall FOR gmfgen::GenCommonBase»«getDiagram().editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».«EXPAND linkGetterName(getContainedLinksMethodNameSuffix())»«ENDDEFINE»
+
+«REM»This DEFING can be used from other templates to inject call to the corresponding method«ENDREM»
+«DEFINE getIncomingLinksMethodCall FOR gmfgen::GenCommonBase»«getDiagram().editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».«EXPAND linkGetterName(getIncomingLinksMethodNameSuffix())»«ENDDEFINE»
+
+«REM»This DEFING can be used from other templates to inject call to the corresponding method«ENDREM»
+«DEFINE getOutgoingLinksMethodCall FOR gmfgen::GenCommonBase»«getDiagram().editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».«EXPAND linkGetterName(getOutgoingLinksMethodNameSuffix())»«ENDDEFINE»
+
+«DEFINE linkGetterName(String suffix) FOR gmfgen::GenCommonBase»get«getUniqueIdentifier()»«suffix»Links«ENDDEFINE»
+
+«DEFINE getContainedLinks FOR gmfgen::GenCommonBase-»
+ «EXPAND getConnectedLinks(getContainedLinks(getMetaClass(this), getDiagram()), getContainedLinksMethodNameSuffix(), false)-»
+«ENDDEFINE»
+
+«DEFINE getIncomingLinks FOR gmfgen::GenCommonBase-»
+ «EXPAND getConnectedLinks(getIncomingLinks(getMetaClass(this), getDiagram()), getIncomingLinksMethodNameSuffix(), true)-»
+«ENDDEFINE»
+
+«DEFINE getOutgoingLinks FOR gmfgen::GenCommonBase-»
+ «EXPAND getConnectedLinks(getOutgoingLinks(getMetaClass(this), getDiagram()), getOutgoingLinksMethodNameSuffix(), false)-»
+«ENDDEFINE»
+
+«DEFINE getConnectedLinks(List[gmfgen::GenLink] genLinks, String methodNameSuffix, boolean needCrossReferencer) FOR gmfgen::GenCommonBase-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+public static java.util.List «EXPAND linkGetterName(methodNameSuffix)»(org.eclipse.gmf.runtime.notation.View view) {
+ «IF !genLinks.isEmpty()-»
+ «LET getMetaClass(this) AS metaclass-»
+ «EXPAND MetaModel::DeclareAndAssign("modelElement", "view.getElement()") FOR metaclass»
+ «IF needCrossReferencer-»
+ java.util.Map crossReferences = org.eclipse.emf.ecore.util.EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ «ENDIF-»
+ java.util.List result = new java.util.LinkedList();
+ «EXPAND colectConnectedLinks(methodNameSuffix, needCrossReferencer, metaclass.isExternalInterface()) FOREACH genLinks-»
+ return result;
+ «ENDLET-»
+ «ELSE-»
+ return java.util.Collections.EMPTY_LIST;
+ «ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE colectConnectedLinks(String methodNameSuffix, boolean needCrossReferencer, boolean isExternalInterface) FOR gmfgen::GenLink-»
+«IF isExternalInterface-»
+ if («EXPAND MetaModel::IsInstance("modelElement") FOR modelFacet.getLinkEndType(methodNameSuffix)») {
+«ENDIF-»
+ result.addAll(«EXPAND chooseConnectedLinksByTypeMethodName(methodNameSuffix, this) FOR modelFacet»(«IF isExternalInterface-»
+«EXPAND MetaModel::CastEObject("modelElement") FOR getLinkEndType(modelFacet, methodNameSuffix)»«ELSE»modelElement«ENDIF»«IF needCrossReferencer», crossReferences«ENDIF»));
+«IF isExternalInterface-»
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE chooseConnectedLinksByTypeMethodName(String methodNameSuffix, gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
+ «EXPAND incorrectLinkModelFacet-»
+«ENDDEFINE»
+
+«REM»
+ For FeatureModelFacet-based links we are calling
+ getOutgoing???Links instead of getContained???Links
+«ENDREM»
+«DEFINE chooseConnectedLinksByTypeMethodName(String methodNameSuffix, gmfgen::GenLink genLink) FOR gmfgen::FeatureLinkModelFacet-»
+«IF getContainedLinksMethodNameSuffix() == methodNameSuffix»«EXPAND getConnectedLinksByTypeMethodName(getOutgoingLinksMethodNameSuffix()) FOR genLink-»
+«ELSE»«EXPAND getConnectedLinksByTypeMethodName(methodNameSuffix) FOR genLink-»
+«ENDIF-»
+«ENDDEFINE»
+
+«REM»
+ For TypeModelFacet-based links we are calling
+ getContained???Links instead of getOutgoinf???Links
+ if sourceMetaFeature was not specified
+«ENDREM»
+«DEFINE chooseConnectedLinksByTypeMethodName(String methodNameSuffix, gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
+«IF getOutgoingLinksMethodNameSuffix() == methodNameSuffix && null == sourceMetaFeature»«EXPAND getConnectedLinksByTypeMethodName(getContainedLinksMethodNameSuffix()) FOR genLink-»
+«ELSE»«EXPAND getConnectedLinksByTypeMethodName(methodNameSuffix) FOR genLink-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getContainedLinksByTypeMethod FOR gmfgen::GenLink»«EXPAND getContainedLinksByTypeMethod(this) FOR modelFacet»«ENDDEFINE»
+
+«DEFINE getConnectedLinksByTypeMethodName(String suffix) FOR gmfgen::GenLink»get«suffix»«EXPAND getConnectedLinksByTypeMethodFragment FOR modelFacet»_«visualID»«ENDDEFINE»
+
+«DEFINE getConnectedLinksByTypeMethodFragment FOR gmfgen::TypeLinkModelFacet»TypeModelFacetLinks_«metaClass.ecoreClass.name»«ENDDEFINE»
+
+«DEFINE getConnectedLinksByTypeMethodFragment FOR gmfgen::FeatureLinkModelFacet»FeatureModelFacetLinks_«metaFeature.genClass.ecoreClass.name»_«metaFeature.ecoreFeature.name.toFirstUpper()»«ENDDEFINE»
+
+«DEFINE getConnectedLinksByTypeMethodFragment FOR gmfgen::LinkModelFacet-»
+ «EXPAND incorrectLinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE getContainedLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
+ «EXPAND incorrectLinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE getContainedLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::FeatureLinkModelFacet»«ENDDEFINE»
+
+«DEFINE getContainedLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private static java.util.Collection «EXPAND getConnectedLinksByTypeMethodName(getContainedLinksMethodNameSuffix()) FOR genLink»(«EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container) {
+ «EXPAND getContainedLinksByTypeMethodBody(genLink, false)-»
+}
+«ENDDEFINE»
+
+«DEFINE getContainedLinksByTypeMethodBody(gmfgen::GenLink genLink, boolean sourceVarDefined) FOR gmfgen::TypeLinkModelFacet-»
+java.util.Collection result = new java.util.LinkedList();
+ «LET childMetaFeature.isListType() AS inLoop-»
+«IF inLoop-»
+for (java.util.Iterator links = «EXPAND MetaModel::getFeatureValue("container", containmentMetaFeature.genClass) FOR childMetaFeature».iterator(); links.hasNext();) {
+ org.eclipse.emf.ecore.EObject linkObject = (org.eclipse.emf.ecore.EObject ) links.next();
+ if («EXPAND MetaModel::NotInstance("linkObject") FOR metaClass») {
+ continue;
+ }
+ «EXPAND MetaModel::DeclareAndAssign("link", "linkObject") FOR metaClass»
+«ELSE-»
+ «IF getTypeGenClassX(childMetaFeature) == metaClass-»
+ «EXPAND MetaModel::DeclareAndAssign("link", "container", getSourceType(), childMetaFeature) FOR metaClass»
+ «ELSE-»
+ «EXPAND MetaModel::DeclareAndAssign("linkObject", "container", getSourceType(), childMetaFeature) FOR getTypeGenClassX(childMetaFeature)»
+ if («EXPAND MetaModel::NotInstance("linkObject") FOR metaClass») {
+ return result;
+ }
+ «EXPAND MetaModel::DeclareAndAssign("link", "linkObject") FOR metaClass»
+ «ENDIF-»
+«ENDIF-»
+ «EXPAND checkLinkVisualID(genLink, inLoop)-»
+ «EXPAND defineLinkDestination(inLoop)-»
+ «IF null != sourceMetaFeature-»
+ «EXPAND defineLinkSource(inLoop)-»
+ «IF sourceVarDefined-»
+ «EXPAND checkLinkSource(inLoop)-»
+ «ENDIF-»
+ «EXPAND addLinkDescriptor(genLink, "src", "dst")-»
+ «ELSE-»
+ «EXPAND addLinkDescriptor(genLink, "container", "dst")-»
+ «ENDIF-»
+«IF inLoop-»
+}
+«ENDIF-»
+ «ENDLET-»
+return result;
+«ENDDEFINE»
+
+«DEFINE addLinkDescriptor(gmfgen::GenLink genLink, String srcVar, String dstVar) FOR gmfgen::TypeLinkModelFacet-»
+result.add(new «genLink.getDiagram().editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()»(«EXPAND MetaModel::DowncastToEObject(srcVar) FOR getSourceType()», «EXPAND MetaModel::DowncastToEObject(dstVar) FOR getTargetType()», «EXPAND MetaModel::DowncastToEObject("link") FOR metaClass», «genLink.getDiagram().getElementTypesQualifiedClassName()».«genLink.getUniqueIdentifier()», «EXPAND xpt::editor::VisualIDRegistry::visualID FOR genLink»));
+«ENDDEFINE»
+
+«DEFINE checkLinkVisualID(gmfgen::GenLink genLink, boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
+if («EXPAND xpt::editor::VisualIDRegistry::visualID FOR genLink» != «EXPAND xpt::editor::VisualIDRegistry::getLinkWithClassVisualIDMethodCall FOR genLink.getDiagram()»(«EXPAND MetaModel::DowncastToEObject("link") FOR metaClass»)) {
+ «EXPAND stopLinkProcessing(inLoop)-»
+}
+«ENDDEFINE»
+
+«DEFINE defineLinkSource(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
+ «IF sourceMetaFeature.isListType()-»
+java.util.List sources = «EXPAND MetaModel::getFeatureValue("link", metaClass) FOR sourceMetaFeature»;
+Object theSource = sources.size() == 1 ? sources.get(0) : null;
+if («EXPAND MetaModel::NotInstance("theSource") FOR getSourceType()») {
+ «EXPAND stopLinkProcessing(inLoop)-»
+}
+«EXPAND MetaModel::DeclareAndAssign("src", "theSource", true) FOR getSourceType()»
+ «ELSE-»
+«EXPAND MetaModel::DeclareAndAssign("src", "link", metaClass, sourceMetaFeature) FOR getSourceType()»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkLinkSource(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
+if (src != source) {
+ «EXPAND stopLinkProcessing(inLoop)-»
+}
+«ENDDEFINE»
+
+«DEFINE defineLinkDestination(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
+ «IF targetMetaFeature.isListType()-»
+java.util.List targets = «EXPAND MetaModel::getFeatureValue("link", metaClass) FOR targetMetaFeature»;
+Object theTarget = targets.size() == 1 ? targets.get(0) : null;
+if («EXPAND MetaModel::NotInstance("theTarget") FOR getTargetType()») {
+ «EXPAND stopLinkProcessing(inLoop)-»
+}
+«EXPAND MetaModel::DeclareAndAssign("dst", "theTarget", true) FOR getTargetType()»
+ «ELSE-»
+«EXPAND MetaModel::DeclareAndAssign("dst", "link", metaClass, targetMetaFeature) FOR getTargetType()»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE stopLinkProcessing(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
+«IF inLoop-»
+continue;
+«ELSE-»
+return result;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getIncomingLinksByTypeMethod FOR gmfgen::GenLink-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private static java.util.Collection «EXPAND getConnectedLinksByTypeMethodName(getIncomingLinksMethodNameSuffix())»(«EXPAND MetaModel::QualifiedClassName FOR modelFacet.getTargetType()» target, java.util.Map crossReferences) {
+ java.util.Collection result = new java.util.LinkedList();
+ java.util.Collection settings = (java.util.Collection) crossReferences.get(target);
+ for (java.util.Iterator it = settings.iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.EStructuralFeature.Setting setting = (org.eclipse.emf.ecore.EStructuralFeature.Setting) it.next();
+ «EXPAND getIncomingLinksByTypeMethodBody(this) FOR modelFacet-»
+ }
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE getIncomingLinksByTypeMethodBody(gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
+if (setting.getEStructuralFeature() != «EXPAND MetaModel::MetaFeature FOR targetMetaFeature» || «EXPAND MetaModel::NotInstance("setting.getEObject()") FOR metaClass») {
+ continue;
+}
+«EXPAND MetaModel::DeclareAndAssign("link", "setting.getEObject()") FOR metaClass»
+ «EXPAND checkLinkVisualID(genLink, true)-»
+ «IF null != sourceMetaFeature-»
+ «EXPAND defineLinkSource(true)-»
+ «EXPAND addLinkDescriptor(genLink, "src", "target")-»
+ «ELSE-»
+ «EXPAND defineLinkContainer(true)-»
+ «EXPAND addLinkDescriptor(genLink, "container", "target")-»
+«REM»TODO: continue here.«ENDREM»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE defineLinkContainer(boolean inLoop) FOR gmfgen::TypeLinkModelFacet-»
+if (false == «EXPAND MetaModel::IsContainerInstance("link", metaClass) FOR containmentMetaFeature.genClass») {
+ «EXPAND stopLinkProcessing(inLoop)-»
+}
+«EXPAND MetaModel::DeclareAndAssignContainer("container", "link", metaClass) FOR containmentMetaFeature.genClass»
+«ENDDEFINE»
+
+«DEFINE getIncomingLinksByTypeMethodBody(gmfgen::GenLink genLink) FOR gmfgen::FeatureLinkModelFacet-»
+if (setting.getEStructuralFeature() == «EXPAND MetaModel::MetaFeature FOR metaFeature») {
+ result.add(new «genLink.getDiagram().editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()»(setting.getEObject(), «EXPAND MetaModel::DowncastToEObject("target") FOR getTargetType()», «genLink.getDiagram().getElementTypesQualifiedClassName()».«genLink.getUniqueIdentifier()», «EXPAND xpt::editor::VisualIDRegistry::visualID FOR genLink»));
+}
+«ENDDEFINE»
+
+«DEFINE getIncomingLinksByTypeMethodBody(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
+ «EXPAND incorrectLinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE getOutgoingLinksByTypeMethod FOR gmfgen::GenLink-»
+ «EXPAND getOutgoingLinksByTypeMethod(this) FOR modelFacet-»
+«ENDDEFINE»
+
+«DEFINE getOutgoingLinksByTypeMethodSignature FOR gmfgen::GenLink»private static java.util.Collection «EXPAND getConnectedLinksByTypeMethodName(getOutgoingLinksMethodNameSuffix())»(«EXPAND MetaModel::QualifiedClassName FOR modelFacet.getSourceType()» source)«ENDDEFINE»
+
+«DEFINE getOutgoingLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::FeatureLinkModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+«EXPAND getOutgoingLinksByTypeMethodSignature FOR genLink» {
+ java.util.Collection result = new java.util.LinkedList();
+ «IF metaFeature.isListType()-»
+ for (java.util.Iterator destinations = «EXPAND MetaModel::getFeatureValue("source", getSourceType()) FOR metaFeature».iterator(); destinations.hasNext();) {
+ «EXPAND MetaModel::DeclareAndAssign("destination", "destinations.next()", true) FOR getTargetType()»
+ «ELSE-»
+ «EXPAND MetaModel::DeclareAndAssign("destination", "source", getSourceType(), metaFeature) FOR getTargetType()»
+ if (destination == null) {
+ return result;
+ }
+ «ENDIF-»
+ result.add(new «genLink.getDiagram().editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()»(«EXPAND MetaModel::DowncastToEObject("source") FOR getSourceType()», «EXPAND MetaModel::DowncastToEObject("destination") FOR getTargetType()», «genLink.getDiagram().getElementTypesQualifiedClassName()».«genLink.getUniqueIdentifier()», «EXPAND xpt::editor::VisualIDRegistry::visualID FOR genLink»));
+ «IF metaFeature.isListType()-»
+ }
+ «ENDIF-»
+ return result;
+}
+«ENDDEFINE»
+
+«REM»More careful way to find container should be used here then GMF will be modified in accordance«ENDREM»
+«DEFINE getOutgoingLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet-»
+ «IF null != sourceMetaFeature-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+«EXPAND getOutgoingLinksByTypeMethodSignature FOR genLink» {
+ «EXPAND MetaModel::QualifiedClassName FOR containmentMetaFeature.genClass» container = null;
+ // Find container element for the link.
+ // Climb up by containment hierarchy starting from the source
+ // and return the first element that is instance of the container class.
+ for (org.eclipse.emf.ecore.EObject element = «EXPAND MetaModel::DowncastToEObject("source") FOR getSourceType()»; element != null && container == null; element = element.eContainer()) {
+ if («EXPAND MetaModel::IsInstance("element") FOR containmentMetaFeature.genClass») {
+ container = «EXPAND MetaModel::CastEObject("element") FOR containmentMetaFeature.genClass»;
+ }
+ }
+ if (container == null) {
+ return java.util.Collections.EMPTY_LIST;
+ }
+ «EXPAND getContainedLinksByTypeMethodBody(genLink, true)-»
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getOutgoingLinksByTypeMethod(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet-»
+ «EXPAND incorrectLinkModelFacet-»
+«ENDDEFINE»
+
+«DEFINE incorrectLinkModelFacet FOR gmfgen::LinkModelFacet-»
+ «ERROR "Incorrect LinkModelFacet: " + this»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/updater/LinkDescriptor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE LinkDescriptor FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «linkDescriptorClassName» extends «getNodeDescriptorQualifiedClassName()» {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND refOnlyLinkConstructor-»
+
+ «EXPAND typeLinkConstructor-»
+
+ «EXPAND getSource-»
+
+ «EXPAND getDestination-»
+
+ «EXPAND getSemanticAdapter-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+
+«DEFINE attributes FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.ecore.EObject mySource;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.ecore.EObject myDestination;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.core.runtime.IAdaptable mySemanticAdapter;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private «linkDescriptorClassName»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.emf.ecore.EObject linkElement, int linkVID) {
+ super(linkElement, linkVID);
+ mySource = source;
+ myDestination = destination;
+}
+«ENDDEFINE»
+
+«DEFINE refOnlyLinkConstructor FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «linkDescriptorClassName»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, int linkVID) {
+ this(source, destination, (org.eclipse.emf.ecore.EObject) null, linkVID);
+ «EXPAND elementTypeCopy-»
+ mySemanticAdapter = new org.eclipse.core.runtime.IAdaptable() {
+ public Object getAdapter(Class adapter) {
+ «EXPAND elementTypeAdapter-»
+ return null;
+ }
+ };
+}
+«ENDDEFINE»
+
+«DEFINE typeLinkConstructor FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «linkDescriptorClassName»(org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EObject destination, org.eclipse.emf.ecore.EObject linkElement, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType, int linkVID) {
+ this(source, destination, linkElement, linkVID);
+ «EXPAND elementTypeCopy-»
+ mySemanticAdapter = new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(linkElement) {
+ public Object getAdapter(Class adapter) {
+ «EXPAND elementTypeAdapter-»
+ return super.getAdapter(adapter);
+ }
+ };
+}
+«ENDDEFINE»
+
+«DEFINE elementTypeCopy FOR gmfgen::GenDiagramUpdater-»
+final org.eclipse.gmf.runtime.emf.type.core.IElementType elementTypeCopy = elementType;
+«ENDDEFINE»
+
+«DEFINE elementTypeAdapter FOR gmfgen::GenDiagramUpdater-»
+if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) {
+ return elementTypeCopy;
+}
+«ENDDEFINE»
+
+«DEFINE getSource FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.ecore.EObject getSource() {
+ return mySource;
+}
+«ENDDEFINE»
+
+«DEFINE getDestination FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.ecore.EObject getDestination() {
+ return myDestination;
+}
+«ENDDEFINE»
+
+«DEFINE getSemanticAdapter FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.core.runtime.IAdaptable getSemanticAdapter() {
+ return mySemanticAdapter;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/updater/NodeDescriptor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE NodeDescriptor FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «nodeDescriptorClassName» {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND getModelElement-»
+
+ «EXPAND getVisualID-»
+
+ «EXPAND getType-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.ecore.EObject myModelElement;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private int myVisualID;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private String myType;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «nodeDescriptorClassName»(org.eclipse.emf.ecore.EObject modelElement, int visualID) {
+ myModelElement = modelElement;
+ myVisualID = visualID;
+}
+«ENDDEFINE»
+
+«DEFINE getModelElement FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.ecore.EObject getModelElement() {
+ return myModelElement;
+}
+«ENDDEFINE»
+
+«DEFINE getVisualID FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int getVisualID() {
+ return myVisualID;
+}
+«ENDDEFINE»
+
+«DEFINE getType FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getType() {
+ if (myType == null) {
+ myType = «EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR editorGen.diagram»(getVisualID());
+ }
+ return myType;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/updater/UpdateCommand.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE UpdateCommand FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «updateCommandClassName» implements org.eclipse.core.commands.IHandler {
+
+ «EXPAND addHandlerListener-»
+
+ «EXPAND dispose-»
+
+ «EXPAND execute-»
+
+ «EXPAND isEnabled-»
+
+ «EXPAND isHandled-»
+
+ «EXPAND removeHandlerListener-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE addHandlerListener FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void addHandlerListener(org.eclipse.core.commands.IHandlerListener handlerListener) {
+}
+«ENDDEFINE»
+
+«DEFINE dispose FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+}
+«ENDDEFINE»
+
+«DEFINE execute FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object execute(org.eclipse.core.commands.ExecutionEvent event) throws org.eclipse.core.commands.ExecutionException {
+ org.eclipse.jface.viewers.ISelection selection = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection) {
+ org.eclipse.jface.viewers.IStructuredSelection structuredSelection = (org.eclipse.jface.viewers.IStructuredSelection) selection;
+ if (structuredSelection.size() != 1) {
+ return null;
+ }
+ if (structuredSelection.getFirstElement() instanceof org.eclipse.gef.EditPart && ((org.eclipse.gef.EditPart) structuredSelection.getFirstElement()).getModel() instanceof org.eclipse.gmf.runtime.notation.View) {
+ org.eclipse.emf.ecore.EObject modelElement = ((org.eclipse.gmf.runtime.notation.View) ((org.eclipse.gef.EditPart) structuredSelection.getFirstElement()).getModel()).getElement();
+ java.util.List editPolicies = org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
+ for (java.util.Iterator it = editPolicies.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy nextEditPolicy = (org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy) it.next();
+ nextEditPolicy.refresh();
+ }
+
+ }
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE isEnabled FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isEnabled() {
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE isHandled FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isHandled() {
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE removeHandlerListener FOR gmfgen::GenDiagramUpdater-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void removeHandlerListener(org.eclipse.core.commands.IHandlerListener handlerListener) {
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagramUpdater»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/updater/Utils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+extension xpt::diagram::editpolicies::LinkUtils;
+
+String getContainedLinksMethodNameSuffix() :
+ "Contained"
+;
+
+String getIncomingLinksMethodNameSuffix() :
+ "Incoming"
+;
+
+String getOutgoingLinksMethodNameSuffix() :
+ "Outgoing"
+;
+
+cached List[gmfgen::GenLink] getContainedLinks(genmodel::GenClass metaClass, gmfgen::GenDiagram diagram) :
+ diagram.links.select(link | canBeContainer(link, metaClass))
+;
+
+cached List[gmfgen::GenLink] getOutgoingLinks(genmodel::GenClass metaClass, gmfgen::GenDiagram diagram) :
+ diagram.links.select(link | canBeSource(link, metaClass))
+;
+
+cached List[gmfgen::GenLink] getIncomingLinks(genmodel::GenClass metaClass, gmfgen::GenDiagram diagram) :
+ diagram.links.select(link | canBeTarget(link, metaClass))
+;
+
+List[gmfgen::GenLink] getAllContainedLinks(gmfgen::GenDiagram diagram) :
+ diagram.links.select(link | !getAllSemanticElements(diagram).select(commonBase | canBeContainer(link, getMetaClass(commonBase))).isEmpty())
+;
+
+List[gmfgen::GenLink] getAllIncomingLinks(gmfgen::GenDiagram diagram) :
+ diagram.links.select(link | !getAllSemanticDiagramElements(diagram).select(commonBase | canBeTarget(link, getMetaClass(commonBase))).isEmpty())
+;
+
+List[gmfgen::GenLink] getAllOutgoingLinks(gmfgen::GenDiagram diagram) :
+ diagram.links.select(link | isOutgoingLink(link)).select(link | !getAllSemanticDiagramElements(diagram).select(commonBase | canBeSource(link, getMetaClass(commonBase))).isEmpty())
+;
+
+private boolean isOutgoingLink(gmfgen::GenLink link) :
+ null != link.modelFacet && isOutgoingLink(link.modelFacet)
+;
+
+private boolean isOutgoingLink(gmfgen::LinkModelFacet modelFacet) :
+ true
+;
+
+private boolean isOutgoingLink(gmfgen::TypeLinkModelFacet modelFacet) :
+ null != modelFacet.sourceMetaFeature
+;
+
+cached List[gmfgen::GenCommonBase] getAllSemanticDiagramElements(gmfgen::GenDiagram diagram) :
+ diagram.getAllNodes().toList().addAll(diagram.links).typeSelect(gmfgen::GenCommonBase).select(commonBase | null != getMetaClass(commonBase))
+;
+
+cached List[gmfgen::GenCommonBase] getAllSemanticElements(gmfgen::GenDiagram diagram) :
+ null != diagram.domainDiagramElement
+ ? {diagram}.addAll(getAllSemanticDiagramElements(diagram))
+ : getAllSemanticDiagramElements(diagram)
+;
+
+cached genmodel::GenClass getMetaClass(gmfgen::GenCommonBase commonBase) :
+ null
+;
+
+cached genmodel::GenClass getMetaClass(gmfgen::GenDiagram diagram) :
+ diagram.domainDiagramElement
+;
+
+cached genmodel::GenClass getMetaClass(gmfgen::GenNode node) :
+ node.modelFacet.metaClass
+;
+
+cached genmodel::GenClass getMetaClass(gmfgen::GenLink link) :
+ null != link.modelFacet ? getMetaClass(link.modelFacet) : null
+;
+
+private genmodel::GenClass getMetaClass(gmfgen::LinkModelFacet modelFacet) :
+ null
+;
+
+private genmodel::GenClass getMetaClass(gmfgen::TypeLinkModelFacet modelFacet) :
+ modelFacet.metaClass
+;
+
+boolean hasSemanticChildren(gmfgen::GenContainerBase container) :
+ !container.sansDomain && !container.containedNodes.isEmpty()
+;
+
+genmodel::GenClass getModelElementType(gmfgen::GenContainerBase containerBase) :
+// Never should be here!
+ null
+;
+
+genmodel::GenClass getModelElementType(gmfgen::GenDiagram diagram) :
+ diagram.domainDiagramElement
+;
+
+genmodel::GenClass getModelElementType(gmfgen::GenCompartment compartment) :
+ getModelElementType(compartment.node)
+;
+
+genmodel::GenClass getModelElementType(gmfgen::GenNode node) :
+ node.modelFacet.metaClass
+;
+
+cached Set[genmodel::GenFeature] getSemanticChildrenChildFeatures(gmfgen::GenContainerBase containerBase) :
+ getNonPhantomSemanticChildren(containerBase).collect(node | node.modelFacet.childMetaFeature).toSet()
+;
+
+cached Set[genmodel::GenFeature] getSemanticChildrenContainmentFeatures(gmfgen::GenContainerBase containerBase) :
+ getNonPhantomSemanticChildren(containerBase).collect(node | node.modelFacet.containmentMetaFeature).toSet()
+;
+
+cached List[gmfgen::GenNode] getSemanticChildren(gmfgen::GenContainerBase containerBase, genmodel::GenFeature childMetaFeature) :
+ getNonPhantomSemanticChildren(containerBase).select(node | node.modelFacet.childMetaFeature == childMetaFeature)
+;
+
+private cached List[gmfgen::GenNode] getNonPhantomSemanticChildren(gmfgen::GenContainerBase containerBase) :
+ getSemanticChildren(containerBase).select(node | !node.modelFacet.isPhantomElement())
+;
+
+cached List[gmfgen::GenNode] getPhantomNodes(gmfgen::GenContainerBase containerBase) :
+ {}
+;
+
+cached List[gmfgen::GenNode] getPhantomNodes(gmfgen::GenDiagram diagram) :
+ getSemanticChildren(diagram).select(node | node.modelFacet.isPhantomElement())
+;
+
+cached List[gmfgen::GenNode] getSemanticChildren(gmfgen::GenContainerBase containerBase) :
+ containerBase.containedNodes.select(node | null != node.modelFacet)
+;
+
+cached boolean hasConformableSemanticChildren(gmfgen::GenContainerBase containerBase) :
+ let childMetaClasses = getSemanticChildren(containerBase).collect(node | node.modelFacet.metaClass) :
+ !childMetaClasses.forAll(mc | childMetaClasses.select(mc2 | mc == mc2).size() == 1)
+;
+
+GenClass getLinkEndType(gmfgen::LinkModelFacet f, String methodNameSuffix) :
+ null
+;
+
+// For FeatureModelFacet-based links we are calling
+// getOutgoing???Links instead of getContained???Links
+GenClass getLinkEndType(gmfgen::FeatureLinkModelFacet f, String methodNameSuffix) :
+ getIncomingLinksMethodNameSuffix() == methodNameSuffix
+ ? f.getTargetType()
+ : f.getSourceType()
+;
+
+// For TypeModelFacet-based links we are calling
+// getContained???Links instead of getOutgoinf???Links
+// if sourceMetaFeature was not specified
+GenClass getLinkEndType(gmfgen::TypeLinkModelFacet f, String methodNameSuffix) :
+ getIncomingLinksMethodNameSuffix() == methodNameSuffix
+ ? f.getTargetType()
+ : (getOutgoingLinksMethodNameSuffix() == methodNameSuffix && null != f.sourceMetaFeature
+ ? f.getSourceType()
+ : f.containmentMetaFeature.genClass
+ )
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/updater/containerBaseCanonicalMethods.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::diagram::updater::Utils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE containerBaseCanonicalMethods FOR gmfgen::GenContainerBase-»
+ «EXPAND attributes-»
+
+ «EXPAND getSemanticChildrenList-»
+ «EXPAND shouldDeleteView-»
+
+ «EXPAND isOrphaned-»
+ «IF hasConformableSemanticChildren(this)-»
+
+ «EXPAND populateViewProperties-»
+ «ENDIF-»
+
+ «EXPAND getDefaultFactoryHint-»
+ «EXPAND getFeaturesToSynchronize-»
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenContainerBase-»
+«IF getSemanticChildrenContainmentFeatures(this).size() > 0-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+java.util.Set myFeaturesToSynchronize;
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getSemanticChildrenList FOR gmfgen::GenContainerBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getSemanticChildrenList() {
+ «IF hasSemanticChildren(this)-»
+ org.eclipse.gmf.runtime.notation.View viewObject = (org.eclipse.gmf.runtime.notation.View) getHost().getModel();
+ java.util.List result = new java.util.LinkedList();
+ for (java.util.Iterator it = «EXPAND xpt::diagram::updater::DiagramUpdater::getSemanticChildrenMethodCall»(viewObject).iterator(); it.hasNext();) {
+ result.add(((«getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()») it.next()).getModelElement());
+ }
+ return result;
+ «ELSE-»
+ return java.util.Collections.EMPTY_LIST;
+ «ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE shouldDeleteView FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE shouldDeleteView FOR gmfgen::GenDiagram-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+protected boolean shouldDeleteView(org.eclipse.gmf.runtime.notation.View view) {
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE checkShortcutProperty FOR gmfgen::GenDiagram-»
+ «IF !containsShortcutsTo.isEmpty()-»
+if (view.getEAnnotation("Shortcut") != null) {«EXPAND xpt::Common::nonNLS»
+ return «editorGen.diagramUpdater.getDiagramUpdaterQualifiedClassName()».isShortcutOrphaned(view);
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkShortcutProperty FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE getDefaultFactoryHint FOR gmfgen::GenContainerBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected String getDefaultFactoryHint() {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE isOrphaned FOR gmfgen::GenContainerBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected boolean isOrphaned(java.util.Collection semanticChildren, final org.eclipse.gmf.runtime.notation.View view) {
+ «EXPAND checkShortcutProperty-»
+ «IF !getSemanticChildren(this).isEmpty()-»
+ int visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(view);
+ switch (visualID) {
+ «EXPAND xpt::Common::caseVisualID FOREACH getSemanticChildren(this)»
+ if (!semanticChildren.contains(view.getElement())) {
+ return true;
+ }
+ «IF hasConformableSemanticChildren(this)-»
+ «EXPAND updateNotationModelElement-»
+ «ENDIF-»
+ }
+ «ENDIF-»
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE updateNotationModelElement FOR gmfgen::GenCommonBase-»
+ org.eclipse.emf.ecore.EObject domainModelElement = view.getElement();
+ if (visualID != «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall FOR getDiagram()»((org.eclipse.gmf.runtime.notation.View) getHost().getModel(), domainModelElement)) {
+ java.util.List createdViews = createViews(java.util.Collections.singletonList(domainModelElement));
+ assert createdViews.size() == 1;
+ final org.eclipse.gmf.runtime.notation.View createdView = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) createdViews.get(0)).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (createdView != null) {
+ try {
+ new org.eclipse.emf.workspace.AbstractEMFOperation(host().getEditingDomain(), org.eclipse.gmf.runtime.common.core.util.StringStatics.BLANK, Collections.singletonMap(org.eclipse.emf.transaction.Transaction.OPTION_UNPROTECTED, Boolean.TRUE)) {
+ protected org.eclipse.core.runtime.IStatus doExecute(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
+ populateViewProperties(view, createdView);
+ return org.eclipse.core.runtime.Status.OK_STATUS;
+ }
+ }.execute(new org.eclipse.core.runtime.NullProgressMonitor(), null);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Error while copyign view information to newly created view", e); //$NON-NLS-1$
+ }
+ }
+ deleteViews(java.util.Collections.singletonList(view).iterator());
+ }
+«ENDDEFINE»
+
+«DEFINE populateViewProperties FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void populateViewProperties(org.eclipse.gmf.runtime.notation.View oldView, org.eclipse.gmf.runtime.notation.View newView) {
+ if (oldView instanceof org.eclipse.gmf.runtime.notation.Node && newView instanceof org.eclipse.gmf.runtime.notation.Node) {
+ org.eclipse.gmf.runtime.notation.Node oldNode = (org.eclipse.gmf.runtime.notation.Node) oldView;
+ org.eclipse.gmf.runtime.notation.Node newNode = (org.eclipse.gmf.runtime.notation.Node) newView;
+ if (oldNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Location && newNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Location) {
+ ((org.eclipse.gmf.runtime.notation.Location) newNode.getLayoutConstraint()).setX(((org.eclipse.gmf.runtime.notation.Location) oldNode.getLayoutConstraint()).getX());
+ ((org.eclipse.gmf.runtime.notation.Location) newNode.getLayoutConstraint()).setY(((org.eclipse.gmf.runtime.notation.Location) oldNode.getLayoutConstraint()).getY());
+ }
+ if (oldNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Size && newNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Size) {
+ ((org.eclipse.gmf.runtime.notation.Size) newNode.getLayoutConstraint()).setWidth(((org.eclipse.gmf.runtime.notation.Size) oldNode.getLayoutConstraint()).getWidth());
+ ((org.eclipse.gmf.runtime.notation.Size) newNode.getLayoutConstraint()).setHeight(((org.eclipse.gmf.runtime.notation.Size) oldNode.getLayoutConstraint()).getHeight());
+ }
+ if (oldNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Ratio && newNode.getLayoutConstraint() instanceof org.eclipse.gmf.runtime.notation.Ratio) {
+ ((org.eclipse.gmf.runtime.notation.Ratio) newNode.getLayoutConstraint()).setValue(((org.eclipse.gmf.runtime.notation.Ratio) oldNode.getLayoutConstraint()).getValue());
+ }
+ newNode.persist();
+ }
+}
+«ENDDEFINE»
+
+«DEFINE getFeaturesToSynchronize FOR gmfgen::GenContainerBase-»
+«IF getSemanticChildrenChildFeatures(this).size() > 0-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+protected java.util.Set getFeaturesToSynchronize(){
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new java.util.HashSet();
+ «EXPAND addContainmentFeature FOREACH getSemanticChildrenContainmentFeatures(this)-»
+ }
+ return myFeaturesToSynchronize;
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addContainmentFeature FOR genmodel::GenFeature-»
+myFeaturesToSynchronize.add(«EXPAND MetaModel::MetaFeature»);
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/updater/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE extensions FOR gmfgen::GenDiagramUpdater-»
+ <extension point="org.eclipse.ui.commands">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <command
+ categoryId="org.eclipse.ui.category.edit"
+ defaultHandler="«getUpdateCommandQualifiedClassName()»"
+ description="%update.diagram.description"
+ id="«updateCommandID»"
+ name="%update.diagram.name"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <key
+ commandId="«updateCommandID»"
+ contextId="«editorGen.editor.contextID»"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F5"/>
+ </extension>
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/views/CompartmentViewFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE CompartmentViewFactory FOR gmfgen::GenCompartment-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «IF canCollapse-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDrawerStyle());
+ «ENDIF-»
+ «IF needsTitle-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createTitleStyle());
+ «ENDIF-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFilteringStyle());
+ «IF isStoringChildPositions(node.getLayoutType())-»
+ «EXPAND xpt::diagram::views::Utils::addShapeStyle("styles") FOR viewmap-»
+ «ENDIF-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
+ return styles;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
+ org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ «EXPAND xpt::diagram::views::Utils::foregroundColour("view") FOR viewmap-»
+ }
+ «IF isStoringChildPositions(node.getLayoutType())-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.notation.LayoutConstraint createLayoutConstraint() {
+ return org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createBounds();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void initializeFromPreferences(org.eclipse.gmf.runtime.notation.View view) {
+ super.initializeFromPreferences(view);
+ org.eclipse.jface.preference.IPreferenceStore store =
+ (org.eclipse.jface.preference.IPreferenceStore) getPreferencesHint().getPreferenceStore();
+ org.eclipse.swt.graphics.RGB fillRGB = org.eclipse.jface.preference.PreferenceConverter.getColor(store,
+ org.eclipse.gmf.runtime.diagram.ui.preferences.IPreferenceConstants.PREF_FILL_COLOR);
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(view,
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(),
+ org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.RGBToInteger(fillRGB));
+ }
+ «ENDIF-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setupCompartmentTitle(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gmf.runtime.notation.TitleStyle titleStyle = (org.eclipse.gmf.runtime.notation.TitleStyle) view.getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null){
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setupCompartmentCollapsed(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gmf.runtime.notation.DrawerStyle drawerStyle = (org.eclipse.gmf.runtime.notation.DrawerStyle) view.getStyle(
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null){
+ drawerStyle.setCollapsed(false);
+ }
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCompartment»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/views/DiagramViewFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE DiagramViewFactory FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDiagramStyle());
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
+ return styles;
+ }
+«IF units != null-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.notation.MeasurementUnit getMeasurementUnit() {
+ return org.eclipse.gmf.runtime.notation.MeasurementUnit.«units.toUpperCase()»_LITERAL;
+ }
+«ENDIF-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/views/FloatingLabelViewFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE FloatingLabelViewFactory FOR gmfgen::GenLabel-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.notation.View createView(org.eclipse.core.runtime.IAdaptable semanticAdapter,
+ org.eclipse.gmf.runtime.notation.View containerView, String semanticHint, int index, boolean persisted,
+ org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint preferencesHint) {
+ org.eclipse.gmf.runtime.notation.Node view = (org.eclipse.gmf.runtime.notation.Node) super.createView(
+ semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ «EXPAND offset-»
+ return view;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «EXPAND xpt::diagram::views::Utils::addTextStyle("styles") FOR modelFacet-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
+ return styles;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE offset FOR gmfgen::GenLabel-»
+«ENDDEFINE»
+
+«DEFINE offset FOR gmfgen::GenLinkLabel-»
+ «LET labelOffsetX(viewmap, 0) AS x-»
+ «LET labelOffsetY(viewmap, 0) AS y-»
+ «IF x != 0 || y != 0-»
+ «EXPAND offset(x, y)-»
+ «ENDIF-»
+ «ENDLET-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE offset FOR gmfgen::GenExternalNodeLabel-»
+ «EXPAND offset(0, 5)-»
+«ENDDEFINE»
+
+«DEFINE offset(Integer x, Integer y) FOR gmfgen::GenLabel-»
+ org.eclipse.gmf.runtime.notation.Location location = (org.eclipse.gmf.runtime.notation.Location) view.getLayoutConstraint();
+ org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode mapMode =
+ org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(«x»));
+ location.setY(mapMode.DPtoLP(«y»));
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLabel»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/views/LabelNodeViewFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE LabelNodeViewFactory FOR gmfgen::GenChildLabelNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «EXPAND xpt::diagram::views::Utils::addLinkedDiagramStyle("styles")-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
+ return styles;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
+ org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ «EXPAND xpt::diagram::views::Utils::foregroundColour("view") FOR viewmap-»
+ «EXPAND xpt::diagram::views::Utils::backgroundColour("view") FOR viewmap-»
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenChildLabelNode»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/views/LabelViewFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE LabelViewFactory FOR gmfgen::GenNodeLabel-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «EXPAND xpt::diagram::views::Utils::addTextStyle("styles") FOR modelFacet-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
+ return styles;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNodeLabel»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/views/LinkViewFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE LinkViewFactory FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «IF !isFixedForeground(viewmap)-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createConnectorStyle());
+ «ELSE-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createRoutingStyle());
+ «ENDIF-»
+ «IF !isFixedFont(viewmap)-»
+ styles.add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFontStyle());
+ «ENDIF-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
+ return styles;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
+ org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ «EXPAND xpt::diagram::views::Utils::foregroundColour("view") FOR viewmap-»
+ «IF labels.size() > 0-»
+ org.eclipse.core.runtime.IAdaptable eObjectAdapter = null;
+ «EXPAND xpt::diagram::views::Utils::domainElementAdapter("eObjectAdapter") FOR modelFacet-»
+ «EXPAND xpt::diagram::views::Utils::createChildNode FOREACH labels-»
+ «ENDIF-»
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenLink»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/views/NodeViewFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+
+«DEFINE NodeViewFactory FOR gmfgen::GenNode-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «getDiagram().notationViewFactoriesPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewFactoryClassName» extends org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory {
+
+ «EXPAND createStyles-»
+
+ «EXPAND decorateView-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE createStyles FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.util.List createStyles(org.eclipse.gmf.runtime.notation.View view) {
+ java.util.List styles = new java.util.ArrayList();
+ «EXPAND xpt::diagram::views::Utils::addShapeStyle("styles") FOR viewmap-»
+ «EXPAND xpt::diagram::views::Utils::addLinkedDiagramStyle("styles")-»
+ «EXPAND xpt::diagram::views::Utils::addCustomStyles("styles")-»
+ return styles;
+ }
+«ENDDEFINE»
+
+«DEFINE decorateView FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void decorateView(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.gmf.runtime.notation.View view,
+ org.eclipse.core.runtime.IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ «EXPAND xpt::diagram::views::Utils::updateSemanticHint-»
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ «EXPAND addShortcut-»
+ «EXPAND xpt::diagram::views::Utils::foregroundColour("view") FOR viewmap-»
+ «EXPAND xpt::diagram::views::Utils::backgroundColour("view") FOR viewmap-»
+ «IF labels.size() > 0 || compartments.size() > 0-»
+ org.eclipse.core.runtime.IAdaptable eObjectAdapter = null;
+ «EXPAND xpt::diagram::views::Utils::domainElementAdapter("eObjectAdapter") FOR modelFacet-»
+ «EXPAND xpt::diagram::views::Utils::createChildNode FOREACH labels-»
+ «EXPAND xpt::diagram::views::Utils::createChildNode FOREACH compartments-»
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE addShortcut FOR gmfgen::GenNode-»
+«ENDDEFINE»
+
+«DEFINE addShortcut FOR gmfgen::GenTopLevelNode-»
+ if (!«getDiagram().getEditPartQualifiedClassName()».MODEL_ID.equals(
+ «getDiagram().getVisualIDRegistryQualifiedClassName()».getModelID(containerView))) {
+ «EXPAND xpt::Common::addShortcutAnnotation("view") FOR getDiagram()-»
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNode»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/diagram/views/Utils.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::diagram::ViewmapAttributesUtils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE updateSemanticHint FOR gmfgen::GenCommonBase-»
+ if (semanticHint == null) {
+ semanticHint = «getDiagram().getVisualIDRegistryQualifiedClassName()».getType(
+ «getEditPartQualifiedClassName()».VISUAL_ID);
+ view.setType(semanticHint);
+ }
+«ENDDEFINE»
+
+«DEFINE createChildNode FOR gmfgen::GenCommonBase-»
+ getViewService().createNode(eObjectAdapter, view,
+ «getDiagram().getVisualIDRegistryQualifiedClassName()».getType(«getEditPartQualifiedClassName()».VISUAL_ID),
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true, getPreferencesHint());
+«ENDDEFINE»
+
+«DEFINE domainElementAdapter(String adapterVar) FOR gmfgen::ModelFacet-»
+«ENDDEFINE»
+
+«DEFINE domainElementAdapter(String adapterVar) FOR gmfgen::TypeModelFacet-»
+ org.eclipse.emf.ecore.EObject eObject =
+ (org.eclipse.emf.ecore.EObject) semanticAdapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ if (eObject != null) {
+ «adapterVar» = new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(eObject);
+ }
+«ENDDEFINE»
+
+«DEFINE foregroundColour(String viewVar) FOR gmfgen::Viewmap-»
+ «EXPAND foregroundColour(viewVar) FOREACH attributes-»
+«ENDDEFINE»
+
+«DEFINE foregroundColour(String viewVar) FOR gmfgen::Attributes-»
+«ENDDEFINE»
+
+«DEFINE foregroundColour(String viewVar) FOR gmfgen::ColorAttributes-»
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar»,
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getLineStyle_LineColor(),
+ org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.colorToInteger(
+ org.eclipse.draw2d.ColorConstants.«foregroundColor»));
+«ENDDEFINE»
+
+«DEFINE backgroundColour(String viewVar) FOR gmfgen::Viewmap-»
+ «EXPAND backgroundColour(viewVar) FOREACH attributes-»
+«ENDDEFINE»
+
+«DEFINE backgroundColour(String viewVar) FOR gmfgen::Attributes-»
+«ENDDEFINE»
+
+«DEFINE backgroundColour(String viewVar) FOR gmfgen::ColorAttributes-»
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.setStructuralFeatureValue(«viewVar»,
+ org.eclipse.gmf.runtime.notation.NotationPackage.eINSTANCE.getFillStyle_FillColor(),
+ org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities.colorToInteger(
+ org.eclipse.draw2d.ColorConstants.«backgroundColor»));
+«ENDDEFINE»
+
+«DEFINE addShapeStyle(String stylesVar) FOR gmfgen::Viewmap-»
+ «IF isFixedFont()-»
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createFillStyle());
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createLineStyle());
+ «ELSE-»
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createShapeStyle());
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addTextStyle(String stylesVar) FOR gmfgen::LabelModelFacet-»
+«ENDDEFINE»
+
+«DEFINE addTextStyle(String stylesVar) FOR gmfgen::DesignLabelModelFacet-»
+ «stylesVar».add(org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createDescriptionStyle());
+«ENDDEFINE»
+
+«DEFINE addLinkedDiagramStyle(String stylesVar) FOR gmfgen::GenCommonBase-»
+ «EXPAND addLinkedDiagramStyle(stylesVar) FOREACH behaviour-»
+«ENDDEFINE»
+
+«DEFINE addLinkedDiagramStyle(String stylesVar) FOR gmfgen::Behaviour-»
+«ENDDEFINE»
+
+«DEFINE addLinkedDiagramStyle(String stylesVar) FOR gmfgen::OpenDiagramBehaviour-»
+ {
+ org.eclipse.gmf.runtime.notation.HintedDiagramLinkStyle diagramFacet =
+ org.eclipse.gmf.runtime.notation.NotationFactory.eINSTANCE.createHintedDiagramLinkStyle();
+ «IF diagramKind != null-»
+ diagramFacet.setHint("«diagramKind»"); // $NON-NLS-1$
+ «ENDIF-»
+ «stylesVar».add(diagramFacet);
+ }
+«ENDDEFINE»
+
+«DEFINE addCustomStyles(String stylesVar) FOR gmfgen::GenCommonBase-»
+ «FOREACH styles AS style-»
+ «stylesVar».add(«EXPAND MetaModel::NewInstance FOR style»);
+ «ENDFOREACH-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/ActionBarContributor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE ActionBarContributor FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «actionBarContributorClassName» extends org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected Class getEditorClass() {
+ return «getQualifiedClassName()».class;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getEditorId() {
+ return «getQualifiedClassName()».ID;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenEditorView»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/CreateShortcutAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2006,2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE CreateShortcutAction FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «createShortcutActionClassName» implements org.eclipse.ui.IObjectActionDelegate {
+
+ «EXPAND attributes-»
+
+ «EXPAND setActivePart-»
+
+ «EXPAND selectionChanged-»
+
+ «EXPAND isEnabled-»
+
+ «EXPAND run-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private «getEditPartQualifiedClassName()» mySelectedElement;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.swt.widgets.Shell myShell;
+«ENDDEFINE»
+
+«DEFINE setActivePart FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
+ myShell = targetPart.getSite().getShell();
+}
+«ENDDEFINE»
+
+«DEFINE selectionChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
+ mySelectedElement = null;
+ if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection) {
+ org.eclipse.jface.viewers.IStructuredSelection structuredSelection = (org.eclipse.jface.viewers.IStructuredSelection) selection;
+ if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof «getEditPartQualifiedClassName()») {
+ mySelectedElement = («getEditPartQualifiedClassName()») structuredSelection.getFirstElement();
+ }
+ }
+ action.setEnabled(isEnabled());
+}
+«ENDDEFINE»
+
+«DEFINE isEnabled FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean isEnabled() {
+ return mySelectedElement != null;
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void run(org.eclipse.jface.action.IAction action) {
+ final org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) mySelectedElement.getModel();
+ «IF null == editorGen.application-»
+ «getElementChooserQualifiedClassName()» elementChooser = new «getElementChooserQualifiedClassName()»(myShell, view);
+ int result = elementChooser.open();
+ if (result != org.eclipse.jface.window.Window.OK) {
+ return;
+ }
+ org.eclipse.emf.common.util.URI selectedModelElementURI = elementChooser.getSelectedModelElementURI();
+ final org.eclipse.emf.ecore.EObject selectedElement;
+ try {
+ selectedElement = mySelectedElement.getEditingDomain().getResourceSet().getEObject(selectedModelElementURI, true);
+ } catch (org.eclipse.emf.common.util.WrappedException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while loading object: " + selectedModelElementURI.toString(), e); «EXPAND xpt::Common::nonNLS»
+ return;
+ }
+
+ if (selectedElement == null) {
+ return;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor viewDescriptor = new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedElement), org.eclipse.gmf.runtime.notation.Node.class, null, «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT);
+ org.eclipse.gmf.runtime.common.core.command.ICommand command = new org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand(mySelectedElement.getEditingDomain(), viewDescriptor, view);
+ command = command.compose(new «getCreateShortcutDecorationsCommandQualifiedClassName()»(mySelectedElement.getEditingDomain(), view, viewDescriptor));
+ try {
+ org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.NullProgressMonitor(), null);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to create shortcut", e); «EXPAND xpt::Common::nonNLS»
+ }
+ «ELSE-»
+ org.eclipse.emf.ecore.resource.Resource resource = «getDiagramEditorUtilQualifiedClassName()».openModel(myShell, «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForOpenModel(this))) FOR editorGen», mySelectedElement.getEditingDomain());
+ if (resource == null || resource.getContents().isEmpty()) {
+ return;
+ }
+ «EXPAND xpt::editor::ShortcutCreationWizard::qualifiedClassName» wizard = new «EXPAND xpt::editor::ShortcutCreationWizard::qualifiedClassName»((org.eclipse.emf.ecore.EObject) resource.getContents().get(0), view, mySelectedElement.getEditingDomain());
+ wizard.setWindowTitle(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForCreateShortcus(this))) FOR editorGen»);
+ «getDiagramEditorUtilQualifiedClassName()».runWizard(myShell, wizard, "CreateShortcut"); «EXPAND xpt::Common::nonNLS»
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF null != editorGen.application-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForOpenModel(this)), "Select model to reference")-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForCreateShortcus(this)), "Create shortcut")-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «IF null != editorGen.application-»
+ «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForOpenModel(this)))-»
+ «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForCreateShortcus(this)))-»
+ «ENDIF-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/CreationWizard.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE CreationWizard FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «creationWizardClassName»
+ extends org.eclipse.jface.wizard.Wizard implements org.eclipse.ui.INewWizard {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.IWorkbench workbench;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.jface.viewers.IStructuredSelection selection;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «getCreationWizardPageQualifiedClassName()» diagramModelFilePage;
+ «IF isStandaloneDomainModel()-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «getCreationWizardPageQualifiedClassName()» domainModelFilePage;
+ «ENDIF-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.ecore.resource.Resource diagram;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private boolean openNewlyCreatedDiagramEditor = true;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.ui.IWorkbench getWorkbench() {
+ return workbench;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.jface.viewers.IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public final org.eclipse.emf.ecore.resource.Resource getDiagram() {
+ return diagram;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public final boolean isOpenNewlyCreatedDiagramEditor() {
+ return openNewlyCreatedDiagramEditor;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
+ this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void init(org.eclipse.ui.IWorkbench workbench, org.eclipse.jface.viewers.IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizard().titleKey()) FOR editorGen»);
+ setDefaultPageImageDescriptor(«editorGen.plugin.getActivatorQualifiedClassName()».getBundledImageDescriptor(
+ "icons/wizban/New«IF domainDiagramElement != null»«domainDiagramElement.genPackage.prefix»«ENDIF»Wizard.gif")); //$NON-NLS-1$
+ setNeedsProgressMonitor(true);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void addPages() {
+ diagramModelFilePage = new «getCreationWizardPageQualifiedClassName()»(
+ "DiagramModelFile", getSelection(), "«editorGen.diagramFileExtension»"); //$NON-NLS-1$ //$NON-NLS-2$
+ diagramModelFilePage.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardDiagramPage().titleKey()) FOR editorGen»);
+ diagramModelFilePage.setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardDiagramPage().descriptionKey()) FOR editorGen»);
+ addPage(diagramModelFilePage);
+ «IF isStandaloneDomainModel()-»
+
+ domainModelFilePage = new «getCreationWizardPageQualifiedClassName()»(
+ "DomainModelFile", getSelection(), "«editorGen.domainFileExtension»") { //$NON-NLS-1$ //$NON-NLS-2$
+
+ public void setVisible(boolean visible) {
+ if (visible) {
+ String fileName = diagramModelFilePage.getFileName();
+ fileName = fileName.substring(0, fileName.length() - ".«editorGen.diagramFileExtension»".length()); //$NON-NLS-1$
+ setFileName(«getDiagramEditorUtilQualifiedClassName()».getUniqueFileName(
+ getContainerFullPath(), fileName, "«editorGen.domainFileExtension»")); //$NON-NLS-1$
+ }
+ super.setVisible(visible);
+ }
+ };
+ domainModelFilePage.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardDomainPage().titleKey()) FOR editorGen»);
+ domainModelFilePage.setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardDomainPage().descriptionKey()) FOR editorGen»);
+ addPage(domainModelFilePage);
+ «ENDIF-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean performFinish() {
+ org.eclipse.jface.operation.IRunnableWithProgress op =
+ «IF editorGen.application == null-»
+ new org.eclipse.ui.actions.WorkspaceModifyOperation(null) {
+
+ protected void execute(org.eclipse.core.runtime.IProgressMonitor monitor)
+ throws org.eclipse.core.runtime.CoreException, InterruptedException {
+ «ELSE-»
+ new org.eclipse.jface.operation.IRunnableWithProgress() {
+
+ public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
+ throws InvocationTargetException, InterruptedException {
+ «ENDIF-»
+ diagram = «getDiagramEditorUtilQualifiedClassName()».createDiagram(diagramModelFilePage.getURI(),
+ «IF isStandaloneDomainModel()-»
+ domainModelFilePage.getURI(),
+ «ENDIF-»
+ monitor);
+ if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
+ try {
+ «getDiagramEditorUtilQualifiedClassName()».openDiagram(diagram);
+ } catch (org.eclipse.ui.PartInitException e) {
+ org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardOpenEditorError()) FOR editorGen», null, e.getStatus());
+ }
+ }
+ }
+ };
+ try {
+ getContainer().run(false, true, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (java.lang.reflect.InvocationTargetException e) {
+ if (e.getTargetException() instanceof org.eclipse.core.runtime.CoreException) {
+ org.eclipse.jface.dialogs.ErrorDialog.openError(getContainer().getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardCreationError()) FOR editorGen», null,
+ ((org.eclipse.core.runtime.CoreException) e.getTargetException()).getStatus());
+ } else {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Error creating diagram", e.getTargetException()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ return diagram != null;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizard().titleKey(), "New "+editorGen.modelID+" Diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardDiagramPage().titleKey(), "Create "+editorGen.modelID+" Diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardDiagramPage().descriptionKey(), (isStandaloneDomainModel() ? "Select file that will contain diagram model." : "Select file that will contain diagram and domain models."))-»
+«IF isStandaloneDomainModel()-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardDomainPage().titleKey(), "Create "+editorGen.modelID+" Domain Model")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardDomainPage().descriptionKey(), "Select file that will contain domain model.")-»
+«ENDIF-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardOpenEditorError(), "Error opening diagram editor")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardCreationError(), "Creation Problems")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizard().titleKey())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardDiagramPage().titleKey())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardDiagramPage().descriptionKey())-»
+ «IF isStandaloneDomainModel()-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardDomainPage().titleKey())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardDomainPage().descriptionKey())-»
+ «ENDIF-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardOpenEditorError())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardCreationError())-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/CreationWizardPage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE CreationWizardPage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «creationWizardPageClassName» extends
+ «IF editorGen.application == null-»
+ org.eclipse.ui.dialogs.WizardNewFileCreationPage
+ «ELSE-»
+ «editorGen.application.packageName».WizardNewFileCreationPage
+ «ENDIF-»
+ {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final String fileExtension;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «creationWizardPageClassName»(String pageName,
+ org.eclipse.jface.viewers.IStructuredSelection selection, String fileExtension) {
+ super(pageName, selection);
+ this.fileExtension = fileExtension;
+ }
+
+ /**
+ * Override to create files with this extension.
+ *
+ * @generated
+ */
+ protected String getExtension() {
+ return fileExtension;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.common.util.URI getURI() {
+ «IF editorGen.application == null-»
+ return org.eclipse.emf.common.util.URI.createPlatformResourceURI(getFilePath().toString(), false);
+ «ELSE-»
+ return org.eclipse.emf.common.util.URI.createFileURI(getFilePath().toString());
+ «ENDIF-»
+ }
+ «IF editorGen.application == null-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.core.runtime.IPath getFilePath() {
+ org.eclipse.core.runtime.IPath path = getContainerFullPath();
+ if (path == null) {
+ path = new org.eclipse.core.runtime.Path(""); //$NON-NLS-1$
+ }
+ String fileName = getFileName();
+ if (fileName != null) {
+ path = path.append(fileName);
+ }
+ return path;
+ }
+ «ENDIF-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void createControl(org.eclipse.swt.widgets.Composite parent) {
+ super.createControl(parent);
+ setFileName(«getDiagramEditorUtilQualifiedClassName()».getUniqueFileName(
+ getContainerFullPath(), getFileName(), getExtension()));
+ setPageComplete(validatePage());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean validatePage() {
+ if (!super.validatePage()) {
+ return false;
+ }
+ String extension = getExtension();
+ if (extension != null && !getFilePath().toString().endsWith("." + extension)) {
+ setErrorMessage(org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreationWizardPageExtensionError()) FOR editorGen», extension));
+ return false;
+ }
+ return true;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreationWizardPageExtensionError(), "File name should have {0} extension.")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForCreationWizardPageExtensionError())-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/DeleteElementAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DeleteElementAction«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE DeleteElementAction FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.actions.AbstractDeleteFromAction {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.ui.IWorkbenchPart part) {
+ super(part);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.ui.IWorkbenchPage workbenchPage) {
+ super(workbenchPage);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void init() {
+ super.init();
+ setId(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.ACTION_DELETE_FROM_MODEL);
+ setText(org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages.DiagramEditor_Delete_from_Model);
+ setToolTipText(org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages.DiagramEditor_Delete_from_ModelToolTip);
+ org.eclipse.ui.ISharedImages workbenchImages = org.eclipse.ui.PlatformUI.getWorkbench().getSharedImages();
+ setHoverImageDescriptor(workbenchImages.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_TOOL_DELETE));
+ setImageDescriptor(workbenchImages.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_TOOL_DELETE));
+ setDisabledImageDescriptor(workbenchImages.getImageDescriptor(org.eclipse.ui.ISharedImages.IMG_TOOL_DELETE_DISABLED));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getCommandLabel() {
+ return org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramUIMessages.DiagramEditor_Delete_from_Model;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gef.commands.Command getCommand(org.eclipse.gef.Request request) {
+ java.util.List operationSet = getOperationSet();
+ if (operationSet.isEmpty()) {
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ }
+ java.util.Iterator editParts = operationSet.iterator();
+ org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand command =
+ new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(getEditingDomain(), getCommandLabel());
+ while (editParts.hasNext()) {
+ org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) editParts.next();
+ org.eclipse.gef.commands.Command curCommand = editPart.getCommand(request);
+ if (curCommand != null) {
+ command.compose(new org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy(curCommand));
+ }
+ }
+ if (command.isEmpty() || command.size() != operationSet.size()) {
+ return org.eclipse.gef.commands.UnexecutableCommand.INSTANCE;
+ }
+ return new org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy(command);
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/DiagramContentInitializer.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«EXTENSION xpt::diagram::updater::Utils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE DiagramContentInitializer FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «diagramContentInitializerClassName» {
+
+ «EXPAND attributes-»
+
+ «EXPAND initDiagramContent-»
+
+ «EXPAND createChildren FOREACH getAllContainers().select(container | !container.sansDomain)-»
+
+ «EXPAND createNode-»
+
+ «EXPAND createLinks-»
+ «IF !getAllContainers().typeSelect(gmfgen::GenCompartment).isEmpty()-»
+
+ «EXPAND getCompartment-»
+ «ENDIF-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private java.util.Map myDomain2NotationMap = new java.util.HashMap();
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection myLinkDescriptors = new java.util.LinkedList();
+«ENDDEFINE»
+
+«DEFINE initDiagramContent FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void initDiagramContent(org.eclipse.gmf.runtime.notation.Diagram diagram) {
+ if (!«EXPAND xpt::editor::VisualIDRegistry::modelID».equals(diagram.getType())) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Incorrect diagram passed as a parameter: " + diagram.getType());
+ return;
+ }
+ if («EXPAND MetaModel::NotInstance("diagram.getElement()") FOR domainDiagramElement») {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Incorrect diagram element specified: " + diagram.getElement() + " instead of «domainDiagramElement.ecoreClass.name»");
+ return;
+ }
+ «EXPAND createChildrenMethodName»(diagram);
+ createLinks(diagram);
+}
+«ENDDEFINE»
+
+«DEFINE createChildrenMethodName FOR gmfgen::GenContainerBase»create«getUniqueIdentifier()»Children«ENDDEFINE»
+
+«DEFINE createChildren FOR gmfgen::GenContainerBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void «EXPAND createChildrenMethodName»(org.eclipse.gmf.runtime.notation.View view) {
+ «EXPAND collectContainedLinks-»
+ «IF hasSemanticChildren(this)-»
+ java.util.Collection childNodeDescriptors = «EXPAND xpt::diagram::updater::DiagramUpdater::getSemanticChildrenMethodCall»(view);
+ for (java.util.Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, («getDiagram().editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()») it.next());
+ }
+ «ENDIF-»
+ «EXPAND createCompartmentsChildren-»
+}
+«ENDDEFINE»
+
+«DEFINE collectContainedLinks FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE collectContainedLinks FOR gmfgen::GenNode-»
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(«EXPAND xpt::diagram::updater::DiagramUpdater::getOutgoingLinksMethodCall»(view));
+«ENDDEFINE»
+
+«DEFINE createCompartmentsChildren FOR gmfgen::GenContainerBase»«ENDDEFINE»
+
+«DEFINE createCompartmentsChildren FOR gmfgen::GenNode-»
+ «EXPAND callCreateCompartmentChildren FOREACH compartments»
+«ENDDEFINE»
+
+«REM»
+ Will be called for each compartment of GenNode for GenNode.isSansDomain() == false.
+ if !GenNode.isSansDomain() => !GenCompartment.isSansDomain() so should not check
+ !this.isSansDomain() here.
+«ENDREM»
+«DEFINE callCreateCompartmentChildren FOR gmfgen::GenCompartment-»
+ «EXPAND createChildrenMethodName»(getCompartment(view, «EXPAND xpt::editor::VisualIDRegistry::visualID»));
+«ENDDEFINE»
+
+«DEFINE createNode FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void createNode(org.eclipse.gmf.runtime.notation.View parentView, «editorGen.diagramUpdater.getNodeDescriptorQualifiedClassName()» nodeDescriptor) {
+ org.eclipse.gmf.runtime.notation.Node node = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createNode(parentView, nodeDescriptor.getModelElement(), nodeDescriptor.getType(), «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT);
+ switch (nodeDescriptor.getVisualID()) {
+ «EXPAND createNodeCase FOREACH getAllNodes().select(node | !node.sansDomain)-»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE createNodeCase FOR gmfgen::GenContainerBase-»
+«EXPAND xpt::Common::caseVisualID»
+ «EXPAND createChildrenMethodName»(node);
+ return;
+«ENDDEFINE»
+
+«REM»Adopt this code to work with links to links«ENDREM»
+«DEFINE createLinks FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void createLinks(org.eclipse.gmf.runtime.notation.Diagram diagram) {
+ for (boolean continueLinkCreation = true; continueLinkCreation;) {
+ continueLinkCreation = false;
+ java.util.Collection additionalDescriptors = new java.util.LinkedList();
+ for (java.util.Iterator it = myLinkDescriptors.iterator(); it.hasNext();) {
+ «editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()» nextLinkDescriptor = («editorGen.diagramUpdater.getLinkDescriptorQualifiedClassName()») it.next();
+ if (!myDomain2NotationMap.containsKey(nextLinkDescriptor.getSource()) || !myDomain2NotationMap.containsKey(nextLinkDescriptor.getDestination())) {
+ continue;
+ }
+ org.eclipse.gmf.runtime.notation.Edge edge = (org.eclipse.gmf.runtime.notation.Edge) org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().createEdge(nextLinkDescriptor.getSemanticAdapter(), diagram, nextLinkDescriptor.getType(), org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT);
+ if (edge != null) {
+ edge.setSource((org.eclipse.gmf.runtime.notation.View) myDomain2NotationMap.get(nextLinkDescriptor.getSource()));
+ edge.setTarget((org.eclipse.gmf.runtime.notation.View) myDomain2NotationMap.get(nextLinkDescriptor.getDestination()));
+ it.remove();
+ if (nextLinkDescriptor.getModelElement() != null) {
+ myDomain2NotationMap.put(nextLinkDescriptor.getModelElement(), edge);
+ }
+ continueLinkCreation = true;
+ switch (nextLinkDescriptor.getVisualID()) {
+ «EXPAND createLinksCase FOREACH links.select(link | null != getMetaClass(link))-»
+ }
+ }
+ }
+ myLinkDescriptors.addAll(additionalDescriptors);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE createLinksCase FOR gmfgen::GenLink-»
+«EXPAND xpt::Common::caseVisualID»
+ additionalDescriptors.addAll(«EXPAND xpt::diagram::updater::DiagramUpdater::getOutgoingLinksMethodCall»(edge));
+ break;
+«ENDDEFINE»
+
+«DEFINE getCompartment FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.notation.Node getCompartment(org.eclipse.gmf.runtime.notation.View node, int visualID) {
+ String type = «EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR getDiagram()»(visualID);
+ for (java.util.Iterator it = node.getChildren().iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
+ if (nextView instanceof org.eclipse.gmf.runtime.notation.Node && type.equals(nextView.getType())) {
+ return (org.eclipse.gmf.runtime.notation.Node) nextView;
+ }
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/DiagramEditorContextMenuProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE className FOR gmfgen::GenDiagram»DiagramEditorContextMenuProvider«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE DiagramEditorContextMenuProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.IWorkbenchPart part;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «EXPAND xpt::editor::DeleteElementAction::qualifiedClassName» deleteAction;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public DiagramEditorContextMenuProvider(org.eclipse.ui.IWorkbenchPart part, org.eclipse.gef.EditPartViewer viewer) {
+ super(part, viewer);
+ this.part = part;
+ deleteAction = new «EXPAND xpt::editor::DeleteElementAction::qualifiedClassName»(part);
+ deleteAction.init();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void dispose() {
+ if (deleteAction != null) {
+ deleteAction.dispose();
+ deleteAction = null;
+ }
+ super.dispose();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void buildContextMenu(final org.eclipse.jface.action.IMenuManager menu) {
+ getViewer().flush();
+ try {
+ org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(
+ (org.eclipse.emf.ecore.EObject) getViewer().getContents().getModel()).runExclusive(new Runnable() {
+
+ public void run() {
+ org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.ContributionItemService.getInstance().contributeToPopupMenu(
+ DiagramEditorContextMenuProvider.this, part);
+ menu.remove(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.ACTION_DELETE_FROM_MODEL);
+ menu.appendToGroup("editGroup", deleteAction);
+ }
+ });
+ } catch (Exception e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Error building context menu", e);
+ }
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/DiagramEditorUtil.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,423 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::editor::GenDiagram»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE DiagramEditorUtil FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «diagramEditorUtilClassName» {
+
+«EXPAND saveOptions-»
+
+«EXPAND openDiagramMethod-»
+«IF editorGen.application == null-»
+
+ «EXPAND setCharsetMethods-»
+«ENDIF-»
+
+«EXPAND getUniqueFileNameMethod-»
+
+«IF editorGen.application != null»
+ /**
+ * Allows user to select file and loads it as a model.
+ *
+ * @generated
+ */
+ public static org.eclipse.emf.ecore.resource.Resource openModel(
+ org.eclipse.swt.widgets.Shell shell, String description, org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
+ org.eclipse.swt.widgets.FileDialog fileDialog = new org.eclipse.swt.widgets.FileDialog(shell, org.eclipse.swt.SWT.OPEN);
+ if (description != null) {
+ fileDialog.setText(description);
+ }
+ fileDialog.open();
+ String fileName = fileDialog.getFileName();
+ if (fileName == null || fileName.length() == 0) {
+ return null;
+ }
+ if (fileDialog.getFilterPath() != null) {
+ fileName = fileDialog.getFilterPath() + java.io.File.separator + fileName;
+ }
+ org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI.createFileURI(fileName);
+ org.eclipse.emf.ecore.resource.Resource resource = null;
+ try {
+ resource = editingDomain.getResourceSet().getResource(uri, true);
+ } catch (org.eclipse.emf.common.util.WrappedException we) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to load resource: " + uri, we); «EXPAND xpt::Common::nonNLS»
+ org.eclipse.jface.dialogs.MessageDialog.openError(shell,
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenModelResourceErrorDialog().titleKey()) FOR editorGen»,
+ org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenModelResourceErrorDialog().messageKey()) FOR editorGen»,
+ fileName));
+ }
+ return resource;
+ }
+«ENDIF»
+
+ /**
+ * Runs the wizard in a dialog.
+ *
+ * @generated
+ */
+ public static void runWizard(org.eclipse.swt.widgets.Shell shell, org.eclipse.jface.wizard.Wizard wizard, String settingsKey) {
+ org.eclipse.jface.dialogs.IDialogSettings pluginDialogSettings = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getDialogSettings();
+ org.eclipse.jface.dialogs.IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey);
+ if (wizardDialogSettings == null) {
+ wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey);
+ }
+ wizard.setDialogSettings(wizardDialogSettings);
+ org.eclipse.jface.wizard.WizardDialog dialog = new org.eclipse.jface.wizard.WizardDialog(shell, wizard);
+ dialog.create();
+ dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
+ dialog.open();
+ }
+
+«EXPAND createDiagramMethod-»
+«IF domainDiagramElement != null»
+ «EXPAND createInitialModelMethod»
+ «EXPAND attachModelMethod»
+ «IF hasDocumentRoot()»«EXPAND createDocumentRootMethod»«ENDIF»
+«ENDIF»
+
+«EXPAND selectElementsMethod»
+«EXPAND findElementsMethod»
+«EXPAND findViewMethod»
+
+«EXPAND additions»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE saveOptions FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static java.util.Map getSaveOptions() {
+ java.util.Map saveOptions = new java.util.HashMap();
+ saveOptions.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_ENCODING, "UTF-8"); «EXPAND xpt::Common::nonNLS»
+ saveOptions.put(org.eclipse.emf.ecore.resource.Resource.OPTION_SAVE_ONLY_IF_CHANGED, org.eclipse.emf.ecore.resource.Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+ return saveOptions;
+ }
+«ENDDEFINE»
+
+«DEFINE openDiagramMethod FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static boolean openDiagram(org.eclipse.emf.ecore.resource.Resource diagram) throws org.eclipse.ui.PartInitException {
+«IF editorGen.application == null-»
+ String path = diagram.getURI().toPlatformString(true);
+ org.eclipse.core.resources.IResource workspaceResource = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().findMember(new org.eclipse.core.runtime.Path(path));
+ if (workspaceResource instanceof org.eclipse.core.resources.IFile) {
+ org.eclipse.ui.IWorkbenchPage page = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ return null != page.openEditor(new org.eclipse.ui.part.FileEditorInput((org.eclipse.core.resources.IFile) workspaceResource), «editorGen.editor.getQualifiedClassName()».ID);
+ }
+ return false;
+«ELSE-»
+ org.eclipse.ui.IWorkbenchPage page = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ page.openEditor(new org.eclipse.emf.common.ui.URIEditorInput(diagram.getURI()), «editorGen.editor.getQualifiedClassName()».ID);
+ return true;
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE setCharsetMethods FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void setCharset(org.eclipse.core.resources.IFile file) {
+ if (file == null) {
+ return;
+ }
+ try {
+ file.setCharset("UTF-8", new org.eclipse.core.runtime.NullProgressMonitor()); «EXPAND xpt::Common::nonNLS»
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to set charset for file " + file.getFullPath(), e); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getUniqueFileNameMethod FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static String getUniqueFileName(org.eclipse.core.runtime.IPath containerFullPath, String fileName, String extension) {
+ if (containerFullPath == null) {
+ containerFullPath = new org.eclipse.core.runtime.Path(""); «EXPAND xpt::Common::nonNLS»
+ }
+ if (fileName == null || fileName.trim().length() == 0) {
+ fileName = "default"; «EXPAND xpt::Common::nonNLS»
+ }
+ org.eclipse.core.runtime.IPath filePath = containerFullPath.append(fileName);
+ if (extension != null && !extension.equals(filePath.getFileExtension())) {
+ filePath = filePath.addFileExtension(extension);
+ }
+ extension = filePath.getFileExtension();
+ fileName = filePath.removeFileExtension().lastSegment();
+ int i = 1;
+ while (
+ «IF editorGen.application == null-»
+ org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().exists(filePath)
+ «ELSE-»
+ filePath.toFile().exists()
+ «ENDIF-»
+ ) {
+ i++;
+ filePath = containerFullPath.append(fileName + i);
+ if (extension != null) {
+ filePath = filePath.addFileExtension(extension);
+ }
+ }
+ return filePath.lastSegment();
+ }
+«ENDDEFINE»
+
+«DEFINE createDiagramMethod FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment(editorGen.application == null ? "This method should be called within a workspace modify operation since it creates resources." : "")»
+ public static org.eclipse.emf.ecore.resource.Resource createDiagram(org.eclipse.emf.common.util.URI diagramURI,«IF standaloneDomainModel()» org.eclipse.emf.common.util.URI modelURI,«ENDIF» org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ progressMonitor.beginTask(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreateDiagramProgressTask()) FOR editorGen», 3);
+ final org.eclipse.emf.ecore.resource.Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
+«IF standaloneDomainModel()-»
+ final org.eclipse.emf.ecore.resource.Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
+«ELSEIF domainDiagramElement != null && hasDocumentRoot() /*for standalone models, we assume its resourcefactory would be able to set extendedMetaData option*/-»
+ ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultSaveOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
+ ((org.eclipse.emf.ecore.xmi.XMLResource) diagramResource).getDefaultLoadOptions().put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
+«ENDIF-»
+ final String diagramName = diagramURI.lastSegment();
+ org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command = new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(editingDomain, «EXPAND xpt::Externalizer::accessorCall(i18nKeyForCreateDiagramCommandLabel()) FOR editorGen», java.util.Collections.EMPTY_LIST) {
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
+«IF domainDiagramElement != null-»
+ «EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model = createInitialModel();
+ attachModelToResource(model, «IF standaloneDomainModel()»model«ELSE»diagram«ENDIF»Resource);
+«ENDIF»
+ org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(
+«IF domainDiagramElement != null-»
+ «IF domainDiagramElement.isExternalInterface()»(org.eclipse.emf.ecore.EObject) «ENDIF»model,
+«ENDIF-»
+ «EXPAND xpt::editor::VisualIDRegistry::modelID», «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT);
+ if (diagram != null) {
+ diagramResource.getContents().add(diagram);
+ diagram.setName(diagramName);
+«IF domainDiagramElement != null-»
+ diagram.setElement(«IF domainDiagramElement.isExternalInterface()»(org.eclipse.emf.ecore.EObject) «ENDIF»model);
+«ENDIF-»
+ }
+
+ try {
+ «IF standaloneDomainModel()»modelResource.save(«EXPAND xpt::Common::getSaveOptions»);«ENDIF»
+ diagramResource.save(«EXPAND xpt::Common::getSaveOptions»);
+ } catch (java.io.IOException e) {
+ «/* TODO CommandResult.newErrorCommandResult(e) would be better? Or even throw ExecutionEx?*/»
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to store model and diagram resources", e); «EXPAND xpt::Common::nonNLS»
+ }
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
+ }
+ };
+ try {
+ org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(command, new org.eclipse.core.runtime.SubProgressMonitor(progressMonitor, 1), null);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to create model and diagram", e); «EXPAND xpt::Common::nonNLS»
+ }
+«IF editorGen.application == null-»
+ «IF standaloneDomainModel()»setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(modelResource));«ENDIF»
+ setCharset(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource));
+«ENDIF-»
+ return diagramResource;
+ }
+«ENDDEFINE»
+
+«DEFINE createInitialModelMethod FOR gmfgen::GenDiagram»
+ «EXPAND xpt::Common::generatedMemberComment("Create a new instance of domain element associated with canvas.\n<!-- begin-user-doc -->\n<!-- end-user-doc -->")»
+ private static «EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» createInitialModel() {
+ return «EXPAND MetaModel::NewInstance FOR domainDiagramElement»;
+ }
+«ENDDEFINE»
+
+«DEFINE attachModelMethod FOR gmfgen::GenDiagram»
+ «EXPAND xpt::Common::generatedMemberComment("Store model element in the resource.\n<!-- begin-user-doc -->\n<!-- end-user-doc -->")»
+ private static void attachModelToResource(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model, org.eclipse.emf.ecore.resource.Resource resource) {
+ resource.getContents().add(«IF hasDocumentRoot()»createDocumentRoot(model)«ELSE»«IF domainDiagramElement.isExternalInterface()»(org.eclipse.emf.ecore.EObject) «ENDIF»model«ENDIF»);
+ }
+«ENDDEFINE»
+
+// invoke only when there's DocumentRoot in the domain model
+«DEFINE createDocumentRootMethod FOR gmfgen::GenDiagram»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static «EXPAND MetaModel::QualifiedClassName FOR getDocumentRoot()» createDocumentRoot(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model) {
+ «EXPAND MetaModel::NewInstance("docRoot") FOR getDocumentRoot()»
+«LET getDocumentRootSetFeature() AS f»«IF f == null-»
+ docRoot.set«domainDiagramElement.ecoreClass.name»(model); // FIXME name of the set method is pure guess«ELSE-»
+ «EXPAND MetaModel::setFeatureValue("docRoot", getDocumentRoot(), "model") FOR f»;«ENDIF»
+«ENDLET-»
+ return docRoot;
+ }
+«ENDDEFINE»
+
+«DEFINE selectElementsMethod FOR gmfgen::GenDiagram»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void selectElementsInDiagram(org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart diagramPart, java.util.List/*EditPart*/ editParts) {
+ diagramPart.getDiagramGraphicalViewer().deselectAll();
+
+ org.eclipse.gef.EditPart firstPrimary = null;
+ for (java.util.Iterator it = editParts.iterator(); it.hasNext();) {
+ org.eclipse.gef.EditPart nextPart = (org.eclipse.gef.EditPart) it.next();
+ diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
+ if(firstPrimary == null && nextPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart) {
+ firstPrimary = nextPart;
+ }
+ }
+
+ if(!editParts.isEmpty()) {
+ diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (org.eclipse.gef.EditPart)editParts.get(0));
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE findElementsMethod FOR gmfgen::GenDiagram»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static int findElementsInDiagramByID(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramPart, org.eclipse.emf.ecore.EObject element, java.util.List editPartCollector) {
+ org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer viewer = (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer) diagramPart.getViewer();
+ final int intialNumOfEditParts = editPartCollector.size();
+
+ if (element instanceof org.eclipse.gmf.runtime.notation.View) { // support notation element lookup
+ org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) viewer.getEditPartRegistry().get(element);
+ if (editPart != null) {
+ editPartCollector.add(editPart);
+ return 1;
+ }
+ }
+
+ String elementID = org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getProxyID(element);
+ java.util.List associatedParts = viewer.findEditPartsForElement(elementID, org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
+ // perform the possible hierarchy disjoint -> take the top-most parts only
+ for (java.util.Iterator editPartIt = associatedParts.iterator(); editPartIt.hasNext();) {
+ org.eclipse.gef.EditPart nextPart = (org.eclipse.gef.EditPart) editPartIt.next();
+ org.eclipse.gef.EditPart parentPart = nextPart.getParent();
+ while (parentPart != null && !associatedParts.contains(parentPart)) {
+ parentPart = parentPart.getParent();
+ }
+ if (parentPart == null) {
+ editPartCollector.add(nextPart);
+ }
+ }
+
+ if (intialNumOfEditParts == editPartCollector.size()) {
+ if (!associatedParts.isEmpty()) {
+ editPartCollector.add(associatedParts.iterator().next());
+ } else {
+ if (element.eContainer() != null) {
+ return findElementsInDiagramByID(diagramPart, element.eContainer(), editPartCollector);
+ }
+ }
+ }
+ return editPartCollector.size() - intialNumOfEditParts;
+ }
+«ENDDEFINE»
+
+«DEFINE findViewMethod FOR gmfgen::GenDiagram»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static org.eclipse.gmf.runtime.notation.View findView(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, org.eclipse.emf.ecore.EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) {
+ boolean hasStructuralURI = false;
+ if(targetElement.eResource() instanceof org.eclipse.emf.ecore.xmi.XMLResource) {
+ hasStructuralURI = ((org.eclipse.emf.ecore.xmi.XMLResource)targetElement.eResource()).getID(targetElement) == null;
+ }
+
+ org.eclipse.gmf.runtime.notation.View view = null;
+ if(hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) {
+ view = (org.eclipse.gmf.runtime.notation.View)lazyElement2ViewMap.getElement2ViewMap().get(targetElement);
+ } else if (findElementsInDiagramByID(diagramEditPart, targetElement, lazyElement2ViewMap.editPartTmpHolder) > 0) {
+ org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) lazyElement2ViewMap.editPartTmpHolder.get(0);
+ lazyElement2ViewMap.editPartTmpHolder.clear();
+ view = editPart.getModel() instanceof org.eclipse.gmf.runtime.notation.View ? (org.eclipse.gmf.runtime.notation.View) editPart.getModel() : null;
+ }
+
+ return (view == null) ? diagramEditPart.getDiagramView() : view;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static class LazyElement2ViewMap {
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.util.Map element2ViewMap;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.View scope;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.util.Set elementSet;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public final java.util.List editPartTmpHolder = new java.util.ArrayList();
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public LazyElement2ViewMap(org.eclipse.gmf.runtime.notation.View scope, java.util.Set elements) {
+ this.scope = scope;
+ this.elementSet = elements;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public final java.util.Map getElement2ViewMap() {
+ if(element2ViewMap == null) {
+ element2ViewMap = new java.util.HashMap();
+ // map possible notation elements to itself as these can't be found by view.getElement()
+ for (java.util.Iterator it = elementSet.iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) it.next();
+ if(element instanceof org.eclipse.gmf.runtime.notation.View) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) element;
+ if(view.getDiagram() == scope.getDiagram()) {
+ element2ViewMap.put(element, element); // take only those that part of our diagram
+ }
+ }
+ }
+
+ buildElement2ViewMap(scope, element2ViewMap, elementSet);
+ }
+ return element2ViewMap;
+ }
+ «EXPAND xpt::Common::generatedMemberComment»
+ static java.util.Map buildElement2ViewMap(org.eclipse.gmf.runtime.notation.View parentView, java.util.Map element2ViewMap, java.util.Set elements) {
+ if(elements.size() == element2ViewMap.size()) return element2ViewMap;
+
+ if(parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) && elements.contains(parentView.getElement())) {
+ element2ViewMap.put(parentView.getElement(), parentView);
+ if(elements.size() == element2ViewMap.size()) return element2ViewMap;
+ }
+
+ for (java.util.Iterator it = parentView.getChildren().iterator(); it.hasNext();) {
+ buildElement2ViewMap((org.eclipse.gmf.runtime.notation.View) it.next(), element2ViewMap, elements);
+ if(elements.size() == element2ViewMap.size()) return element2ViewMap;
+ }
+ for (java.util.Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) {
+ buildElement2ViewMap((org.eclipse.gmf.runtime.notation.View) it.next(), element2ViewMap, elements);
+ if(elements.size() == element2ViewMap.size()) return element2ViewMap;
+ }
+ for (java.util.Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) {
+ buildElement2ViewMap((org.eclipse.gmf.runtime.notation.View) it.next(), element2ViewMap, elements);
+ if(elements.size() == element2ViewMap.size()) return element2ViewMap;
+ }
+ return element2ViewMap;
+ }
+ } //LazyElement2ViewMap
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenModelResourceErrorDialog().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenModelResourceErrorDialog().messageKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreateDiagramProgressTask())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForCreateDiagramCommandLabel())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenModelResourceErrorDialog().titleKey(), "Error")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenModelResourceErrorDialog().messageKey(), "Failed to load model file {0}")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreateDiagramProgressTask(), "Creating diagram and model files")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForCreateDiagramCommandLabel(), "Creating diagram and model")-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/DocumentProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,748 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE DocumentProvider FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «documentProviderClassName» extends org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider implements org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocumentProvider {
+
+ «EXPAND createElementInfo-»
+
+ «EXPAND createDocument-»
+
+ «EXPAND setupDocument-»
+
+ «EXPAND computeModificationStamp-»
+
+ «EXPAND createEmptyDocument-»
+
+ «EXPAND createEditingDomain-»
+
+ «EXPAND setDocumentContent-»
+
+ «EXPAND getModificationStamp-»
+
+ «EXPAND isDeleted-»
+
+ «EXPAND getResourceSetInfo-»
+
+ «EXPAND disposeElementInfo-»
+ «IF null == editorGen.application-»
+
+ «EXPAND doValidateState-»
+ «ENDIF-»
+
+ «EXPAND isReadOnly-»
+
+ «EXPAND isModifiable-»
+
+ «EXPAND updateCache-»
+
+ «EXPAND doUpdateStateCache-»
+
+ «EXPAND isSynchronized-»
+ «IF null == editorGen.application-»
+
+ «EXPAND getResetRule-»
+
+ «EXPAND getSaveRule-»
+
+ «EXPAND getSynchronizeRule-»
+
+ «EXPAND getValidateStateRule-»
+
+ «EXPAND computeSchedulingRule-»
+ «ENDIF-»
+
+ «EXPAND doSynchronize-»
+
+ «EXPAND doSaveDocument-»
+
+ «EXPAND handleElementChanged-»
+
+ «EXPAND handleElementMoved-»
+
+ «EXPAND createInputWithEditingDomain-»
+
+ «EXPAND getDiagramDocument-»
+
+ «EXPAND getOperationRunner-»
+ «IF null != editorGen.application-»
+
+ «EXPAND getFile-»
+ «ENDIF-»
+
+ «EXPAND xpt::editor::ResourceSetInfo::ResourceSetInfo-»
+
+ «EXPAND xpt::editor::ResourceSetModificationListener::ResourceSetModificationListener-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE createElementInfo FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected ElementInfo createElementInfo(Object element) throws org.eclipse.core.runtime.CoreException {
+ «EXPAND checkEditorInputInstance-»
+ org.eclipse.ui.IEditorInput editorInput = (org.eclipse.ui.IEditorInput) element;
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) createDocument(editorInput);
+
+ ResourceSetInfo info = new ResourceSetInfo(document, editorInput);
+ info.setModificationStamp(computeModificationStamp(info));
+ info.fStatus = null;
+ return info;
+}
+«ENDDEFINE»
+
+«DEFINE checkEditorInputInstance FOR gmfgen::GenDiagram-»
+if («IF null == editorGen.application»false == element instanceof «EXPAND fileEditorInputClassFQName» && «ENDIF»false == element instanceof «EXPAND uriEditorInputClassFQName») {
+ «EXPAND throwIncorrectInputException-»
+}
+«ENDDEFINE»
+
+«DEFINE throwIncorrectInputException FOR gmfgen::GenDiagram-»
+throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
+ org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderIncorrectInputError()) FOR editorGen»,
+ new Object[] {element, «IF null == editorGen.application»"«EXPAND fileEditorInputClassFQName»", «ENDIF»"«EXPAND uriEditorInputClassFQName»"}), «EXPAND xpt::Common::nonNLS(1)»«IF null == editorGen.application» «EXPAND xpt::Common::nonNLS(2)»«ENDIF»
+ null));
+«ENDDEFINE»
+
+«DEFINE fileEditorInputClassFQName FOR gmfgen::GenDiagram»org.eclipse.ui.part.FileEditorInput«ENDDEFINE»
+
+«DEFINE uriEditorInputClassFQName FOR gmfgen::GenDiagram»org.eclipse.emf.common.ui.URIEditorInput«ENDDEFINE»
+
+«DEFINE createDocument FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument createDocument(Object element) throws org.eclipse.core.runtime.CoreException {
+ «EXPAND checkEditorInputInstance-»
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document = createEmptyDocument();
+ setDocumentContent(document, (org.eclipse.ui.IEditorInput) element);
+ setupDocument(element, document);
+ return document;
+}
+«ENDDEFINE»
+
+«DEFINE setupDocument FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment(
+ "Sets up the given document as it would be provided for the given element. The\n" +
+ "content of the document is not changed. This default implementation is empty.\n" +
+ "Subclasses may reimplement.\n" +
+ "\n" +
+ "@param element the blue-print element\n" +
+ "@param document the document to set up"
+ )»
+protected void setupDocument(Object element, org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document) {
+ // for subclasses
+}
+«ENDDEFINE»
+
+«DEFINE computeModificationStamp FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private long computeModificationStamp(ResourceSetInfo info) {
+ int result = 0;
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ «IF null == editorGen.application-»
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ if (file.getLocation() != null) {
+ result += file.getLocation().toFile().lastModified();
+ } else {
+ result += file.getModificationStamp();
+ }
+ }
+ «ELSE-»
+ java.io.File file = getFile(nextResource);
+ if (file != null && file.exists()) {
+ result += file.lastModified();
+ }
+ «ENDIF-»
+ }
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE createEmptyDocument FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument createEmptyDocument() {
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument document = new org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument();
+ document.setEditingDomain(createEditingDomain());
+ return document;
+}
+«ENDDEFINE»
+
+«DEFINE createEditingDomain FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.transaction.TransactionalEditingDomain createEditingDomain() {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory.getInstance().createEditingDomain();
+ editingDomain.setID("«editingDomainID»"); «EXPAND xpt::Common::nonNLS»
+ final org.eclipse.emf.transaction.NotificationFilter diagramResourceModifiedFilter = org.eclipse.emf.transaction.NotificationFilter.createNotifierFilter(editingDomain.getResourceSet()).and(org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.ADD)).and(org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(org.eclipse.emf.ecore.resource.ResourceSet.class, org.eclipse.emf.ecore.resource.ResourceSet.RESOURCE_SET__RESOURCES));
+ editingDomain.getResourceSet().eAdapters().add(new org.eclipse.emf.common.notify.Adapter() {
+
+ private org.eclipse.emf.common.notify.Notifier myTarger;
+
+ public org.eclipse.emf.common.notify.Notifier getTarget() {
+ return myTarger;
+ }
+
+ public boolean isAdapterForType(Object type) {
+ return false;
+ }
+
+ public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
+ if (diagramResourceModifiedFilter.matches(notification)) {
+ Object value = notification.getNewValue();
+ if (value instanceof org.eclipse.emf.ecore.resource.Resource) {
+ ((org.eclipse.emf.ecore.resource.Resource) value).setTrackingModification(true);
+ }
+ }
+ }
+
+ public void setTarget(org.eclipse.emf.common.notify.Notifier newTarget) {
+ myTarger = newTarget;
+ }
+
+ });
+
+ return editingDomain;
+}
+«ENDDEFINE»
+
+«DEFINE setDocumentContent FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void setDocumentContent(org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, org.eclipse.ui.IEditorInput element) throws org.eclipse.core.runtime.CoreException {
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;
+ org.eclipse.emf.transaction.TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
+ «IF null == editorGen.application»if (element instanceof «EXPAND fileEditorInputClassFQName») {
+ org.eclipse.core.resources.IStorage storage = ((«EXPAND fileEditorInputClassFQName») element).getStorage();
+ org.eclipse.gmf.runtime.notation.Diagram diagram = org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil.load(domain, storage, true, getProgressMonitor());
+ document.setContent(diagram);
+ } else «ENDIF»if(element instanceof «EXPAND uriEditorInputClassFQName») {
+ org.eclipse.emf.common.util.URI uri = ((«EXPAND uriEditorInputClassFQName») element).getURI();
+ org.eclipse.emf.ecore.resource.Resource resource = null;
+ try {
+ resource = domain.getResourceSet().getResource(uri.trimFragment(), false);
+ if (resource == null) {
+ resource = domain.getResourceSet().createResource(uri.trimFragment());
+ }
+ if (!resource.isLoaded()) {
+ try {
+ java.util.Map options = new java.util.HashMap(org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory.getDefaultLoadOptions());
+ // @see 171060
+ // options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, Boolean.TRUE);
+ resource.load(options);
+ } catch (java.io.IOException e) {
+ resource.unload();
+ throw e;
+ }
+ }
+ if (uri.fragment() != null) {
+ org.eclipse.emf.ecore.EObject rootElement = resource.getEObject(uri.fragment());
+ if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);
+ return;
+ }
+ } else {
+ for (java.util.Iterator it = resource.getContents().iterator(); it.hasNext();) {
+ Object rootElement = it.next();
+ if (rootElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ document.setContent((org.eclipse.gmf.runtime.notation.Diagram) rootElement);
+ return;
+ }
+ }
+ }
+ throw new RuntimeException(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderNoDiagramInResourceError()) FOR editorGen»);
+ } catch (Exception e) {
+ org.eclipse.core.runtime.CoreException thrownExcp = null;
+ if (e instanceof org.eclipse.core.runtime.CoreException) {
+ thrownExcp = (org.eclipse.core.runtime.CoreException) e;
+ } else {
+ String msg = e.getLocalizedMessage();
+ thrownExcp = new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
+ msg != null ? msg : «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderDiagramLoadingError()) FOR editorGen», e));
+ }
+ throw thrownExcp;
+ }
+ } else {
+ «EXPAND throwIncorrectInputException-»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE getModificationStamp FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public long getModificationStamp(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return computeModificationStamp(info);
+ }
+ return super.getModificationStamp(element);
+}
+«ENDDEFINE»
+
+«DEFINE isDeleted FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isDeleted(Object element) {
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument(element);
+ if (document != null) {
+ org.eclipse.emf.ecore.resource.Resource diagramResource = document.getDiagram().eResource();
+ if (diagramResource != null) {
+ «IF null == editorGen.application-»
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource);
+ return file == null || file.getLocation() == null || !file.getLocation().toFile().exists();
+ «ELSE-»
+ java.io.File file = getFile(diagramResource);
+ return file != null && !file.exists();
+ «ENDIF-»
+ }
+ }
+ return super.isDeleted(element);
+}
+«ENDDEFINE»
+
+«DEFINE getResourceSetInfo FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public ResourceSetInfo getResourceSetInfo(Object editorInput) {
+ return (ResourceSetInfo) super.getElementInfo(editorInput);
+}
+«ENDDEFINE»
+
+«DEFINE disposeElementInfo FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void disposeElementInfo(Object element, ElementInfo info) {
+ if (info instanceof ResourceSetInfo) {
+ ResourceSetInfo resourceSetInfo = (ResourceSetInfo) info;
+ resourceSetInfo.dispose();
+ }
+ super.disposeElementInfo(element, info);
+}
+«ENDDEFINE»
+
+«DEFINE doValidateState FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void doValidateState(Object element, Object computationContext) throws org.eclipse.core.runtime.CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ java.util.Collection/*<org.eclipse.core.resources.IFile>*/ files2Validate = new java.util.ArrayList/*<org.eclipse.core.resources.IFile>*/();
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null && file.isReadOnly()) {
+ files2Validate.add(file);
+ }
+ }
+ org.eclipse.core.resources.ResourcesPlugin.getWorkspace().validateEdit((org.eclipse.core.resources.IFile[]) files2Validate.toArray(new org.eclipse.core.resources.IFile[files2Validate.size()]), computationContext);
+ }
+
+ super.doValidateState(element, computationContext);
+}
+«ENDDEFINE»
+
+«DEFINE isReadOnly FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isReadOnly(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ «EXPAND callUpdateCache-»
+ return info.isReadOnly();
+ }
+ return super.isReadOnly(element);
+}
+«ENDDEFINE»
+
+«DEFINE isModifiable FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isModifiable(Object element) {
+ if (!isStateValidated(element)) {
+ if («IF null == editorGen.application»element instanceof «EXPAND fileEditorInputClassFQName» || «ENDIF»element instanceof «EXPAND uriEditorInputClassFQName») {
+ return true;
+ }
+ }
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ «EXPAND callUpdateCache-»
+ return info.isModifiable();
+ }
+ return super.isModifiable(element);
+}
+«ENDDEFINE»
+
+«DEFINE callUpdateCache FOR gmfgen::GenDiagram-»
+if (info.isUpdateCache()) {
+ try {
+ updateCache(element);
+ } catch (org.eclipse.core.runtime.CoreException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderIsModifiable()) FOR editorGen», ex);
+ // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
+ }
+}
+«ENDDEFINE»
+
+«DEFINE updateCache FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void updateCache(Object element) throws org.eclipse.core.runtime.CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ «IF null == editorGen.application-»
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null && file.isReadOnly()) {
+ «ELSE-»
+ java.io.File file = getFile(nextResource);
+ if (file != null && file.exists() && !file.canWrite()) {
+ «ENDIF-»
+ info.setReadOnly(true);
+ info.setModifiable(false);
+ return;
+ }
+ }
+ info.setReadOnly(false);
+ info.setModifiable(true);
+ return;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE doUpdateStateCache FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void doUpdateStateCache(Object element) throws org.eclipse.core.runtime.CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ info.setUpdateCache(true);
+ }
+ super.doUpdateStateCache(element);
+}
+«ENDDEFINE»
+
+«DEFINE isSynchronized FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isSynchronized(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return info.isSynchronized();
+ }
+ return super.isSynchronized(element);
+}
+«ENDDEFINE»
+
+«DEFINE getResetRule FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.core.runtime.jobs.ISchedulingRule getResetRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ rules = new java.util.ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
+ }
+ }
+ return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getSaveRule FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.core.runtime.jobs.ISchedulingRule getSaveRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ rules = new java.util.ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(computeSchedulingRule(file));
+ }
+ }
+ return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getSynchronizeRule FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.core.runtime.jobs.ISchedulingRule getSynchronizeRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ rules = new java.util.ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
+ }
+ }
+ return new org.eclipse.core.runtime.jobs.MultiRule((org.eclipse.core.runtime.jobs.ISchedulingRule[]) rules.toArray(new org.eclipse.core.runtime.jobs.ISchedulingRule[rules.size()]));
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getValidateStateRule FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.core.runtime.jobs.ISchedulingRule getValidateStateRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ java.util.Collection/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/ files = new java.util.ArrayList/*<org.eclipse.core.runtime.jobs.ISchedulingRule>*/();
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ files.add(file);
+ }
+ }
+ return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule((org.eclipse.core.resources.IFile[]) files.toArray(new org.eclipse.core.resources.IFile[files.size()]));
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE computeSchedulingRule FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.core.runtime.jobs.ISchedulingRule computeSchedulingRule(org.eclipse.core.resources.IResource toCreateOrModify) {
+ if (toCreateOrModify.exists())
+ return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
+
+ org.eclipse.core.resources.IResource parent = toCreateOrModify;
+ do {
+ /*
+ * XXX This is a workaround for
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=67601
+ * IResourceRuleFactory.createRule should iterate the hierarchy
+ * itself.
+ */
+ toCreateOrModify = parent;
+ parent = toCreateOrModify.getParent();
+ } while (parent != null && !parent.exists());
+
+ return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
+}
+«ENDDEFINE»
+
+«DEFINE doSynchronize FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void doSynchronize(Object element, org.eclipse.core.runtime.IProgressMonitor monitor) throws org.eclipse.core.runtime.CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ handleElementChanged(info, nextResource, monitor);
+ }
+ return;
+ }
+ super.doSynchronize(element, monitor);
+}
+«ENDDEFINE»
+
+«DEFINE handleElementChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void handleElementChanged(ResourceSetInfo info, org.eclipse.emf.ecore.resource.Resource changedResource, org.eclipse.core.runtime.IProgressMonitor monitor) {
+ «IF null == editorGen.application-»
+ org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(changedResource);
+ if (file != null) {
+ try {
+ file.refreshLocal(org.eclipse.core.resources.IResource.DEPTH_INFINITE, monitor);
+ } catch (org.eclipse.core.runtime.CoreException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentProviderHandleElementContentChanged()) FOR editorGen», ex);
+ // Error message to log was initially taken from org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.FileDocumentProvider_handleElementContentChanged
+ }
+ }
+ «ENDIF-»
+ changedResource.unload();
+
+ fireElementContentAboutToBeReplaced(info.getEditorInput());
+ removeUnchangedElementListeners(info.getEditorInput(), info);
+ info.fStatus = null;
+ try {
+ setDocumentContent(info.fDocument, info.getEditorInput());
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ info.fStatus = e.getStatus();
+ }
+«REM»TODO: Remove this if and call setModificationStamp only from doSaveDocument method«ENDREM»«-»
+ if (!info.fCanBeSaved) {
+ info.setModificationStamp(computeModificationStamp(info));
+ }
+ addUnchangedElementListeners(info.getEditorInput(), info);
+ fireElementContentReplaced(info.getEditorInput());
+}
+«ENDDEFINE»
+
+«DEFINE doSaveDocument FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void doSaveDocument(org.eclipse.core.runtime.IProgressMonitor monitor, Object element, org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document, boolean overwrite) throws org.eclipse.core.runtime.CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (!overwrite && !info.isSynchronized()) {
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID,
+ «IF null == editorGen.application»org.eclipse.core.resources.IResourceStatus.OUT_OF_SYNC_LOCAL«ELSE»org.eclipse.core.runtime.IStatus.ERROR«ENDIF»,
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentUnsynchronizedFileSaveError()) FOR editorGen»,
+ null));
+ }
+ «IF null == editorGen.application-»
+ info.stopResourceListening();
+ «ENDIF-»
+ fireElementStateChanging(element);
+ try {
+ monitor.beginTask(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveDiagramTask()) FOR editorGen», info.getResourceSet().getResources().size() + 1); //"Saving diagram"
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = info.getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ monitor.setTaskName(org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveNextResourceTask()) FOR editorGen»,
+ nextResource.getURI()));
+ if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
+ try {
+ nextResource.save(«EXPAND xpt::Common::getSaveOptions»);
+ } catch (java.io.IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null));
+ }
+ }
+ monitor.worked(1);
+ }
+ monitor.done();
+ info.setModificationStamp(computeModificationStamp(info));
+ } catch (RuntimeException x) {
+ fireElementStateChangeFailed(element);
+ throw x;
+ } «IF null == editorGen.application» finally {
+ info.startResourceListening();
+ } «ENDIF»
+ } else {
+ org.eclipse.emf.common.util.URI newResoruceURI;
+ java.util.List affectedFiles = null;
+ «IF null == editorGen.application»if (element instanceof «EXPAND fileEditorInputClassFQName») {
+ org.eclipse.core.resources.IFile newFile = ((«EXPAND fileEditorInputClassFQName») element).getFile();
+ affectedFiles = java.util.Collections.singletonList(newFile);
+ newResoruceURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
+ } else «ENDIF»if(element instanceof «EXPAND uriEditorInputClassFQName») {
+ newResoruceURI = ((«EXPAND uriEditorInputClassFQName») element).getURI();
+ } else {
+ fireElementStateChangeFailed(element);
+ «EXPAND throwIncorrectInputException-»
+ }
+ if (false == document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
+ fireElementStateChangeFailed(element);
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0,
+ "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); «EXPAND xpt::Common::nonNLS(1)» «EXPAND xpt::Common::nonNLS(2)»
+ }
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument diagramDocument = (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document;
+ final org.eclipse.emf.ecore.resource.Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
+ final org.eclipse.gmf.runtime.notation.Diagram diagramCopy = (org.eclipse.gmf.runtime.notation.Diagram) org.eclipse.emf.ecore.util.EcoreUtil.copy(diagramDocument.getDiagram());
+ try {
+ new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(diagramDocument.getEditingDomain(), org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForDocumentSaveAs()) FOR editorGen», diagramCopy.getName()), affectedFiles) {
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info) throws org.eclipse.core.commands.ExecutionException {
+ newResource.getContents().add(diagramCopy);
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
+ }
+ }.execute(monitor, null);
+ newResource.save(«EXPAND xpt::Common::getSaveOptions»);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ fireElementStateChangeFailed(element);
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, e.getLocalizedMessage(), null));
+ } catch (java.io.IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new org.eclipse.core.runtime.CoreException(new org.eclipse.core.runtime.Status(org.eclipse.core.runtime.IStatus.ERROR, «editorGen.plugin.getActivatorQualifiedClassName()».ID, 0, e.getLocalizedMessage(), null));
+ }
+ newResource.unload();
+ }
+}
+«ENDDEFINE»
+
+«DEFINE handleElementMoved FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void handleElementMoved(org.eclipse.ui.IEditorInput input, org.eclipse.emf.common.util.URI uri) {
+ «IF null == editorGen.application»if (input instanceof «EXPAND fileEditorInputClassFQName») {
+ org.eclipse.core.resources.IFile newFile = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFile(new org.eclipse.core.runtime.Path(org.eclipse.emf.common.util.URI.decode(uri.path())).removeFirstSegments(1));
+ fireElementMoved(input, newFile == null ? null : new org.eclipse.ui.part.FileEditorInput(newFile));
+ return;
+ }«ENDIF»
+ // TODO: append suffix to the URI! (use diagram as a parameter)
+ fireElementMoved(input, new org.eclipse.emf.common.ui.URIEditorInput(uri));
+}
+«ENDDEFINE»
+
+«DEFINE createInputWithEditingDomain FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.ui.IEditorInput createInputWithEditingDomain(org.eclipse.ui.IEditorInput editorInput, org.eclipse.emf.transaction.TransactionalEditingDomain domain) {
+ return editorInput;
+}
+«ENDDEFINE»
+
+«DEFINE getDiagramDocument FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument getDiagramDocument(Object element) {
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument doc = getDocument(element);
+ if (doc instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
+ return (org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) doc;
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getOperationRunner FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.jface.operation.IRunnableContext getOperationRunner(org.eclipse.core.runtime.IProgressMonitor monitor) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getFile FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static java.io.File getFile(org.eclipse.emf.ecore.resource.Resource resource) {
+ org.eclipse.emf.common.util.URI resourceUri = resource.getURI();
+ if (resourceUri != null && resourceUri.isFile()) {
+ java.io.File file = new java.io.File(resourceUri.toFileString());
+ if (!file.isDirectory()) {
+ return file;
+ }
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderIsModifiable())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderHandleElementContentChanged())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderIncorrectInputError())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderNoDiagramInResourceError())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentProviderDiagramLoadingError())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentUnsynchronizedFileSaveError())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentSaveDiagramTask())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentSaveNextResourceTask())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForDocumentSaveAs())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderIsModifiable(), "Updating cache failed")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderHandleElementContentChanged(), "Failed to refresh hierarchy for changed resource")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderIncorrectInputError(), "Incorrect element used: {0} instead of " + editorGen.application == null ? "{1} or {2}" : "{1}")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderNoDiagramInResourceError(), "Diagram is not present in resource")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentProviderDiagramLoadingError(), "Error loading diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentUnsynchronizedFileSaveError(), "The file has been changed on the file system")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentSaveDiagramTask(), "Saving diagram")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentSaveNextResourceTask(), "Saving {0}")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForDocumentSaveAs(), "Saving {0} diagram as")-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/DomainModelElementTester.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE DomainModelElementTester FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «domainModelElementTesterClassName» extends org.eclipse.core.expressions.PropertyTester {
+
+ «EXPAND test-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE test FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
+ if (false == receiver instanceof org.eclipse.emf.ecore.EObject) {
+ return false;
+ }
+ org.eclipse.emf.ecore.EObject eObject = (org.eclipse.emf.ecore.EObject) receiver;
+ org.eclipse.emf.ecore.EClass eClass = eObject.eClass();
+ «EXPAND checkGenClass FOREACH editorGen.domainGenModel.genPackages.genClasses-»
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE checkGenClass FOR genmodel::GenClass-»
+if (eClass == «EXPAND MetaModel::MetaClass») {
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/Editor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,404 @@
+/*
+ * Copyright (c) 2006,2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE Editor FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «className» extends org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor«EXPAND implementsList FOR getEditorImplementsList(this)» {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND getContextID-»
+ «EXPAND createPaletteRoot FOR editorGen.diagram.palette-»
+
+ «EXPAND getPreferencesHint-»
+
+ «EXPAND getContributorId-»
+ «EXPAND getAdapter-»
+
+ «EXPAND getDocumentProvider-»
+
+ «EXPAND getEditingDomain-»
+
+ «EXPAND setDocumentProvider-»
+ «IF isIDEMode(this)-»
+
+ «EXPAND gotoMarker-»
+
+ «EXPAND isSaveAsAllowed-»
+
+ «EXPAND doSaveAs-»
+
+ «EXPAND performSaveAs-»
+
+ «EXPAND getShowInContext-»
+ «EXPAND getNavigatorSelection FOR editorGen.navigator-»
+ «ENDIF-»
+
+ «EXPAND configureGraphicalViewer-»
+
+ «IF editorGen.diagram.generateCreateShortcutAction()-»
+
+ «EXPAND initializeGraphicalViewer-»
+
+ «EXPAND DropTargetListener-»
+ «ENDIF-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static final String ID = "«iD»"; «EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+public static final String CONTEXT_ID = "«contextID»"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «className»() {
+ super(«null != editorGen.diagram.palette && editorGen.diagram.palette.flyout»);
+}
+«ENDDEFINE»
+
+«DEFINE getContextID FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected String getContextID() {
+ return CONTEXT_ID;
+}
+«ENDDEFINE»
+
+«DEFINE createPaletteRoot FOR gmfgen::Palette-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gef.palette.PaletteRoot createPaletteRoot(org.eclipse.gef.palette.PaletteRoot existingPaletteRoot) {
+ org.eclipse.gef.palette.PaletteRoot root = super.createPaletteRoot(existingPaletteRoot);
+ new «getFactoryQualifiedClassName()»().fillPalette(root);
+ return root;
+}
+«ENDDEFINE»
+
+«DEFINE getPreferencesHint FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint getPreferencesHint() {
+«REM»
+ XXX seems better we use preference store directly (in configureGraphicalViewer) instead all these indirect ids
+«ENDREM»«-»
+ return «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT;
+}
+«ENDDEFINE»
+
+«DEFINE getContributorId FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getContributorId() {
+ return «editorGen.plugin.getActivatorQualifiedClassName()».ID;
+}
+«ENDDEFINE»
+
+«DEFINE getAdapter FOR gmfgen::GenEditorView-»
+ «IF !hasPropertySheet(this) || hasNavigator(this)-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object getAdapter(Class type) {
+ «IF !hasPropertySheet(this)-»
+ if (type == org.eclipse.ui.views.properties.IPropertySheetPage.class) {
+ return null;
+ }
+ «ENDIF-»
+ «IF hasNavigator(this)-»
+ if (type == org.eclipse.ui.part.IShowInTargetList.class) {
+ return new org.eclipse.ui.part.IShowInTargetList() {
+ public String[] getShowInTargetIds() {
+ return new String[] { org.eclipse.ui.navigator.resources.ProjectExplorer.VIEW_ID };
+ }
+ };
+ }
+ «ENDIF-»
+ return super.getAdapter(type);
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getDocumentProvider FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider getDocumentProvider(org.eclipse.ui.IEditorInput input) {
+ if («EXPAND checkEditorInput») {
+ return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getDocumentProvider();
+ }
+ return super.getDocumentProvider(input);
+}
+«ENDDEFINE»
+
+«DEFINE getEditingDomain FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument document = getEditorInput() != null ? getDocumentProvider().getDocument(getEditorInput()) : null;
+ if (document instanceof org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) {
+ return ((org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument) document).getEditingDomain();
+ }
+ return super.getEditingDomain();
+}
+«ENDDEFINE»
+
+«DEFINE setDocumentProvider FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void setDocumentProvider(org.eclipse.ui.IEditorInput input) {
+ if («EXPAND checkEditorInput») {
+ setDocumentProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getDocumentProvider());
+ } else {
+ super.setDocumentProvider(input);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE checkEditorInput FOR gmfgen::GenEditorView»«IF isIDEMode(this)»input instanceof org.eclipse.ui.IFileEditorInput || «ENDIF»input instanceof org.eclipse.emf.common.ui.URIEditorInput«ENDDEFINE»
+
+«DEFINE gotoMarker FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void gotoMarker(org.eclipse.core.resources.IMarker marker) {
+ org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService.getInstance().gotoMarker(this, marker);
+}
+«ENDDEFINE»
+
+«DEFINE isSaveAsAllowed FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isSaveAsAllowed() {
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE doSaveAs FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void doSaveAs() {
+ performSaveAs(new org.eclipse.core.runtime.NullProgressMonitor());
+}
+«ENDDEFINE»
+
+«DEFINE performSaveAs FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void performSaveAs(org.eclipse.core.runtime.IProgressMonitor progressMonitor) {
+ org.eclipse.swt.widgets.Shell shell = getSite().getShell();
+ org.eclipse.ui.IEditorInput input = getEditorInput();
+ org.eclipse.ui.dialogs.SaveAsDialog dialog = new org.eclipse.ui.dialogs.SaveAsDialog(shell);
+ org.eclipse.core.resources.IFile original = input instanceof org.eclipse.ui.IFileEditorInput ? ((org.eclipse.ui.IFileEditorInput) input).getFile() : null;
+ if (original != null) {
+ dialog.setOriginalFile(original);
+ }
+ dialog.create();
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider provider = getDocumentProvider();
+ if (provider == null) {
+ // editor has been programmatically closed while the dialog was open
+ return;
+ }
+ if (provider.isDeleted(input) && original != null) {
+ String message = org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForSavingDeletedFile(this)) FOR editorGen», original.getName());
+ dialog.setErrorMessage(null);
+ dialog.setMessage(message, org.eclipse.jface.dialogs.IMessageProvider.WARNING);
+ }
+ if (dialog.open() == org.eclipse.jface.window.Window.CANCEL) {
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(true);
+ }
+ return;
+ }
+ org.eclipse.core.runtime.IPath filePath = dialog.getResult();
+ if (filePath == null) {
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(true);
+ }
+ return;
+ }
+ org.eclipse.core.resources.IWorkspaceRoot workspaceRoot = org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot();
+ org.eclipse.core.resources.IFile file = workspaceRoot.getFile(filePath);
+ final org.eclipse.ui.IEditorInput newInput = new org.eclipse.ui.part.FileEditorInput(file);
+ // Check if the editor is already open
+ org.eclipse.ui.IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy();
+ org.eclipse.ui.IEditorReference[] editorRefs = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+ for (int i = 0; i < editorRefs.length; i++) {
+ if (matchingStrategy.matches(editorRefs[i], newInput)) {
+ org.eclipse.jface.dialogs.MessageDialog.openWarning(shell, «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForSaveAsProblems(this))) FOR editorGen», «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForSaveAsProblems(this))) FOR editorGen»);
+ return;
+ }
+ }
+ boolean success = false;
+ try {
+ provider.aboutToChange(newInput);
+ getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);
+ success = true;
+ } catch (org.eclipse.core.runtime.CoreException x) {
+ org.eclipse.core.runtime.IStatus status = x.getStatus();
+ if (status == null || status.getSeverity() != org.eclipse.core.runtime.IStatus.CANCEL) {
+ org.eclipse.jface.dialogs.ErrorDialog.openError(shell, «EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForSaveProblems(this))) FOR editorGen», «EXPAND xpt::Externalizer::accessorCall(messageKey(i18nKeyForSaveProblems(this))) FOR editorGen», x.getStatus());
+ }
+ } finally {
+ provider.changed(newInput);
+ if (success) {
+ setInput(newInput);
+ }
+ }
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(!success);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE getShowInContext FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.ui.part.ShowInContext getShowInContext() {
+ return new org.eclipse.ui.part.ShowInContext(getEditorInput(), «IF hasNavigator(this)»getNavigatorSelection()«ELSE»getGraphicalViewer().getSelection()«ENDIF»);
+}
+«ENDDEFINE»
+
+«DEFINE getNavigatorSelection FOR gmfgen::GenNavigator-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.ISelection getNavigatorSelection() {
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = getDiagramDocument();
+ «EXPAND xpt::navigator::NavigatorLinkHelper::findSelectionBody-»
+}
+«ENDDEFINE»
+
+«DEFINE configureGraphicalViewer FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ «EXPAND xpt::editor::DiagramEditorContextMenuProvider::qualifiedClassName FOR editorGen.diagram» provider =
+ new «EXPAND xpt::editor::DiagramEditorContextMenuProvider::qualifiedClassName FOR editorGen.diagram»(this, getDiagramGraphicalViewer());
+ getDiagramGraphicalViewer().setContextMenu(provider);
+ getSite().registerContextMenu(org.eclipse.gmf.runtime.diagram.ui.actions.ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
+ }
+«ENDDEFINE»
+
+«DEFINE initializeGraphicalViewer FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected void initializeGraphicalViewer() {
+ super.initializeGraphicalViewer();
+ «EXPAND addDropTargetListener("org.eclipse.jface.util.LocalSelectionTransfer.getTransfer()")-»
+ «EXPAND addDropTargetListener("org.eclipse.emf.edit.ui.dnd.LocalTransfer.getInstance()")-»
+}
+«ENDDEFINE»
+
+«DEFINE addDropTargetListener(String transferAccessor) FOR gmfgen::GenEditorView-»
+getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), «transferAccessor») {
+
+ protected Object getJavaObject(org.eclipse.swt.dnd.TransferData data) {
+ return «transferAccessor».nativeToJava(data);
+ }
+
+});
+«ENDDEFINE»
+
+«DEFINE DropTargetListener FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedClassComment»
+private abstract class DropTargetListener extends org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener {
+
+ «EXPAND DTL_constructor-»
+
+ «EXPAND DTL_getObjectsBeingDropped-»
+
+ «EXPAND DTL_getJavaObject-»
+
+ «EXPAND DTL_additions-»
+}
+«ENDDEFINE»
+
+
+«DEFINE DTL_constructor FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public DropTargetListener(org.eclipse.gef.EditPartViewer viewer, org.eclipse.swt.dnd.Transfer xfer) {
+ super(viewer, xfer);
+}
+«ENDDEFINE»
+
+«DEFINE DTL_getObjectsBeingDropped FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected java.util.List getObjectsBeingDropped() {
+ org.eclipse.swt.dnd.TransferData data = getCurrentEvent().currentDataType;
+ java.util.Collection uris = new java.util.HashSet();
+
+ Object transferedObject = getJavaObject(data);
+ if (transferedObject instanceof org.eclipse.jface.viewers.IStructuredSelection) {
+ org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) transferedObject;
+ for (java.util.Iterator it = selection.iterator(); it.hasNext();) {
+ Object nextSelectedObject = it.next();
+«REM»
+ TODO: move NavigatorItem to some place available in runtime and remove
+ "genEditor.getEditorGen().getNavigator() != null" test
+«ENDREM»«-»
+ «IF hasNavigator(this)»if (nextSelectedObject instanceof «editorGen.navigator.getNavigatorItemQualifiedClassName()») {
+ org.eclipse.gmf.runtime.notation.View view = ((«editorGen.navigator.getNavigatorItemQualifiedClassName()») nextSelectedObject).getView();
+ nextSelectedObject = view.getElement();
+ } else «ENDIF»if (nextSelectedObject instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.core.runtime.IAdaptable adaptable = (org.eclipse.core.runtime.IAdaptable) nextSelectedObject;
+ nextSelectedObject = adaptable.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ }
+
+ if (nextSelectedObject instanceof org.eclipse.emf.ecore.EObject) {
+ org.eclipse.emf.ecore.EObject modelElement = (org.eclipse.emf.ecore.EObject) nextSelectedObject;
+ org.eclipse.emf.ecore.resource.Resource modelElementResource = modelElement.eResource();
+ uris.add(modelElementResource.getURI().appendFragment(modelElementResource.getURIFragment(modelElement)));
+ }
+ }
+ }
+
+ java.util.List result = new java.util.ArrayList();
+ for (java.util.Iterator it = uris.iterator(); it.hasNext();) {
+ org.eclipse.emf.common.util.URI nextURI = (org.eclipse.emf.common.util.URI) it.next();
+ org.eclipse.emf.ecore.EObject modelObject = getEditingDomain().getResourceSet().getEObject(nextURI, true);
+ result.add(modelObject);
+ }
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE DTL_getJavaObject FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected abstract Object getJavaObject(org.eclipse.swt.dnd.TransferData data);
+«ENDDEFINE»
+
+«DEFINE implementsList FOR List[String]-»
+«IF !isEmpty()» implements «EXPAND implementsListEntry FOREACH this SEPARATOR ", "»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE implementsListEntry FOR String»«this»«ENDDEFINE»
+
+«DEFINE DTL_additions FOR gmfgen::GenEditorView-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenEditorView-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenEditorView-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForSavingDeletedFile(this), "The original file \"{0}\" has been deleted.")-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForSaveAsProblems(this)), "Problem During Save As...")-»
+«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForSaveAsProblems(this)), "Save could not be completed. Target file is already open in another editor.")-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForSaveProblems(this)), "Save Problems")-»
+«EXPAND xpt::Externalizer::messageEntry(messageKey(i18nKeyForSaveProblems(this)), "Could not save file.")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenEditorView-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForSavingDeletedFile(this))-»
+ «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForSaveAsProblems(this)))-»
+ «EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForSaveAsProblems(this)))-»
+ «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForSaveProblems(this)))-»
+ «EXPAND xpt::Externalizer::accessorField(messageKey(i18nKeyForSaveProblems(this)))-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/ElementChooser.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE ElementChooser FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «elementChooserClassName» extends org.eclipse.jface.dialogs.Dialog {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND createDialogArea-»
+
+ «EXPAND createButtonBar-»
+
+ «EXPAND createModelBrowser-»
+
+ «EXPAND setOkButtonEnabled-»
+
+ «EXPAND isValidModelFile-»
+
+ «EXPAND getSelectedModelElementURI-»
+
+ «EXPAND open-»
+
+ «EXPAND ModelElementsTreeContentProvider-»
+
+ «EXPAND ModelElementsTreeLabelProvider-»
+
+ «EXPAND ModelFilesFilter-»
+
+ «EXPAND OkButtonEnabler-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.TreeViewer myTreeViewer;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.common.util.URI mySelectedModelElementURI;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.notation.View myView;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain = org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «elementChooserClassName»(org.eclipse.swt.widgets.Shell parentShell, org.eclipse.gmf.runtime.notation.View view) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | org.eclipse.swt.SWT.RESIZE);
+ myView = view;
+}
+«ENDDEFINE»
+
+«DEFINE createDialogArea FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent) {
+ org.eclipse.swt.widgets.Composite composite = (org.eclipse.swt.widgets.Composite) super.createDialogArea(parent);
+ getShell().setText(«EXPAND xpt::Externalizer::accessorCall(titleKey(i18nKeyForSelectModelElement(this))) FOR editorGen»);
+ createModelBrowser(composite);
+ return composite;
+}
+«ENDDEFINE»
+
+«DEFINE createButtonBar FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite parent) {
+ org.eclipse.swt.widgets.Control buttonBar = super.createButtonBar(parent);
+ setOkButtonEnabled(false);
+ return buttonBar;
+}
+«ENDDEFINE»
+
+«DEFINE createModelBrowser FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void createModelBrowser(org.eclipse.swt.widgets.Composite composite) {
+ myTreeViewer = new org.eclipse.jface.viewers.TreeViewer(composite, org.eclipse.swt.SWT.SINGLE | org.eclipse.swt.SWT.H_SCROLL | org.eclipse.swt.SWT.V_SCROLL | org.eclipse.swt.SWT.BORDER);
+ org.eclipse.swt.layout.GridData layoutData = new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ myTreeViewer.getTree().setLayoutData(layoutData);
+ myTreeViewer.setContentProvider(new ModelElementsTreeContentProvider());
+ myTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider());
+ myTreeViewer.setInput(org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot());
+ myTreeViewer.addFilter(new ModelFilesFilter());
+ myTreeViewer.addSelectionChangedListener(new OkButtonEnabler());
+}
+«ENDDEFINE»
+
+«DEFINE setOkButtonEnabled FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void setOkButtonEnabled(boolean enabled) {
+ getButton(org.eclipse.jface.dialogs.IDialogConstants.OK_ID).setEnabled(enabled);
+}
+«ENDDEFINE»
+
+«DEFINE isValidModelFile FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean isValidModelFile(org.eclipse.core.resources.IFile file) {
+ String fileExtension = file.getFullPath().getFileExtension();
+ return «EXPAND compareModelFileExtension FOREACH containsShortcutsTo SEPARATOR " || "»; «EXPAND xpt::Common::nonNLS({}) FOREACH containsShortcutsTo SEPARATOR " "»
+}
+«ENDDEFINE»
+
+«DEFINE compareModelFileExtension FOR String»"«this»".equals(fileExtension)«ENDDEFINE»
+
+«DEFINE getSelectedModelElementURI FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.common.util.URI getSelectedModelElementURI() {
+ return mySelectedModelElementURI;
+}
+«ENDDEFINE»
+
+«DEFINE open FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int open() {
+ int result = super.open();
+ for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ resource.unload();
+ }
+ myEditingDomain.dispose();
+ return result;
+}
+«ENDDEFINE»
+
+«DEFINE ModelElementsTreeContentProvider FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class ModelElementsTreeContentProvider implements org.eclipse.jface.viewers.ITreeContentProvider {
+
+ «EXPAND METCP_attributes-»
+
+ «EXPAND METCP_getChildren-»
+
+ «EXPAND METCP_getParent-»
+
+ «EXPAND METCP_hasChildren-»
+
+ «EXPAND METCP_getElements-»
+
+ «EXPAND METCP_dispose-»
+
+ «EXPAND METCP_inputChanged-»
+
+ «EXPAND METCP_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE METCP_attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.ITreeContentProvider myWorkbenchContentProvider = new «IF null == editorGen.application»org.eclipse.ui.model.WorkbenchContentProvider«ELSE»org.eclipse.ui.model.BaseWorkbenchContentProvider«ENDIF»();
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider myAdapterFctoryContentProvier = new org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+«ENDDEFINE»
+
+«DEFINE METCP_getChildren FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] getChildren(Object parentElement) {
+ Object[] result = myWorkbenchContentProvider.getChildren(parentElement);
+ if (result != null && result.length > 0) {
+ return result;
+ }
+ if (parentElement instanceof org.eclipse.core.resources.IFile) {
+ org.eclipse.core.resources.IFile modelFile = (org.eclipse.core.resources.IFile) parentElement;
+ org.eclipse.core.runtime.IPath resourcePath = modelFile.getFullPath();
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet();
+ try {
+ org.eclipse.emf.ecore.resource.Resource modelResource = resourceSet.getResource(org.eclipse.emf.common.util.URI.createPlatformResourceURI(resourcePath.toString(), true), true);
+ return myAdapterFctoryContentProvier.getChildren(modelResource);
+ } catch (org.eclipse.emf.common.util.WrappedException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to load resource: " + resourcePath.toString(), e); «EXPAND xpt::Common::nonNLS»
+ }
+ return java.util.Collections.EMPTY_LIST.toArray();
+ }
+ return myAdapterFctoryContentProvier.getChildren(parentElement);
+}
+«ENDDEFINE»
+
+«DEFINE METCP_getParent FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object getParent(Object element) {
+ Object parent = myWorkbenchContentProvider.getParent(element);
+ if (parent != null) {
+ return parent;
+ }
+ if (element instanceof org.eclipse.emf.ecore.EObject) {
+ org.eclipse.emf.ecore.EObject eObject = (org.eclipse.emf.ecore.EObject) element;
+ if (eObject.eContainer() == null && eObject.eResource().getURI().isFile()) {
+ String path = eObject.eResource().getURI().path();
+ return org.eclipse.core.resources.ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new org.eclipse.core.runtime.Path(path));
+ }
+ return myAdapterFctoryContentProvier.getParent(eObject);
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE METCP_hasChildren FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean hasChildren(Object element) {
+ if (element instanceof org.eclipse.core.resources.IFile) {
+ return isValidModelFile((org.eclipse.core.resources.IFile) element);
+ }
+ return myWorkbenchContentProvider.hasChildren(element) || myAdapterFctoryContentProvier.hasChildren(element);
+}
+«ENDDEFINE»
+
+«DEFINE METCP_getElements FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] getElements(Object inputElement) {
+ Object[] elements = myWorkbenchContentProvider.getElements(inputElement);
+ return elements;
+}
+«ENDDEFINE»
+
+«DEFINE METCP_dispose FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ myWorkbenchContentProvider.dispose();
+ myAdapterFctoryContentProvier.dispose();
+}
+«ENDDEFINE»
+
+«DEFINE METCP_inputChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
+ myWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput);
+ myAdapterFctoryContentProvier.inputChanged(viewer, oldInput, newInput);
+}
+«ENDDEFINE»
+
+«DEFINE ModelElementsTreeLabelProvider FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class ModelElementsTreeLabelProvider implements org.eclipse.jface.viewers.ILabelProvider {
+
+ «EXPAND METLP_attributes-»
+
+ «EXPAND METLP_getImage-»
+
+ «EXPAND METLP_getText-»
+
+ «EXPAND METLP_addListener-»
+
+ «EXPAND METLP_dispose-»
+
+ «EXPAND METLP_isLabelProperty-»
+
+ «EXPAND METLP_removeListener-»
+
+ «EXPAND METLP_additions-»
+}
+«ENDDEFINE»
+
+
+«DEFINE METLP_attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.model.WorkbenchLabelProvider myWorkbenchLabelProvider = new org.eclipse.ui.model.WorkbenchLabelProvider();
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+«ENDDEFINE»
+
+«DEFINE METLP_getImage FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.swt.graphics.Image getImage(Object element) {
+ org.eclipse.swt.graphics.Image result = myWorkbenchLabelProvider.getImage(element);
+ return result != null ? result : myAdapterFactoryLabelProvider.getImage(element);
+}
+«ENDDEFINE»
+
+«DEFINE METLP_getText FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getText(Object element) {
+ String result = myWorkbenchLabelProvider.getText(element);
+ return result != null && result.length() > 0 ? result : myAdapterFactoryLabelProvider.getText(element);
+}
+«ENDDEFINE»
+
+«DEFINE METLP_addListener FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.addListener(listener);
+ myAdapterFactoryLabelProvider.addListener(listener);
+}
+«ENDDEFINE»
+
+«DEFINE METLP_dispose FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ myWorkbenchLabelProvider.dispose();
+ myAdapterFactoryLabelProvider.dispose();
+}
+«ENDDEFINE»
+
+«DEFINE METLP_isLabelProperty FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isLabelProperty(Object element, String property) {
+ return myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+}
+«ENDDEFINE»
+
+«DEFINE METLP_removeListener FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.removeListener(listener);
+ myAdapterFactoryLabelProvider.removeListener(listener);
+}
+«ENDDEFINE»
+
+«DEFINE ModelFilesFilter FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class ModelFilesFilter extends org.eclipse.jface.viewers.ViewerFilter {
+
+ «EXPAND MFF_select-»
+
+ «EXPAND MFF_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE MFF_select FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean select(org.eclipse.jface.viewers.Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof org.eclipse.core.resources.IContainer) {
+ return true;
+ }
+ if (element instanceof org.eclipse.core.resources.IFile) {
+ org.eclipse.core.resources.IFile file = (org.eclipse.core.resources.IFile) element;
+ return isValidModelFile(file);
+ }
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE OkButtonEnabler FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class OkButtonEnabler implements org.eclipse.jface.viewers.ISelectionChangedListener {
+
+ «EXPAND OBE_selectionChanged-»
+
+ «EXPAND OBE_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE OBE_selectionChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event) {
+ if (event.getSelection() instanceof org.eclipse.jface.viewers.IStructuredSelection) {
+ org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) event.getSelection();
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof org.eclipse.emf.edit.provider.IWrapperItemProvider) {
+ selectedElement = ((org.eclipse.emf.edit.provider.IWrapperItemProvider) selectedElement).getValue();
+ }
+ if (selectedElement instanceof org.eclipse.emf.ecore.util.FeatureMap.Entry) {
+ selectedElement = ((org.eclipse.emf.ecore.util.FeatureMap.Entry) selectedElement).getValue();
+ }
+ if (selectedElement instanceof org.eclipse.emf.ecore.EObject) {
+ org.eclipse.emf.ecore.EObject selectedModelElement = (org.eclipse.emf.ecore.EObject) selectedElement;
+ setOkButtonEnabled(org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides(org.eclipse.gmf.runtime.notation.Node.class, new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedModelElement), myView, null, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true, «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT));
+ mySelectedModelElementURI = org.eclipse.emf.ecore.util.EcoreUtil.getURI(selectedModelElement);
+ return;
+ }
+ }
+ }
+ mySelectedModelElementURI = null;
+ setOkButtonEnabled(false);
+}
+«ENDDEFINE»
+
+«DEFINE METCP_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE METLP_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE MFF_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE OBE_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(titleKey(i18nKeyForSelectModelElement(this)), "Select model element")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Externalizer::accessorField(titleKey(i18nKeyForSelectModelElement(this)))-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/GenDiagram.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+extension xpt::GenModelUtils;
+
+boolean standaloneDomainModel(gmfgen::GenDiagram genDiagram) :
+ !genDiagram.editorGen.sameFileForDiagramAndModel && genDiagram.domainDiagramElement != null
+;
+
+boolean hasDocumentRoot(gmfgen::GenDiagram genDiagram) :
+ genDiagram.getDocumentRoot() != null
+;
+
+genmodel::GenClass getDocumentRoot(gmfgen::GenDiagram genDiagram) :
+ genDiagram.domainDiagramElement == null ? null : genDiagram.domainDiagramElement.genPackage.getDocumentRoot()
+;
+
+genmodel::GenFeature getDocumentRootSetFeature(gmfgen::GenDiagram genDiagram) :
+ genDiagram.getDocumentRoot().genFeatures.select(f | f.isDocRootSetFeature(genDiagram.domainDiagramElement.ecoreClass)).first()
+;
+
+// const ETypedElement.UNSPECIFIED_MULTIPLICITY = -2
+private boolean isDocRootSetFeature(genmodel::GenFeature gf, ecore::EClass eType) :
+ (!gf.isListType() && gf.ecoreFeature.changeable) && -2 == gf.ecoreFeature.upperBound && ((EClass) gf.ecoreFeature.eType).isSuperTypeOf(eType)
+ // Perhaps, makes sense to check instanceof EReference && isContainment
+;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/InitDiagramFileAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Dmitry Stadnik (Borland) - rewritten in xpand
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE className FOR gmfgen::GenDiagram»«initDiagramFileActionClassName»«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE InitDiagramFileAction FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className»
+ «IF editorGen.application == null-»
+implements org.eclipse.ui.IObjectActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.IWorkbenchPart targetPart;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.common.util.URI domainModelURI;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
+ domainModelURI = null;
+ action.setEnabled(false);
+ if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection == false || selection.isEmpty()) {
+ return;
+ }
+ org.eclipse.core.resources.IFile file =
+ (org.eclipse.core.resources.IFile) ((org.eclipse.jface.viewers.IStructuredSelection) selection).getFirstElement();
+ domainModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ action.setEnabled(true);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.swt.widgets.Shell getShell() {
+ return targetPart.getSite().getShell();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
+ org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ «IF editorGen.sameFileForDiagramAndModel-»
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = new org.eclipse.emf.ecore.resource.impl.ResourceSetImpl();
+ «ELSE-»
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = editingDomain.getResourceSet();
+ «ENDIF-»
+ org.eclipse.emf.ecore.EObject diagramRoot = null;
+ try {
+ org.eclipse.emf.ecore.resource.Resource resource = resourceSet.getResource(domainModelURI, true);
+ diagramRoot = (org.eclipse.emf.ecore.EObject) resource.getContents().get(0);
+ } catch (org.eclipse.emf.common.util.WrappedException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Unable to load resource: " + domainModelURI, ex); «EXPAND xpt::Common::nonNLS»
+ }
+ if (diagramRoot == null) {
+ org.eclipse.jface.dialogs.MessageDialog.openError(getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileResourceErrorDialog().titleKey()) FOR editorGen»,
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileResourceErrorDialog().messageKey()) FOR editorGen»);
+ return;
+ }
+ org.eclipse.jface.wizard.Wizard wizard = new «getNewDiagramFileWizardQualifiedClassName()»(domainModelURI, diagramRoot, editingDomain);
+ wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileWizardTitle()) FOR editorGen»,
+ «EXPAND xpt::editor::VisualIDRegistry::modelID»));
+ «getDiagramEditorUtilQualifiedClassName()».runWizard(getShell(), wizard, "InitDiagramFile"); «EXPAND xpt::Common::nonNLS»
+ }
+ «ELSE-»
+implements org.eclipse.ui.IWorkbenchWindowActionDelegate {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.IWorkbenchWindow window;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void init(org.eclipse.ui.IWorkbenchWindow window) {
+ this.window = window;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void dispose() {
+ window = null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.swt.widgets.Shell getShell() {
+ return window.getShell();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
+ org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ org.eclipse.emf.ecore.resource.Resource resource =
+ «getDiagramEditorUtilQualifiedClassName()».openModel(getShell(),
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramOpenFileDialogTitle()) FOR editorGen», editingDomain);
+ if (resource == null || resource.getContents().isEmpty()) {
+ return;
+ }
+ org.eclipse.emf.ecore.EObject diagramRoot = (org.eclipse.emf.ecore.EObject) resource.getContents().get(0);
+ org.eclipse.jface.wizard.Wizard wizard = new «getNewDiagramFileWizardQualifiedClassName()»(resource.getURI(), diagramRoot, editingDomain);
+ wizard.setWindowTitle(org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForInitDiagramFileWizardTitle()) FOR editorGen»,
+ «EXPAND xpt::editor::VisualIDRegistry::modelID»));
+ «getDiagramEditorUtilQualifiedClassName()».runWizard(getShell(), wizard, "InitDiagramFile"); «EXPAND xpt::Common::nonNLS»
+ }
+ «ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForInitDiagramFileResourceErrorDialog().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForInitDiagramFileResourceErrorDialog().messageKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForInitDiagramFileWizardTitle())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForInitDiagramOpenFileDialogTitle())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForInitDiagramFileResourceErrorDialog().titleKey(), "Error")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForInitDiagramFileResourceErrorDialog().messageKey(), "Model file loading failed")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForInitDiagramFileWizardTitle(), "Initialize new {0} diagram file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForInitDiagramOpenFileDialogTitle(), "Select domain model")-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/LoadResourceAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE LoadResourceAction FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «loadResourceActionClassName» implements org.eclipse.ui.IObjectActionDelegate {
+
+ «EXPAND attributes-»
+
+ «EXPAND setActivePart-»
+
+ «EXPAND run-»
+
+ «EXPAND selectionChanged-»
+
+ «EXPAND isEnabled-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private «getEditPartQualifiedClassName()» mySelectedElement;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.swt.widgets.Shell myShell;
+«ENDDEFINE»
+
+«DEFINE setActivePart FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void setActivePart(org.eclipse.jface.action.IAction action, org.eclipse.ui.IWorkbenchPart targetPart) {
+ myShell = targetPart.getSite().getShell();
+}
+«ENDDEFINE»
+
+«DEFINE run FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void run(org.eclipse.jface.action.IAction action) {
+ org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog loadResourceDialog = new org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog(myShell, mySelectedElement.getEditingDomain());
+ loadResourceDialog.open();
+}
+«ENDDEFINE»
+
+«DEFINE selectionChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {
+ mySelectedElement = null;
+ if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection) {
+ org.eclipse.jface.viewers.IStructuredSelection structuredSelection = (org.eclipse.jface.viewers.IStructuredSelection) selection;
+ if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof «getEditPartQualifiedClassName()») {
+ mySelectedElement = («getEditPartQualifiedClassName()») structuredSelection.getFirstElement();
+ }
+ }
+ action.setEnabled(isEnabled());
+}
+«ENDDEFINE»
+
+«DEFINE isEnabled FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean isEnabled() {
+ return mySelectedElement != null;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/MatchingStrategy.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE MatchingStrategy FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «matchingStrategyClassName» implements org.eclipse.ui.IEditorMatchingStrategy {
+
+ «EXPAND matches-»
+
+}
+«ENDDEFINE»
+
+«DEFINE matches FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean matches(org.eclipse.ui.IEditorReference editorRef, org.eclipse.ui.IEditorInput input) {
+ org.eclipse.ui.IEditorInput editorInput;
+ try {
+ editorInput = editorRef.getEditorInput();
+ } catch (org.eclipse.ui.PartInitException e) {
+ return false;
+ }
+
+ if (editorInput.equals(input)) {
+ return true;
+ }
+«REM»
+ Should be removed then https://bugs.eclipse.org/bugs/show_bug.cgi?id=175260 commited.
+ Problem is: URIEditorInput has no .equals() overriden
+«ENDREM-»
+ if (editorInput instanceof org.eclipse.emf.common.ui.URIEditorInput && input instanceof org.eclipse.emf.common.ui.URIEditorInput) {
+ return ((org.eclipse.emf.common.ui.URIEditorInput) editorInput).getURI().equals(((org.eclipse.emf.common.ui.URIEditorInput) input).getURI());
+ }
+ return false;
+}
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/ModelElementSelectionPage.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::editor::GenDiagram»
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE className FOR gmfgen::GenDiagram»«defaultModelElementSelectionPageClassName()»«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE ModelElementSelectionPage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment("Wizard page that allows to select element from model.")»
+public class «EXPAND className» extends org.eclipse.jface.wizard.WizardPage {
+ «EXPAND attributes-»
+
+ «EXPAND ctor-»
+
+ «EXPAND getModelElement-»
+
+ «EXPAND setModelElement-»
+
+ «EXPAND createControl-»
+
+ «EXPAND getSelectionTitle-»
+
+ «EXPAND updateSelection-»
+
+ «EXPAND validatePage-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected org.eclipse.emf.ecore.EObject selectedModelElement;
+
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.TreeViewer modelViewer;
+«ENDDEFINE»
+
+«DEFINE ctor FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public «EXPAND className»(String pageName) {
+ super(pageName);
+}
+«ENDDEFINE»
+
+«DEFINE getModelElement FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.ecore.EObject getModelElement() {
+ return selectedModelElement;
+}
+«ENDDEFINE»
+
+«DEFINE setModelElement FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void setModelElement(org.eclipse.emf.ecore.EObject modelElement) {
+ selectedModelElement = modelElement;
+ if (modelViewer != null) {
+ if (selectedModelElement != null) {
+ modelViewer.setInput(selectedModelElement.eResource());
+ modelViewer.setSelection(new org.eclipse.jface.viewers.StructuredSelection(selectedModelElement));
+ } else {
+ modelViewer.setInput(null);
+ }
+ setPageComplete(validatePage());
+ }
+}
+«ENDDEFINE»
+
+«DEFINE createControl FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void createControl(org.eclipse.swt.widgets.Composite parent) {
+ initializeDialogUnits(parent);
+
+ org.eclipse.swt.widgets.Composite plate = new org.eclipse.swt.widgets.Composite(parent, org.eclipse.swt.SWT.NONE);
+ plate.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.FILL_BOTH));
+ org.eclipse.swt.layout.GridLayout layout = new org.eclipse.swt.layout.GridLayout();
+ layout.marginWidth = 0;
+ plate.setLayout(layout);
+ setControl(plate);
+
+ org.eclipse.swt.widgets.Label label = new org.eclipse.swt.widgets.Label(plate, org.eclipse.swt.SWT.NONE);
+ label.setText(getSelectionTitle());
+ label.setLayoutData(new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ modelViewer = new org.eclipse.jface.viewers.TreeViewer(
+ plate, org.eclipse.swt.SWT.SINGLE | org.eclipse.swt.SWT.H_SCROLL | org.eclipse.swt.SWT.V_SCROLL | org.eclipse.swt.SWT.BORDER);
+ org.eclipse.swt.layout.GridData layoutData = new org.eclipse.swt.layout.GridData(org.eclipse.swt.layout.GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ modelViewer.getTree().setLayoutData(layoutData);
+ modelViewer.setContentProvider(new org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider(
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory()));
+ modelViewer.setLabelProvider(new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory()));
+ if (selectedModelElement != null) {
+ modelViewer.setInput(selectedModelElement.eResource());
+ modelViewer.setSelection(new org.eclipse.jface.viewers.StructuredSelection(selectedModelElement));
+ }
+ modelViewer.addSelectionChangedListener(new org.eclipse.jface.viewers.ISelectionChangedListener() {
+ public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event) {
+ «EXPAND className».this.updateSelection((org.eclipse.jface.viewers.IStructuredSelection) event.getSelection());
+ }
+ });
+
+ setPageComplete(validatePage());
+}
+«ENDDEFINE»
+
+«DEFINE getSelectionTitle FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment("Override to provide custom model element description.")»
+protected String getSelectionTitle() {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nKeyForModelElementSelectionPage().messageKey()) FOR editorGen»;
+}
+«ENDDEFINE»
+
+«DEFINE updateSelection FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+protected void updateSelection(org.eclipse.jface.viewers.IStructuredSelection selection) {
+ selectedModelElement = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof org.eclipse.emf.edit.provider.IWrapperItemProvider) {
+ selectedElement = ((org.eclipse.emf.edit.provider.IWrapperItemProvider) selectedElement).getValue();
+ }
+ if (selectedElement instanceof org.eclipse.emf.ecore.util.FeatureMap.Entry) {
+ selectedElement = ((org.eclipse.emf.ecore.util.FeatureMap.Entry) selectedElement).getValue();
+ }
+ if (selectedElement instanceof org.eclipse.emf.ecore.EObject) {
+ selectedModelElement = (org.eclipse.emf.ecore.EObject) selectedElement;
+ }
+ }
+ setPageComplete(validatePage());
+}
+«ENDDEFINE»
+
+«DEFINE validatePage FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment("Override to provide specific validation of the selected model element.")»
+protected boolean validatePage() {
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForModelElementSelectionPage().messageKey(), "Select model element:")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForModelElementSelectionPage().messageKey())-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/NewDiagramFileWizard.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ * Dmitry Stadnik (Borland) - rewritten in xpand
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE className FOR gmfgen::GenDiagram»«newDiagramFileWizardClassName»«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE NewDiagramFileWizard FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.jface.wizard.Wizard {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «EXPAND creationPage» myFileCreationPage;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «EXPAND xpt::editor::ModelElementSelectionPage::qualifiedClassName» diagramRootElementSelectionPage;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.transaction.TransactionalEditingDomain myEditingDomain;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.emf.common.util.URI domainModelURI,
+ org.eclipse.emf.ecore.EObject diagramRoot,
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
+ assert domainModelURI != null : "Domain model uri must be specified"; «EXPAND xpt::Common::nonNLS»
+ assert diagramRoot != null : "Doagram root element must be specified"; «EXPAND xpt::Common::nonNLS»
+ assert editingDomain != null : "Editing domain must be specified"; «EXPAND xpt::Common::nonNLS»
+
+ myFileCreationPage = new «EXPAND creationPage»(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardCreationPage().nameKey()) FOR editorGen», org.eclipse.jface.viewers.StructuredSelection.EMPTY);
+ myFileCreationPage.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardCreationPage().titleKey()) FOR editorGen»);
+ myFileCreationPage.setDescription(org.eclipse.osgi.util.NLS.bind(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardCreationPage().descriptionKey()) FOR editorGen»,
+ «EXPAND xpt::editor::VisualIDRegistry::modelID»));
+ org.eclipse.core.runtime.IPath filePath;
+ String fileName = domainModelURI.trimFileExtension().lastSegment();
+ if (domainModelURI.isPlatformResource()) {
+ filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toPlatformString(true));
+ } else if (domainModelURI.isFile()) {
+ filePath = new org.eclipse.core.runtime.Path(domainModelURI.trimSegments(1).toFileString());
+ } else {
+ // TODO : use some default path
+ throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); «EXPAND xpt::Common::nonNLS»
+ }
+ myFileCreationPage.setContainerFullPath(filePath);
+ myFileCreationPage.setFileName(«getDiagramEditorUtilQualifiedClassName()».getUniqueFileName(
+ filePath, fileName, "«editorGen.diagramFileExtension»")); «EXPAND xpt::Common::nonNLS»
+
+ diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardRootSelectionPage().nameKey()) FOR editorGen»);
+ diagramRootElementSelectionPage.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardRootSelectionPage().titleKey()) FOR editorGen»);
+ diagramRootElementSelectionPage.setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardRootSelectionPage().descriptionKey()) FOR editorGen»);
+ diagramRootElementSelectionPage.setModelElement(diagramRoot);
+
+ myEditingDomain = editingDomain;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void addPages() {
+ addPage(myFileCreationPage);
+ addPage(diagramRootElementSelectionPage);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean performFinish() {
+ java.util.List affectedFiles = new java.util.LinkedList();
+ «IF null == editorGen.application-»
+ org.eclipse.core.resources.IFile diagramFile = myFileCreationPage.createNewFile();
+ «EXPAND xpt::Common::setCharset("diagramFile")-»
+ affectedFiles.add(diagramFile);
+ org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
+ «ELSE-»
+ org.eclipse.core.runtime.IPath diagramModelPath = myFileCreationPage.getContainerFullPath().append(myFileCreationPage.getFileName());
+ org.eclipse.emf.common.util.URI diagramModelURI = org.eclipse.emf.common.util.URI.createFileURI(diagramModelPath.toString());
+ «ENDIF-»
+ org.eclipse.emf.ecore.resource.ResourceSet resourceSet = myEditingDomain.getResourceSet();
+ final org.eclipse.emf.ecore.resource.Resource diagramResource = resourceSet.createResource(diagramModelURI);
+ org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand command =
+ new org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand(
+ myEditingDomain, «EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardInitDiagramCommand()) FOR editorGen», affectedFiles) {
+
+ protected org.eclipse.gmf.runtime.common.core.command.CommandResult doExecuteWithResult(
+ org.eclipse.core.runtime.IProgressMonitor monitor, org.eclipse.core.runtime.IAdaptable info)
+ throws org.eclipse.core.commands.ExecutionException {
+ int diagramVID = «EXPAND xpt::editor::VisualIDRegistry::getDiagramVisualIDMethodCall»(diagramRootElementSelectionPage.getModelElement());
+ if (diagramVID != «EXPAND xpt::editor::VisualIDRegistry::visualID») {
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newErrorCommandResult(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardIncorrectRootError()) FOR editorGen»);
+ }
+ org.eclipse.gmf.runtime.notation.Diagram diagram =
+ org.eclipse.gmf.runtime.diagram.core.services.ViewService.createDiagram(
+ diagramRootElementSelectionPage.getModelElement(), «EXPAND xpt::editor::VisualIDRegistry::modelID»,
+ «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT);
+ diagramResource.getContents().add(diagram);
+ «IF editorGen.sameFileForDiagramAndModel-»
+ diagramResource.getContents().add(diagram.getElement());
+ «ENDIF-»
+ «IF !synchronized-»
+ new «getDiagramContentInitializerQualifiedClassName()»().initDiagramContent(diagram);
+ «ENDIF-»
+ return org.eclipse.gmf.runtime.common.core.command.CommandResult.newOKCommandResult();
+ }
+ };
+ try {
+ org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(
+ command, new org.eclipse.core.runtime.NullProgressMonitor(), null);
+ diagramResource.save(«EXPAND xpt::Common::getSaveOptions»);
+ «getDiagramEditorUtilQualifiedClassName()».openDiagram(diagramResource);
+ } catch (org.eclipse.core.commands.ExecutionException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Unable to create model and diagram", e); «EXPAND xpt::Common::nonNLS»
+ } catch (java.io.IOException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Save operation failed for: " + diagramModelURI, ex); «EXPAND xpt::Common::nonNLS»
+ } catch (org.eclipse.ui.PartInitException ex) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Unable to open editor", ex); «EXPAND xpt::Common::nonNLS»
+ }
+ return true;
+ }
+
+ «EXPAND xpt::Common::generatedClassComment»
+ private static class DiagramRootElementSelectionPage extends «EXPAND xpt::editor::ModelElementSelectionPage::qualifiedClassName» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected DiagramRootElementSelectionPage(String pageName) {
+ super(pageName);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getSelectionTitle() {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle()) FOR editorGen»;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean validatePage() {
+ if (selectedModelElement == null) {
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage()) FOR editorGen»);
+ return false;
+ }
+ boolean result = org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides(
+ new org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation(
+ new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedModelElement),
+ «EXPAND xpt::editor::VisualIDRegistry::modelID»,
+ «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT));
+ setErrorMessage(result ? null : «EXPAND xpt::Externalizer::accessorCall(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage()) FOR editorGen»);
+ return result;
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE creationPage FOR gmfgen::GenDiagram»
+«IF null == editorGen.application-»
+org.eclipse.ui.dialogs.WizardNewFileCreationPage«ELSE-»
+«editorGen.application.packageName».WizardNewFileCreationPage«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardCreationPage().nameKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardCreationPage().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardCreationPage().descriptionKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardRootSelectionPage().nameKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardRootSelectionPage().titleKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardRootSelectionPage().descriptionKey())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardInitDiagramCommand())-»
+«EXPAND xpt::Externalizer::accessorField(i18nKeyForNewDiagramFileWizardIncorrectRootError())-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardCreationPage().nameKey(), "Initialize new diagram file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardCreationPage().titleKey(), "Diagram file")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardCreationPage().descriptionKey(), "Create new diagram based on {0} model content")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPage().nameKey(), "Select diagram root element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPage().titleKey(), "Diagram root element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPage().descriptionKey(), "Select semantic model element to be depicted on diagram")-»"Select diagram root element:"
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(), "Select diagram root element:")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(), "Diagram root element is not selected")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(), "Invalid diagram root element is selected")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardInitDiagramCommand(), "Initializing diagram contents")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForNewDiagramFileWizardIncorrectRootError(), "Incorrect model object stored as a root resource object")-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/ResourceSetInfo.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«REM»Inner class of DocumentProvider«ENDREM»
+«DEFINE ResourceSetInfo FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+protected class ResourceSetInfo extends ElementInfo {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND getModificationStamp-»
+
+ «EXPAND setModificationStamp-»
+
+ «EXPAND getEditingDomain-»
+
+ «EXPAND getResourceSet-»
+
+ «EXPAND getLoadedResourcesIterator-»
+
+ «EXPAND getEditorInput-»
+
+ «EXPAND dispose-»
+
+ «EXPAND isSynchronized-»
+
+ «IF null == editorGen.application-»
+ «EXPAND setUnSynchronized-»
+
+ «EXPAND setSynchronized-»
+
+ «EXPAND stopResourceListening-»
+
+ «EXPAND startResourceListening-»
+
+ «ENDIF-»
+ «EXPAND isUpdateCache-»
+
+ «EXPAND setUpdateCache-»
+
+ «EXPAND isModifiable-»
+
+ «EXPAND setModifiable-»
+
+ «EXPAND isReadOnly-»
+
+ «EXPAND setReadOnly-»
+
+ «IF null == editorGen.application-»
+ «EXPAND SynchronizerDelegate-»
+
+ «ENDIF-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private long myModificationStamp = «IF null == editorGen.application»org.eclipse.core.resources.IResource.NULL_STAMP«ELSE»0«ENDIF»;
+
+ «IF null == editorGen.application-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.workspace.util.WorkspaceSynchronizer mySynchronizer;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.util.Collection myUnSynchronizedResources = new java.util.ArrayList();
+
+ «ENDIF-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument myDocument;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.ui.IEditorInput myEditorInput;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private boolean myUpdateCache = true;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private boolean myModifiable = false;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private boolean myReadOnly = true;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private ResourceSetModificationListener myResourceSetListener;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public ResourceSetInfo(org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document, org.eclipse.ui.IEditorInput editorInput) {
+ super(document);
+ myDocument = document;
+ myEditorInput = editorInput;
+ «IF null == editorGen.application-»
+ startResourceListening();
+ «ENDIF-»
+ myResourceSetListener = new ResourceSetModificationListener(this);
+ getResourceSet().eAdapters().add(myResourceSetListener);
+}
+«ENDDEFINE»
+
+«DEFINE getModificationStamp FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public long getModificationStamp() {
+ return myModificationStamp;
+}
+«ENDDEFINE»
+
+«DEFINE setModificationStamp FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void setModificationStamp(long modificationStamp) {
+ myModificationStamp = modificationStamp;
+}
+«ENDDEFINE»
+
+«DEFINE getEditingDomain FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain() {
+ return myDocument.getEditingDomain();
+}
+«ENDDEFINE»
+
+«DEFINE getResourceSet FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet() {
+ return getEditingDomain().getResourceSet();
+}
+«ENDDEFINE»
+
+«DEFINE getLoadedResourcesIterator FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ getLoadedResourcesIterator() {
+ return new java.util.ArrayList/*<org.eclipse.emf.ecore.resource.Resource>*/(getResourceSet().getResources()).iterator();
+}
+«ENDDEFINE»
+
+«DEFINE getEditorInput FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.ui.IEditorInput getEditorInput() {
+ return myEditorInput;
+}
+«ENDDEFINE»
+
+«DEFINE dispose FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ «IF null == editorGen.application-»
+ stopResourceListening();
+ «ENDIF-»
+ getResourceSet().eAdapters().remove(myResourceSetListener);
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = getLoadedResourcesIterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ resource.unload();
+ }
+}
+«ENDDEFINE»
+
+«DEFINE isSynchronized FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isSynchronized() {
+ «IF null == editorGen.application-»
+ return myUnSynchronizedResources.size() == 0;
+ «ELSE-»
+ return getModificationStamp() == computeModificationStamp(this);
+ «ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE setUnSynchronized FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void setUnSynchronized(org.eclipse.emf.ecore.resource.Resource resource) {
+ myUnSynchronizedResources.add(resource);
+}
+«ENDDEFINE»
+
+«DEFINE setSynchronized FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void setSynchronized(org.eclipse.emf.ecore.resource.Resource resource) {
+ myUnSynchronizedResources.remove(resource);
+}
+«ENDDEFINE»
+
+«DEFINE stopResourceListening FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public final void stopResourceListening() {
+ mySynchronizer.dispose();
+ mySynchronizer = null;
+}
+«ENDDEFINE»
+
+«DEFINE startResourceListening FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public final void startResourceListening() {
+ mySynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(getEditingDomain(), new SynchronizerDelegate());
+}
+«ENDDEFINE»
+
+«DEFINE isUpdateCache FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isUpdateCache() {
+ return myUpdateCache;
+}
+«ENDDEFINE»
+
+«DEFINE setUpdateCache FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void setUpdateCache(boolean update) {
+ myUpdateCache = update;
+}
+«ENDDEFINE»
+
+«DEFINE isModifiable FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isModifiable() {
+ return myModifiable;
+}
+«ENDDEFINE»
+
+«DEFINE setModifiable FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void setModifiable(boolean modifiable) {
+ myModifiable = modifiable;
+}
+«ENDDEFINE»
+
+«DEFINE isReadOnly FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isReadOnly() {
+ return myReadOnly;
+}
+«ENDDEFINE»
+
+«DEFINE setReadOnly FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void setReadOnly(boolean readOnly) {
+ myReadOnly = readOnly;
+}
+«ENDDEFINE»
+
+«DEFINE SynchronizerDelegate FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class SynchronizerDelegate implements org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate {
+
+ «EXPAND disposeSD-»
+
+ «EXPAND handleResourceChangedSD-»
+
+ «EXPAND handleResourceDeletedSD-»
+
+ «EXPAND handleResourceMovedSD-»
+
+ «EXPAND additionsSD-»
+}
+«ENDDEFINE»
+
+«DEFINE disposeSD FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+}
+«ENDDEFINE»
+
+«DEFINE handleResourceChangedSD FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
+ «EXPAND updateSynchStateSD-»
+ org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
+ public void run() {
+ handleElementChanged(ResourceSetInfo.this, resource, null);
+ }
+ });
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE handleResourceDeletedSD FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
+ «EXPAND updateSynchStateSD-»
+ org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
+ public void run() {
+ fireElementDeleted(ResourceSetInfo.this.getEditorInput());
+ }
+ });
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE handleResourceMovedSD FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
+ «EXPAND updateSynchStateSD-»
+ if (myDocument.getDiagram().eResource() == resource) {
+ org.eclipse.swt.widgets.Display.getDefault().asyncExec(new java.lang.Runnable() {
+ public void run() {
+ handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
+ }
+ });
+ } else {
+ handleResourceDeleted(resource);
+ }
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE updateSynchStateSD FOR gmfgen::GenDiagram-»
+synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ ResourceSetInfo.this.setUnSynchronized(resource);
+ return true;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE additionsSD FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/ResourceSetModificationListener.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«REM»Inner class of DocumentProvider«ENDREM»
+«DEFINE ResourceSetModificationListener FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class ResourceSetModificationListener extends org.eclipse.emf.ecore.util.EContentAdapter {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND notifyChanged-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.transaction.NotificationFilter myModifiedFilter;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private ResourceSetInfo myInfo;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public ResourceSetModificationListener(ResourceSetInfo info) {
+ myInfo = info;
+ myModifiedFilter = org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.SET).or(org.eclipse.emf.transaction.NotificationFilter.createEventTypeFilter(org.eclipse.emf.common.notify.Notification.UNSET)).and(org.eclipse.emf.transaction.NotificationFilter.createFeatureFilter(org.eclipse.emf.ecore.resource.Resource.class, org.eclipse.emf.ecore.resource.Resource.RESOURCE__IS_MODIFIED));
+}
+«ENDDEFINE»
+
+«DEFINE notifyChanged FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void notifyChanged(org.eclipse.emf.common.notify.Notification notification) {
+ if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.ResourceSet) {
+ super.notifyChanged(notification);
+ }
+ if (!notification.isTouch() && myModifiedFilter.matches(notification)) {
+ if (notification.getNotifier() instanceof org.eclipse.emf.ecore.resource.Resource) {
+ org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) notification.getNotifier();
+ if (resource.isLoaded()) {
+ boolean modified = false;
+ for (java.util.Iterator/*<org.eclipse.emf.ecore.resource.Resource>*/ it = myInfo.getLoadedResourcesIterator(); it.hasNext() && !modified;) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ if (nextResource.isLoaded()) {
+ modified = nextResource.isModified();
+ }
+ }
+ boolean dirtyStateChanged = false;
+ synchronized (myInfo) {
+ if (modified != myInfo.fCanBeSaved) {
+ myInfo.fCanBeSaved = modified;
+ dirtyStateChanged = true;
+ }
+ «IF null == editorGen.application-»
+ if (!resource.isModified()) {
+ myInfo.setSynchronized(resource);
+ }
+ «ENDIF-»
+ }
+ if (dirtyStateChanged) {
+ fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);
+
+ if (!modified) {
+ myInfo.setModificationStamp(computeModificationStamp(myInfo));
+ }
+ }
+ }
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/ShortcutCreationWizard.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::editor::GenDiagram»
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE className FOR gmfgen::GenDiagram»«defaultShortcutCreationWizardClassName()»«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE ShortcutCreationWizard FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+/**
+ * Allows to select foreign model element and add shortcut to the diagram.
+ *
+ * @generated
+ */
+public class «EXPAND className» extends org.eclipse.jface.wizard.Wizard {
+
+ /**
+ * @generated
+ */
+ private ReferencedElementSelectionPage referencedElementSelectionPage;
+
+ /**
+ * @generated
+ */
+ private org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain;
+
+ /**
+ * @generated
+ */
+ public «EXPAND className»(org.eclipse.emf.ecore.EObject modelElement, org.eclipse.gmf.runtime.notation.View view,
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) {
+ referencedElementSelectionPage = new ReferencedElementSelectionPage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForShortcutWizardReferencedElementPage().nameKey()) FOR editorGen», view);
+ referencedElementSelectionPage.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForShortcutWizardReferencedElementPage().titleKey()) FOR editorGen»);
+ referencedElementSelectionPage.setDescription(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForShortcutWizardReferencedElementPage().descriptionKey()) FOR editorGen»);
+ referencedElementSelectionPage.setModelElement(modelElement);
+
+ this.editingDomain = editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ public void addPages() {
+ addPage(referencedElementSelectionPage);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean performFinish() {
+ org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor viewDescriptor =
+ new org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor(
+ new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(referencedElementSelectionPage.getModelElement()),
+ org.eclipse.gmf.runtime.notation.Node.class, null,
+ «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT);
+ org.eclipse.gmf.runtime.common.core.command.ICommand command =
+ new org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand(
+ editingDomain, viewDescriptor, referencedElementSelectionPage.getView());
+ command = command.compose(new «getCreateShortcutDecorationsCommandQualifiedClassName()»(
+ editingDomain, referencedElementSelectionPage.getView(), viewDescriptor));
+ try {
+ org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory().execute(
+ command, new org.eclipse.core.runtime.NullProgressMonitor(), null);
+ } catch (org.eclipse.core.commands.ExecutionException ee) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to create shortcut", ee); «EXPAND xpt::Common::nonNLS»
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ private static class ReferencedElementSelectionPage extends «EXPAND xpt::editor::ModelElementSelectionPage::qualifiedClassName» {
+
+ /**
+ * @generated
+ */
+ private org.eclipse.gmf.runtime.notation.View view;
+
+ /**
+ * @generated
+ */
+ public ReferencedElementSelectionPage(String pageName, org.eclipse.gmf.runtime.notation.View view) {
+ super(pageName);
+ this.view = view;
+ }
+
+ /**
+ * @generated
+ */
+ public org.eclipse.gmf.runtime.notation.View getView() {
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getSelectionTitle() {
+ return «EXPAND xpt::Externalizer::accessorCall(i18nKeyForShortcutWizardReferencedElementPage().messageKey()) FOR editorGen»;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean validatePage() {
+ if (selectedModelElement == null) {
+ setErrorMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForShortcutWizardReferencedElementPageEmptyError()) FOR editorGen»);
+ return false;
+ }
+ boolean result = org.eclipse.gmf.runtime.diagram.core.services.ViewService.getInstance().provides(
+ org.eclipse.gmf.runtime.notation.Node.class,
+ new org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter(selectedModelElement),
+ view, null, org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.APPEND, true,
+ «editorGen.plugin.getActivatorQualifiedClassName()».DIAGRAM_PREFERENCES_HINT);
+ setErrorMessage(result ? null : «EXPAND xpt::Externalizer::accessorCall(i18nKeyForShortcutWizardReferencedElementPageInvalidError()) FOR editorGen»);
+ return result;
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«IF null != editorGen.application-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForShortcutWizardReferencedElementPage().nameKey(), "Select referenced element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForShortcutWizardReferencedElementPage().titleKey(), "Referenced element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForShortcutWizardReferencedElementPage().descriptionKey(), "Select element that the new shortcut will refer to.")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForShortcutWizardReferencedElementPage().messageKey(), "Select referenced element:")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForShortcutWizardReferencedElementPageEmptyError(), "Referenced element is not selected")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForShortcutWizardReferencedElementPageInvalidError(), "Invalid referenced element is selected")-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+«IF null != editorGen.application-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForShortcutWizardReferencedElementPage().nameKey())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForShortcutWizardReferencedElementPage().titleKey())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForShortcutWizardReferencedElementPage().descriptionKey())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForShortcutWizardReferencedElementPage().messageKey())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForShortcutWizardReferencedElementPageEmptyError())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForShortcutWizardReferencedElementPageInvalidError())-»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/ShortcutPropertyTester.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE ShortcutPropertyTester FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «shortcutPropertyTesterClassName» extends org.eclipse.core.expressions.PropertyTester {
+
+ «EXPAND attributes-»
+
+ «EXPAND test-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected static final String SHORTCUT_PROPERTY = "isShortcut"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE test FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
+ if (false == receiver instanceof org.eclipse.gmf.runtime.notation.View) {
+ return false;
+ }
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) receiver;
+ if (SHORTCUT_PROPERTY.equals(method)) {
+ org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
+ if (annotation != null) {
+ return «EXPAND xpt::editor::VisualIDRegistry::modelID».equals(annotation.getDetails().get("modelID")); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/UriEditorInputTester.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE UriEditorInputTester FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «uriInputTesterClassName» extends org.eclipse.core.expressions.PropertyTester {
+
+ «EXPAND test FOR editorGen-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE test FOR gmfgen::GenEditorGenerator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
+ if (false == receiver instanceof org.eclipse.emf.common.ui.URIEditorInput) {
+ return false;
+ }
+ org.eclipse.emf.common.ui.URIEditorInput editorInput = (org.eclipse.emf.common.ui.URIEditorInput) receiver;
+ return "«diagramFileExtension»".equals(editorInput.getURI().fileExtension()); «EXPAND xpt::Common::nonNLS»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/Utils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+
+boolean isStandaloneDomainModel(gmfgen::GenDiagram diagram) :
+ !diagram.editorGen.sameFileForDiagramAndModel && null != diagram.domainDiagramElement
+;
+
+boolean hasNavigator(gmfgen::GenEditorView editorView) :
+ null != editorView.editorGen.navigator
+;
+
+private List[String] addGotoMarker(gmfgen::GenEditorView editorView, List[String] implementsList) :
+ isIDEMode(editorView) ?
+ implementsList.add("org.eclipse.ui.ide.IGotoMarker") :
+ implementsList
+;
+
+boolean isIDEMode(gmfgen::GenEditorView editorView) :
+ null == editorView.editorGen.application
+;
+
+private List[String] addReadOnlyPropSheet(gmfgen::GenEditorView editorView, List[String] implementsList) :
+ hasPropertySheet(editorView) && editorView.editorGen.propertySheet.readOnly ?
+ implementsList.add("org.eclipse.gmf.runtime.diagram.ui.properties.views.IReadOnlyDiagramPropertySheetPageContributor") :
+ implementsList
+;
+
+boolean hasPropertySheet(gmfgen::GenEditorView editorView) :
+ null != editorView.editorGen.propertySheet
+;
+
+cached List[String] getEditorImplementsList(gmfgen::GenEditorView editorView) :
+ addGotoMarker(editorView, addReadOnlyPropSheet(editorView, {}))
+;
+
+cached List[gmfgen::GenNode] getContainedSemanticNodes(gmfgen::GenContainerBase container) :
+ container.containedNodes.select(node | null != node.modelFacet)
+;
+
+Collection[gmfgen::GenCommonBase] getEssentialVisualChildren(gmfgen::GenCommonBase visualParent) :
+ {}
+;
+
+Collection[gmfgen::GenCommonBase] getEssentialVisualChildren(gmfgen::GenLink visualParent) :
+ visualParent.labels
+;
+
+Collection[gmfgen::GenCommonBase] getEssentialVisualChildren(gmfgen::GenContainerBase visualParent) :
+ visualParent.containedNodes
+;
+
+Collection[gmfgen::GenCommonBase] getEssentialVisualChildren(gmfgen::GenNode visualParent) :
+ {}.addAll(visualParent.labels).addAll(visualParent.compartments).addAll(visualParent.containedNodes)
+;
+
+String defaultShortcutCreationWizardClassName(gmfgen::GenDiagram diagram) :
+"ShortcutCreationWizard"
+;
+
+String defaultModelElementSelectionPageClassName(gmfgen::GenDiagram diagram) :
+"ModelElementSelectionPage"
+;
+
+String defaultValidateActionClassName(gmfgen::GenDiagram diagram) :
+"ValidateAction"
+;
+
+private String i18nKeyForDocumentProvider(gmfgen::GenDiagram diagram) :
+ // XXX might not be the best idea - as long as doc provider is single, no reason
+ // to have property names based on its name (stale properties in messages.properties once
+ // the class gets renamed
+ diagram.documentProviderClassName
+;
+
+String i18nKeyForDocumentProviderIsModifiable(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDocumentProvider()+"_isModifiable"
+;
+
+String i18nKeyForDocumentProviderHandleElementContentChanged(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDocumentProvider()+"_handleElementContentChanged"
+;
+
+String i18nKeyForDocumentProviderIncorrectInputError(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDocumentProvider()+".IncorrectInputError"
+;
+
+String i18nKeyForDocumentProviderNoDiagramInResourceError(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDocumentProvider()+".NoDiagramInResourceError"
+;
+
+String i18nKeyForDocumentProviderDiagramLoadingError(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDocumentProvider()+".DiagramLoadingError"
+;
+
+String i18nKeyForDocumentUnsynchronizedFileSaveError(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDocumentProvider()+".UnsynchronizedFileSaveError"
+;
+
+String i18nKeyForDocumentSaveDiagramTask(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDocumentProvider()+".SaveDiagramTask"
+;
+
+String i18nKeyForDocumentSaveNextResourceTask(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDocumentProvider()+".SaveNextResourceTask"
+;
+
+String i18nKeyForDocumentSaveAs(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDocumentProvider()+".SaveAsOperation"
+;
+
+private String i18nKeyForDiagramEditorUtil(gmfgen::GenDiagram diagram) :
+ diagram.diagramEditorUtilClassName
+;
+
+String i18nKeyForOpenModelResourceErrorDialog(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDiagramEditorUtil()+".OpenModelResourceErrorDialog"
+;
+
+String i18nKeyForCreateDiagramProgressTask(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDiagramEditorUtil()+".CreateDiagramProgressTask"
+;
+
+String i18nKeyForCreateDiagramCommandLabel(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForDiagramEditorUtil()+".CreateDiagramCommandLabel"
+;
+
+private String i18nKeyForInitDiagramFileAction(gmfgen::GenDiagram diagram) :
+ diagram.initDiagramFileActionClassName
+;
+
+String i18nKeyForInitDiagramFileResourceErrorDialog(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForInitDiagramFileAction()+".InitDiagramFileResourceErrorDialog"
+;
+
+String i18nKeyForInitDiagramFileWizardTitle(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForInitDiagramFileAction()+".InitDiagramFileWizardTitle"
+;
+
+String i18nKeyForInitDiagramOpenFileDialogTitle(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForInitDiagramFileAction()+".OpenModelFileDialogTitle"
+;
+
+private String i18nKeyForNewDiagramFileWizard(gmfgen::GenDiagram diagram) :
+ diagram.newDiagramFileWizardClassName
+;
+
+String i18nKeyForNewDiagramFileWizardCreationPage(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForNewDiagramFileWizard()+".CreationPage"
+;
+
+String i18nKeyForNewDiagramFileWizardRootSelectionPage(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForNewDiagramFileWizard()+".RootSelectionPage"
+;
+
+String i18nKeyForNewDiagramFileWizardRootSelectionPageSelectionTitle(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForNewDiagramFileWizardRootSelectionPage()+"SelectionTitle"
+;
+
+String i18nKeyForNewDiagramFileWizardRootSelectionPageNoSelectionMessage(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForNewDiagramFileWizardRootSelectionPage()+"NoSelectionMessage"
+;
+
+String i18nKeyForNewDiagramFileWizardRootSelectionPageInvalidSelectionMessage(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForNewDiagramFileWizardRootSelectionPage()+"InvalidSelectionMessage"
+;
+
+String i18nKeyForNewDiagramFileWizardInitDiagramCommand(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForNewDiagramFileWizard()+".InitDiagramCommand"
+;
+
+String i18nKeyForNewDiagramFileWizardIncorrectRootError(gmfgen::GenDiagram diagram) :
+ diagram.i18nKeyForNewDiagramFileWizard()+".IncorrectRootError"
+;
+
+String i18nKeyForSavingDeletedFile(gmfgen::GenEditorView editor) :
+ i18nKeyForEditor(editor) + ".SavingDeletedFile"
+;
+
+String i18nKeyForSaveAsProblems(gmfgen::GenEditorView editor) :
+ i18nKeyForEditor(editor) + ".SaveAsError"
+;
+
+String i18nKeyForSaveProblems(gmfgen::GenEditorView editor) :
+ i18nKeyForEditor(editor) + ".SaveError"
+;
+
+private String i18nKeyForEditor(gmfgen::GenEditorView editor) :
+ editor.className
+;
+
+String i18nKeyForSelectModelElement(gmfgen::GenDiagram diagram) :
+ i18nKeyForElementChooser(diagram) + ".SelectModelElement"
+;
+
+private String i18nKeyForElementChooser(gmfgen::GenDiagram diagram) :
+ diagram.elementChooserClassName
+;
+
+String i18nKeyForOpenModel(gmfgen::GenDiagram diagram) :
+ i18nKeyForCreateShortcutAction(diagram) + ".OpenModel"
+;
+
+String i18nKeyForCreateShortcus(gmfgen::GenDiagram diagram) :
+ i18nKeyForCreateShortcutAction(diagram) + ".CreateShortcut"
+;
+
+private String i18nKeyForCreateShortcutAction(gmfgen::GenDiagram diagram) :
+ diagram.createShortcutActionClassName
+;
+
+String i18nKeyForShortcutWizardReferencedElementPage(gmfgen::GenDiagram diagram) :
+ diagram.defaultShortcutCreationWizardClassName()+".ReferencedElementSelectionPage"
+;
+
+String i18nKeyForModelElementSelectionPage(gmfgen::GenDiagram diagram) :
+ diagram.defaultModelElementSelectionPageClassName()
+;
+
+String i18nKeyForValidateAction(gmfgen::GenDiagram diagram) :
+ diagram.defaultValidateActionClassName()
+;
+
+String i18nKeyForShortcutWizardReferencedElementPageEmptyError(gmfgen::GenDiagram diagram) :
+diagram.i18nKeyForShortcutWizardReferencedElementPage()+"EmptyError"
+;
+
+String i18nKeyForShortcutWizardReferencedElementPageInvalidError(gmfgen::GenDiagram diagram) :
+diagram.i18nKeyForShortcutWizardReferencedElementPage()+"InvalidError"
+;
+
+String i18nKeyForCreationWizard(gmfgen::GenDiagram diagram) :
+diagram.creationWizardClassName
+;
+
+String i18nKeyForCreationWizardDiagramPage(gmfgen::GenDiagram diagram) :
+diagram.creationWizardClassName+".DiagramModelFilePage"
+;
+
+String i18nKeyForCreationWizardDomainPage(gmfgen::GenDiagram diagram) :
+diagram.creationWizardClassName+".DomainModelFilePage"
+;
+
+String i18nKeyForCreationWizardOpenEditorError(gmfgen::GenDiagram diagram) :
+diagram.creationWizardClassName+"OpenEditorError"
+;
+
+String i18nKeyForCreationWizardCreationError(gmfgen::GenDiagram diagram) :
+diagram.creationWizardClassName+"CreationError"
+;
+
+String i18nKeyForCreationWizardPageExtensionError(gmfgen::GenDiagram diagram) :
+diagram.creationWizardPageClassName+"ExtensionError"
+;
+
+String titleKey(String dialogKey) :
+ dialogKey+"Title"
+;
+
+String messageKey(String dialogKey) :
+ dialogKey+"Message"
+;
+
+String nameKey(String dialogKey) :
+ dialogKey+"Name"
+;
+
+String descriptionKey(String dialogKey) :
+ dialogKey+"Description"
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/ValidateAction.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::editor::Utils»
+«EXTENSION xpt::GenAuditRoot»
+
+«DEFINE className FOR gmfgen::GenDiagram»«defaultValidateActionClassName()»«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE ValidateAction FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends org.eclipse.jface.action.Action {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String VALIDATE_ACTION_KEY = "validateAction"; «EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor workbenchPartDescriptor;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor workbenchPartDescriptor) {
+ setId(VALIDATE_ACTION_KEY);
+ setText(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForValidateAction().messageKey()) FOR editorGen»);
+ this.workbenchPartDescriptor = workbenchPartDescriptor;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run() {
+ org.eclipse.ui.IWorkbenchPart workbenchPart = workbenchPartDescriptor.getPartPage().getActivePart();
+ if (workbenchPart instanceof org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) {
+ final org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart part =
+ (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) workbenchPart;
+ try {
+ «IF editorGen.application == null-»
+ new org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation(
+ «ENDIF-»
+ new org.eclipse.jface.operation.IRunnableWithProgress() {
+
+ public void run(org.eclipse.core.runtime.IProgressMonitor monitor)
+ throws InterruptedException, java.lang.reflect.InvocationTargetException {
+ runValidation(part.getDiagramEditPart(), part.getDiagram());
+ }
+ }
+ «IF editorGen.application == null-»
+ )
+ «ENDIF-»
+ .run(new org.eclipse.core.runtime.NullProgressMonitor());
+ } catch (Exception e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Validation action failed", e); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void runValidation(org.eclipse.gmf.runtime.notation.View view) {
+ try {
+ if («getDiagramEditorUtilQualifiedClassName()».openDiagram(view.eResource())) {
+ org.eclipse.ui.IEditorPart editorPart = org.eclipse.ui.PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if (editorPart instanceof org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) {
+ runValidation(((org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) editorPart).
+ getDiagramEditPart(), view);
+ } else {
+ runNonUIValidation(view);
+ }
+ }
+ } catch (Exception e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Validation action failed", e); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void runNonUIValidation(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart =
+ org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory.getInstance().createDiagramEditPart(
+ view.getDiagram());
+ runValidation(diagramEditPart, view);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void runValidation(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, org.eclipse.gmf.runtime.notation.View view) {
+ final org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart fpart = diagramEditPart;
+ final org.eclipse.gmf.runtime.notation.View fview = view;
+ org.eclipse.emf.transaction.TransactionalEditingDomain txDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(view);
+ «getValidationProviderQualifiedClassName()».runWithConstraints(txDomain, new Runnable() {
+
+ public void run() {
+ validate(fpart, fview);
+ }
+ });
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static org.eclipse.emf.common.util.Diagnostic runEMFValidator(
+ org.eclipse.gmf.runtime.notation.View target) {
+ if (target.isSetElement() && target.getElement() != null) {
+ return new org.eclipse.emf.ecore.util.Diagnostician() {
+
+ public String getObjectLabel(org.eclipse.emf.ecore.EObject eObject) {
+ return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(eObject, true);
+ }
+ }.validate(target.getElement());
+ }
+ return org.eclipse.emf.common.util.Diagnostic.OK_INSTANCE;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static void validate(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart,
+ org.eclipse.gmf.runtime.notation.View view) {
+ «IF editorGen.application == null-»
+ org.eclipse.core.resources.IFile target = view.eResource() != null ?
+ org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(view.eResource()) : null;
+ if (target != null) {
+ «getMarkerNavigationProviderQualifiedClassName()».deleteMarkers(target);
+ }
+ «ELSE-»
+ org.eclipse.gmf.runtime.notation.View target = view;
+ «EXPAND xpt::editor::ValidationMarker::qualifiedClassName».removeAllMarkers(diagramEditPart.getViewer());
+ «ENDIF-»
+ org.eclipse.emf.common.util.Diagnostic diagnostic = runEMFValidator(view);
+ createMarkers(target, diagnostic, diagramEditPart);
+ org.eclipse.emf.validation.service.IBatchValidator validator =
+ (org.eclipse.emf.validation.service.IBatchValidator)
+ org.eclipse.emf.validation.service.ModelValidationService.getInstance().newValidator(
+ org.eclipse.emf.validation.model.EvaluationMode.BATCH);
+ validator.setIncludeLiveConstraints(true);
+ if (view.isSetElement() && view.getElement() != null) {
+ org.eclipse.core.runtime.IStatus status = validator.validate(view.getElement());
+ createMarkers(target, status, diagramEditPart);
+ }
+«IF shouldRunValidateOnDiagram(editorGen.audits)-»
+«IF hasDiagramElementTargetRule(editorGen.audits)-»
+ validator.setTraversalStrategy(«getValidationProviderQualifiedClassName()».getNotationTraversalStrategy(validator));
+«ENDIF-»
+ org.eclipse.core.runtime.IStatus status = validator.validate(view);
+ createMarkers(target, status, diagramEditPart);
+«ENDIF-»
+ «IF editorGen.application != null && validationDecorators-»
+ «getValidationDecoratorProviderQualifiedClassName()».refreshDecorators(view);
+ for (java.util.Iterator it = view.eAllContents(); it.hasNext();) {
+ org.eclipse.emf.ecore.EObject next = (org.eclipse.emf.ecore.EObject) it.next();
+ if (next instanceof org.eclipse.gmf.runtime.notation.View) {
+ «getValidationDecoratorProviderQualifiedClassName()».refreshDecorators(
+ (org.eclipse.gmf.runtime.notation.View) next);
+ }
+ }
+ «ENDIF-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static void createMarkers(
+ «IF editorGen.application == null»org.eclipse.core.resources.IFile
+ «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target,
+ org.eclipse.core.runtime.IStatus validationStatus,
+ org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {
+ if (validationStatus.isOK()) {
+ return;
+ }
+ final org.eclipse.core.runtime.IStatus rootStatus = validationStatus;
+ java.util.List allStatuses = new java.util.ArrayList();
+ «getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap element2ViewMap =
+ new «getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap(
+ diagramEditPart.getDiagramView(),
+ collectTargetElements(rootStatus, new java.util.HashSet(), allStatuses));
+ for (java.util.Iterator it = allStatuses.iterator(); it.hasNext();) {
+ org.eclipse.emf.validation.model.IConstraintStatus nextStatus =
+ (org.eclipse.emf.validation.model.IConstraintStatus) it.next();
+ org.eclipse.gmf.runtime.notation.View view = «getDiagramEditorUtilQualifiedClassName()».findView(
+ diagramEditPart, nextStatus.getTarget(), element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),
+ org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true),
+ nextStatus.getMessage(), nextStatus.getSeverity());
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static void createMarkers(
+ «IF editorGen.application == null»org.eclipse.core.resources.IFile
+ «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target,
+ org.eclipse.emf.common.util.Diagnostic emfValidationStatus,
+ org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart) {
+ if (emfValidationStatus.getSeverity() == org.eclipse.emf.common.util.Diagnostic.OK) {
+ return;
+ }
+ final org.eclipse.emf.common.util.Diagnostic rootStatus = emfValidationStatus;
+ java.util.List allDiagnostics = new java.util.ArrayList();
+ «getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap element2ViewMap =
+ new «getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap(
+ diagramEditPart.getDiagramView(),
+ collectTargetElements(rootStatus, new java.util.HashSet(), allDiagnostics));
+ for (java.util.Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
+ org.eclipse.emf.common.util.Diagnostic nextDiagnostic = (org.eclipse.emf.common.util.Diagnostic) it.next();
+ java.util.List data = nextDiagnostic.getData();
+ if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
+ org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) data.get(0);
+ org.eclipse.gmf.runtime.notation.View view = «getDiagramEditorUtilQualifiedClassName()».findView(
+ diagramEditPart, element, element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view),
+ org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(element, true),
+ nextDiagnostic.getMessage(), diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));
+ }
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static void addMarker(org.eclipse.gef.EditPartViewer viewer,
+ «IF editorGen.application == null»org.eclipse.core.resources.IFile
+ «ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target,
+ String elementId, String location, String message, int statusSeverity) {
+ if (target == null) {
+ return;
+ }
+ «IF editorGen.application == null-»
+ «getMarkerNavigationProviderQualifiedClassName()».addMarker(
+ target, elementId, location, message, statusSeverity);
+ «ELSE-»
+ new «EXPAND xpt::editor::ValidationMarker::qualifiedClassName»(
+ location, message, statusSeverity).add(viewer, elementId);
+ «ENDIF-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
+ if (diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.OK) {
+ return org.eclipse.core.runtime.IStatus.OK;
+ } else if (diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.INFO) {
+ return org.eclipse.core.runtime.IStatus.INFO;
+ } else if (diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.WARNING) {
+ return org.eclipse.core.runtime.IStatus.WARNING;
+ } else if (diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.ERROR
+ || diagnosticSeverity == org.eclipse.emf.common.util.Diagnostic.CANCEL) {
+ return org.eclipse.core.runtime.IStatus.ERROR;
+ }
+ return org.eclipse.core.runtime.IStatus.INFO;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static java.util.Set collectTargetElements(org.eclipse.core.runtime.IStatus status,
+ java.util.Set targetElementCollector, java.util.List allConstraintStatuses) {
+ if (status instanceof org.eclipse.emf.validation.model.IConstraintStatus) {
+ targetElementCollector.add(((org.eclipse.emf.validation.model.IConstraintStatus) status).getTarget());
+ allConstraintStatuses.add(status);
+ }
+ if (status.isMultiStatus()) {
+ org.eclipse.core.runtime.IStatus[] children = status.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ collectTargetElements(children[i], targetElementCollector, allConstraintStatuses);
+ }
+ }
+ return targetElementCollector;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static java.util.Set collectTargetElements(org.eclipse.emf.common.util.Diagnostic diagnostic,
+ java.util.Set targetElementCollector, java.util.List allDiagnostics) {
+ java.util.List data = diagnostic.getData();
+ org.eclipse.emf.ecore.EObject target = null;
+ if (data != null && !data.isEmpty() && data.get(0) instanceof org.eclipse.emf.ecore.EObject) {
+ target = (org.eclipse.emf.ecore.EObject) data.get(0);
+ targetElementCollector.add(target);
+ allDiagnostics.add(diagnostic);
+ }
+ if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
+ for (java.util.Iterator it = diagnostic.getChildren().iterator(); it.hasNext();) {
+ collectTargetElements((org.eclipse.emf.common.util.Diagnostic) it.next(),
+ targetElementCollector, allDiagnostics);
+ }
+ }
+ return targetElementCollector;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForValidateAction().messageKey(), "Validate")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForValidateAction().messageKey())-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/ValidationMarker.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::editor::Utils»
+
+«DEFINE className FOR gmfgen::GenDiagram»ValidationMarker«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«editorGen.editor.packageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE ValidationMarker FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static final String KEY = "validation_marker"; //$NON-NLS-1$
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final «EXPAND className»[] EMPTY_ARRAY = new «EXPAND className»[0];
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final String location;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final String message;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final int statusSeverity;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(String location, String message, int statusSeverity) {
+ this.location = location;
+ this.message = message;
+ this.statusSeverity = statusSeverity;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getLocation() {
+ return location;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getMessage() {
+ return message;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public int getStatusSeverity() {
+ return statusSeverity;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static java.util.Map getMarkers(org.eclipse.gef.EditPartViewer viewer) {
+ java.util.Map markers = (java.util.Map) viewer.getProperty(KEY);
+ if (markers == null) {
+ markers = new java.util.HashMap();
+ viewer.setProperty(KEY, markers);
+ }
+ return markers;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static java.util.Set getMarkers(org.eclipse.gef.EditPartViewer viewer, String viewId, boolean create) {
+ java.util.Set markers = (java.util.Set) getMarkers(viewer).get(viewId);
+ if (markers == null) {
+ if (!create) {
+ return java.util.Collections.EMPTY_SET;
+ }
+ markers = new java.util.HashSet();
+ getMarkers(viewer).put(viewId, markers);
+ }
+ return markers;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static «EXPAND className»[] getMarkers(org.eclipse.gef.EditPartViewer viewer, String viewId) {
+ java.util.Set markers = getMarkers(viewer, viewId, false);
+ if (markers.isEmpty()) {
+ return EMPTY_ARRAY;
+ }
+ return («EXPAND className»[]) markers.toArray(new «EXPAND className»[markers.size()]);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void removeAllMarkers(org.eclipse.gef.EditPartViewer viewer) {
+ getMarkers(viewer).clear();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void add(org.eclipse.gef.EditPartViewer viewer, String viewId) {
+ getMarkers(viewer, viewId, true).add(this);
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/VisualIDRegistry.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::editor::Utils»
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::diagram::editpolicies::LinkUtils»
+«EXTENSION xpt::expressions::ValueExpression»
+
+«DEFINE VisualIDRegistry FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «editorGen.editor.packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment(
+ "This registry is used to determine which type of visual object should be\n" +
+ "created for the corresponding Diagram, Node, ChildNode or Link represented\n" +
+ "by a domain model object.\n"
+ )»
+public class «visualIDRegistryClassName» {
+
+ «EXPAND attributes-»
+
+ «EXPAND getViewVisualID-»
+
+ «EXPAND getModelID-»
+
+ «EXPAND getVisualID-»
+
+ «EXPAND getType-»
+
+ «EXPAND getDiagramVisualID-»
+
+ «EXPAND getNodeVisualID-»
+
+ «EXPAND canCreateNode-»
+
+ «EXPAND getLinkWithClassVisualID-»
+
+ «EXPAND isDiagram-»
+
+ «EXPAND _constraintMethods-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«REM»
+ <Definitions of templates for outside usage>
+«ENDREM»
+
+«DEFINE visualID FOR gmfgen::GenCommonBase»«getEditPartQualifiedClassName()».VISUAL_ID«ENDDEFINE»
+
+«DEFINE modelID FOR gmfgen::GenDiagram»«getEditPartQualifiedClassName()».MODEL_ID«ENDDEFINE»
+
+«DEFINE getVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getVisualIdMethodName»«ENDDEFINE»
+
+«DEFINE getModelIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getModelIDMethodName»«ENDDEFINE»
+
+«DEFINE getTypeMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getTypeMethodName»«ENDDEFINE»
+
+«DEFINE getDiagramVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getDiagramVisualIDMethodName»«ENDDEFINE»
+
+«DEFINE getNodeVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getNodeVisualIDMethodName»«ENDDEFINE»
+
+«DEFINE canCreateNodeMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND canCreateNodeMethodName»«ENDDEFINE»
+
+«DEFINE getLinkWithClassVisualIDMethodCall FOR gmfgen::GenDiagram»«getVisualIDRegistryQualifiedClassName()».«EXPAND getLinkWithClassVisualIDMethodName»«ENDDEFINE»
+
+«REM»
+ </Definitions of templates for outside usage>
+«ENDREM»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static final String DEBUG_KEY = "«editorGen.plugin.iD»/debug/visualID"; «EXPAND xpt::Common::nonNLS»
+«IF null != editorGen.expressionProviders-»
+ «EXPAND _constraintField FOREACH topLevelNodes-»
+ «EXPAND _constraintField FOREACH childNodes-»
+ «EXPAND _constraintField FOREACH links-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getViewVisualID FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static int «EXPAND getVisualIdMethodName»(org.eclipse.gmf.runtime.notation.View view) {
+ if (view instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ if («EXPAND modelID».equals(view.getType())) {
+ return «EXPAND visualID»;
+ } else {
+ «EXPAND unrecognizedVID-»
+ }
+ }
+ return «EXPAND getVisualIDMethodCall»(view.getType());
+}
+«ENDDEFINE»
+
+«DEFINE getVisualIdMethodName FOR gmfgen::GenDiagram»getVisualID«ENDDEFINE»
+
+«DEFINE getModelID FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static String «EXPAND getModelIDMethodName»(org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gmf.runtime.notation.View diagram = view.getDiagram();
+ while (view != diagram) {
+ org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
+ if (annotation != null) {
+ return (String) annotation.getDetails().get("modelID"); «EXPAND xpt::Common::nonNLS»
+ }
+ view = (org.eclipse.gmf.runtime.notation.View) view.eContainer();
+ }
+ return diagram != null ? diagram.getType() : null;
+}
+«ENDDEFINE»
+
+«DEFINE getModelIDMethodName FOR gmfgen::GenDiagram»getModelID«ENDDEFINE»
+
+«DEFINE getVisualID FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static int «EXPAND getVisualIdMethodName»(String type) {
+ try {
+ return Integer.parseInt(type);
+ } catch (NumberFormatException e) {
+ if (Boolean.TRUE.toString().equalsIgnoreCase(org.eclipse.core.runtime.Platform.getDebugOption(DEBUG_KEY))) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Unable to parse view type as a visualID number: " + type);
+ }
+ }
+ «EXPAND unrecognizedVID-»
+}
+«ENDDEFINE»
+
+«DEFINE getType FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static String «EXPAND getTypeMethodName»(int visualID) {
+ return String.valueOf(visualID);
+}
+«ENDDEFINE»
+
+«DEFINE getTypeMethodName FOR gmfgen::GenDiagram»getType«ENDDEFINE»
+
+«DEFINE getDiagramVisualID FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static int «EXPAND getDiagramVisualIDMethodName»(org.eclipse.emf.ecore.EObject domainElement) {
+ if (domainElement == null) {
+ «EXPAND unrecognizedVID-»
+ }
+«IF null != domainDiagramElement-»
+ «EXPAND returnVisualID-»
+«ENDIF-»
+ «EXPAND unrecognizedVID-»
+}
+«ENDDEFINE»
+
+«DEFINE getDiagramVisualIDMethodName FOR gmfgen::GenDiagram»getDiagramVisualID«ENDDEFINE»
+
+«DEFINE returnVisualID FOR gmfgen::GenCommonBase-»
+if («EXPAND checkSemanticElement») {
+ return «EXPAND visualID»;
+}
+«ENDDEFINE»
+
+«DEFINE checkSemanticElement FOR gmfgen::GenCommonBase-»
+ «ERROR "checkSemanticElement not supported for: " + this-»
+«ENDDEFINE»
+
+«DEFINE checkSemanticElement FOR gmfgen::GenDiagram»«EXPAND checkDomainElementMetaclass FOR domainDiagramElement» && isDiagram(«EXPAND MetaModel::CastEObject("domainElement") FOR domainDiagramElement»)«ENDDEFINE»
+«DEFINE checkSemanticElement FOR gmfgen::GenNode»«EXPAND checkDomainElementMetaclass FOR modelFacet.metaClass»«EXPAND checkDomainElementConstraints(this) FOR modelFacet»«ENDDEFINE»
+«DEFINE checkSemanticElement FOR gmfgen::GenLink»«EXPAND checkSemanticElement(this) FOR modelFacet»«ENDDEFINE»
+
+«DEFINE checkDomainElementMetaclass FOR genmodel::GenClass»«EXPAND MetaModel::MetaClass».isSuperTypeOf(domainElement.eClass())«ENDDEFINE»
+
+«DEFINE checkDomainElementConstraints(gmfgen::GenCommonBase commonBase) FOR gmfgen::TypeModelFacet-»
+«IF null != modelElementSelector» && «EXPAND _domainElementConstraintMethodName FOR commonBase»(«EXPAND MetaModel::CastEObject("domainElement") FOR metaClass»)«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkSemanticElement(gmfgen::GenLink genLink) FOR gmfgen::LinkModelFacet»«ERROR "checkSemanticElement is supported only for TypeLinkModelFacet: " + this»«ENDDEFINE»
+«DEFINE checkSemanticElement(gmfgen::GenLink genLink) FOR gmfgen::TypeLinkModelFacet»«EXPAND checkDomainElementMetaclass FOR metaClass»«EXPAND checkDomainElementConstraints(genLink)»«ENDDEFINE»
+
+
+«DEFINE getNodeVisualID FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static int «EXPAND getNodeVisualIDMethodName»(org.eclipse.gmf.runtime.notation.View containerView, org.eclipse.emf.ecore.EObject domainElement) {
+ if (domainElement == null) {
+ «EXPAND unrecognizedVID-»
+ }
+ String containerModelID = «EXPAND getModelIDMethodCall»(containerView);
+ if (!«EXPAND modelID».equals(containerModelID)«EXPAND checkContainerModelID FOREACH shortcutsProvidedFor») { «EXPAND xpt::Common::nonNLS({}) FOREACH shortcutsProvidedFor SEPARATOR " "»
+ «EXPAND unrecognizedVID-»
+ }
+ int containerVisualID;
+ if («EXPAND modelID».equals(containerModelID)) {
+ containerVisualID = «EXPAND getVisualIDMethodCall»(containerView);
+ } else {
+ if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ containerVisualID = «EXPAND visualID»;
+ } else {
+ «EXPAND unrecognizedVID-»
+ }
+ }
+ switch (containerVisualID) {
+ «EXPAND caseDomainContainerVisualID FOREACH getAllContainers()-»
+ }
+ «EXPAND unrecognizedVID-»
+}
+«ENDDEFINE»
+
+«DEFINE getNodeVisualIDMethodName FOR gmfgen::GenDiagram»getNodeVisualID«ENDDEFINE»
+
+«DEFINE caseDomainContainerVisualID FOR gmfgen::GenContainerBase-»
+ «IF getContainedSemanticNodes(this).size() > 0-»
+«EXPAND xpt::Common::caseVisualID»
+ «EXPAND returnVisualID FOREACH getContainedSemanticNodes(this)-»
+ break;
+ «ENDIF-»
+«ENDDEFINE»
+
+
+«DEFINE canCreateNode FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static boolean «EXPAND canCreateNodeMethodName»(org.eclipse.gmf.runtime.notation.View containerView, int nodeVisualID) {
+ String containerModelID = «EXPAND getModelIDMethodCall»(containerView);
+ if (!«EXPAND modelID».equals(containerModelID)«EXPAND checkContainerModelID FOREACH shortcutsProvidedFor») { «EXPAND xpt::Common::nonNLS({}) FOREACH shortcutsProvidedFor SEPARATOR " "»
+ return false;
+ }
+ int containerVisualID;
+ if («EXPAND modelID».equals(containerModelID)) {
+ containerVisualID = «EXPAND getVisualIDMethodCall»(containerView);
+ } else {
+ if (containerView instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ containerVisualID = «EXPAND visualID»;
+ } else {
+ return false;
+ }
+ }
+ switch (containerVisualID) {
+ «EXPAND caseVisualID FOREACH getAllContainers().select(e| !e.getEssentialVisualChildren().isEmpty())-»
+ «EXPAND caseVisualID FOREACH links.select(e| !e.getEssentialVisualChildren().isEmpty())-»
+ }
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE canCreateNodeMethodName FOR gmfgen::GenDiagram»canCreateNode«ENDDEFINE»
+
+«DEFINE checkContainerModelID FOR String» && !"«this»".equals(containerModelID)«ENDDEFINE»
+
+«DEFINE caseVisualID FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::caseVisualID»
+ «EXPAND checkEssentialChild FOREACH getEssentialVisualChildren()-»
+ break;
+«ENDDEFINE»
+
+«DEFINE checkEssentialChild FOR gmfgen::GenCommonBase-»
+if («EXPAND visualID» == nodeVisualID) {
+ return true;
+}
+«ENDDEFINE»
+
+«DEFINE getLinkWithClassVisualID FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static int «EXPAND getLinkWithClassVisualIDMethodName»(org.eclipse.emf.ecore.EObject domainElement) {
+ if (domainElement == null) {
+ «EXPAND unrecognizedVID-»
+ }
+ «EXPAND returnVisualID FOREACH links.select(link | isTypeLink(link))-»
+ «EXPAND unrecognizedVID-»
+}
+«ENDDEFINE»
+
+«DEFINE getLinkWithClassVisualIDMethodName FOR gmfgen::GenDiagram»getLinkWithClassVisualID«ENDDEFINE»
+
+
+«DEFINE isDiagram FOR gmfgen::GenDiagram-»
+ «IF null != domainDiagramElement-»
+ «EXPAND xpt::Common::generatedMemberComment(
+ "User can change implementation of this method to handle some specific\n" +
+ "situations not covered by default logic.\n"
+ )»
+private static boolean isDiagram(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» element) {
+ return true;
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+
+«REM»
+
+ Support for extra contstraints to check about model element.
+ Includes expression fields for interpreted constrains (like ocl or regexp).
+ For each model element that has an associated constraint, there's a method is<DomainElement>_<UID>()
+ that performs extra specification as defined by value expression
+
+ FIXME don't use static fields, replace with instance/separate cache (e.g. accessible from Activator)
+«ENDREM»
+
+«DEFINE _constraintMethods FOR GenDiagram-»
+«IF null != editorGen.expressionProviders-»
+ «EXPAND _constraintMethod FOREACH topLevelNodes.select(n | n.modelFacet.modelElementSelector != null)-»
+ «EXPAND _constraintMethod FOREACH childNodes.select(n | n.modelFacet.modelElementSelector != null)-»
+ «FOREACH links AS l»«EXPAND _constraintMethod(l) FOR l.modelFacet»«ENDFOREACH»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE _constraintMethod FOR GenNode-»
+«EXPAND _domainElementConstraintMethod(this, modelFacet.modelElementSelector, modelFacet.metaClass) FOR modelFacet.modelElementSelector.provider»
+«ENDDEFINE»
+
+«DEFINE _constraintMethod(GenLink l) FOR LinkModelFacet»«ENDDEFINE» // no-op
+«DEFINE _constraintMethod(GenLink l) FOR TypeLinkModelFacet-»
+«IF modelElementSelector != null»«EXPAND _domainElementConstraintMethod(l, modelElementSelector, metaClass) FOR modelElementSelector.provider»«ENDIF-»
+«ENDDEFINE»
+
+
+«DEFINE _domainElementConstraintMethodName FOR GenCommonBase»is«getUniqueIdentifier()»«ENDDEFINE»
+
+«DEFINE _domainElementConstraintMethod(GenCommonBase diagramElement, ValueExpression expression, GenClass context) FOR GenExpressionProviderBase»«ERROR "Constraint method is not supported for " + this»«ENDDEFINE»
+
+«DEFINE _domainElementConstraintMethod(GenCommonBase diagramElement, ValueExpression expression, GenClass context) FOR GenJavaExpressionProvider-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static boolean «EXPAND _domainElementConstraintMethodName FOR diagramElement»(«EXPAND MetaModel::QualifiedClassName FOR context» domainElement) {
+«IF injectExpressionBody && expression.body != null && expression.body.length() != 0-»
+ «expression.body»
+«ELSEIF throwException || (injectExpressionBody && (expression.body == null || expression.body.length() == 0))-»
+ // FIXME: implement this method
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new java.lang.UnsupportedOperationException("No java implementation provided in '«EXPAND _domainElementConstraintMethodName FOR diagramElement»' operation");«EXPAND xpt::Common::nonNLS»
+«ELSE-»
+ return false;
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE _domainElementConstraintMethod(GenCommonBase diagramElement, ValueExpression expression, GenClass context) FOR GenExpressionInterpreter-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static boolean «EXPAND _domainElementConstraintMethodName FOR diagramElement»(«EXPAND MetaModel::QualifiedClassName FOR context» domainElement) {
+ if («constraintFieldName(diagramElement)» == null) { // lazy initialization
+ «constraintFieldName(diagramElement)» = «EXPAND xpt::expressions::getExpression::getExpression(expression, context)»; «EXPAND xpt::Common::nonNLS»
+ }
+ Object result = «constraintFieldName(diagramElement)».evaluate(domainElement);
+ return result instanceof Boolean && ((Boolean)result).booleanValue();
+ }
+«ENDDEFINE»
+
+
+«DEFINE _constraintField FOR GenNode»«EXPAND _constraintField(this) FOR modelFacet»«ENDDEFINE»
+«DEFINE _constraintField FOR GenLink»«EXPAND _constraintField(this) FOR modelFacet»«ENDDEFINE»
+
+«DEFINE _constraintField(GenCommonBase diagramElement) FOR ModelFacet»«ENDDEFINE»
+«DEFINE _constraintField(GenCommonBase diagramElement) FOR TypeModelFacet-»
+«IF modelElementSelector != null»«EXPAND _constraintField(diagramElement) FOR modelElementSelector.provider»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE _constraintField(GenCommonBase diagramElement) FOR GenExpressionInterpreter»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static «container.getAbstractExpressionQualifiedClassName()» «constraintFieldName(diagramElement)»;
+«ENDDEFINE»
+
+«DEFINE _constraintField(GenCommonBase diagramElement) FOR GenExpressionProviderBase»«ERROR "Need to define approach to constraint fields for " + this»«ENDDEFINE»
+«DEFINE _constraintField(GenCommonBase diagramElement) FOR GenJavaExpressionProvider»«ENDDEFINE»// IOW, no fields for Java
+
+«REM»
+ Constraints support end.
+«ENDREM»
+
+
+«DEFINE unrecognizedVID FOR gmfgen::GenDiagram-»
+return -1;
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
\ No newline at end of file
Binary file carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/diagram.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE extensions FOR gmfgen::GenEditorGenerator-»
+ <extension point="org.eclipse.ui.editors">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <editor
+ id="«editor.iD»"
+ name="%editorName"
+ icon="«editor.iconPathX»"
+ extensions="«diagramFileExtension»"
+ default="true"
+ class="«editor.getQualifiedClassName()»"
+ matchingStrategy="«diagram.getMatchingStrategyQualifiedClassName()»"
+ contributorClass="«editor.getActionBarContributorQualifiedClassName()»">
+ </editor>
+ </extension>
+
+ <extension point="org.eclipse.ui.contexts">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <context
+ description="%context.description"
+ id="«editor.contextID»"
+ name="%context.name"
+ parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext">
+ </context>
+ </extension>
+
+ <extension point="org.eclipse.ui.newWizards">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <wizard
+ name="%newWizardName"
+ icon="«diagram.creationWizardIconPathX»"
+ category="«diagram.creationWizardCategoryID»"
+ class="«diagram.getCreationWizardQualifiedClassName()»"
+ id="«diagram.getCreationWizardQualifiedClassName()»ID">
+ <description>%newWizardDesc</description>
+ </wizard>
+ </extension>
+
+ <extension point="org.eclipse.ui.popupMenus">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+«IF diagram.generateCreateShortcutAction()-»
+ <objectContribution
+ adaptable="false"
+ id="«plugin.iD».CreateShortcut"
+ objectClass="«diagram.getEditPartQualifiedClassName()»">
+ <action
+ class="«diagram.getCreateShortcutActionQualifiedClassName()»"
+ enablesFor="1"
+ id="«plugin.iD».CreateShortcutAction"
+ label="%createShortcutActionLabel"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
+«ENDIF-»
+ <objectContribution
+ adaptable="false"
+ id="«plugin.iD».LoadResource"
+ objectClass="«diagram.getEditPartQualifiedClassName()»">
+ <action
+ class="«diagram.getLoadResourceActionQualifiedClassName()»"
+ enablesFor="1"
+ id="«plugin.iD».LoadResourceAction"
+ label="%loadResourceActionLabel"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
+ </extension>
+«IF diagram.generateInitDiagramAction()-»
+
+ «IF null == application»<extension point="org.eclipse.ui.popupMenus">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <objectContribution
+ id="«plugin.iD».InitDiagram"
+ nameFilter="*.«domainFileExtension»"
+ objectClass="org.eclipse.core.resources.IFile">
+ <action
+ label="%initDiagramActionLabel"
+ class="«diagram.getInitDiagramFileActionQualifiedClassName()»"
+ menubarPath="additions"
+ enablesFor="1"
+ id="«plugin.iD».InitDiagramAction">
+ </action>
+ </objectContribution>
+ </extension>
+ «ELSE-»
+ <extension point="org.eclipse.ui.actionSets">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <actionSet
+ label="%initDiagramActionLabel"
+ visible="true"
+ id="«plugin.iD».InitDiagram">
+ <action
+ label="%initDiagramActionLabel"
+ class="«diagram.getInitDiagramFileActionQualifiedClassName()»"
+ menubarPath="file/additions"
+ id="«plugin.iD».InitDiagramAction">
+ </action>
+ </actionSet>
+ </extension>
+ «ENDIF-»
+«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/palette/PaletteFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,275 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::editor::palette::Utils»
+
+«DEFINE Factory FOR gmfgen::Palette»
+«EXPAND xpt::Common::copyright FOR diagram.editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «factoryClassName» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void fillPalette(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
+«IF definesStandardTools()-»
+ cleanStandardTools(paletteRoot);
+«ENDIF-»
+ «EXPAND addEntry("paletteRoot") FOREACH groups-»
+ }
+«IF definesStandardTools()»
+«EXPAND cleanStandardToolsHack-»
+«ENDIF-»
+
+«EXPAND createGroup FOREACH collectGroups()»
+«EXPAND createEntry FOREACH collectTools()»
+
+«IF needsNodeToolEntryClass()»«EXPAND nodeToolEntry»«ENDIF-»
+«IF needsLinkToolEntryClass()»«EXPAND linkToolEntry»«ENDIF-»
+}
+«ENDDEFINE»
+
+«DEFINE createGroup FOR gmfgen::ToolGroup-»
+ «EXPAND xpt::Common::generatedMemberComment("Creates \"" + title + "\" palette tool group")»
+ private org.eclipse.gef.palette.PaletteContainer «createMethodName»() {
+ «EXPAND newContainer("paletteContainer")-»
+ «EXPAND setDescription("paletteContainer", this) FOR description-»
+ «EXPAND addEntry("paletteContainer") FOREACH entries-»
+ return paletteContainer;
+ }
+«ENDDEFINE»
+
+«DEFINE newContainer(String varName) FOR gmfgen::ToolGroup-»
+«IF collapse && toolsOnly-»
+ org.eclipse.gef.palette.PaletteDrawer «varName» = new org.eclipse.gef.palette.PaletteDrawer(«EXPAND i18nTitle»);
+«ELSEIF stack-»
+ org.eclipse.gef.palette.PaletteStack «varName» = new org.eclipse.gef.palette.PaletteStack(«EXPAND i18nTitle», null, null);
+«ELSE-»
+ org.eclipse.gef.palette.PaletteGroup «varName» = new org.eclipse.gef.palette.PaletteGroup(«EXPAND i18nTitle»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setDescription(String varName, gmfgen::ToolGroup gr) FOR String-»
+«varName».setDescription(«EXPAND i18nDesc FOR gr»);
+«ENDDEFINE»
+
+«DEFINE addEntry(String varName) FOR gmfgen::ToolGroupItem»
+«ERROR "abstract addEntry(ToolGroupItem,String) template"»
+«ENDDEFINE»
+
+«DEFINE addEntry(String varName) FOR gmfgen::AbstractToolEntry-»
+«varName».add(«createMethodName»());
+«IF default_ && group.stack-»
+«varName».setActiveEntry((org.eclipse.gef.palette.ToolEntry) paletteContainer.getChildren().get(paletteContainer.getChildren().size() - 1));
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addEntry(String varName) FOR gmfgen::Separator-»
+«varName».add(new org.eclipse.gef.palette.PaletteSeparator());
+«ENDDEFINE»
+
+«DEFINE addEntry(String varName) FOR gmfgen::ToolGroup-»
+«varName».add(«createMethodName»());
+«ENDDEFINE»
+
+«DEFINE createEntry FOR gmfgen::AbstractToolEntry-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gef.palette.ToolEntry «createMethodName»() {
+ «EXPAND newEntry("entry")-»
+ «EXPAND setSmallImage("entry")-»
+ «EXPAND setLargeImage("entry")-»
+ «EXPAND setToolClass("entry")-»
+ «EXPAND setToolProperty("entry") FOREACH properties-»
+ return entry;
+ }
+«ENDDEFINE»
+
+«DEFINE newEntry(String toolVarName) FOR gmfgen::AbstractToolEntry-»
+«ERROR "abstract newEntry(AbstractToolEntry,String) template"»
+«ENDDEFINE»
+
+«DEFINE newEntry(String toolVarName) FOR gmfgen::ToolEntry-»
+«IF elements.isEmpty()-»
+org.eclipse.gef.palette.ToolEntry «toolVarName» = new org.eclipse.gef.palette.ToolEntry(«EXPAND i18nTitle», «EXPAND i18nDesc», null, null) {};
+«ELSE-»
+«LET genNodes.isEmpty() ? "LinkToolEntry" : "NodeToolEntry" AS toolEntryClass-»
+java.util.List/*<IElementType>*/ types = new java.util.ArrayList/*<IElementType>*/(«elements.size()»);
+«FOREACH elements AS e-»
+types.add(«elementTypesClass()».«e.getUniqueIdentifier()»);
+«ENDFOREACH-»
+«toolEntryClass» «toolVarName» = new «toolEntryClass»(«EXPAND i18nTitle», «EXPAND i18nDesc», types);
+«ENDLET-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE newEntry(String toolVarName) FOR gmfgen::StandardEntry-»
+«IF StandardEntryKind::SELECT.value == kind.value -»
+«EXPAND newStdSelectEntry(toolVarName)-»
+«ELSEIF kind.value == StandardEntryKind::MARQUEE.value-»
+«EXPAND newStdMarqueeEntry(toolVarName)-»
+«ELSEIF kind.value == StandardEntryKind::ZOOM.value-»
+«EXPAND newStdZoomEntry(toolVarName)-»
+«ELSE-»
+«EXPAND newStdOtherEntry(toolVarName)-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE newStdSelectEntry(String toolVarName) FOR gmfgen::StandardEntry-»
+org.eclipse.gef.palette.PanningSelectionToolEntry «toolVarName» = new org.eclipse.gef.palette.PanningSelectionToolEntry();
+«ENDDEFINE»
+
+«DEFINE newStdMarqueeEntry(String toolVarName) FOR gmfgen::StandardEntry-»
+org.eclipse.gef.palette.MarqueeToolEntry «toolVarName» = new org.eclipse.gef.palette.MarqueeToolEntry();
+«ENDDEFINE»
+
+«DEFINE newStdZoomEntry(String toolVarName) FOR gmfgen::StandardEntry-»
+FIXME
+«ENDDEFINE»
+
+«DEFINE newStdOtherEntry(String toolVarName) FOR gmfgen::StandardEntry-»
+«ERROR "override newStdOtherEntry(StandardEntry, String) for kind " + kind.literal»
+«ENDDEFINE»
+
+«DEFINE setSmallImage(String toolVarName) FOR gmfgen::AbstractToolEntry-»
+«IF null != smallIconPath-»
+«toolVarName».setSmallIcon(«activatorFQN()».findImageDescriptor("«smallIconPath»")); «EXPAND xpt::Common::nonNLS»
+«ELSEIF !{this}.typeSelect(gmfgen::ToolEntry).elements.isEmpty()-»
+«LET ((gmfgen::ToolEntry) this) AS toolEntry-»
+«toolVarName».setSmallIcon(«elementTypesClass(toolEntry)».getImageDescriptor(«elementTypesClass(toolEntry)».«((GenCommonBase) toolEntry.elements.toList().first()).getUniqueIdentifier()»));
+«ENDLET-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setLargeImage(String toolVarName) FOR gmfgen::AbstractToolEntry-»
+«IF null != largeIconPath-»
+«toolVarName».setLargeIcon(«activatorFQN()».findImageDescriptor("«largeIconPath»")); «EXPAND xpt::Common::nonNLS»
+«ELSEIF !{this}.typeSelect(gmfgen::ToolEntry).elements.isEmpty()-»
+«toolVarName».setLargeIcon(«toolVarName».getSmallIcon());
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setToolClass(String toolVarName) FOR gmfgen::AbstractToolEntry-»
+«IF null != qualifiedToolName-»
+«toolVarName».setToolClass(«qualifiedToolName».class);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setToolProperty(String toolVarName) FOR ecore::EStringToStringMapEntry-»
+«toolVarName».setToolProperty(«key», «value»);
+«ENDDEFINE»
+
+«DEFINE i18nTitle FOR gmfgen::ToolEntry-»
+«IF title == null»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nTitleKey()) FOR group.palette.diagram.editorGen»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nTitle FOR gmfgen::ToolGroup-»
+«IF title == null»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nTitleKey()) FOR palette.diagram.editorGen»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nDesc FOR gmfgen::ToolEntry-»
+«IF null == description»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nDescKey()) FOR group.palette.diagram.editorGen»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nDesc FOR gmfgen::ToolGroup-»
+«IF null == description»null«ELSE»«EXPAND xpt::Externalizer::accessorCall(i18nDescKey()) FOR palette.diagram.editorGen»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::Palette-»
+«EXPAND internal_i18n_accessors FOREACH collectGroups()-»
+«EXPAND internal_i18n_accessors FOREACH collectTools()-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::Palette-»
+«EXPAND internal_i18n_values FOREACH collectGroups()-»
+«EXPAND internal_i18n_values FOREACH collectTools()-»
+«ENDDEFINE»
+
+«DEFINE internal_i18n_accessors FOR gmfgen::EntryBase-»
+«IF null != title»«EXPAND xpt::Externalizer::accessorField(i18nTitleKey())»«ENDIF-»
+«IF null != description»«EXPAND xpt::Externalizer::accessorField(i18nDescKey())»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE internal_i18n_values FOR gmfgen::EntryBase-»
+«IF null != title»«EXPAND xpt::Externalizer::messageEntry(i18nTitleKey(), title)»«ENDIF-»
+«IF null != description»«EXPAND xpt::Externalizer::messageEntry(i18nDescKey(), description)»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE cleanStandardToolsHack FOR gmfgen::Palette»
+ «EXPAND xpt::Common::generatedMemberComment("Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=159289")»
+ private void cleanStandardTools(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
+ for (java.util.Iterator it = paletteRoot.getChildren().iterator(); it.hasNext();) {
+ org.eclipse.gef.palette.PaletteEntry entry = (org.eclipse.gef.palette.PaletteEntry) it.next();
+ if (!"standardGroup".equals(entry.getId())) { «EXPAND xpt::Common::nonNLS»
+ continue;
+ }
+ for (java.util.Iterator it2 = ((org.eclipse.gef.palette.PaletteContainer) entry).getChildren().iterator(); it2.hasNext();) {
+ org.eclipse.gef.palette.PaletteEntry entry2 = (org.eclipse.gef.palette.PaletteEntry) it2.next();
+ if ("zoomTool".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
+ it2.remove();
+ } else if ("noteStack".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
+ it2.remove();
+ } else if ("selectionTool".equals(entry2.getId())) { «EXPAND xpt::Common::nonNLS»
+ it2.remove();
+ }
+ if (paletteRoot.getDefaultEntry() == entry2) {
+ paletteRoot.setDefaultEntry(null);
+ }
+ }
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE nodeToolEntry FOR Object»
+ «EXPAND xpt::Common::generatedClassComment»
+ private static class NodeToolEntry extends org.eclipse.gef.palette.ToolEntry {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final java.util.List elementTypes;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private NodeToolEntry(String title, String description, java.util.List elementTypes) {
+ super(title, description, null, null);
+ this.elementTypes = elementTypes;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gef.Tool createTool() {
+ org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool(elementTypes);
+ tool.setProperties(getToolProperties());
+ return tool;
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE linkToolEntry FOR Object»
+ «EXPAND xpt::Common::generatedClassComment»
+ private static class LinkToolEntry extends org.eclipse.gef.palette.ToolEntry {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final java.util.List relationshipTypes;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private LinkToolEntry(String title, String description, java.util.List relationshipTypes) {
+ super(title, description, null, null);
+ this.relationshipTypes = relationshipTypes;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gef.Tool createTool() {
+ org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool(relationshipTypes);
+ tool.setProperties(getToolProperties());
+ return tool;
+ }
+ }
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/palette/Utils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,66 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+// TODO instead, use smth like plugin::Utils::activatorFQN(palette.diagram.editorGen.plugin)
+// i.e. create a system of extensions
+private String activatorFQN(gmfgen::Palette palette) :
+ palette.diagram.editorGen.plugin.getActivatorQualifiedClassName()
+;
+
+String activatorFQN(gmfgen::AbstractToolEntry toolEntry) :
+ activatorFQN(toolEntry.group.palette)
+;
+
+String activatorFQN(gmfgen::ToolGroup toolGroup) :
+ activatorFQN(toolGroup.palette)
+;
+
+private String i18nKey(gmfgen::EntryBase group) :
+ let rv = group.createMethodName :
+ rv.startsWith("get") ? rv.subString(3) : (rv.startsWith("create") ? rv.subString(6) : rv)
+;
+
+String i18nTitleKey(gmfgen::EntryBase group) :
+ i18nKey(group)+"_title"
+;
+
+String i18nDescKey(gmfgen::EntryBase group) :
+ i18nKey(group)+"_desc"
+;
+
+List[gmfgen::ToolGroup] collectGroups(gmfgen::Palette palette) :
+ palette.groups.union(palette.groups.collectSubGroups())
+;
+
+private List[gmfgen::ToolGroup] collectSubGroups(gmfgen::ToolGroup group) :
+ let rv = group.entries.typeSelect(gmfgen::ToolGroup) :
+ rv.addAll(rv.collect(g| g.collectSubGroups()).flatten())
+;
+
+List[gmfgen::AbstractToolEntry] collectTools(gmfgen::Palette palette) :
+ palette.collectGroups().collect(g | g.entries.typeSelect(gmfgen::AbstractToolEntry)).flatten()
+;
+
+boolean needsNodeToolEntryClass(gmfgen::Palette palette) :
+ collectTools(palette).typeSelect(gmfgen::ToolEntry).exists(e | !e.genNodes.isEmpty())
+;
+
+boolean needsLinkToolEntryClass(gmfgen::Palette palette) :
+ collectTools(palette).typeSelect(gmfgen::ToolEntry).exists(e | !e.genLinks.isEmpty())
+;
+
+String elementTypesClass(gmfgen::ToolEntry entry) :
+ entry.group.palette.diagram.getElementTypesQualifiedClassName()
+;
\ No newline at end of file
Binary file carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/shortcut.gif has changed
Binary file carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/editor/wizban.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/expressions/AbstractExpression.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE AbstractExpression FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.expressionProviders.expressionsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public abstract class «editorGen.expressionProviders.abstractExpressionClassName» «EXPAND supertypes»{
+
+«EXPAND status-»
+
+«EXPAND body-»
+
+«EXPAND context-»
+
+«EXPAND ctors-»
+
+«EXPAND evaluate-»
+
+«EXPAND performCast-»
+
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»«ENDDEFINE»
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE status FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.core.runtime.IStatus status = org.eclipse.core.runtime.Status.OK_STATUS;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setStatus(int severity, String message, Throwable throwable) {
+ String pluginID = «editorGen.plugin.getActivatorQualifiedClassName()».ID;
+ this.status = new org.eclipse.core.runtime.Status(severity, pluginID, -1, (message != null) ? message : "", throwable); «EXPAND xpt::Common::nonNLS»
+ if(!this.status.isOK()) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Expression problem:" + message + "body:"+ body(), throwable); «EXPAND xpt::Common::nonNLS» «EXPAND xpt::Common::nonNLS(2)»
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.core.runtime.IStatus getStatus() {
+ return status;
+ }
+«ENDDEFINE»
+
+«DEFINE body FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final String myBody;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String body() {
+ return myBody;
+ }
+«ENDDEFINE»
+
+«DEFINE context FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.emf.ecore.EClassifier myContext;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EClassifier context() {
+ return myContext;
+ }
+«ENDDEFINE»
+
+«DEFINE ctors FOR gmfgen::GenDiagram-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected «editorGen.expressionProviders.abstractExpressionClassName»(String body, org.eclipse.emf.ecore.EClassifier context) {
+ myBody = body;
+ myContext = context;
+ }
+«ENDDEFINE»
+
+«DEFINE evaluate FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected abstract Object doEvaluate(Object context, java.util.Map env);
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public Object evaluate(Object context) {
+ return evaluate(context, java.util.Collections.EMPTY_MAP);
+ }
+
+«EXPAND xpt::Common::generatedMemberComment»
+ public Object evaluate(Object context, java.util.Map env) {
+ if(context().isInstance(context)) {
+ try {
+ return doEvaluate(context, env);
+ } catch(Exception e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Expression evaluation failure: " + body(), e);«EXPAND xpt::Common::nonNLS»
+ }
+ }
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE performCast FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment("Expression may return number value which is not directly compatible with feature type (e.g. Double when Integer is expected), or EEnumLiteral meta-object when literal instance is expected")»
+ public static Object performCast(Object value, org.eclipse.emf.ecore.EDataType targetType) {
+ if (targetType instanceof org.eclipse.emf.ecore.EEnum) {
+ if (value instanceof org.eclipse.emf.ecore.EEnumLiteral) {
+ org.eclipse.emf.ecore.EEnumLiteral literal = (org.eclipse.emf.ecore.EEnumLiteral) value;
+ return (literal.getInstance() != null) ? literal.getInstance() : literal;
+ }
+ }
+ if (false == value instanceof Number || targetType == null || targetType.getInstanceClass() == null) {
+ return value;
+ }
+ Class targetClass = targetType.getInstanceClass();
+ Number num = (Number) value;
+ Class valClass = value.getClass();
+ Class targetWrapperClass = targetClass;
+ if (targetClass.isPrimitive()) {
+ targetWrapperClass = org.eclipse.emf.ecore.util.EcoreUtil.wrapperClassFor(targetClass);
+ }
+ if (valClass.equals(targetWrapperClass)) {
+ return value;
+ }
+ if (Number.class.isAssignableFrom(targetWrapperClass)) {
+ if (targetWrapperClass.equals(Byte.class)) return new Byte(num.byteValue());
+ if (targetWrapperClass.equals(Integer.class)) return new Integer(num.intValue());
+ if (targetWrapperClass.equals(Short.class)) return new Short(num.shortValue());
+ if (targetWrapperClass.equals(Long.class)) return new Long(num.longValue());
+ if (targetWrapperClass.equals(java.math.BigInteger.class)) return java.math.BigInteger.valueOf(num.longValue());
+ if (targetWrapperClass.equals(Float.class)) return new Float(num.floatValue());
+ if (targetWrapperClass.equals(Double.class)) return new Double(num.doubleValue());
+ if (targetWrapperClass.equals(java.math.BigDecimal.class)) return new java.math.BigDecimal(num.doubleValue());
+ }
+ return value;
+ }
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/expressions/OCLExpressionFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE OCLExpressionFactory FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::copyright FOR container.editorGen-»
+package «container.expressionsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «className»() {
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static «container.getAbstractExpressionQualifiedClassName()» getExpression(
+ String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
+ return new Expression(body, context, environment);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static «container.getAbstractExpressionQualifiedClassName()» getExpression(
+ String body, org.eclipse.emf.ecore.EClassifier context) {
+ return getExpression(body, context, java.util.Collections.EMPTY_MAP);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static class Expression extends «container.getAbstractExpressionQualifiedClassName()» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.lang.ref.WeakReference queryRef;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.ocl.ecore.OCL oclInstance;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public Expression(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
+ super(body, context);
+ oclInstance = org.eclipse.ocl.ecore.OCL.newInstance();
+ initCustomEnv(oclInstance.getEnvironment(), environment);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.ocl.Query getQuery() {
+ org.eclipse.ocl.Query oclQuery = null;
+ if (this.queryRef != null) {
+ oclQuery = (org.eclipse.ocl.Query) this.queryRef.get();
+ }
+ if (oclQuery == null) {
+ org.eclipse.ocl.helper.OCLHelper oclHelper = oclInstance.createOCLHelper();
+ oclHelper.setContext(context());
+ try {
+ org.eclipse.ocl.expressions.OCLExpression oclExpression = oclHelper.createQuery(body());
+ oclQuery = oclInstance.createQuery(oclExpression);
+ this.queryRef = new java.lang.ref.WeakReference(oclQuery);
+ setStatus(org.eclipse.core.runtime.IStatus.OK, null, null);
+ } catch (org.eclipse.ocl.ParserException e) {
+ setStatus(org.eclipse.core.runtime.IStatus.ERROR, e.getMessage(), e);
+ }
+ }
+ return oclQuery;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected Object doEvaluate(Object context, java.util.Map env) {
+ org.eclipse.ocl.Query oclQuery = getQuery();
+ if (oclQuery == null) {
+ return null;
+ }
+ org.eclipse.ocl.EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();
+ // init environment
+ for (java.util.Iterator it = env.entrySet().iterator(); it.hasNext();) {
+ java.util.Map.Entry nextEntry = (java.util.Map.Entry) it.next();
+ evalEnv.replace((String) nextEntry.getKey(), nextEntry.getValue());
+ }
+ try {
+ initExtentMap(context);
+ Object result = oclQuery.evaluate(context);
+ return (result != oclInstance.getEnvironment().getOCLStandardLibrary().getOclInvalid()) ? result : null;
+ } finally {
+ evalEnv.clear();
+ oclQuery.getExtentMap().clear();
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void initExtentMap(Object context) {
+ if (!getStatus().isOK() || context == null) {
+ return;
+ }
+ final org.eclipse.ocl.Query queryToInit = getQuery();
+ final Object extentContext = context;
+ queryToInit.getExtentMap().clear();
+ if (queryToInit.queryText() != null
+ && queryToInit.queryText().indexOf(org.eclipse.ocl.utilities.PredefinedType.ALL_INSTANCES_NAME) >= 0) {
+ org.eclipse.ocl.utilities.AbstractVisitor visitior = new org.eclipse.ocl.utilities.AbstractVisitor() {
+
+ private boolean usesAllInstances = false;
+
+ public Object visitOperationCallExp(org.eclipse.ocl.expressions.OperationCallExp oc) {
+ if (!usesAllInstances) {
+ usesAllInstances = org.eclipse.ocl.utilities.PredefinedType.ALL_INSTANCES == oc.getOperationCode();
+ if (usesAllInstances) {
+ queryToInit.getExtentMap().putAll(
+ oclInstance.getEvaluationEnvironment().createExtentMap(extentContext));
+ }
+ }
+ return super.visitOperationCallExp(oc);
+ }
+ };
+ queryToInit.getExpression().accept(visitior);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static void initCustomEnv(org.eclipse.ocl.Environment ecoreEnv, java.util.Map environment) {
+ for (java.util.Iterator it = environment.keySet().iterator(); it.hasNext();) {
+ String varName = (String) it.next();
+ org.eclipse.emf.ecore.EClassifier varType = (org.eclipse.emf.ecore.EClassifier) environment.get(varName);
+ ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static org.eclipse.ocl.expressions.Variable createVar(
+ org.eclipse.ocl.Environment ecoreEnv, String name, org.eclipse.emf.ecore.EClassifier type) {
+ org.eclipse.ocl.expressions.Variable var = org.eclipse.ocl.ecore.EcoreFactory.eINSTANCE.createVariable();
+ var.setName(name);
+ var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
+ return var;
+ }
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/expressions/RegexpExpressionFactory.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE RegexpExpressionFactory FOR gmfgen::GenExpressionInterpreter-»
+«EXPAND xpt::Common::copyright FOR container.editorGen-»
+package «container.expressionsPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «className»() {
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static «container.getAbstractExpressionQualifiedClassName()» getExpression(
+ String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
+ return new Expression(body, context, environment);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static «container.getAbstractExpressionQualifiedClassName()» getExpression(
+ String body, org.eclipse.emf.ecore.EClassifier context) {
+ return getExpression(body, context, java.util.Collections.EMPTY_MAP);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static class Expression extends «container.getAbstractExpressionQualifiedClassName()» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final java.util.regex.Pattern pattern;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public Expression(String body, org.eclipse.emf.ecore.EClassifier context, java.util.Map environment) {
+ super(body, context);
+ java.util.regex.Pattern p;
+ try {
+ p = java.util.regex.Pattern.compile(body);
+ } catch (java.util.regex.PatternSyntaxException e) {
+ setStatus(org.eclipse.core.runtime.IStatus.ERROR, e.getMessage(), e);
+ p = null;
+ }
+ this.pattern = p;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected Object doEvaluate(Object contextInstance, java.util.Map env) {
+ if (pattern == null) {
+ return null;
+ }
+ if (context() instanceof org.eclipse.emf.ecore.EDataType) {
+ contextInstance = org.eclipse.emf.ecore.util.EcoreUtil.convertToString(
+ (org.eclipse.emf.ecore.EDataType) context(), contextInstance);
+ }
+ java.util.regex.Matcher matcher = this.pattern.matcher(String.valueOf(contextInstance));
+ return Boolean.valueOf(«IF language.literal == gmfgen::GenLanguage::nregexp.literal»!«ENDIF»matcher.matches());
+ }
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenExpressionInterpreter»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/expressions/ValueExpression.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+
+constraintFieldName(GenCommonBase cb) : cb.getUniqueIdentifier() + "_Constraint" ;
+
+sourceConstraintFieldName(GenLink l) : l.getUniqueIdentifier() + "_SourceExpression" ;
+targetConstraintFieldName(GenLink l) : l.getUniqueIdentifier() + "_TargetExpression";
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/expressions/getExpression.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE getExpression(gmfgen::ValueExpression valueExpr, genmodel::GenClassifier context) FOR gmfgen::GenExpressionInterpreter-»
+«getQualifiedClassName()».«getExpressionAccessor(valueExpr)»(«valueExpr.getBodyString()», «EXPAND MetaModel::MetaClass FOR context»)«-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/AbstractNavigatorItem.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE AbstractNavigatorItem FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public abstract class «abstractNavigatorItemClassName» extends org.eclipse.core.runtime.PlatformObject {
+
+«IF null != editorGen.propertySheet»
+ «EXPAND registerAdapterFactory-»
+«ENDIF-»
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND getParent-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE registerAdapterFactory FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+static {
+ final Class[] supportedTypes = new Class[] { org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class };
+ final org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor propertySheetPageContributor = new org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor() {
+ public String getContributorId() {
+ return "«editorGen.plugin.iD»"; «EXPAND xpt::Common::nonNLS»
+ }
+ };
+ org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof «getAbstractNavigatorItemQualifiedClassName()» && adapterType == org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor.class) {
+ return propertySheetPageContributor;
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, «getAbstractNavigatorItemQualifiedClassName()».class);
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private Object myParent;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+protected «abstractNavigatorItemClassName»(Object parent) {
+ myParent = parent;
+}
+«ENDDEFINE»
+
+«DEFINE getParent FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object getParent() {
+ return myParent;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/DomainNavigatorContentProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE DomainNavigatorContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «domainContentProviderClassName» implements org.eclipse.ui.navigator.ICommonContentProvider {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iContentProvider-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iStructuredContentProvider-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iMementoAware-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iCommonContentProvider-»
+
+ «EXPAND iTreeContentProvider-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider myAdapterFctoryContentProvier;
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::attributes-»
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «domainContentProviderClassName»() {
+ myAdapterFctoryContentProvier = new org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+ «EXPAND xpt::navigator::NavigatorContentProvider::initCommonAttributes-»
+}
+«ENDDEFINE»
+
+«DEFINE iTreeContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND getChildren-»
+
+ «EXPAND wrapEObjects-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::getParent-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::hasChildren-»
+«ENDDEFINE»
+
+«DEFINE getChildren FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof org.eclipse.core.resources.IFile) {
+ «EXPAND xpt::navigator::NavigatorContentProvider::getFileResoruce-»
+ return wrapEObjects(myAdapterFctoryContentProvier.getChildren(resource), parentElement);
+ }
+
+ if (parentElement instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ return wrapEObjects(myAdapterFctoryContentProvier.getChildren(((«getDomainNavigatorItemQualifiedClassName()») parentElement).getEObject()), parentElement);
+ }
+ «EXPAND getOtherChildren-»
+}
+«ENDDEFINE»
+
+«DEFINE getOtherChildren FOR gmfgen::GenNavigator-»
+return EMPTY_ARRAY;
+«ENDDEFINE»
+
+«DEFINE wrapEObjects FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] wrapEObjects(Object[] objects, Object parentElement) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] instanceof org.eclipse.emf.ecore.EObject) {
+ result.add(new «getDomainNavigatorItemQualifiedClassName()»((org.eclipse.emf.ecore.EObject) objects[i], parentElement, myAdapterFctoryContentProvier));
+ }
+ }
+ return result.toArray();
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/DomainNavigatorItem.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE DomainNavigatorItem FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «domainNavigatorItemClassName» extends org.eclipse.core.runtime.PlatformObject {
+
+ «EXPAND registerAdapterFactory-»
+
+ «EXPAND xpt::navigator::AbstractNavigatorItem::attributes-»
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND xpt::navigator::AbstractNavigatorItem::getParent-»
+
+ «EXPAND getEObject-»
+
+ «EXPAND getPropertySourceProvider-»
+
+ «EXPAND equals-»
+
+ «EXPAND hashCode-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE registerAdapterFactory FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+static {
+ final Class[] supportedTypes = new Class[] { org.eclipse.emf.ecore.EObject.class, org.eclipse.ui.views.properties.IPropertySource.class };
+ org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ «getDomainNavigatorItemQualifiedClassName()» domainNavigatorItem = («getDomainNavigatorItemQualifiedClassName()») adaptableObject;
+ org.eclipse.emf.ecore.EObject eObject = domainNavigatorItem.getEObject();
+ if (adapterType == org.eclipse.emf.ecore.EObject.class) {
+ return eObject;
+ }
+ if (adapterType == org.eclipse.ui.views.properties.IPropertySource.class) {
+ return domainNavigatorItem.getPropertySourceProvider().getPropertySource(eObject);
+ }
+ }
+
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, «getDomainNavigatorItemQualifiedClassName()».class);
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.ecore.EObject myEObject;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.views.properties.IPropertySourceProvider myPropertySourceProvider;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «domainNavigatorItemClassName»(org.eclipse.emf.ecore.EObject eObject, Object parent, org.eclipse.ui.views.properties.IPropertySourceProvider propertySourceProvider) {
+ myParent = parent;
+ myEObject = eObject;
+ myPropertySourceProvider = propertySourceProvider;
+}
+«ENDDEFINE»
+
+«DEFINE getEObject FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.emf.ecore.EObject getEObject() {
+ return myEObject;
+}
+«ENDDEFINE»
+
+«DEFINE getPropertySourceProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.ui.views.properties.IPropertySourceProvider getPropertySourceProvider() {
+ return myPropertySourceProvider;
+}
+«ENDDEFINE»
+
+«DEFINE equals FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean equals(Object obj) {
+ if (obj instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getEObject()).equals(org.eclipse.emf.ecore.util.EcoreUtil.getURI(((«getDomainNavigatorItemQualifiedClassName()») obj).getEObject()));
+ }
+ return super.equals(obj);
+}
+«ENDDEFINE»
+
+«DEFINE hashCode FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int hashCode() {
+ return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getEObject()).hashCode();
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/DomainNavigatorLabelProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE DomainNavigatorLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «domainLabelProviderClassName» implements org.eclipse.ui.navigator.ICommonLabelProvider {
+
+ «EXPAND attributes-»
+
+ «EXPAND iCommonLabelProvider-»
+
+ «EXPAND iLabelProvider-»
+
+ «EXPAND iBaseLabelProvider-»
+
+ «EXPAND xpt::navigator::NavigatorContentProvider::iMementoAware-»
+
+ «EXPAND iDescriptionProvider-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+«ENDDEFINE»
+
+«DEFINE iCommonLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
+}
+«ENDDEFINE»
+
+«DEFINE iLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND getImage-»
+
+ «EXPAND getText-»
+«ENDDEFINE»
+
+«DEFINE iBaseLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND addListener-»
+
+ «EXPAND dispose-»
+
+ «EXPAND isLabelProperty-»
+
+ «EXPAND removeListener-»
+«ENDDEFINE»
+
+«DEFINE iDescriptionProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getDescription(Object anElement) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE addListener FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void addListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.addListener(listener);
+}
+«ENDDEFINE»
+
+«DEFINE dispose FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ myAdapterFactoryLabelProvider.dispose();
+}
+«ENDDEFINE»
+
+«DEFINE isLabelProperty FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isLabelProperty(Object element, String property) {
+ return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+}
+«ENDDEFINE»
+
+«DEFINE removeListener FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void removeListener(org.eclipse.jface.viewers.ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.removeListener(listener);
+}
+«ENDDEFINE»
+
+«DEFINE getImage FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.swt.graphics.Image getImage(Object element) {
+ if (element instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ return myAdapterFactoryLabelProvider.getImage(«EXPAND getEObject»);
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getEObject FOR gmfgen::GenNavigator»((«getDomainNavigatorItemQualifiedClassName()») element).getEObject()«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getText(Object element) {
+ if (element instanceof «getDomainNavigatorItemQualifiedClassName()») {
+ return myAdapterFactoryLabelProvider.getText(«EXPAND getEObject»);
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/NavigatorActionProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2006,2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::navigator::Utils»
+
+«DEFINE NavigatorActionProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «actionProviderClassName» extends org.eclipse.ui.navigator.CommonActionProvider {
+
+ «EXPAND attributes-»
+
+ «EXPAND init-»
+
+ «EXPAND makeActions-»
+
+ «EXPAND fillActionBars-»
+
+ «EXPAND fillContextMenu-»
+
+ «EXPAND OpenDiagramAction-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean myContribute;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private OpenDiagramAction myOpenDiagramAction;
+«ENDDEFINE»
+
+«DEFINE init FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void init(org.eclipse.ui.navigator.ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ if (aSite.getViewSite() instanceof org.eclipse.ui.navigator.ICommonViewerWorkbenchSite) {
+ myContribute = true;
+ makeActions((org.eclipse.ui.navigator.ICommonViewerWorkbenchSite) aSite.getViewSite());
+ } else {
+ myContribute = false;
+ }
+}
+«ENDDEFINE»
+
+«DEFINE makeActions FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private void makeActions(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite viewerSite) {
+ myOpenDiagramAction = new OpenDiagramAction(viewerSite);
+}
+«ENDDEFINE»
+
+«DEFINE fillActionBars FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void fillActionBars(org.eclipse.ui.IActionBars actionBars) {
+ if (!myContribute) {
+ return;
+ }
+ org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) getContext().getSelection();
+ myOpenDiagramAction.selectionChanged(selection);
+ if (myOpenDiagramAction.isEnabled()) {
+ actionBars.setGlobalActionHandler(org.eclipse.ui.navigator.ICommonActionConstants.OPEN, myOpenDiagramAction);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE fillContextMenu FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void fillContextMenu(org.eclipse.jface.action.IMenuManager menu) {
+«REM»
+/*
+ * Put following code into the template to generate popup menu
+ *
+ if (!myContribute || getContext().getSelection().isEmpty()) {
+ return;
+ }
+
+ org.eclipse.jface.viewers.IStructuredSelection selection = (org.eclipse.jface.viewers.IStructuredSelection) getContext().getSelection();
+
+ myOpenDiagramAction.selectionChanged(selection);
+ if (myOpenDiagramAction.isEnabled()) {
+ menu.insertAfter(org.eclipse.ui.navigator.ICommonMenuConstants.GROUP_OPEN, myOpenDiagramAction);
+ }*/
+«ENDREM»«-»
+}
+«ENDDEFINE»
+
+«DEFINE OpenDiagramAction FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedClassComment»
+private class OpenDiagramAction extends org.eclipse.jface.action.Action {
+
+ «EXPAND ODA_attributes-»
+
+ «EXPAND ODA_constructor-»
+
+ «EXPAND ODA_selectionChanged-»
+
+ «EXPAND ODA_run-»
+
+ «EXPAND ODA_getEditorInput-»
+
+ «EXPAND ODA_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE ODA_attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.notation.Diagram myDiagram;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.navigator.ICommonViewerWorkbenchSite myViewerSite;
+«ENDDEFINE»
+
+«DEFINE ODA_constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public OpenDiagramAction(org.eclipse.ui.navigator.ICommonViewerWorkbenchSite viewerSite) {
+ super(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForOpenDiagramActionName()) FOR editorGen»);
+ myViewerSite = viewerSite;
+}
+«ENDDEFINE»
+
+«DEFINE ODA_selectionChanged FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public final void selectionChanged(org.eclipse.jface.viewers.IStructuredSelection selection) {
+ myDiagram = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof «getNavigatorItemQualifiedClassName()») {
+ selectedElement = ((«getNavigatorItemQualifiedClassName()») selectedElement).getView();
+ } else if (selectedElement instanceof org.eclipse.core.runtime.IAdaptable) {
+ selectedElement = ((org.eclipse.core.runtime.IAdaptable) selectedElement).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ }
+ if (selectedElement instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ org.eclipse.gmf.runtime.notation.Diagram diagram = (org.eclipse.gmf.runtime.notation.Diagram) selectedElement;
+ if («EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(diagram))) {
+ myDiagram = diagram;
+ }
+ }
+ }
+ setEnabled(myDiagram != null);
+}
+«ENDDEFINE»
+
+«DEFINE ODA_run FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void run() {
+ if (myDiagram == null || myDiagram.eResource() == null) {
+ return;
+ }
+
+ org.eclipse.ui.IEditorInput editorInput = getEditorInput();
+ org.eclipse.ui.IWorkbenchPage page = myViewerSite.getPage();
+ try {
+ page.openEditor(editorInput, «editorGen.editor.getQualifiedClassName()».ID);
+ } catch (org.eclipse.ui.PartInitException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Exception while openning diagram", e); «EXPAND xpt::Common::nonNLS»
+ }
+}
+«ENDDEFINE»
+
+«DEFINE ODA_getEditorInput FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.ui.IEditorInput getEditorInput() {
+ «IF null == editorGen.application-»
+ for (java.util.Iterator it = myDiagram.eResource().getContents().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.EObject nextEObject = (org.eclipse.emf.ecore.EObject) it.next();
+ if (nextEObject == myDiagram) {
+ return new org.eclipse.ui.part.FileEditorInput(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(myDiagram.eResource()));
+ }
+ if (nextEObject instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ break;
+ }
+ }
+ «ENDIF-»
+ «EXPAND xpt::navigator::getEditorInput::defineURIEditorInput("myDiagram") FOR editorGen.diagram-»
+ return editorInput;
+}
+«ENDDEFINE»
+
+«DEFINE ODA_additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForOpenDiagramActionName(), "Open Diagram")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForOpenDiagramActionName())-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/NavigatorContentProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,503 @@
+/*
+ * Copyright (c) 2006,2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::navigator::Utils»
+
+«DEFINE NavigatorContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «contentProviderClassName» implements org.eclipse.ui.navigator.ICommonContentProvider {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND iContentProvider-»
+
+ «EXPAND iStructuredContentProvider-»
+
+ «EXPAND iMementoAware-»
+
+ «EXPAND iCommonContentProvider-»
+
+ «EXPAND iTreeContentProvider-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static final Object[] EMPTY_ARRAY = new Object[0];
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.jface.viewers.Viewer myViewer;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain myEditingDomain;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.emf.workspace.util.WorkspaceSynchronizer myWorkspaceSynchronizer;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private Runnable myViewerRefreshRunnable;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «contentProviderClassName»() {
+ «EXPAND initCommonAttributes-»
+}
+«ENDDEFINE»
+
+«DEFINE initCommonAttributes FOR gmfgen::GenNavigator-»
+org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = «EXPAND createEditingDomain»;
+myEditingDomain = (org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain;
+myEditingDomain.setResourceToReadOnlyMap(new java.util.HashMap() {
+ public Object get(Object key) {
+ if (!containsKey(key)) {
+ put(key, Boolean.TRUE);
+ }
+ return super.get(key);
+ }
+});
+myViewerRefreshRunnable = new Runnable() {
+ public void run() {
+ if (myViewer != null) {
+ myViewer.refresh();
+ }
+ }
+};
+myWorkspaceSynchronizer = new org.eclipse.emf.workspace.util.WorkspaceSynchronizer(editingDomain, new org.eclipse.emf.workspace.util.WorkspaceSynchronizer.Delegate() {
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final org.eclipse.emf.ecore.resource.Resource resource) {
+ «EXPAND processChanges-»
+ }
+
+ public boolean handleResourceDeleted(org.eclipse.emf.ecore.resource.Resource resource) {
+ «EXPAND processChanges-»
+ }
+
+ public boolean handleResourceMoved(org.eclipse.emf.ecore.resource.Resource resource, final org.eclipse.emf.common.util.URI newURI) {
+ «EXPAND processChanges-»
+ }
+});
+«ENDDEFINE»
+
+«DEFINE processChanges FOR gmfgen::GenNavigator-»
+for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource nextResource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ nextResource.unload();
+}
+if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+}
+return true;
+«ENDDEFINE»
+
+«DEFINE iContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND dispose-»
+
+ «EXPAND inputChanged-»
+«ENDDEFINE»
+
+«DEFINE dispose FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void dispose() {
+ myWorkspaceSynchronizer.dispose();
+ myWorkspaceSynchronizer = null;
+ myViewerRefreshRunnable = null;
+ for (java.util.Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.resource.Resource resource = (org.eclipse.emf.ecore.resource.Resource) it.next();
+ resource.unload();
+ }
+ ((org.eclipse.emf.transaction.TransactionalEditingDomain) myEditingDomain).dispose();
+ myEditingDomain = null;
+}
+«ENDDEFINE»
+
+«DEFINE inputChanged FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void inputChanged(org.eclipse.jface.viewers.Viewer viewer, Object oldInput, Object newInput) {
+ myViewer = viewer;
+}
+«ENDDEFINE»
+
+«DEFINE iStructuredContentProvider FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+}
+«ENDDEFINE»
+
+«DEFINE iMementoAware FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void restoreState(org.eclipse.ui.IMemento aMemento) {
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+public void saveState(org.eclipse.ui.IMemento aMemento) {
+}
+«ENDDEFINE»
+
+«DEFINE iCommonContentProvider FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
+}
+«ENDDEFINE»
+
+«DEFINE iTreeContentProvider FOR gmfgen::GenNavigator-»
+ «EXPAND getChildren-»
+
+ «EXPAND getParent-»
+
+ «EXPAND hasChildren-»
+«ENDDEFINE»
+
+«DEFINE getChildren FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof org.eclipse.core.resources.IFile) {
+ «EXPAND getFileChildren-»
+ }
+
+ if (parentElement instanceof «getNavigatorGroupQualifiedClassName()») {
+ «EXPAND getGroupChildren-»
+ }
+
+ if (parentElement instanceof «getNavigatorItemQualifiedClassName()») {
+ «EXPAND getItemChildren-»
+ }
+
+ «IF editorGen.diagram.generateShortcutIcon()-»
+ «EXPAND getAdaptableChildren»
+ «ENDIF-»
+ «EXPAND getOtherChildren-»
+}
+
+ «EXPAND getViewChildren-»
+
+ «EXPAND utilityMethods-»
+«ENDDEFINE»
+
+«DEFINE getParent FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public Object getParent(Object element) {
+ if (element instanceof «getAbstractNavigatorItemQualifiedClassName()») {
+ «getAbstractNavigatorItemQualifiedClassName()» abstractNavigatorItem = («getAbstractNavigatorItemQualifiedClassName()») element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE hasChildren FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+public boolean hasChildren(Object element) {
+ return element instanceof org.eclipse.core.resources.IFile || getChildren(element).length > 0;
+}
+«ENDDEFINE»
+
+«DEFINE getFileChildren FOR gmfgen::GenNavigator-»
+ «EXPAND getFileResoruce-»
+java.util.Collection result = new java.util.ArrayList();
+ «LET getChildReferencesFrom(this, null) AS references-»
+ «EXPAND initGroupVariables(this, references, 'file', null) FOREACH getGroupNames(references)-»
+ «FOREACH references AS ref-»
+ «EXPAND addNavigatorItemsPrefix FOR ref»selectViewsByType(resource.getContents(), «EXPAND getChildViewType FOR ref.child»)«EXPAND addNavigatorItemsSuffix('file', false) FOR ref-»
+ «ENDFOREACH-»
+ «EXPAND addGroups(references) FOREACH getGroupNames(references)-»
+ «ENDLET-»
+return result.toArray();
+«ENDDEFINE»
+
+«DEFINE getFileResoruce FOR gmfgen::GenNavigator-»
+org.eclipse.core.resources.IFile file = (org.eclipse.core.resources.IFile) parentElement;
+org.eclipse.emf.common.util.URI fileURI = org.eclipse.emf.common.util.URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+org.eclipse.emf.ecore.resource.Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
+«ENDDEFINE»
+
+«DEFINE getGroupChildren FOR gmfgen::GenNavigator-»
+«getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») parentElement;
+return group.getChildren();
+«ENDDEFINE»
+
+«DEFINE getItemChildren FOR gmfgen::GenNavigator-»
+«getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») parentElement;
+if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
+ return EMPTY_ARRAY;
+}
+return getViewChildren(navigatorItem.getView(), parentElement);
+«ENDDEFINE»
+
+«DEFINE getAdaptableChildren FOR gmfgen::GenNavigator-»
+/*
+ * Due to plugin.xml restrictions this code will be called only for views representing
+ * shortcuts to this diagram elements created on other diagrams.
+*/
+if (parentElement instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) parentElement).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null) {
+ return getViewChildren(view, parentElement);
+ }
+}
+«ENDDEFINE»
+
+«DEFINE getOtherChildren FOR gmfgen::GenNavigator-»
+return EMPTY_ARRAY;
+«ENDDEFINE»
+
+«DEFINE getViewChildren FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+private Object[] getViewChildren(org.eclipse.gmf.runtime.notation.View view, Object parentElement) {
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
+ «EXPAND caseNavigatorNode(this) FOREACH getNavigatorContainerNodes(this)-»
+ }
+ return EMPTY_ARRAY;
+}
+«ENDDEFINE»
+
+«DEFINE utilityMethods FOR gmfgen::GenNavigator-»
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getLinksSourceByType(java.util.Collection edges, int visualID) {
+ java.util.Collection result = new java.util.ArrayList();
+ «EXPAND getTypeByVID FOR editorGen.diagram-»
+ for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+ org.eclipse.gmf.runtime.notation.View nextEdgeSource = nextEdge.getSource();
+ if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
+ result.add(nextEdgeSource);
+ }
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+ private java.util.Collection getLinksTargetByType(java.util.Collection edges, int visualID) {
+ java.util.Collection result = new java.util.ArrayList();
+ «EXPAND getTypeByVID FOR editorGen.diagram-»
+ for (java.util.Iterator it = edges.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Edge nextEdge = (org.eclipse.gmf.runtime.notation.Edge) it.next();
+ org.eclipse.gmf.runtime.notation.View nextEdgeTarget = nextEdge.getTarget();
+ if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
+ result.add(nextEdgeTarget);
+ }
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+ private java.util.Collection getOutgoingLinksByType(java.util.Collection nodes, int visualID) {
+ java.util.Collection result = new java.util.ArrayList();
+ «EXPAND getTypeByVID FOR editorGen.diagram-»
+ for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
+ result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getIncomingLinksByType(java.util.Collection nodes, int visualID) {
+ java.util.Collection result = new java.util.ArrayList();
+ «EXPAND getTypeByVID FOR editorGen.diagram-»
+ for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
+ result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getChildrenByType(java.util.Collection nodes, int visualID) {
+ java.util.Collection result = new java.util.ArrayList();
+ «EXPAND getTypeByVID FOR editorGen.diagram-»
+ for (java.util.Iterator it = nodes.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextNode = (org.eclipse.gmf.runtime.notation.View) it.next();
+ result.addAll(selectViewsByType(nextNode.getChildren(), type));
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getDiagramLinksByType(java.util.Collection diagrams, int visualID) {
+ java.util.Collection result = new java.util.ArrayList();
+ «EXPAND getTypeByVID FOR editorGen.diagram-»
+ for (java.util.Iterator it = diagrams.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.Diagram nextDiagram = (org.eclipse.gmf.runtime.notation.Diagram) it.next();
+ result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection selectViewsByType(java.util.Collection views, String type) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = views.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
+ if (type.equals(nextView.getType()) && isOwnView(nextView)) {
+ result.add(nextView);
+ }
+ }
+ return result;
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
+ return «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(view));
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection createNavigatorItems(java.util.Collection views, Object parent, boolean isLeafs) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = views.iterator(); it.hasNext();) {
+ result.add(new «getNavigatorItemQualifiedClassName()»((org.eclipse.gmf.runtime.notation.View) it.next(), parent, isLeafs));
+ }
+ return result;
+}
+«EXPAND getForeignShortcuts-»
+«ENDDEFINE»
+
+«DEFINE getTypeByVID FOR gmfgen::GenDiagram-»
+String type = «EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall»(visualID);
+«ENDDEFINE»
+
+«DEFINE getType(String varName) FOR gmfgen::GenDiagram»«EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall»(«varName»)«ENDDEFINE»
+
+«DEFINE getForeignShortcuts FOR gmfgen::GenNavigator-»
+ «IF editorGen.diagram.generateCreateShortcutAction() && getChildReferencesFrom(this, editorGen.diagram).size() > 0-»
+
+«EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection getForeignShortcuts(org.eclipse.gmf.runtime.notation.Diagram diagram, Object parent) {
+ java.util.Collection result = new java.util.ArrayList();
+ for (java.util.Iterator it = diagram.getChildren().iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.notation.View nextView = (org.eclipse.gmf.runtime.notation.View) it.next();
+ if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
+ result.add(nextView);
+ }
+ }
+ return createNavigatorItems(result, parent, false);
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE createEditingDomain FOR gmfgen::GenNavigator»org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory.INSTANCE.createEditingDomain()«ENDDEFINE»
+
+«DEFINE initGroupVariables(gmfgen::GenNavigator navigator, List[gmfgen::GenNavigatorChildReference] references, String parentVarName, gmfgen::GenCommonBase contextElement) FOR String-»
+ «navigator.getNavigatorGroupQualifiedClassName()» «asValidJavaIdentifier(this)» = new «navigator.getNavigatorGroupQualifiedClassName()»(
+ «EXPAND xpt::Externalizer::accessorCall(i18nKeyForGroup(this, contextElement)) FOR navigator.editorGen»,
+ "«getNavigatorReference(this, references).groupIcon»", «parentVarName»); «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE addNavigatorItemsPrefix FOR gmfgen::GenNavigatorChildReference»«IF isInsideGroup()»«asValidJavaIdentifier(groupName)».addChildren(«ELSE»result.addAll(«ENDIF»createNavigatorItems(«ENDDEFINE»
+
+«DEFINE addNavigatorItemsSuffix(String parentVarName, Boolean isLeaf) FOR gmfgen::GenNavigatorChildReference-»
+, «IF isInsideGroup()»«asValidJavaIdentifier(groupName)»«ELSE»«parentVarName»«ENDIF», «isLeaf»));
+«ENDDEFINE»
+
+«DEFINE addGroups(List[gmfgen::GenNavigatorChildReference] references) FOR String-»
+ «LET getNavigatorReference(this, references) AS ref-»
+ «IF ref.hideIfEmpty-»
+ if (!«asValidJavaIdentifier(this)».isEmpty()) {«ENDIF-»
+ result.add(«asValidJavaIdentifier(this)»);
+ «IF ref.hideIfEmpty-»
+ }«ENDIF-»
+ «ENDLET-»
+«ENDDEFINE»
+
+«DEFINE getChildViewType FOR gmfgen::GenDiagram»«EXPAND xpt::editor::VisualIDRegistry::modelID»«ENDDEFINE»
+
+«DEFINE getChildViewType FOR gmfgen::GenCommonBase»«EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR getDiagram()»(«EXPAND xpt::editor::VisualIDRegistry::visualID»)«ENDDEFINE»
+
+«DEFINE caseNavigatorNode(gmfgen::GenNavigator navigator) FOR gmfgen::GenCommonBase»
+«EXPAND xpt::Common::caseVisualID» {
+ java.util.Collection result = new java.util.ArrayList();
+ «EXPAND addForeignShortcuts FOR this-»
+ «LET getChildReferencesFrom(navigator, this) AS references-»
+ «EXPAND initGroupVariables(navigator, references, 'parentElement', this) FOREACH getGroupNames(references)-»
+ «FOREACH references AS reference ITERATOR referencesIterator-»
+ «FOREACH reference.findConnectionPaths() AS path ITERATOR pathsIterator-»
+ «FOREACH path.segments AS segment ITERATOR segmentsIterator-»
+ «IF referencesIterator.isFirstIteration() && pathsIterator.isFirstIteration() && segmentsIterator.isFirstIteration()»java.util.Collection «ENDIF-»
+ connectedViews = «EXPAND childrenMethodName(reference.referenceType, segment) FOR segment.from-»
+ («IF segmentsIterator.isFirstIteration()»java.util.Collections.singleton(view)«ELSE»connectedViews«ENDIF-»
+ , «EXPAND xpt::editor::VisualIDRegistry::visualID FOR segment.to»);
+ «ENDFOREACH-»
+ «EXPAND addNavigatorItemsPrefix FOR reference»connectedViews«EXPAND addNavigatorItemsSuffix('parentElement', reference.referenceType.value != gmfgen::GenNavigatorReferenceType::children.value) FOR reference-»
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ «EXPAND addGroups(references) FOREACH getGroupNames(references)-»
+ «ENDLET-»
+ return result.toArray();
+}
+«ENDDEFINE»
+
+«DEFINE addForeignShortcuts FOR gmfgen::GenDiagram-»
+ «IF generateCreateShortcutAction()-»
+result.addAll(getForeignShortcuts((org.eclipse.gmf.runtime.notation.Diagram) view, parentElement));
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE addForeignShortcuts FOR gmfgen::GenCommonBase»«ENDDEFINE»
+
+«DEFINE childrenMethodName(gmfgen::GenNavigatorReferenceType referenceType, gmfgen::GenNavigatorPathSegment segment) FOR gmfgen::GenLink-»
+ «IF referenceType.value == gmfgen::GenNavigatorReferenceType::out_target.value»getLinksTargetByType«ELSE»getLinksSourceByType«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE childrenMethodName(gmfgen::GenNavigatorReferenceType referenceType, gmfgen::GenNavigatorPathSegment segment) FOR gmfgen::GenCommonBase-»
+ «IF referenceType.value == gmfgen::GenNavigatorReferenceType::out_target.value-»
+ getOutgoingLinksByType«ELSEIF referenceType.value == gmfgen::GenNavigatorReferenceType::in_source.value-»
+ getIncomingLinksByType«ELSE-»
+ «IF {segment.from}.typeSelect(gmfgen::GenDiagram).size() > 0 && {segment.to}.typeSelect(gmfgen::GenLink).size() > 0-»
+ getDiagramLinksByType«ELSE-»
+ getChildrenByType«ENDIF-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenNavigator-»
+ «LET getChildReferencesFrom(this, null) AS references-»
+ «EXPAND internal_i18nAccessors(null) FOREACH getGroupNames(references)-»
+ «ENDLET-»
+ «FOREACH getNavigatorContainerNodes(this) AS contextElement-»
+ «LET getChildReferencesFrom(this, contextElement) AS references-»
+ «EXPAND internal_i18nAccessors(contextElement) FOREACH getGroupNames(references)-»
+ «ENDLET-»
+ «ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE internal_i18nAccessors(gmfgen::GenCommonBase contextElement) FOR String-»
+«IF null != this»«EXPAND xpt::Externalizer::accessorField(i18nKeyForGroup(contextElement))»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenNavigator-»
+«LET getChildReferencesFrom(this, null) AS references-»
+«EXPAND internal_i18nValues(null) FOREACH getGroupNames(references)-»
+«ENDLET-»
+«FOREACH getNavigatorContainerNodes(this) AS contextElement-»
+«LET getChildReferencesFrom(this, contextElement) AS references-»
+«EXPAND internal_i18nValues(contextElement) FOREACH getGroupNames(references)-»
+«ENDLET-»
+«ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE internal_i18nValues(gmfgen::GenCommonBase contextElement) FOR String-»
+«IF null != this»«EXPAND xpt::Externalizer::messageEntry(i18nKeyForGroup(contextElement), this)»«ENDIF-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/NavigatorGroup.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE NavigatorGroup FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «navigatorGroupClassName» extends «getAbstractNavigatorItemQualifiedClassName()» {
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND getGroupName-»
+
+ «EXPAND getIcon-»
+
+ «EXPAND getChildren-»
+
+ «EXPAND addChildren-»
+
+ «EXPAND addChild-»
+
+ «EXPAND isEmpty-»
+
+ «EXPAND equals-»
+
+ «EXPAND hashCode-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private String myGroupName;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private String myIcon;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private java.util.Collection myChildren = new java.util.LinkedList();
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+«navigatorGroupClassName»(String groupName, String icon, Object parent) {
+ super(parent);
+ myGroupName = groupName;
+ myIcon = icon;
+}
+«ENDDEFINE»
+
+«DEFINE getGroupName FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getGroupName() {
+ return myGroupName;
+}
+«ENDDEFINE»
+
+«DEFINE getIcon FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getIcon() {
+ return myIcon;
+}
+«ENDDEFINE»
+
+«DEFINE getChildren FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public Object[] getChildren() {
+ return myChildren.toArray();
+}
+«ENDDEFINE»
+
+«DEFINE addChildren FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void addChildren(java.util.Collection children) {
+ myChildren.addAll(children);
+}
+«ENDDEFINE»
+
+«DEFINE addChild FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void addChild(Object child) {
+ myChildren.add(child);
+}
+«ENDDEFINE»
+
+«DEFINE isEmpty FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isEmpty() {
+ return myChildren.size() == 0;
+}
+«ENDDEFINE»
+
+«DEFINE equals FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean equals(Object obj) {
+ if (obj instanceof «getNavigatorGroupQualifiedClassName()») {
+ «getNavigatorGroupQualifiedClassName()» anotherGroup = («getNavigatorGroupQualifiedClassName()») obj;
+ if (getGroupName().equals(anotherGroup.getGroupName())) {
+ return getParent().equals(anotherGroup.getParent());
+ }
+ }
+ return super.equals(obj);
+}
+«ENDDEFINE»
+
+«DEFINE hashCode FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int hashCode() {
+ return getGroupName().hashCode();
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/NavigatorItem.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE NavigatorItem FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «navigatorItemClassName» extends «getAbstractNavigatorItemQualifiedClassName()» {
+
+ «EXPAND registerAdapterFactory-»
+
+ «EXPAND attributes-»
+
+ «EXPAND constructor-»
+
+ «EXPAND getView-»
+
+ «EXPAND isLeaf-»
+
+ «EXPAND equals-»
+
+ «EXPAND hashCode-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE registerAdapterFactory FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+static {
+ final Class[] supportedTypes = new Class[] { org.eclipse.gmf.runtime.notation.View.class, org.eclipse.emf.ecore.EObject.class };
+ org.eclipse.core.runtime.Platform.getAdapterManager().registerAdapters(new org.eclipse.core.runtime.IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof «getNavigatorItemQualifiedClassName()» && (adapterType == org.eclipse.gmf.runtime.notation.View.class || adapterType == org.eclipse.emf.ecore.EObject.class)) {
+ return ((«getNavigatorItemQualifiedClassName()») adaptableObject).getView();
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, «getNavigatorItemQualifiedClassName()».class);
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.notation.View myView;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean myLeaf = false;
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public «navigatorItemClassName»(org.eclipse.gmf.runtime.notation.View view, Object parent, boolean isLeaf) {
+ super(parent);
+ myView = view;
+ myLeaf = isLeaf;
+}
+«ENDDEFINE»
+
+«DEFINE getView FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.gmf.runtime.notation.View getView() {
+ return myView;
+}
+«ENDDEFINE»
+
+«DEFINE isLeaf FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean isLeaf() {
+ return myLeaf;
+}
+«ENDDEFINE»
+
+«DEFINE equals FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean equals(Object obj) {
+ if (obj instanceof «getNavigatorItemQualifiedClassName()») {
+ return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getView()).equals(org.eclipse.emf.ecore.util.EcoreUtil.getURI(((«getNavigatorItemQualifiedClassName()») obj).getView()));
+ }
+ return super.equals(obj);
+}
+«ENDDEFINE»
+
+«DEFINE hashCode FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int hashCode() {
+ return org.eclipse.emf.ecore.util.EcoreUtil.getURI(getView()).hashCode();
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/NavigatorLabelProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,446 @@
+/*
+ * Copyright (c) 2006, 2008 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::navigator::Utils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE NavigatorLabelProvider FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «labelProviderClassName» extends org.eclipse.jface.viewers.LabelProvider implements org.eclipse.ui.navigator.ICommonLabelProvider, org.eclipse.jface.viewers.ITreePathLabelProvider {
+
+ «EXPAND staticInitializer-»
+
+ «EXPAND updateLabel-»
+
+ «EXPAND getImage-»
+
+ «EXPAND getViewImage-»
+
+ «EXPAND getImageByKey-»
+
+ «EXPAND getText-»
+
+ «EXPAND getViewText-»
+
+ «EXPAND getTextMethod FOREACH getNavigatorContainedNodes(this)-»
+
+ «EXPAND getUnknownElementText-»
+
+ «EXPAND getUnresolvedDomainElementProxyText-»
+
+ «EXPAND init-»
+
+ «EXPAND restoreState-»
+
+ «EXPAND saveState-»
+
+ «EXPAND getDescription-»
+
+ «EXPAND isOwnView-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE staticInitializer FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+static {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry().put(«EXPAND unknownElementKey», org.eclipse.jface.resource.ImageDescriptor.getMissingImageDescriptor()); «EXPAND xpt::Common::nonNLS»
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry().put(«EXPAND notFoundElementKey», org.eclipse.jface.resource.ImageDescriptor.getMissingImageDescriptor()); «EXPAND xpt::Common::nonNLS»
+}
+«ENDDEFINE»
+
+«DEFINE updateLabel FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void updateLabel(org.eclipse.jface.viewers.ViewerLabel label, org.eclipse.jface.viewers.TreePath elementPath) {
+ Object element = elementPath.getLastSegment();
+ if (element instanceof «getNavigatorItemQualifiedClassName()» && !isOwnView(((«getNavigatorItemQualifiedClassName()») element).getView())) {
+ return;
+ }
+ label.setText(getText(element));
+ label.setImage(getImage(element));
+}
+«ENDDEFINE»
+
+«DEFINE getImage FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.swt.graphics.Image getImage(Object element) {
+ «EXPAND getNavigatorGroupImage-»
+
+ «EXPAND getNavigatorItemImage-»
+
+ «EXPAND getAdaptableImage-»
+
+ «EXPAND getAdditionalInputImage-»
+ return super.getImage(element);
+}
+«ENDDEFINE»
+
+«DEFINE getNavigatorGroupImage FOR gmfgen::GenNavigator-»
+if (element instanceof «getNavigatorGroupQualifiedClassName()») {
+ «getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») element;
+ return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getBundledImage(group.getIcon());
+}
+«ENDDEFINE»
+
+«DEFINE getNavigatorItemImage FOR gmfgen::GenNavigator-»
+if (element instanceof «getNavigatorItemQualifiedClassName()») {
+ «getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return super.getImage(element);
+ }
+ return getImage(navigatorItem.getView());
+}
+«ENDDEFINE»
+
+«DEFINE getAdaptableImage FOR gmfgen::GenNavigator-»
+«IF editorGen.diagram.generateShortcutIcon()-»
+// Due to plugin.xml content will be called only for "own" views
+if (element instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null && isOwnView(view)) {
+ return getImage(view);
+ }
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getAdditionalInputImage FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE getViewImage FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.swt.graphics.Image getImage(org.eclipse.gmf.runtime.notation.View view) {
+ «IF !getNavigatorContainedNodes(this).isEmpty()-»
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
+ «EXPAND caseImage FOREACH getNavigatorContainedNodes(this)-»
+ }
+ «ENDIF-»
+ return getImage(«EXPAND unknownElementKey», null); «EXPAND xpt::Common::nonNLS»
+}
+«ENDDEFINE»
+
+«DEFINE caseImage FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::caseVisualID»
+ return getImage("«EXPAND key»", «IF null != elementType»«getDiagram().getElementTypesQualifiedClassName()».«getUniqueIdentifier()»«ELSE»null«ENDIF»); «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE getImageByKey FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.swt.graphics.Image getImage(String key, org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
+ org.eclipse.jface.resource.ImageRegistry imageRegistry = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getImageRegistry();
+ org.eclipse.swt.graphics.Image image = imageRegistry.get(key);
+ if (image == null && elementType != null && «editorGen.diagram.getElementTypesQualifiedClassName()».isKnownElementType(elementType)) {
+ image = «editorGen.diagram.getElementTypesQualifiedClassName()».getImage(elementType);
+ imageRegistry.put(key, image);
+ }
+
+ if (image == null) {
+ image = imageRegistry.get(«EXPAND notFoundElementKey»); «EXPAND xpt::Common::nonNLS»
+ imageRegistry.put(key, image);
+ }
+ return image;
+}
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getText(Object element) {
+ «EXPAND getNavigatorGroupText-»
+
+ «EXPAND getNavigatorItemText-»
+
+ «EXPAND getAdaptableText-»
+
+ «EXPAND getAdditionalInputText-»
+ return super.getText(element);
+}
+«ENDDEFINE»
+
+«DEFINE getNavigatorGroupText FOR gmfgen::GenNavigator-»
+if (element instanceof «getNavigatorGroupQualifiedClassName()») {
+ «getNavigatorGroupQualifiedClassName()» group = («getNavigatorGroupQualifiedClassName()») element;
+ return group.getGroupName();
+}
+«ENDDEFINE»
+
+«DEFINE getNavigatorItemText FOR gmfgen::GenNavigator-»
+if (element instanceof «getNavigatorItemQualifiedClassName()») {
+ «getNavigatorItemQualifiedClassName()» navigatorItem = («getNavigatorItemQualifiedClassName()») element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return null;
+ }
+ return getText(navigatorItem.getView());
+ }
+«ENDDEFINE»
+
+«DEFINE getAdaptableText FOR gmfgen::GenNavigator-»
+«IF editorGen.diagram.generateShortcutIcon()-»
+// Due to plugin.xml content will be called only for "own" views
+if (element instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null && isOwnView(view)) {
+ return getText(view);
+ }
+}
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getAdditionalInputText FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
+
+«DEFINE getViewText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getText(org.eclipse.gmf.runtime.notation.View view) {
+ if (view.getElement() != null && view.getElement().eIsProxy()) {
+ return getUnresolvedDomainElementProxyText(view);
+ }
+ «IF !getNavigatorContainedNodes(this).isEmpty()-»
+ switch («EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(view)) {
+ «EXPAND caseText FOREACH getNavigatorContainedNodes(this)-»
+ }
+ «ENDIF-»
+ return getUnknownElementText(view);
+}
+«ENDDEFINE»
+
+«DEFINE caseText FOR gmfgen::GenCommonBase-»
+«EXPAND xpt::Common::caseVisualID»
+ return «EXPAND getTextMethodName»(view);
+«ENDDEFINE»
+
+«DEFINE getTextMethodName FOR gmfgen::GenCommonBase»get«getUniqueIdentifier()»Text«ENDDEFINE»
+
+«DEFINE getTextMethod FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private String «EXPAND getTextMethodName»(org.eclipse.gmf.runtime.notation.View view) {
+ «EXPAND getText-»
+}
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenCommonBase»«ERROR "Incorrect GenCommonBase: " + this»«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenDiagram-»
+ «EXPAND getLabelFeatureText(domainDiagramElement)-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenChildLabelNode-»
+«IF labelModelFacet == null-»
+ «EXPAND getDiagramLabelTextNoModelFacet(this)-»
+«ELSE-»
+ «EXPAND getDiagramLabelText(this, this) FOR labelModelFacet-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenLinkLabel-»
+ «EXPAND getDiagramLabelText(link, this) FOR modelFacet-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenNodeLabel-»
+ «EXPAND getDiagramLabelText(node, this) FOR modelFacet-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenNode-»
+ «IF labels.isEmpty()-»
+ «EXPAND getLabelFeatureText(modelFacet.metaClass)-»
+ «ELSE-»
+ «EXPAND getDiagramLabelText(labels)-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenLink-»
+ «IF labels.isEmpty()-»
+ «EXPAND getText(modelFacet)-»
+ «ELSE-»
+ «EXPAND getDiagramLabelText(labels)-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getDiagramLabelText(List[gmfgen::GenLabel] labels) FOR gmfgen::GenCommonBase-»
+ «IF labels.isEmpty()-»
+ «ERROR "Empty list of labels passed"-»
+ «ENDIF-»
+ «LET (gmfgen::GenLabel) labels.first() AS label-»
+ «IF label.modelFacet == null-»
+ «EXPAND getDiagramLabelTextNoModelFacet(label)-»
+ «ELSE-»
+ «EXPAND getDiagramLabelText(this, label) FOR label.modelFacet-»
+ «ENDIF»
+ «ENDLET-»
+«ENDDEFINE»
+
+«REM»FIXME: Refactor. This is a fast copy of getDiagramLabelText template (below) to fix #193178. Need to reuse parts of TextAware.xpt«ENDREM»
+«DEFINE getDiagramLabelTextNoModelFacet(gmfgen::GenCommonBase label) FOR gmfgen::GenCommonBase»
+ org.eclipse.core.runtime.IAdaptable hintAdapter = new «getDiagram().getParserProviderQualifiedClassName()».HintAdapter(
+ «getDiagram().getElementTypesQualifiedClassName()».«getUniqueIdentifier()»,
+ (view.getElement() != null ? view.getElement() : view),
+ «EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR label.getDiagram()»(«EXPAND xpt::editor::VisualIDRegistry::visualID FOR label»));
+ org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().getParser(hintAdapter);
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE.intValue());
+ } else {
+ «EXPAND returnEmptyString-»
+ }
+«ENDDEFINE»
+
+«DEFINE getText(gmfgen::LinkModelFacet modelFacet) FOR gmfgen::GenLink-»
+ «EXPAND returnEmptyString-»
+«ENDDEFINE»
+
+«DEFINE getText(gmfgen::TypeLinkModelFacet modelFacet) FOR gmfgen::GenLink-»
+ «EXPAND getLabelFeatureText(modelFacet.metaClass)-»
+«ENDDEFINE»
+
+«DEFINE getText FOR gmfgen::GenCompartment-»
+return "«title»"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE getDiagramLabelText(gmfgen::GenCommonBase elementTypeHolder, gmfgen::GenCommonBase hintHolder) FOR gmfgen::LabelModelFacet-»
+org.eclipse.core.runtime.IAdaptable hintAdapter = new «elementTypeHolder.getDiagram().getParserProviderQualifiedClassName()».HintAdapter(«elementTypeHolder.getDiagram().getElementTypesQualifiedClassName()».«elementTypeHolder.getUniqueIdentifier()», (view.getElement() != null ? view.getElement() : view), «EXPAND hint(hintHolder)»);
+org.eclipse.gmf.runtime.common.ui.services.parser.IParser parser = org.eclipse.gmf.runtime.common.ui.services.parser.ParserService.getInstance().getParser(hintAdapter);
+
+if (parser != null) {
+ return parser.getPrintString(hintAdapter, org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions.NONE.intValue());
+} else {
+ «hintHolder.getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Parser was not found for label " + «hintHolder.visualID»); «EXPAND xpt::Common::nonNLS»
+ «EXPAND returnEmptyString-»
+}
+«ENDDEFINE»
+
+«DEFINE hint(gmfgen::GenCommonBase hintHolder) FOR gmfgen::LabelModelFacet»«EXPAND xpt::editor::VisualIDRegistry::getTypeMethodCall FOR hintHolder.getDiagram()»(«EXPAND xpt::editor::VisualIDRegistry::visualID FOR hintHolder»)«ENDDEFINE»
+
+«DEFINE hint(gmfgen::GenCommonBase hintHolder) FOR gmfgen::DesignLabelModelFacet»org.eclipse.gmf.runtime.common.ui.services.parser.CommonParserHint.DESCRIPTION«ENDDEFINE»
+
+«DEFINE getLabelFeatureText(genmodel::GenClass genClass) FOR gmfgen::GenCommonBase-»
+ «IF null != genClass && null != genClass.labelFeature-»
+«EXPAND MetaModel::DeclareAndAssign("domainModelElement", "view.getElement()") FOR genClass»
+if (domainModelElement != null) {
+ return «IF !isStringFeature(genClass.labelFeature)»String.valueOf(«ENDIF»«EXPAND MetaModel::getFeatureValue("domainModelElement", genClass) FOR genClass.labelFeature»«IF !isStringFeature(genClass.labelFeature)»)«ENDIF»;
+} else {
+ «getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("No domain element for view with visualID = " + «visualID»); «EXPAND xpt::Common::nonNLS»
+ «EXPAND returnEmptyString-»
+}
+ «ELSE-»
+ «EXPAND returnEmptyString-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE returnEmptyString FOR Object-»
+return ""; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE getUnknownElementText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private String getUnknownElementText(org.eclipse.gmf.runtime.notation.View view) {
+ return "<UnknownElement Visual_ID = " + view.getType() + ">"; «EXPAND xpt::Common::nonNLS(1)» «EXPAND xpt::Common::nonNLS(2)»
+}
+«ENDDEFINE»
+
+«DEFINE getUnresolvedDomainElementProxyText FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private String getUnresolvedDomainElementProxyText(org.eclipse.gmf.runtime.notation.View view) {
+ return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; «EXPAND xpt::Common::nonNLS(1)» «EXPAND xpt::Common::nonNLS(2)»
+}
+«ENDDEFINE»
+
+«DEFINE init FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void init(org.eclipse.ui.navigator.ICommonContentExtensionSite aConfig) {
+}
+«ENDDEFINE»
+
+«DEFINE restoreState FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void restoreState(org.eclipse.ui.IMemento aMemento) {
+}
+«ENDDEFINE»
+
+«DEFINE saveState FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void saveState(org.eclipse.ui.IMemento aMemento) {
+}
+«ENDDEFINE»
+
+«DEFINE getDescription FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public String getDescription(Object anElement) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE isOwnView FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private boolean isOwnView(org.eclipse.gmf.runtime.notation.View view) {
+ return «EXPAND xpt::editor::VisualIDRegistry::modelID FOR editorGen.diagram».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall FOR editorGen.diagram»(view));
+}
+«ENDDEFINE»
+
+«DEFINE unknownElementKey FOR Object»"«EXPAND commonKeyPrefix»UnknownElement"«ENDDEFINE»
+
+«DEFINE notFoundElementKey FOR Object»"«EXPAND commonKeyPrefix»ImageNotFound"«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenCommonBase»«ERROR "Incorrect GenCommonBase: " + this»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenDiagram»«EXPAND commonKeyPrefix»Diagram?«EXPAND keyFragment FOR domainDiagramElement»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenNode»«EXPAND commonKeyPrefix»«EXPAND keyFragment»«IF null != modelFacet»«EXPAND keyFragment FOR modelFacet.metaClass»«ELSE»«EXPAND keyFragment FOR viewmap»«ENDIF»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::GenNode»Node?«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::GenTopLevelNode»TopLevelNode?«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenLink»«EXPAND commonKeyPrefix»Link?«IF null != modelFacet»«EXPAND keyFragment FOR modelFacet»«ELSE»«EXPAND keyFragment FOR viewmap»«ENDIF»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::LinkModelFacet»«ERROR "Incorrect link model facet passed: " + this»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::TypeLinkModelFacet»«EXPAND keyFragment FOR metaClass»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::FeatureLinkModelFacet»«EXPAND keyFragment FOR metaFeature»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenCompartment»«EXPAND key FOR node»?Compartment?«title»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenLabel»«ERROR "Incorrect GenLabel:" + this»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenNodeLabel»«EXPAND key FOR node»«EXPAND keyFragment»«ENDDEFINE»
+
+«DEFINE key FOR gmfgen::GenLinkLabel»«EXPAND key FOR link»«EXPAND keyFragment»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::GenLabel»?Label?«EXPAND keyFragment(this) FOR modelFacet»«ENDDEFINE»
+
+«DEFINE keyFragment FOR genmodel::GenClass»«genPackage.ecorePackage.nsURI»?«ecoreClass.name»«ENDDEFINE»
+
+«DEFINE keyFragment FOR genmodel::GenFeature»«EXPAND keyFragment FOR genClass»?«ecoreFeature.name»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::Viewmap»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::FigureViewmap»«figureQualifiedClassName»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::InnerClassViewmap»«className»«ENDDEFINE»
+
+«DEFINE keyFragment FOR gmfgen::ParentAssignedViewmap»«figureQualifiedClassName»«ENDDEFINE»
+
+«DEFINE keyFragment(gmfgen::GenLabel label) FOR gmfgen::LabelModelFacet»«ERROR "Incorrect label model facet: " + this»«ENDDEFINE»
+
+«DEFINE keyFragment(gmfgen::GenLabel label) FOR gmfgen::FeatureLabelModelFacet»«EXPAND keyFragment FOREACH metaFeatures»«ENDDEFINE»
+
+«DEFINE keyFragment(gmfgen::GenLabel label) FOR gmfgen::DesignLabelModelFacet»«EXPAND keyFragment FOR label.viewmap»«ENDDEFINE»
+
+«DEFINE commonKeyPrefix FOR Object»Navigator?«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/NavigatorLinkHelper.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::navigator::Utils»
+
+«DEFINE NavigatorLinkHelper FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «linkHelperClassName» implements org.eclipse.ui.navigator.ILinkHelper {
+
+ «EXPAND xpt::navigator::getEditorInput::getEditorInput FOR editorGen-»
+
+ «EXPAND findSelection-»
+
+ «EXPAND activateEditor-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE findSelection FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public org.eclipse.jface.viewers.IStructuredSelection findSelection(org.eclipse.ui.IEditorInput anInput) {
+ «EXPAND defineDiagramDocument FOR editorGen.plugin-»
+ «EXPAND findSelectionBody-»
+}
+«ENDDEFINE»
+
+«DEFINE defineDiagramDocument FOR gmfgen::GenPlugin-»
+org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument document = «getActivatorQualifiedClassName()».getInstance().getDocumentProvider().getDiagramDocument(anInput);
+«ENDDEFINE»
+
+«DEFINE findSelectionBody FOR gmfgen::GenNavigator-»
+ «EXPAND getDiagramSelection FOR getDiagramTopReference(this)-»
+ return org.eclipse.jface.viewers.StructuredSelection.EMPTY;
+«ENDDEFINE»
+
+«REM»
+ Linking with editor currently supported only for the navigators conteining top
+ reference to the diagram. In this case diagram node will be selected in navigator.
+«ENDREM»
+«DEFINE getDiagramSelection FOR gmfgen::GenNavigatorChildReference-»
+«EXPAND getDiagram FOR navigator.editorGen-»
+org.eclipse.core.resources.IFile file = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagram.eResource());
+if (file != null) {
+ «IF isInsideGroup()-»
+ «navigator.getNavigatorGroupQualifiedClassName()» parentGroup = new «navigator.getNavigatorGroupQualifiedClassName()»("«groupName»", "«groupIcon»", «EXPAND xpt::editor::VisualIDRegistry::modelID FOR navigator.editorGen.diagram», file);
+ «ENDIF-»
+ «navigator.getNavigatorItemQualifiedClassName()» item = new «navigator.getNavigatorItemQualifiedClassName()»(diagram, «IF isInsideGroup()»parentGroup«ELSE»file«ENDIF», false);
+ «IF isInsideGroup()-»
+ parentGroup.addChild(item);
+ «ENDIF-»
+ return new org.eclipse.jface.viewers.StructuredSelection(«IF isInsideGroup()»parentGroup«ELSE»item«ENDIF»);
+}
+«ENDDEFINE»
+
+«DEFINE getDiagram FOR gmfgen::GenEditorGenerator-»
+if (document == null) {
+ return org.eclipse.jface.viewers.StructuredSelection.EMPTY;
+}
+org.eclipse.gmf.runtime.notation.Diagram diagram = document.getDiagram();
+«ENDDEFINE»
+
+«DEFINE activateEditor FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void activateEditor(org.eclipse.ui.IWorkbenchPage aPage, org.eclipse.jface.viewers.IStructuredSelection aSelection) {
+ if (aSelection == null || aSelection.isEmpty()) {
+ return;
+ }
+ if (false == aSelection.getFirstElement() instanceof «getAbstractNavigatorItemQualifiedClassName()») {
+ return;
+ }
+
+ «getAbstractNavigatorItemQualifiedClassName()» abstractNavigatorItem = («getAbstractNavigatorItemQualifiedClassName()») aSelection.getFirstElement();
+ org.eclipse.gmf.runtime.notation.View navigatorView = null;
+ if (abstractNavigatorItem instanceof «getNavigatorItemQualifiedClassName()») {
+ navigatorView = ((«getNavigatorItemQualifiedClassName()») abstractNavigatorItem).getView();
+ } else if (abstractNavigatorItem instanceof «getNavigatorGroupQualifiedClassName()») {
+ «getNavigatorGroupQualifiedClassName()» navigatorGroup = («getNavigatorGroupQualifiedClassName()») abstractNavigatorItem;
+ if (navigatorGroup.getParent() instanceof «getNavigatorItemQualifiedClassName()») {
+ navigatorView = ((«getNavigatorItemQualifiedClassName()») navigatorGroup.getParent()).getView();
+ }«EXPAND getViewFromShortcut-»
+ }
+ if (navigatorView == null) {
+ return;
+ }
+ org.eclipse.ui.IEditorInput editorInput = getEditorInput(navigatorView.getDiagram());
+ org.eclipse.ui.IEditorPart editor = aPage.findEditor(editorInput);
+ if (editor == null) {
+ return;
+ }
+ aPage.bringToTop(editor);
+ if (editor instanceof «EXPAND diagramEditorClassFQName») {
+ «EXPAND diagramEditorClassFQName» diagramEditor = («EXPAND diagramEditorClassFQName») editor;
+ org.eclipse.emf.ecore.resource.ResourceSet diagramEditorResourceSet = diagramEditor.getEditingDomain().getResourceSet();
+ org.eclipse.emf.ecore.EObject selectedView = diagramEditorResourceSet.getEObject(org.eclipse.emf.ecore.util.EcoreUtil.getURI(navigatorView), true);
+ if (selectedView == null) {
+ return;
+ }
+ org.eclipse.gef.GraphicalViewer graphicalViewer = (org.eclipse.gef.GraphicalViewer) diagramEditor.getAdapter(org.eclipse.gef.GraphicalViewer.class);
+ org.eclipse.gef.EditPart selectedEditPart = (org.eclipse.gef.EditPart) graphicalViewer.getEditPartRegistry().get(selectedView);
+ if (selectedEditPart != null) {
+ graphicalViewer.select(selectedEditPart);
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE getViewFromShortcut FOR gmfgen::GenNavigator-»
+ «IF editorGen.diagram.generateShortcutIcon()-»
+else if (navigatorGroup.getParent() instanceof org.eclipse.core.runtime.IAdaptable) {
+ navigatorView = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) navigatorGroup.getParent()).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+}
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE diagramEditorClassFQName FOR gmfgen::GenNavigator»org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/NavigatorSorter.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2006,2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::navigator::Utils»
+
+«DEFINE NavigatorSorter FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «sorterClassName» extends org.eclipse.jface.viewers.ViewerSorter {
+
+ «EXPAND attributes-»
+
+ «EXPAND category-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static final int GROUP_CATEGORY = «getMaxVisualID(this) + 2»;
+ «IF editorGen.diagram.generateCreateShortcutAction()-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private static final int SHORTCUTS_CATEGORY = «getMaxVisualID(this) + 1»;
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE category FOR gmfgen::GenNavigator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public int category(Object element) {
+ if (element instanceof «getNavigatorItemQualifiedClassName()») {
+ «getNavigatorItemQualifiedClassName()» item = («getNavigatorItemQualifiedClassName()») element;
+ «IF editorGen.diagram.generateCreateShortcutAction()-»
+ if (item.getView().getEAnnotation("Shortcut") != null) { «EXPAND xpt::Common::nonNLS»
+ return SHORTCUTS_CATEGORY;
+ }
+ «ENDIF-»
+ return «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»(item.getView());
+ }
+ return GROUP_CATEGORY;
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenNavigator-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/Utils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2006,2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+
+int getMaxVisualID(gmfgen::GenNavigator navigator) :
+ getMaxVisualIDNavigatorNode(navigator).size() == 1 ? ((gmfgen::GenCommonBase) getMaxVisualIDNavigatorNode(navigator).first()).visualID : 0
+;
+
+private cached List[gmfgen::GenCommonBase] getMaxVisualIDNavigatorNode(gmfgen::GenNavigator navigator) :
+ getNavigatorNodes(navigator).select(navigatorNode | isMaximumVisualID(navigatorNode, getNavigatorNodes(navigator)))
+;
+
+private boolean isMaximumVisualID(gmfgen::GenCommonBase commonBase, List[gmfgen::GenCommonBase] allNavigatorNodes) :
+ allNavigatorNodes.select(navigatorNode | navigatorNode.visualID > commonBase.visualID).isEmpty()
+;
+
+boolean isStringFeature(genmodel::GenFeature feature) :
+ feature.ecoreFeature.eType.name == "EString"
+;
+
+cached List[gmfgen::GenCommonBase] getNavigatorContainerNodes(gmfgen::GenNavigator navigator) :
+ getNavigatorNodes(navigator).select( n | getChildReferencesFrom(navigator, n).size() > 0)
+;
+
+cached List[gmfgen::GenCommonBase] getNavigatorContainedNodes(gmfgen::GenNavigator navigator) :
+ getNavigatorNodes(navigator).select( n | getChildReferencesTo(navigator, n).size() > 0)
+;
+
+private List[gmfgen::GenCommonBase] getNavigatorNodes(gmfgen::GenNavigator navigator) :
+ let diagram = navigator.editorGen.diagram :
+ { diagram }
+ .addAll(diagram.topLevelNodes)
+ .addAll(diagram.childNodes)
+ .addAll(diagram.links)
+ .addAll(diagram.compartments)
+ .typeSelect(gmfgen::GenCommonBase)
+;
+
+Set[String] getGroupNames(List[gmfgen::GenNavigatorChildReference] references) :
+ references.select(ref | ref.isInsideGroup()).collect(ref | ref.groupName).toSet()
+;
+
+gmfgen::GenNavigatorChildReference getNavigatorReference(String groupName, List[gmfgen::GenNavigatorChildReference] childReferences) :
+ childReferences.select(r | r.groupName == groupName).toList().first()
+;
+
+List[gmfgen::GenNavigatorChildReference] getChildReferencesFrom(gmfgen::GenNavigator navigator, gmfgen::GenCommonBase parent) :
+ navigator.childReferences.select(r | parent.visualID == r.parent.visualID)
+;
+
+List[gmfgen::GenNavigatorChildReference] getChildReferencesTo(gmfgen::GenNavigator navigator, gmfgen::GenCommonBase child) :
+ navigator.childReferences.select(r | child.visualID == r.child.visualID)
+;
+
+GenNavigatorChildReference getDiagramTopReference(gmfgen::GenNavigator navigator) :
+ let diagramTopReferences = navigator.childReferences.select(cr | null == cr.parent).select(cr | cr.child == navigator.editorGen.diagram) :
+ diagramTopReferences.size() == 0 ? null : diagramTopReferences.get(0)
+;
+
+//
+// CodeGenUtil#validJavaIdentifier()
+//
+String asValidJavaIdentifier(String identifier) :
+JAVA org.eclipse.emf.codegen.util.CodeGenUtil.validJavaIdentifier(java.lang.String)
+;
+
+String i18nKeyForGroup(String groupName, gmfgen::GenCommonBase contextElement) :
+"NavigatorGroupName."+ (null != contextElement ? contextElement.getUniqueIdentifier() : "File") + "." + asValidJavaIdentifier(groupName)
+;
+
+String i18nKeyForOpenDiagramActionName() :
+"NavigatorActionProvider.OpenDiagramActionName"
+;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«DEFINE extensions FOR gmfgen::GenNavigator-»
+ «EXPAND editorInputPropertyTester("URIEditorInput", "org.eclipse.emf.common.ui.URIEditorInput", getUriInputTesterQualifiedClassName())-»
+«IF editorGen.diagram.generateShortcutIcon()-»
+
+ «EXPAND editorInputPropertyTester("Shortcut", "org.eclipse.gmf.runtime.notation.View", editorGen.diagram.getShortcutPropertyTesterQualifiedClassName())-»
+«ENDIF-»
+«IF generateDomainModelNavigator && null != editorGen.domainGenModel-»
+
+ «EXPAND editorInputPropertyTester("DomainModelElement", "org.eclipse.emf.ecore.EObject", getDomainModelElementTesterQualifiedClassName())-»
+«ENDIF-»
+
+ «EXPAND registerBindings-»
+
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <navigatorContent
+ id="«contentExtensionID»"
+ name="«contentExtensionName»"
+ priority="«contentExtensionPriority»"
+ contentProvider="«getContentProviderQualifiedClassName()»"
+ labelProvider="«getLabelProviderQualifiedClassName()»"
+ icon="«editorGen.editor.iconPathX»"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="«editorGen.diagramFileExtension»"/>
+ </and>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+«IF editorGen.diagram.generateShortcutIcon()-»
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="«editorGen.plugin.iD».isShortcut"/>
+ </adapt>
+«ENDIF-»
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+«IF editorGen.diagram.generateShortcutIcon()-»
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="«editorGen.plugin.iD».isShortcut"/>
+ </adapt>
+«ENDIF-»
+ </or>
+ </possibleChildren>
+ <commonSorter
+ id="«sorterExtensionID»"
+ class="«getSorterQualifiedClassName()»">
+ <parentExpression>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="«editorGen.diagramFileExtension»"/>
+ </and>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+ </or>
+ </parentExpression>
+ </commonSorter>
+ </navigatorContent>
+«IF generateDomainModelNavigator && null != editorGen.domainGenModel-»
+ <navigatorContent
+ id="«domainContentExtensionID»"
+ name="«domainContentExtensionName»"
+ priority="«domainContentExtensionPriority»"
+ contentProvider="«getDomainContentProviderQualifiedClassName()»"
+ labelProvider="«getDomainLabelProviderQualifiedClassName()»"
+ icon="«editorGen.editor.iconPathX»"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="«editorGen.domainFileExtension»"/>
+ </and>
+ <and>
+ <instanceof value="org.eclipse.emf.ecore.EObject"/>
+ <test property="«editorGen.plugin.iD».isDomainModelElement"/>
+ </and>
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <and>
+ <instanceof value="org.eclipse.emf.ecore.EObject"/>
+ <test property="«editorGen.plugin.iD».isDomainModelElement"/>
+ </and>
+ </possibleChildren>
+ </navigatorContent>
+«ENDIF-»
+ <actionProvider
+ id="«actionProviderID»"
+ class="«getActionProviderQualifiedClassName()»">
+ <enablement>
+ <or>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+«IF editorGen.diagram.generateShortcutIcon()-»
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="«editorGen.plugin.iD».isShortcut"/>
+ </adapt>
+«ENDIF-»
+ </or>
+ </enablement>
+ </actionProvider>
+ </extension>
+
+ «EXPAND registerLinkHelper-»
+«ENDDEFINE»
+
+«DEFINE editorInputPropertyTester(String property, String type, String testerClass) FOR gmfgen::GenNavigator-»
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <propertyTester
+ id="«editorGen.plugin.iD».«property»PropertyTester"
+ type="«type»"
+ namespace="«editorGen.plugin.iD»"
+ properties="is«property»"
+ class="«testerClass»">
+ </propertyTester>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE registerBindings FOR gmfgen::GenNavigator-»
+ <extension point="org.eclipse.ui.navigator.viewer">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension pattern="«contentExtensionID»"/>
+«IF generateDomainModelNavigator && null != editorGen.domainGenModel-»
+ <contentExtension pattern="«domainContentExtensionID»"/>
+«ENDIF-»
+ <contentExtension pattern="«linkHelperExtensionID»"/>
+ </includes>
+ </viewerContentBinding>
+ <viewerActionBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <actionExtension pattern="«actionProviderID»"/>
+ </includes>
+ </viewerActionBinding>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE registerLinkHelper FOR gmfgen::GenNavigator-»
+ <extension point="org.eclipse.ui.navigator.linkHelper">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <linkHelper
+ id="«linkHelperExtensionID»"
+ class="«getLinkHelperQualifiedClassName()»">
+ <editorInputEnablement>
+ <and>
+ <instanceof value="org.eclipse.emf.common.ui.URIEditorInput"/>
+ <test property="«editorGen.plugin.iD».isURIEditorInput"/>
+ </and>
+ </editorInputEnablement>
+ <selectionEnablement>
+ <instanceof value="«getAbstractNavigatorItemQualifiedClassName()»"/>
+ </selectionEnablement>
+ </linkHelper>
+ </extension>
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/getEditorInput.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE getEditorInput FOR gmfgen::GenEditorGenerator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.ui.IEditorInput getEditorInput(org.eclipse.gmf.runtime.notation.Diagram diagram) {
+ org.eclipse.emf.ecore.resource.Resource diagramResource = diagram.eResource();
+«IF null == application-»
+ for (java.util.Iterator it = diagramResource.getContents().iterator(); it.hasNext();) {
+ org.eclipse.emf.ecore.EObject nextEObject = (org.eclipse.emf.ecore.EObject) it.next();
+ if (nextEObject == diagram) {
+ return new org.eclipse.ui.part.FileEditorInput(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource));
+ }
+ if (nextEObject instanceof org.eclipse.gmf.runtime.notation.Diagram) {
+ break;
+ }
+ }
+«ENDIF-»
+ «EXPAND defineURIEditorInput("diagram") FOR diagram-»
+ return editorInput;
+}
+«ENDDEFINE»
+
+«DEFINE defineURIEditorInput(String diagramVarName) FOR gmfgen::GenDiagram-»
+«EXPAND defineURIEditorInput(diagramVarName, "editorInput")-»
+«ENDDEFINE»
+
+«DEFINE defineURIEditorInput(String diagramVarName, String editorInputVarName) FOR gmfgen::GenDiagram-»
+org.eclipse.emf.common.util.URI uri = org.eclipse.emf.ecore.util.EcoreUtil.getURI(«diagramVarName»);
+String editorName = uri.lastSegment() + "#" + «diagramVarName».eResource().getContents().indexOf(«diagramVarName»); «EXPAND xpt::Common::nonNLS»
+org.eclipse.ui.IEditorInput «editorInputVarName» = new org.eclipse.emf.common.ui.URIEditorInput(uri, editorName);
+«ENDDEFINE»
Binary file carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/navigator/navigatorGroup.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/parsers/AbstractParser.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,366 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::parsers::i18n»
+
+«DEFINE className FOR gmfgen::GenDiagram»«defaultAbstractParserClassName()»«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«parsersPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE AbstractParser FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «parsersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public abstract class «EXPAND className» implements org.eclipse.gmf.runtime.common.ui.services.parser.IParser {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected final org.eclipse.emf.ecore.EAttribute[] features;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String viewPattern;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String editorPattern;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String editPattern;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.emf.ecore.EAttribute[] features) {
+ if (features == null || java.util.Arrays.asList(features).contains(null)) {
+ throw new IllegalArgumentException();
+ }
+ this.features = features;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getViewPattern() {
+ return viewPattern;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setViewPattern(String viewPattern) {
+ this.viewPattern = viewPattern;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditorPattern() {
+ return editorPattern;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setEditorPattern(String editorPattern) {
+ this.editorPattern = editorPattern;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditPattern() {
+ return editPattern;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setEditPattern(String editPattern) {
+ this.editPattern = editPattern;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean isAffectingEvent(Object event, int flags) {
+ if (event instanceof org.eclipse.emf.common.notify.Notification) {
+ return isAffectingFeature(((org.eclipse.emf.common.notify.Notification) event).getFeature());
+ }
+ return false;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean isAffectingFeature(Object feature) {
+ for (int i = 0; i < features.length; i++) {
+ if (features[i] == feature) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor(
+ org.eclipse.core.runtime.IAdaptable element) {
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected Object[] getValues(org.eclipse.emf.ecore.EObject element) {
+ Object[] values = new Object[features.length];
+ for (int i = 0; i < features.length; i++) {
+ values[i] = getValue(element, features[i]);
+ }
+ return values;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected Object getValue(org.eclipse.emf.ecore.EObject element, org.eclipse.emf.ecore.EAttribute feature) {
+ Object value = element.eGet(feature);
+ Class iClass = feature.getEAttributeType().getInstanceClass();
+ if (String.class.equals(iClass)) {
+ if (value == null) {
+ value = ""; «EXPAND xpt::Common::nonNLS»
+ }
+ }
+ return value;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(
+ org.eclipse.core.runtime.IAdaptable adapter, Object[] values, int flags) {
+ if (values == null || validateNewValues(values).getCode() !=
+ org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.EDITABLE) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+ org.eclipse.emf.ecore.EObject element =
+ (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain =
+ org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(element);
+ if (editingDomain == null) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+ org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand command =
+ new org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand(
+ editingDomain, "Set Values"); «EXPAND xpt::Common::nonNLS»
+ for (int i = 0; i < values.length; i++) {
+ command.compose(getModificationCommand(element, features[i], values[i]));
+ }
+ return command;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.core.command.ICommand getModificationCommand(
+ org.eclipse.emf.ecore.EObject element, org.eclipse.emf.ecore.EAttribute feature, Object value) {
+ value = getValidNewValue(feature, value);
+ if (value instanceof InvalidValue) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+ org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest request =
+ new org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest(element, feature, value);
+ return new org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand(request);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus validateNewValues(Object[] values) {
+ if (values.length != features.length) {
+ return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.UNEDITABLE_STATUS;
+ }
+ for (int i = 0; i < values.length; i++) {
+ Object value = getValidNewValue(features[i], values[i]);
+ if (value instanceof InvalidValue) {
+ return new org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus(
+ «editorGen.plugin.getActivatorQualifiedClassName()».ID,
+ org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.UNEDITABLE,
+ value.toString());
+ }
+ }
+ return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected Object getValidNewValue(org.eclipse.emf.ecore.EAttribute feature, Object value) {
+ org.eclipse.emf.ecore.EClassifier type = feature.getEType();
+ if (type instanceof org.eclipse.emf.ecore.EDataType) {
+ Class iClass = type.getInstanceClass();
+ if (Boolean.TYPE.equals(iClass)) {
+ if (value instanceof Boolean) {
+ // ok
+ } else if (value instanceof String) {
+ value = Boolean.valueOf((String) value);
+ } else {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
+ }
+ } else if (Character.TYPE.equals(iClass)) {
+ if (value instanceof Character) {
+ // ok
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ value = new Character(s.charAt(0));
+ }
+ } else {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
+ }
+ } else if (Byte.TYPE.equals(iClass)) {
+ if (value instanceof Byte) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Byte(((Number) value).byteValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Byte.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
+ }
+ } else if (Short.TYPE.equals(iClass)) {
+ if (value instanceof Short) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Short(((Number) value).shortValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Short.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
+ }
+ } else if (Integer.TYPE.equals(iClass)) {
+ if (value instanceof Integer) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Integer(((Number) value).intValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Integer.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
+ }
+ } else if (Long.TYPE.equals(iClass)) {
+ if (value instanceof Long) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Long(((Number) value).longValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Long.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
+ }
+ } else if (Float.TYPE.equals(iClass)) {
+ if (value instanceof Float) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Float(((Number) value).floatValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Float.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
+ }
+ } else if (Double.TYPE.equals(iClass)) {
+ if (value instanceof Double) {
+ // ok
+ } else if (value instanceof Number) {
+ value = new Double(((Number) value).doubleValue());
+ } else if (value instanceof String) {
+ String s = (String) value;
+ if (s.length() == 0) {
+ value = null;
+ } else {
+ try {
+ value = Double.valueOf(s);
+ } catch (NumberFormatException nfe) {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserWrongStringConversionMessage()) FOR editorGen», iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», iClass.getName()));
+ }
+ } else if (type instanceof org.eclipse.emf.ecore.EEnum) {
+ if (value instanceof String) {
+ org.eclipse.emf.ecore.EEnumLiteral literal =
+ ((org.eclipse.emf.ecore.EEnum) type).getEEnumLiteralByLiteral((String) value);
+ if (literal == null) {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnknownLiteralMessage()) FOR editorGen», value));
+ } else {
+ value = literal.getInstance();
+ }
+ } else {
+ value = new InvalidValue(org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForAbstractParserUnexpectedValueTypeMessage()) FOR editorGen», String.class.getName()));
+ }
+ }
+ }
+ return value;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected class InvalidValue {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String description;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public InvalidValue(String description) {
+ this.description = description;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String toString() {
+ return description;
+ }
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAbstractParserUnexpectedValueTypeMessage(), "Value of type {0} is expected")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAbstractParserWrongStringConversionMessage(), "String value does not convert to {0} value")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForAbstractParserUnknownLiteralMessage(), "Unknown literal: {0}")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForAbstractParserUnexpectedValueTypeMessage())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForAbstractParserWrongStringConversionMessage())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForAbstractParserUnknownLiteralMessage())-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/parsers/CompositeParser.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»CompositeParser«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«parsersPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE CompositeParser FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «parsersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» implements org.eclipse.gmf.runtime.common.ui.services.parser.IParser {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.gmf.runtime.common.ui.services.parser.IParser reader;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.gmf.runtime.common.ui.services.parser.IParser writer;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.gmf.runtime.common.ui.services.parser.IParser reader,
+ org.eclipse.gmf.runtime.common.ui.services.parser.IParser writer) {
+ this.reader = reader;
+ this.writer = writer;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean isAffectingEvent(Object event, int flags) {
+ return reader.isAffectingEvent(event, flags);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getPrintString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ return reader.getPrintString(adapter, flags);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ return reader.getEditString(adapter, flags);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus isValidEditString(
+ org.eclipse.core.runtime.IAdaptable adapter, String editString) {
+ return writer.isValidEditString(adapter, editString);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(
+ org.eclipse.core.runtime.IAdaptable adapter, String newString, int flags) {
+ return writer.getParseCommand(adapter, newString, flags);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.jface.text.contentassist.IContentAssistProcessor getCompletionProcessor(
+ org.eclipse.core.runtime.IAdaptable adapter) {
+ return writer.getCompletionProcessor(adapter);
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/parsers/MessageFormatParser.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::parsers::i18n»
+
+«DEFINE className FOR gmfgen::GenDiagram»MessageFormatParser«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«parsersPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE MessageFormatParser FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «parsersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends «EXPAND xpt::parsers::AbstractParser::qualifiedClassName» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String defaultPattern;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.text.MessageFormat viewProcessor;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.text.MessageFormat editorProcessor;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.text.MessageFormat editProcessor;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.emf.ecore.EAttribute[] features) {
+ super(features);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getDefaultPattern() {
+ if (defaultPattern == null) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < features.length; i++) {
+ if (i > 0) {
+ sb.append(' ');
+ }
+ sb.append('{');
+ sb.append(i);
+ sb.append('}');
+ }
+ defaultPattern = sb.toString();
+ }
+ return defaultPattern;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getViewPattern() {
+ String pattern = super.getViewPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setViewPattern(String viewPattern) {
+ super.setViewPattern(viewPattern);
+ viewProcessor = null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.text.MessageFormat createViewProcessor(String viewPattern) {
+ return new java.text.MessageFormat(viewPattern);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.text.MessageFormat getViewProcessor() {
+ if (viewProcessor == null) {
+ viewProcessor = createViewProcessor(getViewPattern());
+ }
+ return viewProcessor;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditorPattern() {
+ String pattern = super.getEditorPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setEditorPattern(String editorPattern) {
+ super.setEditorPattern(editorPattern);
+ editorProcessor = null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.text.MessageFormat createEditorProcessor(String editorPattern) {
+ return new java.text.MessageFormat(editorPattern);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.text.MessageFormat getEditorProcessor() {
+ if (editorProcessor == null) {
+ editorProcessor = createEditorProcessor(getEditorPattern());
+ }
+ return editorProcessor;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditPattern() {
+ String pattern = super.getEditPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setEditPattern(String editPattern) {
+ super.setEditPattern(editPattern);
+ editProcessor = null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.text.MessageFormat createEditProcessor(String editPattern) {
+ return new java.text.MessageFormat(editPattern);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected java.text.MessageFormat getEditProcessor() {
+ if (editProcessor == null) {
+ editProcessor = createEditProcessor(getEditPattern());
+ }
+ return editProcessor;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getPrintString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ org.eclipse.emf.ecore.EObject element =
+ (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ return getViewProcessor().format(getValues(element), new StringBuffer(),
+ new java.text.FieldPosition(0)).toString();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ org.eclipse.emf.ecore.EObject element =
+ (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ return getEditorProcessor().format(getValues(element), new StringBuffer(),
+ new java.text.FieldPosition(0)).toString();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus isValidEditString(
+ org.eclipse.core.runtime.IAdaptable adapter, String editString) {
+ java.text.ParsePosition pos = new java.text.ParsePosition(0);
+ Object[] values = getEditProcessor().parse(editString, pos);
+ if (values == null) {
+ return new org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus(
+ «editorGen.plugin.getActivatorQualifiedClassName()».ID,
+ org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus.UNEDITABLE,
+ org.eclipse.osgi.util.NLS.bind(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForMessageFormatParserInvalidInputError()) FOR editorGen», new Integer(pos.getErrorIndex())));
+ }
+ return validateNewValues(values);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(
+ org.eclipse.core.runtime.IAdaptable adapter, String newString, int flags) {
+ Object[] values = getEditProcessor().parse(newString, new java.text.ParsePosition(0));
+ return getParseCommand(adapter, values, flags);
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForMessageFormatParserInvalidInputError(), "Invalid input at {0}")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForMessageFormatParserInvalidInputError())-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/parsers/NativeParser.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»NativeParser«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«parsersPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE NativeParser FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «parsersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends «EXPAND xpt::parsers::AbstractParser::qualifiedClassName» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.emf.ecore.EAttribute[] features) {
+ super(features);
+ if (features.length != 1) {
+ throw new IllegalArgumentException(java.util.Arrays.toString(features));
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.ecore.EAttribute getAttribute() {
+ return features[0];
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getPrintString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ org.eclipse.emf.ecore.EObject element =
+ (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ org.eclipse.emf.ecore.EAttribute feature = getAttribute();
+ String s = org.eclipse.emf.ecore.util.EcoreUtil.convertToString(
+ feature.getEAttributeType(), element.eGet(feature));
+ return s != null ? s : ""; «EXPAND xpt::Common::nonNLS»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ return getPrintString(adapter, flags);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus isValidEditString(
+ org.eclipse.core.runtime.IAdaptable adapter, String editString) {
+ return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(
+ org.eclipse.core.runtime.IAdaptable adapter, String newString, int flags) {
+ org.eclipse.emf.ecore.EAttribute feature = getAttribute();
+ Object value = org.eclipse.emf.ecore.util.EcoreUtil.createFromString(feature.getEAttributeType(), newString);
+ return getParseCommand(adapter, new Object[] { value }, flags);
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/parsers/PrintfParser.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»PrintfParser«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«parsersPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE PrintfParser FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «parsersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends «EXPAND xpt::parsers::AbstractParser::qualifiedClassName» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String defaultPattern;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.emf.ecore.EAttribute[] features) {
+ super(features);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected String getDefaultPattern() {
+ if (defaultPattern == null) {
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < features.length; i++) {
+ if (i > 0) {
+ sb.append(' ');
+ }
+ sb.append('%');
+ sb.append(i + 1);
+ sb.append('$');
+ sb.append('s');
+ }
+ defaultPattern = sb.toString();
+ }
+ return defaultPattern;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getViewPattern() {
+ String pattern = super.getViewPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditorPattern() {
+ String pattern = super.getEditorPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getPrintString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ org.eclipse.emf.ecore.EObject element =
+ (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ return String.format(getViewPattern(), getValues(element));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ org.eclipse.emf.ecore.EObject element =
+ (org.eclipse.emf.ecore.EObject) adapter.getAdapter(org.eclipse.emf.ecore.EObject.class);
+ return String.format(getEditorPattern(), getValues(element));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus isValidEditString(
+ org.eclipse.core.runtime.IAdaptable adapter, String editString) {
+ return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.UNEDITABLE_STATUS;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(
+ org.eclipse.core.runtime.IAdaptable adapter, String newString, int flags) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/parsers/RegexpParser.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»RegexpParser«ENDDEFINE»
+
+«DEFINE qualifiedClassName FOR gmfgen::GenDiagram»«parsersPackageName».«EXPAND className»«ENDDEFINE»
+
+«DEFINE RegexpParser FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «parsersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «EXPAND className» extends «EXPAND xpt::parsers::AbstractParser::qualifiedClassName» {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «EXPAND className»(org.eclipse.emf.ecore.EAttribute[] features) {
+ super(features);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditPattern() {
+ String pattern = super.getEditPattern();
+ return pattern != null ? pattern : " "; «EXPAND xpt::Common::nonNLS»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getPrintString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ return ""; «EXPAND xpt::Common::nonNLS»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getEditString(org.eclipse.core.runtime.IAdaptable adapter, int flags) {
+ return ""; «EXPAND xpt::Common::nonNLS»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus isValidEditString(
+ org.eclipse.core.runtime.IAdaptable adapter, String editString) {
+ if (editString == null) {
+ return org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus.UNEDITABLE_STATUS;
+ }
+ Object[] values = editString.split(getEditPattern());
+ return validateNewValues(values);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.core.command.ICommand getParseCommand(
+ org.eclipse.core.runtime.IAdaptable adapter, String newString, int flags) {
+ if (newString == null) {
+ return org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand.INSTANCE;
+ }
+ Object[] values = newString.split(getEditPattern());
+ return super.getParseCommand(adapter, values, flags);
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/parsers/i18n.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2007 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:
+ * Anna Karjakina (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+String defaultAbstractParserClassName(gmfgen::GenDiagram diagram) :
+"AbstractParser"
+;
+
+String defaultMessageFormatParserClassName(gmfgen::GenDiagram diagram) :
+"MessageFormatParser"
+;
+
+String i18nKeyForAbstractParserUnexpectedValueTypeMessage(gmfgen::GenDiagram diagram) :
+diagram.defaultAbstractParserClassName()+".UnexpectedValueTypeMessage"
+;
+
+String i18nKeyForAbstractParserWrongStringConversionMessage(gmfgen::GenDiagram diagram) :
+diagram.defaultAbstractParserClassName()+".WrongStringConversionMessage"
+;
+
+String i18nKeyForAbstractParserUnknownLiteralMessage(gmfgen::GenDiagram diagram) :
+diagram.defaultAbstractParserClassName()+".UnknownLiteralMessage"
+;
+
+String i18nKeyForMessageFormatParserInvalidInputError(gmfgen::GenDiagram diagram) :
+diagram.defaultMessageFormatParserClassName()+".InvalidInputError"
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/plugin/Activator.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE Activator FOR gmfgen::GenPlugin-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «editorGen.editor.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «activatorClassName» extends org.eclipse.ui.plugin.AbstractUIPlugin {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String ID = "«iD»"; //$NON-NLS-1$
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint DIAGRAM_PREFERENCES_HINT =
+ new org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint(ID);
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static «activatorClassName» instance;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.edit.provider.ComposedAdapterFactory adapterFactory;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «editorGen.diagram.getDocumentProviderQualifiedClassName()» documentProvider;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «activatorClassName»() {
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void start(org.osgi.framework.BundleContext context) throws Exception {
+ super.start(context);
+ instance = this;
+ org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint.registerPreferenceStore(
+ DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
+ adapterFactory = createAdapterFactory();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void stop(org.osgi.framework.BundleContext context) throws Exception {
+ adapterFactory.dispose();
+ adapterFactory = null;
+ instance = null;
+ super.stop(context);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static «activatorClassName» getInstance() {
+ return instance;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.edit.provider.ComposedAdapterFactory createAdapterFactory() {
+ java.util.List factories = new java.util.ArrayList();
+ fillItemProviderFactories(factories);
+ return new org.eclipse.emf.edit.provider.ComposedAdapterFactory(factories);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void fillItemProviderFactories(java.util.List factories) {
+«EXPAND MetaModel::PopulateItemProviderFactories("factories") FOR editorGen-»
+ factories.add(new org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory());
+ factories.add(new org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.common.notify.AdapterFactory getItemProvidersAdapterFactory() {
+ return adapterFactory;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.jface.resource.ImageDescriptor getItemImageDescriptor(Object item) {
+ org.eclipse.emf.edit.provider.IItemLabelProvider labelProvider =
+ (org.eclipse.emf.edit.provider.IItemLabelProvider) adapterFactory.adapt(
+ item, org.eclipse.emf.edit.provider.IItemLabelProvider.class);
+ if (labelProvider != null) {
+ return org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry.getInstance().getImageDescriptor(
+ labelProvider.getImage(item));
+ }
+ return null;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @generated
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static org.eclipse.jface.resource.ImageDescriptor getBundledImageDescriptor(String path) {
+ return org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(ID, path);
+ }
+
+ /**
+ * Respects images residing in any plug-in. If path is relative,
+ * then this bundle is looked up for the image, otherwise, for absolute
+ * path, first segment is taken as id of plug-in with image
+ *
+ * @generated
+ * @param path the path to image, either absolute (with plug-in id as first segment), or relative for bundled images
+ * @return the image descriptor
+ */
+ public static org.eclipse.jface.resource.ImageDescriptor findImageDescriptor(String path) {
+ final org.eclipse.core.runtime.IPath p = new org.eclipse.core.runtime.Path(path);
+ if (p.isAbsolute() && p.segmentCount() > 1) {
+ return org.eclipse.ui.plugin.AbstractUIPlugin.imageDescriptorFromPlugin(
+ p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
+ } else {
+ return getBundledImageDescriptor(p.makeAbsolute().toString());
+ }
+ }
+
+ /**
+ * Returns an image for the image file at the given plug-in relative path.
+ * Client do not need to dispose this image. Images will be disposed automatically.
+ *
+ * @generated
+ * @param path the path
+ * @return image instance
+ */
+ public org.eclipse.swt.graphics.Image getBundledImage(String path) {
+ org.eclipse.swt.graphics.Image image = getImageRegistry().get(path);
+ if (image == null) {
+ getImageRegistry().put(path, getBundledImageDescriptor(path));
+ image = getImageRegistry().get(path);
+ }
+ return image;
+ }
+
+ /**
+ * Returns string from plug-in's resource bundle
+ *
+ * @generated
+ */
+ public static String getString(String key) {
+ return org.eclipse.core.runtime.Platform.getResourceString(
+ getInstance().getBundle(), "%" + key); //$NON-NLS-1$
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editorGen.diagram.getDocumentProviderQualifiedClassName()» getDocumentProvider() {
+ if (documentProvider == null) {
+ documentProvider = new «editorGen.diagram.getDocumentProviderQualifiedClassName()»();
+ }
+ return documentProvider;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void logError(String error) {
+ logError(error, null);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void logError(String error, Throwable throwable) {
+ if (error == null && throwable != null) {
+ error = throwable.getMessage();
+ }
+ getLog().log(new org.eclipse.core.runtime.Status(
+ org.eclipse.core.runtime.IStatus.ERROR,
+ «activatorClassName».ID,
+ org.eclipse.core.runtime.IStatus.OK,
+ error, throwable));
+ debug(error, throwable);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void logInfo(String message) {
+ logInfo(message, null);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void logInfo(String message, Throwable throwable) {
+ if (message == null && throwable != null) {
+ message = throwable.getMessage();
+ }
+ getLog().log(new org.eclipse.core.runtime.Status(
+ org.eclipse.core.runtime.IStatus.INFO,
+ «activatorClassName».ID,
+ org.eclipse.core.runtime.IStatus.OK,
+ message, throwable));
+ debug(message, throwable);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void debug(String message, Throwable throwable) {
+ if (!isDebugging()) {
+ return;
+ }
+ if (message != null) {
+ System.err.println(message);
+ }
+ if (throwable != null) {
+ throwable.printStackTrace();
+ }
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenPlugin»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/plugin/build.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE build FOR gmfgen::GenPlugin-»
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ messages.properties,\
+ .options
+jars.compile.order = .
+source.. = src/
+output.. = bin/
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/plugin/manifest.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::Utils»
+
+«DEFINE manifest FOR gmfgen::GenPlugin-»
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: «iD»; singleton:=true
+Bundle-Version: «version»
+Bundle-ClassPath: .
+Bundle-Activator: «getActivatorQualifiedClassName()»
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Export-Package: «editorGen.diagram.editPartsPackageName»,
+ «editorGen.editor.packageName»,
+ «editorGen.diagram.providersPackageName»
+Require-Bundle: org.eclipse.core.runtime,
+«IF editorGen.application == null-»
+ org.eclipse.core.resources,
+«ENDIF-»
+«IF editorGen.diagram.generateShortcutIcon() ||
+ (editorGen.navigator != null && editorGen.navigator.generateDomainModelNavigator)-»
+ org.eclipse.core.expressions,
+«ENDIF-»
+ org.eclipse.jface,
+«IF editorGen.application == null-»
+ org.eclipse.ui.ide,
+«ENDIF-»
+ org.eclipse.ui.views,
+«IF editorGen.navigator != null-»
+ org.eclipse.ui.navigator,
+ org.eclipse.ui.navigator.resources,
+«ENDIF-»
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.ecore.xmi,
+ org.eclipse.emf.edit.ui,
+ org.eclipse.gmf.runtime.emf.core,
+ org.eclipse.gmf.runtime.emf.commands.core,
+ org.eclipse.gmf.runtime.emf.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui,
+«IF printingEnabled-»
+ org.eclipse.gmf.runtime.diagram.ui.printing,
+ org.eclipse.gmf.runtime.diagram.ui.printing.render,
+«ENDIF-»
+«IF editorGen.propertySheet != null-»
+ org.eclipse.gmf.runtime.diagram.ui.properties,
+«ENDIF-»
+ org.eclipse.gmf.runtime.diagram.ui.providers,
+«IF editorGen.application == null-»
+ org.eclipse.gmf.runtime.diagram.ui.providers.ide,
+«ENDIF-»
+ org.eclipse.gmf.runtime.diagram.ui.render,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+«IF editorGen.application == null-»
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
+«ENDIF-»
+«FOREACH getAllRequiredPlugins() AS id-»
+ «id»;visibility:=reexport,
+«ENDFOREACH-»
+ org.eclipse.gef;visibility:=reexport
+Eclipse-LazyStart: true
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/plugin/options.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE options FOR gmfgen::GenPlugin-»
+# Tracing options for the «iD» plug-in
+
+# Common issues
+«iD»/debug=false
+
+# Visual IDs
+«iD»/debug/visualID=false
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/plugin/plugin.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::Utils»
+«EXTENSION xpt::GenEditorGenerator»
+
+«DEFINE plugin FOR gmfgen::GenPlugin-»
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+«EXPAND xpt::Common::xcopyright FOR editorGen-»
+<plugin>
+
+ <extension point="org.eclipse.team.core.fileTypes">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <fileTypes
+ type="text"
+ extension="«editorGen.diagramFileExtension»">
+ </fileTypes>
+ </extension>
+
+ <extension point="org.eclipse.emf.ecore.extension_parser">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <parser
+ type="«editorGen.diagramFileExtension»"
+ class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
+ </parser>
+ </extension>
+
+«EXPAND xpt::editor::extensions::extensions FOR editorGen-»
+«EXPAND menu-»
+«EXPAND validation FOR editorGen.diagram-»
+«EXPAND metrics FOR editorGen.metrics-»
+«EXPAND xpt::diagram::preferences::extensions::extensions FOR editorGen.diagram-»
+«EXPAND xpt::propsheet::extensions::extensions FOR editorGen.propertySheet-»
+«EXPAND xpt::providers::extensions::extensions FOR editorGen.diagram-»
+«EXPAND xpt::navigator::extensions::extensions FOR editorGen.navigator-»
+«EXPAND xpt::application::extensions::extensions FOR editorGen.application-»
+«EXPAND xpt::ConstraintProviders::extensions FOR editorGen-»
+«EXPAND xpt::diagram::updater::extensions::extensions FOR editorGen.diagramUpdater-»
+«EXPAND additions-»
+</plugin>
+«ENDDEFINE»
+
+«DEFINE menu FOR gmfgen::GenPlugin-»
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramGlobalActionHandlerProvider"
+ id="«editorGen.modelID»Presentation">
+ <Priority name="Lowest"/>
+ <ViewId id="«editorGen.editor.iD»">
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="delete"/>
+ </ElementType>
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart">
+ <GlobalActionId actionId="save"/>
+ </ElementType>
+ </ViewId>
+ </GlobalActionHandlerProvider>
+«IF printingEnabled-»
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.printing.render.providers.DiagramWithPrintGlobalActionHandlerProvider"
+ id="«editorGen.modelID»PresentationPrint">
+ <Priority name="Lowest"/>
+ <ViewId id="«editorGen.editor.iD»">
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="print"/>
+ </ElementType>
+ </ViewId>
+ </GlobalActionHandlerProvider>
+«ENDIF-»
+«IF null == editorGen.application-»
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.DiagramIDEGlobalActionHandlerProvider"
+ id="«editorGen.modelID»PresentationIDE">
+ <Priority name="Lowest"/>
+ <ViewId id="«editorGen.editor.iD»">
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="bookmark"/>
+ </ElementType>
+ </ViewId>
+ </GlobalActionHandlerProvider>
+«ENDIF-»
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.render.providers.DiagramUIRenderGlobalActionHandlerProvider"
+ id="«editorGen.modelID»Render">
+ <Priority name="Lowest"/>
+ <ViewId id="«editorGen.editor.iD»">
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="cut"/>
+ <GlobalActionId actionId="copy"/>
+ <GlobalActionId actionId="paste"/>
+ </ElementType>
+ </ViewId>
+ </GlobalActionHandlerProvider>
+ </extension>
+
+«IF printingEnabled-»
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <contributionItemProvider class="«editorGen.diagram.getContributionItemProviderQualifiedClassName()»">
+ <Priority name="Low"/>
+ <partContribution id="«editorGen.editor.iD»">
+ <partAction menubarPath="/file/print" id="printPreviewAction"/>
+ </partContribution>
+ </contributionItemProvider>
+ </extension>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE metrics FOR gmfgen::GenMetricContainer-»
+«IF metrics.size() > 0-»
+
+ <extension id="MetricContributionItemProvider" name="Metrics"
+ point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <contributionItemProvider checkPluginLoaded="true" class="«editorGen.diagram.getMetricProviderQualifiedClassName()»">
+ <Priority name="«editorGen.diagram.metricProviderPriority»"/>
+ <partContribution id="«editorGen.editor.iD»">
+ <partMenuGroup menubarPath="/diagramMenu/" id="validationGroup"/>
+ <partAction id="metricsAction" menubarPath="/diagramMenu/validationGroup"/>
+ </partContribution>
+ </contributionItemProvider>
+ </extension>
+
+ <extension point="org.eclipse.ui.views">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <view class="«editorGen.diagram.getMetricProviderQualifiedClassName()»$ResultView"
+ id="«editorGen.diagram.getMetricViewID()»"
+ name="«editorGen.modelID» Diagram Metrics"/>
+ </extension>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE validation FOR gmfgen::GenDiagram-»
+«IF validationEnabled || editorGen.hasAudits()-»
+«IF validationEnabled-»
+
+ <extension id="ValidationContributionItemProvider" name="Validation"
+ point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <contributionItemProvider
+ class="«getValidationProviderQualifiedClassName()»">
+ <Priority name="«validationProviderPriority»"/>
+ <partContribution id="«editorGen.editor.iD»">
+ <partMenuGroup menubarPath="/diagramMenu/" id="validationGroup"/>
+ <partAction id="validateAction" menubarPath="/diagramMenu/validationGroup"/>
+ </partContribution>
+ </contributionItemProvider>
+ </extension>
+«ENDIF-»
+«IF null == editorGen.application-»
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.markerNavigationProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <MarkerNavigationProvider class="«getMarkerNavigationProviderQualifiedClassName()»">
+ <MarkerType name="«editorGen.plugin.iD + "." + getValidationDiagnosticMarkerType()»"/>
+ <Priority name="«markerNavigationProviderPriority»"/>
+ </MarkerNavigationProvider>
+ </extension>
+
+ <extension id="«getValidationDiagnosticMarkerType()»" name="«editorGen.plugin.name» problems" point="org.eclipse.core.resources.markers">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <super type="org.eclipse.core.resources.problemmarker"/>
+ <super type="org.eclipse.gmf.runtime.common.ui.services.marker"/>
+ <persistent value="true"/>
+ </extension>
+«ENDIF-»
+«IF validationDecorators-»
+
+ <extension id="validationDecoratorProvider" name="ValidationDecorations" point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <decoratorProvider class="«getValidationDecoratorProviderQualifiedClassName()»">
+ <Priority name="«validationDecoratorProviderPriority»"/>
+ <object class="org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart(org.eclipse.gmf.runtime.diagram.ui)" id="PRIMARY_VIEW"/>
+ <context decoratorTargets="PRIMARY_VIEW"/>
+ </decoratorProvider>
+ </extension>
+«ENDIF-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenPlugin»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/plugin/properties.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::Utils»
+
+«DEFINE properties FOR gmfgen::GenPlugin-»
+pluginName=«name»
+providerName=«provider»
+
+preferences.general=«editorGen.modelID» Diagram
+preferences.appearance=Appearance
+preferences.connections=Connections
+preferences.printing=Printing
+preferences.rulersAndGrid=Rulers & Grid
+preferences.pathmaps=Path Maps
+
+editorName=«editorGen.modelID» Diagram Editing
+context.description=«editorGen.modelID» Diagram Editing
+context.name=In «editorGen.modelID» Diagram Editor
+newWizardName=«editorGen.modelID» Diagram
+newWizardDesc=Creates «editorGen.modelID» diagram.
+
+«IF editorGen.diagram.generateInitDiagramAction()-»
+initDiagramActionLabel=Initialize «editorGen.diagramFileExtension» diagram file
+«ENDIF-»
+«IF editorGen.diagram.generateCreateShortcutAction()-»
+createShortcutActionLabel=Create Shortcut...
+«ENDIF-»
+loadResourceActionLabel=Load Resource...
+
+«IF null != editorGen.application-»
+perspectiveName=«editorGen.modelID» Perspective
+applicationActionSetLabel=<«editorGen.modelID» Actions
+newDiagramActionLabel=«editorGen.modelID» Diagram
+aboutActionLabel=«editorGen.modelID» Diagram About...
+openURIActionLabel=Open URI...
+openURIActionDescription=Open file by URI
+openActionLabel=Open...
+openActionDescription=Open file
+«ENDIF-»
+
+navigatorContentName=*.«editorGen.diagramFileExtension» diagram contents
+«IF null != editorGen.navigator && editorGen.navigator.generateDomainModelNavigator-»
+domainNavigatorContentName=*.«editorGen.domainFileExtension» model contents
+«ENDIF-»
+update.diagram.name=Update «editorGen.modelID» diagram
+update.diagram.description=Perform «editorGen.modelID» diagram update
+
+«EXPAND xpt::propsheet::extensions::i18n FOR editorGen.propertySheet-»
+«EXPAND xpt::diagram::preferences::extensions::i18n FOR editorGen.diagram-»
+«EXPAND xpt::providers::extensions::i18n FOR editorGen.diagram-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/propsheet/LabelProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE Class FOR gmfgen::GenPropertySheet»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «labelProviderClassName» extends «EXPAND extendsList» {
+
+«EXPAND cons»
+«EXPAND getTextMethod»
+«EXPAND getImageMethod»
+«EXPAND unwrapMethods»
+
+«EXPAND additions»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenPropertySheet»org.eclipse.jface.viewers.DecoratingLabelProvider«ENDDEFINE»
+
+«DEFINE cons FOR gmfgen::GenPropertySheet»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «labelProviderClassName»() {
+ super(new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(«editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory()), null);
+ }
+«ENDDEFINE»
+
+«DEFINE getTextMethod FOR gmfgen::GenPropertySheet»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getText(Object element) {
+ Object selected = unwrap(element);
+«IF editorGen.navigator != null-»
+ if (selected instanceof «editorGen.navigator.getNavigatorGroupQualifiedClassName()») {
+ return ((«editorGen.navigator.getNavigatorGroupQualifiedClassName()») selected).getGroupName();
+ }
+«ENDIF-»
+ return super.getText(selected);
+ }
+«ENDDEFINE»
+
+«DEFINE getImageMethod FOR gmfgen::GenPropertySheet»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.swt.graphics.Image getImage(Object element) {
+ return super.getImage(unwrap(element));
+ }
+«ENDDEFINE»
+
+«DEFINE unwrapMethods FOR gmfgen::GenPropertySheet»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private Object unwrap(Object element) {
+ if (element instanceof org.eclipse.jface.viewers.IStructuredSelection) {
+ return unwrap(((org.eclipse.jface.viewers.IStructuredSelection) element).getFirstElement());
+ }
+ if (element instanceof org.eclipse.gef.EditPart) {
+ return unwrapEditPart((org.eclipse.gef.EditPart) element);
+ }
+ if (element instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) element).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null) {
+ return unwrapView(view);
+ }
+ }
+ return element;
+ }
+ «EXPAND unwrapEditPartMethod»
+ «EXPAND unwrapViewMethod»
+«ENDDEFINE»
+
+«DEFINE unwrapEditPartMethod FOR gmfgen::GenPropertySheet»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private Object unwrapEditPart(org.eclipse.gef.EditPart p) {
+ if (p.getModel() instanceof org.eclipse.gmf.runtime.notation.View) {
+ return unwrapView((org.eclipse.gmf.runtime.notation.View) p.getModel());
+ }
+ return p.getModel();
+ }
+«ENDDEFINE»
+
+«DEFINE unwrapViewMethod FOR gmfgen::GenPropertySheet»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private Object unwrapView(org.eclipse.gmf.runtime.notation.View view) {
+ return view.getElement() == null ? view : view.getElement();
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenPropertySheet»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/propsheet/PropertySection.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE Class FOR gmfgen::GenCustomPropertyTab»
+ «EXPAND xpt::Common::copyright FOR sheet.editorGen-»
+package «sheet.packageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «className» extends «EXPAND extendsList» «EXPAND implementsClause»{
+
+«EXPAND getPropertySourceMethod»
+«IF sheet.readOnly»
+«EXPAND createReadonlyControlsMethod»
+«ENDIF»
+«EXPAND getPropertySourceProviderMethod»
+«EXPAND transfromSelectionMethod»
+«EXPAND setInputMethod»
+«EXPAND getAdapterFactoryMethod»
+
+«EXPAND additions»
+}
+«ENDDEFINE»
+
+«DEFINE extendsList FOR gmfgen::GenCustomPropertyTab»org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection«ENDDEFINE»
+«DEFINE implementsClause FOR gmfgen::GenCustomPropertyTab»implements org.eclipse.ui.views.properties.IPropertySourceProvider«ENDDEFINE»
+
+«DEFINE getPropertySourceMethod FOR gmfgen::GenCustomPropertyTab-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.ui.views.properties.IPropertySource getPropertySource(Object object) {
+ if (object instanceof org.eclipse.ui.views.properties.IPropertySource) {
+ return (org.eclipse.ui.views.properties.IPropertySource) object;
+ }
+ org.eclipse.emf.common.notify.AdapterFactory af = getAdapterFactory(object);
+ if (af != null) {
+ org.eclipse.emf.edit.provider.IItemPropertySource ips = (org.eclipse.emf.edit.provider.IItemPropertySource) af.adapt(object, org.eclipse.emf.edit.provider.IItemPropertySource.class);
+ if (ips != null) {
+ return new org.eclipse.emf.edit.ui.provider.PropertySource(object, ips);
+ }
+ }
+ if (object instanceof org.eclipse.core.runtime.IAdaptable) {
+ return (org.eclipse.ui.views.properties.IPropertySource) ((org.eclipse.core.runtime.IAdaptable) object).getAdapter(org.eclipse.ui.views.properties.IPropertySource.class);
+ }
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE createReadonlyControlsMethod FOR gmfgen::GenCustomPropertyTab»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void createControls(org.eclipse.swt.widgets.Composite parent, org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage aTabbedPropertySheetPage) {
+ super.createControls(parent, aTabbedPropertySheetPage);
+ class ROEntry extends org.eclipse.gmf.runtime.emf.ui.properties.sections.UndoableModelPropertySheetEntry {
+ ROEntry(org.eclipse.core.commands.operations.IOperationHistory operationHistory) {
+ super(operationHistory);
+ }
+ public org.eclipse.jface.viewers.CellEditor getEditor(org.eclipse.swt.widgets.Composite parentComposite) {
+ return null; // do not allow editing
+ }
+ protected org.eclipse.gmf.runtime.emf.ui.properties.sections.PropertySheetEntry createChildEntry() {
+ return new ROEntry(getOperationHistory());
+ }
+ };
+ ROEntry root = new ROEntry(org.eclipse.core.commands.operations.OperationHistoryFactory.getOperationHistory());
+ root.setPropertySourceProvider(getPropertySourceProvider());
+ page.setRootEntry(root);
+ }
+«ENDDEFINE»
+
+«DEFINE getPropertySourceProviderMethod FOR gmfgen::GenCustomPropertyTab»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.ui.views.properties.IPropertySourceProvider getPropertySourceProvider() {
+ return this;
+ }
+«ENDDEFINE»
+
+«DEFINE transfromSelectionMethod FOR gmfgen::GenCustomPropertyTab»
+ «EXPAND xpt::Common::generatedMemberComment("Modify/unwrap selection.")»
+ protected Object transformSelection(Object selected) {
+«IF "domain" == iD /*perhaps, override setInput should obey same condition?*/-»
+ «EXPAND transfromSelectionMethodBodyDefault-»
+«ENDIF-»
+ return selected;
+ }
+«ENDDEFINE»
+
+«DEFINE transfromSelectionMethodBodyDefault FOR gmfgen::GenCustomPropertyTab»
+ if (selected instanceof org.eclipse.gef.EditPart) {
+ Object model = ((org.eclipse.gef.EditPart) selected).getModel();
+ return model instanceof org.eclipse.gmf.runtime.notation.View ? ((org.eclipse.gmf.runtime.notation.View) model).getElement() : null;
+ }
+ if (selected instanceof org.eclipse.gmf.runtime.notation.View) {
+ return ((org.eclipse.gmf.runtime.notation.View) selected).getElement();
+ }
+ if (selected instanceof org.eclipse.core.runtime.IAdaptable) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) ((org.eclipse.core.runtime.IAdaptable) selected).getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null) {
+ return view.getElement();
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE setInputMethod FOR gmfgen::GenCustomPropertyTab»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setInput(org.eclipse.ui.IWorkbenchPart part, org.eclipse.jface.viewers.ISelection selection) {
+ if (selection.isEmpty() || false == selection instanceof org.eclipse.jface.viewers.StructuredSelection) {
+ super.setInput(part, selection);
+ return;
+ }
+ final org.eclipse.jface.viewers.StructuredSelection structuredSelection = ((org.eclipse.jface.viewers.StructuredSelection) selection);
+ java.util.ArrayList transformedSelection = new java.util.ArrayList(structuredSelection.size());
+ for (java.util.Iterator it = structuredSelection.iterator(); it.hasNext();) {
+ Object r = transformSelection(it.next());
+ if (r != null) {
+ transformedSelection.add(r);
+ }
+ }
+ super.setInput(part, new org.eclipse.jface.viewers.StructuredSelection(transformedSelection));
+ }
+«ENDDEFINE»
+
+«DEFINE getAdapterFactoryMethod FOR gmfgen::GenCustomPropertyTab»
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.common.notify.AdapterFactory getAdapterFactory(Object object) {
+ if (getEditingDomain() instanceof org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) {
+ return ((org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) getEditingDomain()).getAdapterFactory();
+ }
+ org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(object);
+ if (editingDomain != null) {
+ return ((org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain) editingDomain).getAdapterFactory();
+ }
+ return null;
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenCustomPropertyTab»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/propsheet/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE extensions FOR gmfgen::GenPropertySheet-»
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <propertyContributor
+ contributorId="«editorGen.plugin.iD»"«IF needsCaption»
+ labelProvider="«getLabelProviderQualifiedClassName()»"«ENDIF»>
+ <propertyCategory category="domain"/>
+ <propertyCategory category="visual"/>
+ <propertyCategory category="extra"/>
+ </propertyContributor>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <propertyTabs contributorId="«editorGen.plugin.iD»">
+«EXPAND tab FOREACH tabs-»
+ </propertyTabs>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <propertySections contributorId="«editorGen.plugin.iD»">
+«EXPAND section FOREACH tabs-»
+ </propertySections>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE tab FOR gmfgen::GenPropertyTab-»
+«ERROR "Unknown property tab: " + this»
+«ENDDEFINE»
+
+«DEFINE tab FOR gmfgen::GenStandardPropertyTab-»
+«IF iD == "appearance"-»
+ <propertyTab
+ category="visual"
+ id="property.tab.AppearancePropertySection"
+ label="%tab.appearance"/>
+«ELSEIF iD == "diagram"-»
+ <propertyTab
+ category="visual"
+ id="property.tab.DiagramPropertySection"
+ label="%tab.diagram"/>
+«ELSEIF iD == "advanced"-»
+ <propertyTab
+ category="extra"
+ id="property.tab.AdvancedPropertySection"
+ label="%tab.advanced"/>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE tab FOR gmfgen::GenCustomPropertyTab-»
+ <propertyTab
+«IF iD == "domain"-»
+ category="domain"
+«ELSE-»
+ category="extra"
+«ENDIF-»
+ id="property.tab.«iD»"
+ label="%tab.«iD»"/>
+«ENDDEFINE»
+
+«DEFINE section FOR gmfgen::GenPropertyTab-»
+«ERROR "Unknown property tab: " + this»
+«ENDDEFINE»
+
+«DEFINE section FOR gmfgen::GenStandardPropertyTab-»
+«IF iD == "appearance"-»
+ <propertySection id="property.section.ConnectorAppearancePropertySection"
+ filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ConnectionEditPartPropertySectionFilter"
+ class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ConnectionAppearancePropertySection"
+ tab="property.tab.AppearancePropertySection">
+ </propertySection>
+ <propertySection id="property.section.ShapeColorAndFontPropertySection"
+ filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.ShapeEditPartPropertySectionFilter"
+ class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.ShapeColorsAndFontsPropertySection"
+ tab="property.tab.AppearancePropertySection">
+ </propertySection>
+ <propertySection id="property.section.DiagramColorsAndFontsPropertySection"
+ filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter"
+ class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.appearance.DiagramColorsAndFontsPropertySection"
+ tab="property.tab.AppearancePropertySection">
+ </propertySection>
+«ELSEIF iD == "diagram"-»
+ <propertySection id="property.section.RulerGridPropertySection"
+ filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.DiagramEditPartPropertySectionFilter"
+ class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.grid.RulerGridPropertySection"
+ tab="property.tab.DiagramPropertySection">
+ </propertySection>
+«ELSEIF iD == "advanced"-»
+ <propertySection id="property.section.AdvancedPropertySection"
+ class="org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection"
+ filter="org.eclipse.gmf.runtime.diagram.ui.properties.filters.EditPartPropertySectionFilter"
+ tab="property.tab.AdvancedPropertySection">
+ </propertySection>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE section FOR gmfgen::GenCustomPropertyTab-»
+ <propertySection
+ id="property.section.«iD»"
+ tab="property.tab.«iD»"
+«EXPAND filter FOR filter-»
+ class="«getQualifiedClassName()»">
+«EXPAND input FOR filter-»
+ </propertySection>
+«ENDDEFINE»
+
+«DEFINE filter FOR gmfgen::GenPropertyTabFilter»«ENDDEFINE»
+
+«DEFINE filter FOR gmfgen::CustomTabFilter-»
+ filter="«getQualifiedClassName()»"
+«ENDDEFINE»
+
+«DEFINE input FOR gmfgen::GenPropertyTabFilter»«ENDDEFINE»
+
+«DEFINE input FOR gmfgen::TypeTabFilter-»
+«FOREACH getAllTypes() AS type-»
+ <input type="«type»"/>
+«ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE i18n FOR gmfgen::GenPropertySheet-»
+
+# Property Sheet
+«FOREACH tabs AS tab-»
+tab.«tab.iD»=«tab.label»
+«ENDFOREACH-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ContributionItemProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE ContributionItemProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «contributionItemProviderClassName»
+ extends org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.jface.action.IAction createAction(String actionId,
+ org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor) {
+ if (actionId.equals(org.eclipse.gmf.runtime.diagram.ui.printing.actions.PrintPreviewAction.ID)) {
+ return new org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.RenderedPrintPreviewAction(
+ new org.eclipse.gmf.runtime.diagram.ui.printing.render.actions.EnhancedPrintActionHelper());
+ }
+ return super.createAction(actionId, partDescriptor);
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/EditPartProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE EditPartProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «editPartProviderClassName»
+ extends org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gef.EditPartFactory factory;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private boolean allowCaching;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.lang.ref.WeakReference cachedPart;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private java.lang.ref.WeakReference cachedView;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public «editPartProviderClassName»() {
+ setFactory(new «getEditPartFactoryQualifiedClassName()»());
+ setAllowCaching(true);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public final org.eclipse.gef.EditPartFactory getFactory() {
+ return factory;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void setFactory(org.eclipse.gef.EditPartFactory factory) {
+ this.factory = factory;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public final boolean isAllowCaching() {
+ return allowCaching;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected synchronized void setAllowCaching(boolean allowCaching) {
+ this.allowCaching = allowCaching;
+ if (!allowCaching) {
+ cachedPart = null;
+ cachedView = null;
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart createEditPart(
+ org.eclipse.gmf.runtime.notation.View view) {
+ org.eclipse.gef.EditPart part = factory.createEditPart(null, view);
+ if (part instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) {
+ return (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) part;
+ }
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart getCachedPart(
+ org.eclipse.gmf.runtime.notation.View view) {
+ if (cachedView != null && cachedView.get() == view) {
+ return (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) cachedPart.get();
+ }
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public synchronized org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart createGraphicEditPart(
+ org.eclipse.gmf.runtime.notation.View view) {
+ if (isAllowCaching()) {
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart part = getCachedPart(view);
+ cachedPart = null;
+ cachedView = null;
+ if (part != null) {
+ return part;
+ }
+ }
+ return createEditPart(view);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public synchronized boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
+ if (operation instanceof org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation) {
+ org.eclipse.gmf.runtime.notation.View view =
+ ((org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation) operation).getView();
+ if (!«getEditPartQualifiedClassName()».MODEL_ID.equals(
+ «getVisualIDRegistryQualifiedClassName()».getModelID(view))) {
+ return false;
+ }
+ if (isAllowCaching() && getCachedPart(view) != null) {
+ return true;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart part = createEditPart(view);
+ if (part != null) {
+ if (isAllowCaching()) {
+ cachedPart = new java.lang.ref.WeakReference(part);
+ cachedView = new java.lang.ref.WeakReference(view);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ElementInitializers.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+
+extension xpt::GenModelUtils reexport;
+
+boolean expressionResultNeedsCast(GenClassifier c) : false ;
+boolean expressionResultNeedsCast(GenClass c) : false ;
+boolean expressionResultNeedsCast(GenDataType c) : isNumberObject(c) || isPrimitiveNumberType(c) ;
+boolean expressionResultNeedsCast(GenEnum c) : true ;
+
+/*
+ * Present approach may result in duplicated methods when same feature gets
+ * initialized using java language inside single ElementInitializer hierarchy
+ */
+String javaMethodName(GenCommonBase de, GenFeatureValueSpec valueSpec) :
+ valueSpec.feature.ecoreFeature.name + "_" + de.getUniqueIdentifier()
+;
+
+List[GenFeatureValueSpec] recurseCollectValueSpec(GenFeatureSeqInitializer si) :
+ si.initializers.typeSelect(GenFeatureValueSpec).union(
+ si.initializers.typeSelect(GenReferenceNewElementSpec).newElementInitializers.recurseCollectValueSpec().flatten())
+;
+
+List[int] getSuffixes(int newSuffix) :
+ {}.add(newSuffix).typeSelect(int)
+;
+
+List[int] getSuffixes(List[int] suffixes, int newSuffix) :
+ {}.addAll(suffixes).add(newSuffix).typeSelect(int)
+;
+
+String getVariableName(String prefix, List[int] suffixes) :
+ prefix + getSuffix(suffixes)
+;
+
+// privates
+
+private boolean isNumberObject(genmodel::GenClassifier c) : false ;
+private boolean isNumberObject(genmodel::GenClass c) : false ;
+private boolean isNumberObject(genmodel::GenDataType c) : {"java.math.BigDecimal", "java.math.BigInteger", "java.lang.Byte", "java.lang.Double", "java.lang.Float", "java.lang.Integer", "java.lang.Long", "java.lang.Short"}.contains(c.ecoreDataType.instanceClassName) ;
+private boolean isNumberObject(genmodel::GenEnum c) : false ;
+
+private boolean isPrimitiveNumberType(genmodel::GenClassifier c) : false ;
+private boolean isPrimitiveNumberType(genmodel::GenClass c) : false ;
+private boolean isPrimitiveNumberType(genmodel::GenDataType c) : {"byte", "double", "float", "int", "long", "short"}.contains(c.ecoreDataType.instanceClassName) ;
+private boolean isPrimitiveNumberType(genmodel::GenEnum c) : false ;
+
+private String getSuffix(List[int] suffixes) :
+ "_" + suffixes.first() + (suffixes.size() > 1 ? getSuffix(suffixes.withoutFirst().typeSelect(int)) : "")
+;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ElementInitializers.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - refactored javaInitilizers not to use methods from GMFGen model
+ * [221347] Got rid of generated interfaces
+ * (IObjectInitializer, IFeatureInitializer) and implementation thereof
+ */
+
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::providers::ElementInitializers»
+
+«DEFINE ElementInitializers FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class ElementInitializers {
+ «EXPAND Initializers»
+ «EXPAND JavaSupport»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE Initializers FOR GenDiagram-»
+ «EXPAND initMethod FOREACH getAllNodes()-»
+ «EXPAND initMethod FOREACH links-»
+«ENDDEFINE»
+
+«DEFINE JavaSupport FOR GenDiagram-»
+«IF editorGen.expressionProviders != null && !editorGen.expressionProviders.providers.typeSelect(GenJavaExpressionProvider).isEmpty()-»
+ «EXPAND javaMethod FOREACH getAllNodes()-»
+ «EXPAND javaMethod FOREACH links-»
+«ENDIF-»
+«ENDDEFINE»
+
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+
+«REM»
+ Definitions of initializer objects.
+«ENDREM»
+
+«DEFINE initMethod FOR GenNode»«EXPAND initMethod(this) FOR modelFacet»«ENDDEFINE»
+«DEFINE initMethod FOR GenLink»«EXPAND initMethod(this) FOR modelFacet»«ENDDEFINE»
+
+«DEFINE initMethod(GenCommonBase diagramElement) FOR ModelFacet»«ENDDEFINE»
+
+«DEFINE initMethod(GenCommonBase diagramElement) FOR TypeModelFacet-»
+«EXPAND initMethod(diagramElement) FOR modelElementInitializer-»
+«ENDDEFINE»
+
+«DEFINE initMethod(GenCommonBase diagramElement) FOR GenElementInitializer»«ERROR "No idea how to init using " + this»«ENDDEFINE»
+
+«DEFINE initMethod(GenCommonBase diagramElement) FOR GenFeatureSeqInitializer-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void init_«diagramElement.getUniqueIdentifier()»(«EXPAND MetaModel::QualifiedClassName FOR elementClass» instance) {
+ try {
+ «FOREACH initializers AS i»«EXPAND performInit(diagramElement, "instance", elementClass, getSuffixes(initializers.indexOf(i))) FOR i»«ENDFOREACH-»
+ } catch(RuntimeException e) {
+ «diagramElement.getDiagram().editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Element initialization failed", e); //$NON-NLS-1$
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE performInit(GenCommonBase diagramElement, String instanceVar, GenClass instanceClass, List[int] counters) FOR GenFeatureInitializer»«ENDDEFINE»
+
+«DEFINE performInit(GenCommonBase diagramElement, String instanceVar, GenClass instanceClass, List[int] counters) FOR GenFeatureValueSpec-»
+«LET getVariableName("value", counters) AS expressionVarName-»
+ Object «expressionVarName» = «EXPAND evaluateExpr(diagramElement, this, instanceVar) FOR value.provider»;
+«IF isListType(feature)-»
+ if («expressionVarName» instanceof java.util.Collection) {
+ «EXPAND MetaModel::getFeatureValue(instanceVar, instanceClass, true) FOR feature».clear();
+«IF expressionResultNeedsCast(getTypeGenClassifier(feature))-»
+ for (java.util.Iterator it = ((java.util.Collection) «expressionVarName»).iterator(); it.hasNext(); ) {
+ Object next = «diagramElement.getDiagram().editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()».performCast(it.next(), «EXPAND MetaModel::MetaClass FOR getTypeGenClassifier(feature)»);
+ «EXPAND MetaModel::getFeatureValue(instanceVar, instanceClass, true) FOR feature».add(next);
+ }
+«ELSE-»
+ «EXPAND MetaModel::getFeatureValue(instanceVar, instanceClass, true) FOR feature».addAll(((java.util.Collection) «expressionVarName»));
+«ENDIF-»
+ } else {
+«IF expressionResultNeedsCast(getTypeGenClassifier(feature))-»
+ «expressionVarName» = «diagramElement.getDiagram().editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()».performCast(«expressionVarName», «EXPAND MetaModel::MetaClass FOR getTypeGenClassifier(feature)»);
+«ENDIF-»
+ «EXPAND MetaModel::getFeatureValue(instanceVar, instanceClass, true) FOR feature».add((«EXPAND MetaModel::QualifiedClassName /*XXX sorta hack, better would be MM::setFeatureValue that supports lists*/FOR getTypeGenClassifier(feature)») «expressionVarName»);
+ }
+«ELSE-»
+«IF expressionResultNeedsCast(getTypeGenClassifier(feature))»
+ «expressionVarName» = «diagramElement.getDiagram().editorGen.expressionProviders.getAbstractExpressionQualifiedClassName()».performCast(«expressionVarName», «EXPAND MetaModel::MetaClass FOR getTypeGenClassifier(feature)»);
+«ENDIF-»
+ «EXPAND MetaModel::setFeatureValue(instanceVar, instanceClass, expressionVarName, true) FOR feature»;
+«ENDIF /*isListType*/-»
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE performInit(GenCommonBase diagramElement, String instanceVar, GenClass instanceClass, List[int] counters) FOR GenReferenceNewElementSpec-»
+«FOREACH newElementInitializers AS newElemInit-»
+«LET getSuffixes(counters, newElementInitializers.indexOf(newElemInit)) AS initializerCounters-»
+«LET getVariableName("newInstance", initializerCounters) AS newInstanceVar-»
+«EXPAND MetaModel::NewInstance(newInstanceVar) FOR newElemInit.elementClass»
+«IF isListType(feature)-»
+«EXPAND MetaModel::getFeatureValue(instanceVar, instanceClass) FOR feature».add(«newInstanceVar»);
+«ELSE-»
+«EXPAND MetaModel::setFeatureValue(instanceVar, instanceClass, newInstanceVar) FOR feature»;
+«ENDIF-»
+«FOREACH newElemInit.initializers AS i»«EXPAND performInit(diagramElement, newInstanceVar, newElemInit.elementClass, getSuffixes(initializerCounters, newElemInit.initializers.indexOf(i))) FOR i»«ENDFOREACH»
+«ENDLET-»
+«ENDLET-»
+«ENDFOREACH-»
+«ENDDEFINE»
+
+/////////////////////////////////
+
+«DEFINE evaluateExpr(GenCommonBase diagramElement, GenFeatureValueSpec valueExpr, String instanceVar) FOR GenExpressionProviderBase»«ENDDEFINE»
+
+// XXX perhaps, using instance.eClass() is better option than MetaModel::MetaClass (though, need to rely on instance variable name/type)
+«DEFINE evaluateExpr(GenCommonBase diagramElement, GenFeatureValueSpec valueExpr, String instanceVar) FOR GenExpressionInterpreter-»
+«EXPAND xpt::expressions::getExpression::getExpression(valueExpr.value, valueExpr.featureSeqInitializer.elementClass)».evaluate(«instanceVar»)«-»
+«ENDDEFINE»
+
+«REM»
+ XXX revisit: if emf java merge doesn't support genereated NOT methods with modified
+ return type, there's no much sense to keep Object value = invokeJavaMethodWithSpecificReturnType,
+ as client won't benefit from such code (he can't modify return type and thus would get duplicated methods on regeneration)
+ However, if merge does ignore method return type when merging, allowing Object as return type may help.
+«ENDREM»
+«DEFINE evaluateExpr(GenCommonBase diagramElement, GenFeatureValueSpec valueExpr, String instanceVar) FOR GenJavaExpressionProvider-»
+«javaMethodName(diagramElement, valueExpr)»(«instanceVar»)«-»
+«ENDDEFINE»
+
+/////////////////////////////////
+
+«DEFINE javaMethod FOR GenNode»«EXPAND javaMethod(this) FOR modelFacet»«ENDDEFINE»
+«DEFINE javaMethod FOR GenLink»«EXPAND javaMethod(this) FOR modelFacet»«ENDDEFINE»
+«DEFINE javaMethod(GenCommonBase diagramElement) FOR ModelFacet»«ENDDEFINE»
+«DEFINE javaMethod(GenCommonBase diagramElement) FOR TypeModelFacet-»
+«EXPAND javaMethod(diagramElement) FOR modelElementInitializer-»
+«ENDDEFINE»
+
+«DEFINE javaMethod(GenCommonBase diagramElement) FOR GenElementInitializer»«ERROR "No idea how to handle " + this»«ENDDEFINE»
+«DEFINE javaMethod(GenCommonBase diagramElement) FOR GenFeatureSeqInitializer-»
+«FOREACH recurseCollectValueSpec(this) AS vs»«EXPAND javaMethod(diagramElement, vs) FOR vs.value.provider»«ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE javaMethod(GenCommonBase diagramElement, GenFeatureValueSpec vs) FOR GenExpressionProviderBase-»«ENDDEFINE»
+«DEFINE javaMethod(GenCommonBase diagramElement, GenFeatureValueSpec vs) FOR GenJavaExpressionProvider-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static «EXPAND MetaModel::featureTargetType FOR vs.feature» «javaMethodName(diagramElement, vs)»(«EXPAND MetaModel::QualifiedClassName FOR vs.featureSeqInitializer.elementClass» self) {
+«IF injectExpressionBody && vs.value.body != null && vs.value.body.length() != 0-»
+ «vs.value.body»
+«ELSEIF throwException || (injectExpressionBody && (vs.value.body == null || vs.value.body.length() == 0))-»
+ // TODO: implement this method to return value
+ // for «EXPAND MetaModel::MetaFeature FOR vs.feature»
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new java.lang.UnsupportedOperationException("No user java implementation provided in '«javaMethodName(diagramElement, vs)»' operation");«EXPAND xpt::Common::nonNLS»
+«ELSE-»
+ return null;
+«ENDIF-»
+ }
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ElementTypes.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,238 @@
+/*
+ * Copyright (c) 2006, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::Utils»
+«EXTENSION xpt::GenModelUtils»
+
+«DEFINE ElementTypes FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «elementTypesClassName» extends ElementInitializers {
+
+ «EXPAND constructor-»
+
+ «EXPAND attributes-»
+
+ «EXPAND elementTypeField FOREACH getElements()-»
+
+ «EXPAND getImageRegistry-»
+
+ «EXPAND getImageRegistryKey-»
+
+ «EXPAND getProvidedImageDescriptor-»
+
+ «EXPAND getNamedElementImageDescriptor-»
+
+ «EXPAND getNamedElementImage-»
+
+ «EXPAND getAdaptableImageDescriptor-»
+
+ «EXPAND getAdaptableImage-»
+
+ «EXPAND getElement-»
+
+ «EXPAND getElementType-»
+
+ «EXPAND isKnownElementType-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private «elementTypesClassName»() {
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static java.util.Map elements;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.jface.resource.ImageRegistry imageRegistry;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+private static java.util.Set KNOWN_ELEMENT_TYPES;
+«ENDDEFINE»
+
+
+«DEFINE getImageRegistry FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.jface.resource.ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ imageRegistry = new org.eclipse.jface.resource.ImageRegistry();
+ }
+ return imageRegistry;
+}
+«ENDDEFINE»
+
+«DEFINE getImageRegistryKey FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static String getImageRegistryKey(org.eclipse.emf.ecore.ENamedElement element) {
+ return element.getName();
+}
+«ENDDEFINE»
+
+«DEFINE getProvidedImageDescriptor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.jface.resource.ImageDescriptor getProvidedImageDescriptor(org.eclipse.emf.ecore.ENamedElement element) {
+ if (element instanceof org.eclipse.emf.ecore.EStructuralFeature) {
+ org.eclipse.emf.ecore.EStructuralFeature feature = ((org.eclipse.emf.ecore.EStructuralFeature) element);
+ org.eclipse.emf.ecore.EClass eContainingClass = feature.getEContainingClass();
+ org.eclipse.emf.ecore.EClassifier eType = feature.getEType();
+ if (eContainingClass != null && !eContainingClass.isAbstract()){
+ element = eContainingClass;
+ } else if (eType instanceof org.eclipse.emf.ecore.EClass && !((org.eclipse.emf.ecore.EClass)eType).isAbstract()){
+ element = eType;
+ }
+ }
+ if (element instanceof org.eclipse.emf.ecore.EClass) {
+ org.eclipse.emf.ecore.EClass eClass = (org.eclipse.emf.ecore.EClass) element;
+ if (!eClass.isAbstract()) {
+ return «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemImageDescriptor(
+ eClass.getEPackage().getEFactoryInstance().create(eClass));
+ }
+ }
+ // TODO : support structural features
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getNamedElementImageDescriptor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(org.eclipse.emf.ecore.ENamedElement element) {
+ String key = getImageRegistryKey(element);
+ org.eclipse.jface.resource.ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(key);
+ if (imageDescriptor == null) {
+ «EXPAND loadProvidedImageDescriptor-»
+ }
+ return imageDescriptor;
+}
+«ENDDEFINE»
+
+«DEFINE loadProvidedImageDescriptor FOR gmfgen::GenDiagram-»
+imageDescriptor = getProvidedImageDescriptor(element);
+if (imageDescriptor == null) {
+ imageDescriptor = org.eclipse.jface.resource.ImageDescriptor.getMissingImageDescriptor();
+}
+getImageRegistry().put(key, imageDescriptor);
+«ENDDEFINE»
+
+«DEFINE getNamedElementImage FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.swt.graphics.Image getImage(org.eclipse.emf.ecore.ENamedElement element) {
+ String key = getImageRegistryKey(element);
+ org.eclipse.swt.graphics.Image image = getImageRegistry().get(key);
+ if (image == null) {
+ org.eclipse.jface.resource.ImageDescriptor «EXPAND loadProvidedImageDescriptor-»
+ image = getImageRegistry().get(key);
+ }
+ return image;
+}
+«ENDDEFINE»
+
+«DEFINE getAdaptableImageDescriptor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.jface.resource.ImageDescriptor getImageDescriptor(org.eclipse.core.runtime.IAdaptable hint) {
+ «EXPAND getNamedElement-»
+ return getImageDescriptor(element);
+}
+«ENDDEFINE»
+
+«DEFINE getNamedElement FOR gmfgen::GenDiagram-»
+org.eclipse.emf.ecore.ENamedElement element = getElement(hint);
+if (element == null) {
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getAdaptableImage FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static org.eclipse.swt.graphics.Image getImage(org.eclipse.core.runtime.IAdaptable hint) {
+ «EXPAND getNamedElement-»
+ return getImage(element);
+}
+«ENDDEFINE»
+
+«DEFINE getElement FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment("Returns \'type\' of the ecore object associated with the hint.\n")»
+public static org.eclipse.emf.ecore.ENamedElement getElement(org.eclipse.core.runtime.IAdaptable hint) {
+ Object type = hint.getAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
+ if (elements == null) {
+ elements = new java.util.IdentityHashMap();
+ «EXPAND bindUniqueIdentifierToNamedElement(getUniqueIdentifier()) FOR domainDiagramElement-»
+ «FOREACH getNodes() AS node-»
+ «EXPAND bindUniqueIdentifierToNamedElement(node.getUniqueIdentifier()) FOR node.modelFacet-»
+ «ENDFOREACH-»
+ «FOREACH links AS link-»
+ «EXPAND bindUniqueIdentifierToNamedElement(link.getUniqueIdentifier()) FOR link.modelFacet-»
+ «ENDFOREACH-»
+ }
+ return (org.eclipse.emf.ecore.ENamedElement) elements.get(type);
+}
+«ENDDEFINE»
+
+«DEFINE bindUniqueIdentifierToNamedElement(String id) FOR genmodel::GenClass»
+ elements.put(«id», «EXPAND MetaModel::MetaClass»);
+«ENDDEFINE»
+
+«DEFINE bindUniqueIdentifierToNamedElement(String id) FOR gmfgen::ModelFacet»
+ «ERROR "Unsupported model facet: " + this-»
+«ENDDEFINE»
+
+«DEFINE bindUniqueIdentifierToNamedElement(String id) FOR gmfgen::TypeModelFacet»
+ «EXPAND bindUniqueIdentifierToNamedElement(id) FOR metaClass-»
+«ENDDEFINE»
+
+«DEFINE bindUniqueIdentifierToNamedElement(String id) FOR gmfgen::FeatureLinkModelFacet»
+ elements.put(«id», «EXPAND MetaModel::MetaFeature FOR metaFeature»);
+«ENDDEFINE»
+
+«DEFINE elementTypeField FOR gmfgen::GenCommonBase-»
+ «IF null != elementType-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static final org.eclipse.gmf.runtime.emf.type.core.IElementType «getUniqueIdentifier()» = getElementType("«elementType.uniqueIdentifier»"); «EXPAND xpt::Common::nonNLS»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getElementType FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+private static org.eclipse.gmf.runtime.emf.type.core.IElementType getElementType(String id) {
+ return org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getType(id);
+}
+«ENDDEFINE»
+
+«DEFINE isKnownElementType FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static boolean isKnownElementType(org.eclipse.gmf.runtime.emf.type.core.IElementType elementType) {
+ if (KNOWN_ELEMENT_TYPES == null) {
+ KNOWN_ELEMENT_TYPES = new java.util.HashSet();
+ «EXPAND addKnownElementType FOREACH getElements()-»
+ }
+ return KNOWN_ELEMENT_TYPES.contains(elementType);
+}
+«ENDDEFINE»
+
+«DEFINE addKnownElementType FOR gmfgen::GenCommonBase-»
+ «IF null != elementType-»
+KNOWN_ELEMENT_TYPES.add(«getUniqueIdentifier()»);
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/IconProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE IconProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «iconProviderClassName» extends org.eclipse.gmf.runtime.common.core.service.AbstractProvider
+ implements org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.swt.graphics.Image getIcon(org.eclipse.core.runtime.IAdaptable hint, int flags) {
+ return «getElementTypesQualifiedClassName()».getImage(hint);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
+ if (operation instanceof org.eclipse.gmf.runtime.common.ui.services.icon.GetIconOperation) {
+ return ((org.eclipse.gmf.runtime.common.ui.services.icon.GetIconOperation) operation).execute(this) != null;
+ }
+ return false;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/MarkerNavigationProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE MarkerNavigationProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «markerNavigationProviderClassName»
+ extends org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String MARKER_TYPE =
+ «editorGen.plugin.getActivatorQualifiedClassName()».ID + ".«getValidationDiagnosticMarkerType()»"; «EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected void doGotoMarker(org.eclipse.core.resources.IMarker marker) {
+ String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null);
+ if (elementId == null || !(getEditor() instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor)) {
+ return;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor editor =
+ (org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor) getEditor();
+ java.util.Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
+ org.eclipse.emf.ecore.EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
+ if (targetView == null) {
+ return;
+ }
+ org.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart) editPartRegistry.get(targetView);
+ if (targetEditPart != null) {
+ «getDiagramEditorUtilQualifiedClassName()».selectElementsInDiagram(
+ editor, java.util.Arrays.asList(new org.eclipse.gef.EditPart[] { targetEditPart }));
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void deleteMarkers(org.eclipse.core.resources.IResource resource) {
+ try {
+ resource.deleteMarkers(MARKER_TYPE, true, org.eclipse.core.resources.IResource.DEPTH_ZERO);
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Failed to delete validation markers", e); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static org.eclipse.core.resources.IMarker addMarker(org.eclipse.core.resources.IFile file,
+ String elementId, String location, String message, int statusSeverity) {
+ org.eclipse.core.resources.IMarker marker = null;
+ try {
+ marker = file.createMarker(MARKER_TYPE);
+ marker.setAttribute(org.eclipse.core.resources.IMarker.MESSAGE, message);
+ marker.setAttribute(org.eclipse.core.resources.IMarker.LOCATION, location);
+ marker.setAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, elementId);
+ int markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_INFO;
+ if (statusSeverity == org.eclipse.core.runtime.IStatus.WARNING) {
+ markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_WARNING;
+ } else if (statusSeverity == org.eclipse.core.runtime.IStatus.ERROR ||
+ statusSeverity == org.eclipse.core.runtime.IStatus.CANCEL) {
+ markerSeverity = org.eclipse.core.resources.IMarker.SEVERITY_ERROR;
+ }
+ marker.setAttribute(org.eclipse.core.resources.IMarker.SEVERITY, markerSeverity);
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Failed to create validation marker", e); «EXPAND xpt::Common::nonNLS»
+ }
+ return marker;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/MetricProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,445 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - refactoring (https://bugs.eclipse.org/230014)
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::EMFUtils»
+«EXTENSION xpt::providers::Metrics»
+
+«DEFINE MetricProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «metricProviderClassName»
+ extends org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.jface.action.IAction createAction(String actionId,
+ org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor) {
+ if (MetricsAction.ACTION_KEY.equals(actionId)) {
+ return new MetricsAction(partDescriptor);
+ }
+ return super.createAction(actionId, partDescriptor);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static class MetricsAction extends org.eclipse.jface.action.Action {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String ACTION_KEY = "metricsAction"; //$NON-NLS-1$
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor workbenchPartDescriptor;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public MetricsAction(org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor workbenchPartDescriptor) {
+ setId(ACTION_KEY);
+ setText("Metrics");
+ this.workbenchPartDescriptor = workbenchPartDescriptor;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void run() {
+ org.eclipse.ui.IWorkbenchPart workbenchPart = workbenchPartDescriptor.getPartPage().getActivePart();
+ org.eclipse.ui.IViewPart metricsView = null;
+ try {
+ metricsView = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(«EXPAND resultViewID»);
+ if (metricsView == null) {
+ metricsView = org.eclipse.ui.PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(«EXPAND resultViewID»);
+ } else {
+ if (metricsView != null && workbenchPart instanceof org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) {
+ final org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart part = (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) workbenchPart;
+ ((ResultView) metricsView).setInput(part);
+ }
+ workbenchPart.getSite().getPage().activate(metricsView);
+ }
+ } catch (org.eclipse.ui.PartInitException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Diagram metric view failure", e); //$NON-NLS-1$
+ }
+ }
+ }
+
+«EXPAND calculateMetricsMethods-»
+
+«EXPAND formatNotationElementNameMethod-»
+«EXPAND formatSemanticElementNameMethod-»
+
+«EXPAND metricsClasses»
+
+«EXPAND keysAndToolTipsMethods FOR editorGen.metrics»
+
+«EXPAND metricCalcField FOREACH editorGen.metrics.metrics.select(m | m.rule != null && m.target != null && m.target.getContext() != null)»
+«EXPAND metricCalcMethod FOREACH editorGen.metrics.metrics.select(m | m.rule != null && m.target != null && m.target.getContext() != null)»
+
+«EXPAND MetricsResultView::Class»
+
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE resultViewQualifiedClassName FOR gmfgen::GenDiagram»«providersPackageName».«metricProviderClassName».«EXPAND MetricsResultView::className»«ENDDEFINE»
+«DEFINE resultViewID FOR gmfgen::GenDiagram»«EXPAND resultViewQualifiedClassName».VIEW_ID«ENDDEFINE»
+
+
+//////////////////////////////////////////////////////////////////////////
+
+«DEFINE calculateMetricsMethods FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static java.util.List calculateMetrics(org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart diagramPart) {
+ final org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart = diagramPart.getDiagramEditPart();
+ try {
+ return (java.util.List) diagramPart.getDiagramEditPart().getEditingDomain().runExclusive(
+ new org.eclipse.emf.transaction.RunnableWithResult.Impl() {
+
+ public void run() {
+ org.eclipse.gmf.runtime.notation.Diagram diagram = diagramEditPart.getDiagramView();
+ java.util.ArrayList/*<ElementMetrics>*/ metrics = new java.util.ArrayList/*<ElementMetrics>*/(50);
+«IF !getNotationMetrics(editorGen.metrics).isEmpty()-»
+ calculateNotationElementMetrics(diagram, metrics);
+«ENDIF-»
+«IF !getDiagramMetrics(editorGen.metrics).isEmpty()-»
+ calculateDiagramElementMetrics(diagram, metrics);
+«ENDIF-»
+«IF !getDomainMetrics(editorGen.metrics).isEmpty()-»
+ calculateSemanticElementMetrics(diagramEditPart, metrics);
+«ENDIF-»
+ setResult(metrics);
+ }
+ });
+ } catch (InterruptedException e) {
+ return java.util.Collections.EMPTY_LIST;
+ }
+ }
+
+«IF !getNotationMetrics(editorGen.metrics).isEmpty()»«EXPAND calcNotationMetricsMethod FOR editorGen»«ENDIF»
+«IF !getDiagramMetrics(editorGen.metrics).isEmpty()»«EXPAND calcDiagramMetricsMethod FOR editorGen»«ENDIF»
+«IF !getDomainMetrics(editorGen.metrics).isEmpty()»«EXPAND calcDomainMetricsMethod FOR editorGen»«ENDIF»
+«ENDDEFINE»
+
+
+«DEFINE metricsClasses FOR GenDiagram»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static class ElementMetrics {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ final Metric[] metrics;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ final String targetElementQName;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ final org.eclipse.swt.graphics.Image elementImage;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ String diagramElementID; «REM»FIXME add specific constructor for View elements, set diagramElementID from there«ENDREM»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ ElementMetrics(org.eclipse.emf.ecore.EObject target, String name, Metric[] metrics) {
+ assert metrics.length > 0;
+ assert name != null;
+ this.metrics = metrics;
+ this.targetElementQName = name;
+ org.eclipse.emf.ecore.EClass imageTarget = target.eClass();
+ if (target instanceof org.eclipse.gmf.runtime.notation.View) {
+ org.eclipse.gmf.runtime.notation.View viewTarget = (org.eclipse.gmf.runtime.notation.View) target;
+ if ("".equals(viewTarget.getType()) && viewTarget.getElement() != null) {«EXPAND xpt::Common::nonNLS»
+ imageTarget = viewTarget.getElement().eClass();
+ }
+ }
+ this.elementImage = «EXPAND getImageAccessor("imageTarget")»;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ Metric getMetricByKey(String key) {
+ for (int i = 0; i < metrics.length; i++) {
+ if (metrics[i].key.equals(key)) {
+ return metrics[i];
+ }
+ }
+ return null;
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static class Metric implements Comparable {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ final String key;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ final Double value;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ final Double lowLimit;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ final Double highLimit;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ final String displayValue;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ Metric(String key, Double value) {
+ this(key, value, null, null);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ Metric(String key, Double value, Double low, Double high) {
+ assert key != null;
+ this.key = key;
+ this.value = value;
+ this.lowLimit = low;
+ this.highLimit = high;
+ this.displayValue = (value != null) ? java.text.NumberFormat.getInstance().format(value) : "null"; //$NON-NLS-1$
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public int compareTo(Object other) {
+ Metric otherMetric = (Metric) other;
+ if (value != null && otherMetric.value != null) {
+ return (value.longValue() < otherMetric.value.longValue()) ? -1
+ : (value.longValue() == otherMetric.value.longValue() ? 0 : 1);
+ }
+ return (value == null && otherMetric.value == null) ? 0
+ : (value == null) ? -1 : 1;
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE getImageAccessor(String imageClassVar) FOR gmfgen::GenDiagram»«getElementTypesQualifiedClassName()».getImage(«imageClassVar»)«ENDDEFINE»
+
+«DEFINE calcNotationMetricsMethod FOR GenEditorGenerator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static void calculateNotationElementMetrics(org.eclipse.gmf.runtime.notation.Diagram diagram, java.util.List/*<ElementMetrics>*/ metricsList) {
+ ElementMetrics row = null;
+«LET getNotationMetrics(metrics).select(m | ((GenNotationElementTarget) m.target).element.ecoreClass.name == "Diagram") AS diagramMetrics-»
+«IF !diagramMetrics.isEmpty()-»
+ row = new ElementMetrics(diagram, formatViewName(diagram), new Metric[] {
+«EXPAND metricResult("diagram", false) FOREACH diagramMetrics SEPARATOR ",\n"»
+ });
+ row.diagramElementID = diagram.eResource().getURIFragment(diagram);
+ metricsList.add(row);
+«ENDIF-»
+«ENDLET-»
+«LET getNotationMetrics(metrics).collect(m | ((GenNotationElementTarget) m.target).element).toSet() AS notationTargets»
+ for (java.util.Iterator it = diagram.eAllContents(); it.hasNext(); ) {
+ Object next = it.next();
+«FOREACH notationTargets.typeSelect(GenClass) AS nt-»
+ if («EXPAND MetaModel::IsInstance("next") FOR nt») {
+ «EXPAND MetaModel::DeclareAndAssign("_" + nt.ecoreClass.name.toLowerCase(), "next", true) FOR nt»
+ row = new ElementMetrics(«"_" + nt.ecoreClass.name.toLowerCase()», formatViewName(«"_" + nt.ecoreClass.name.toLowerCase()»), new Metric[] {«-»
+ «FOREACH getNotationMetrics(metrics).select(m | ((GenNotationElementTarget) m.target).element == nt) AS m SEPARATOR ","»
+ «EXPAND metricResult("_" + nt.ecoreClass.name.toLowerCase(), false) FOR m-»
+ «ENDFOREACH»
+ });
+ row.diagramElementID = «"_" + nt.ecoreClass.name.toLowerCase()».eResource().getURIFragment(«"_" + nt.ecoreClass.name.toLowerCase()»);
+ metricsList.add(row);
+ }
+«ENDFOREACH-»
+ }
+«ENDLET-»
+ }
+«ENDDEFINE»
+
+«DEFINE calcDiagramMetricsMethod FOR GenEditorGenerator-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static void calculateDiagramElementMetrics(org.eclipse.gmf.runtime.notation.Diagram diagram, java.util.List/*<ElementMetrics>*/ metricsList) {
+ org.eclipse.emf.ecore.EObject next = diagram;
+ java.util.Iterator/*<EObject>*/ it = diagram.eAllContents();
+ do {
+ if (next instanceof org.eclipse.gmf.runtime.notation.View) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) next;
+ final int vid = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR diagram»(view);
+ java.util.ArrayList/*<Metric>*/ res = new java.util.ArrayList/*<Metric>*/(5);
+ switch (vid) {
+«FOREACH getDiagramMetrics(metrics).collect(m | ((GenDiagramElementTarget) m.target).element).flatten().toSet().typeSelect(GenCommonBase) AS cb-»
+ case «EXPAND xpt::editor::VisualIDRegistry::visualID FOR cb» : {«-»
+«FOREACH getDiagramMetrics(metrics).select(m | ((GenDiagramElementTarget) m.target).element.contains(cb)) AS m»
+ res.add(«EXPAND metricResult("view", true) FOR m»);
+«ENDFOREACH-»
+ break;
+ }
+«ENDFOREACH-»
+ }
+ if (!res.isEmpty()) {
+ ElementMetrics row = new ElementMetrics(view, formatViewName(view), (Metric[]) res.toArray(new Metric[res.size()]));
+ row.diagramElementID = view.eResource().getURIFragment(view);
+ metricsList.add(row);
+ }
+ }
+ next = it.hasNext() ? (org.eclipse.emf.ecore.EObject) it.next() : null;
+ } while (next != null);
+ }
+«ENDDEFINE»
+
+/*
+ * FIXME:
+ * for now, keep approach from old implementation, i.e. iterate content
+ * of element associated with diagram. Smarter approach would be
+ * iteration over diagram elements, then accessing their respective
+ * semantic elements (if set), and collecting metrics for them.
+ */
+«DEFINE calcDomainMetricsMethod FOR GenEditorGenerator»
+ «EXPAND xpt::Common::generatedMemberComment("NOTE: metrics are being collected for domain elements contained in the semantic element associated with diagram view, actual diagram content (elements present there) is not taken into account.")»
+ static void calculateSemanticElementMetrics(org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart diagramEditPart, java.util.List/*<ElementMetrics>*/ metricsList) {
+ org.eclipse.gmf.runtime.notation.Diagram diagram = diagramEditPart.getDiagramView();
+ org.eclipse.emf.ecore.EObject next = diagram.getElement();
+ java.util.Iterator/*<EObject>*/ it = next != null ? next.eAllContents() : java.util.Collections.EMPTY_LIST.iterator();
+ java.util.HashMap/*<EObject, ElementMetrics>*/ target2row = new java.util.HashMap/*<EObject, ElementMetrics>*/();
+ while (next != null) {
+ java.util.ArrayList/*<Metric>*/ res = new java.util.ArrayList/*<Metric>*/(5);
+«FOREACH metrics.metrics.target.typeSelect(GenDomainElementTarget).element.purgeDups().typeSelect(GenClass) AS e-»
+ if («EXPAND MetaModel::MetaClass FOR e».isInstance(next)) {
+«FOREACH metrics.metrics.select(m | m.target.getContext() == e) AS m-»
+ res.add(«EXPAND metricResult("next", true) FOR m»);
+«ENDFOREACH-»
+ }
+«ENDFOREACH-»
+ if (!res.isEmpty()) {
+ ElementMetrics row = new ElementMetrics(next, formatElementName(next), (Metric[]) res.toArray(new Metric[res.size()]));
+ metricsList.add(row);
+ target2row.put(next, row);
+ }
+ next = it.hasNext() ? (org.eclipse.emf.ecore.EObject) it.next() : null;
+ }
+ if (!target2row.isEmpty()) { // list was modified, need to process only semantic metrics
+ // bind semantic elements to notation
+ «diagram.getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap element2ViewMap = new «diagram.getDiagramEditorUtilQualifiedClassName()».LazyElement2ViewMap(diagram, target2row.keySet());
+ for (java.util.Iterator it2 = target2row.entrySet().iterator(); it2.hasNext();) {
+ java.util.Map.Entry entry = (java.util.Map.Entry) it2.next();
+ org.eclipse.emf.ecore.EObject semanticElement = (org.eclipse.emf.ecore.EObject) entry.getKey();
+ org.eclipse.gmf.runtime.notation.View targetView = «diagram.getDiagramEditorUtilQualifiedClassName()».findView(diagramEditPart, semanticElement, element2ViewMap);
+ ElementMetrics elementMetrics = (ElementMetrics) entry.getValue();
+ elementMetrics.diagramElementID = targetView.eResource().getURIFragment(targetView);
+ }
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE formatNotationElementNameMethod FOR GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static String formatViewName(org.eclipse.gmf.runtime.notation.View viewTarget) {
+ StringBuffer notationQNameBuf = new StringBuffer();
+ notationQNameBuf.append(formatElementName(viewTarget));
+ if (viewTarget.getElement() != null) {
+ notationQNameBuf.append("->").append(formatElementName(viewTarget.getElement())); «EXPAND xpt::Common::nonNLS»
+ }
+ int visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(viewTarget);
+ notationQNameBuf.append('[').append(visualID < 0 ? Integer.toString(System.identityHashCode(viewTarget)) : Integer.toString(visualID)).append(']');
+ return notationQNameBuf.toString();
+ }
+«ENDDEFINE»
+
+«DEFINE formatSemanticElementNameMethod FOR GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static String formatElementName(org.eclipse.emf.ecore.EObject object) {
+ return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(object, true);
+ }
+«ENDDEFINE»
+
+«DEFINE metricCalcMethod FOR GenMetricRule»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static«REM»FIXME: (1) refactor to get rid of statics (2) 'public' only those referenced from audits«ENDREM» Double «calcMethodName()»(«EXPAND calcMethodArgs(this) FOR target») {
+ «EXPAND calcMethodBody(this) FOR rule.provider-»
+ }
+«ENDDEFINE»
+
+«DEFINE calcMethodArgs(GenMetricRule metric) FOR GenMeasurable»«ERROR "Unrecognized metric target: " + this»«ENDDEFINE»
+
+«DEFINE calcMethodArgs(GenMetricRule metric) FOR GenDomainElementTarget»«EXPAND MetaModel::QualifiedClassName FOR element» target«ENDDEFINE»
+
+«REM»
+ We do check all elements to be of specific kind to provide most narrow type cast
+ However, GenDiagramElementTargetImpl#getContext uses first element's notation class only
+«ENDREM»
+«DEFINE calcMethodArgs(GenMetricRule metric) FOR GenDiagramElementTarget-»
+«IF element.typeSelect(GenNode).size() == element.size()»org.eclipse.gmf.runtime.notation.Node«-»
+«ELSEIF element.typeSelect(GenLink).size() == element.size()»org.eclipse.gmf.runtime.notation.Edge«-»
+«ELSEIF element.typeSelect(GenDiagram).size() == element.size()»org.eclipse.gmf.runtime.notation.Diagram«-»
+«ELSE»org.eclipse.gmf.runtime.notation.View«ENDIF» target«ENDDEFINE»
+
+«REM»Note, use of QualifiedClassName here assumes it always works the same for the notation model, regardless of 'dynamic model' use (i.e. always gives qName of oeg.runtime.notation.* Java class)«ENDREM»
+«DEFINE calcMethodArgs(GenMetricRule metric) FOR GenNotationElementTarget»«EXPAND MetaModel::QualifiedClassName FOR element» target«ENDDEFINE»
+
+
+«DEFINE calcMethodBody(GenMetricRule metric) FOR GenExpressionProviderBase»«ERROR "No idea how to calculate metric\'s value for " + this»«ENDDEFINE»
+
+«DEFINE calcMethodBody(GenMetricRule metric) FOR GenExpressionInterpreter-»
+ if («exprFieldName(metric)» == null) {
+ «exprFieldName(metric)» = «EXPAND xpt::expressions::getExpression::getExpression(metric.rule, metric.target.getContext())»;
+ }
+ Object val = «exprFieldName(metric)».evaluate(target);
+ if (val instanceof Number) {
+ return val.getClass() == Double.class ? (Double) val : new Double(((Number) val).doubleValue());
+ }
+ return null;
+«ENDDEFINE»
+
+«DEFINE calcMethodBody(GenMetricRule metric) FOR GenJavaExpressionProvider-»
+«IF injectExpressionBody && metric.rule.body != null && metric.rule.body.length() != 0-»
+ «metric.rule.body»
+«ELSEIF throwException || (injectExpressionBody && (metric.rule.body == null || metric.rule.body.length() == 0))-»
+ // TODO: implement this method
+ // Ensure that you remove @generated or mark it @generated NOT
+ throw new java.lang.UnsupportedOperationException("No user java implementation provided");«EXPAND xpt::Common::nonNLS»
+«ELSE-»
+ return new Double(Double.NaN);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE metricCalcField FOR GenMetricRule-»
+«EXPAND metricCalcField(this) FOR rule.provider-»
+«ENDDEFINE»
+
+«DEFINE metricCalcField(GenMetricRule metric) FOR GenExpressionProviderBase»«REM»NO-OP«ENDREM»«ENDDEFINE»
+«DEFINE metricCalcField(GenMetricRule metric) FOR GenExpressionInterpreter-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static«REM»FIXME: refactor to get rid of static fields«ENDREM» «container.getAbstractExpressionQualifiedClassName()» «exprFieldName(metric)»;
+«ENDDEFINE»
+
+«DEFINE invokeCalcMethod(String accessor, boolean isSpecific) FOR GenMetricRule»
+«container.editorGen.diagram.getMetricProviderQualifiedClassName()».«calcMethodName()»(«IF !isSpecific /*CastEObject would be better, however need GenClassifier*/»(«EXPAND MetaModel::QualifiedClassName FOR target.getContext()») «ENDIF»«accessor»)«ENDDEFINE»
+
+
+/*
+ * Next two methods should return arrays of identical length, hence are placed into a single template
+ */
+«DEFINE keysAndToolTipsMethods FOR GenMetricContainer»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static String[] getMetricKeys() {
+ return new String[] {
+ «FOREACH metrics AS m SEPARATOR ",\n"»«toStringLiteral(m.key)»«ENDFOREACH»
+ };
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static String[] getMetricToolTips() {
+ return new String[] {
+ «FOREACH metrics AS m SEPARATOR ",\n"-»
+«toStringLiteral(m.name == null ? m.key : m.name)»«IF m.description != null» + '\n' + «toStringLiteral(m.description)» + '\n'«ENDIF»«IF null != m.lowLimit» + «toStringLiteral("low: " + m.lowLimit)»«ENDIF»«IF null != m.highLimit» + «toStringLiteral("high: " + m.highLimit)»«ENDIF-»
+ «ENDFOREACH»
+ };
+ }
+«ENDDEFINE»
+
+«DEFINE metricResult(String targetAccessor, boolean isJustEObject) FOR GenMetricRule-»
+new Metric(«toStringLiteral(key)», «calcMethodName()»(«IF isJustEObject && /*safe to assume it is GenClass, nevertheless check*/ !{ target.getContext() }.typeSelect(GenClass).isEmpty()»«EXPAND MetaModel::CastEObject(targetAccessor) FOR (GenClass) target.getContext()»«ELSE»«targetAccessor»«ENDIF»), «IF null == lowLimit»null«ELSE»new Double(«lowLimit»)«ENDIF», «IF null == highLimit»null«ELSE»new Double(«highLimit»)«ENDIF»)
+«ENDDEFINE»
+
+
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/Metrics.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+cached List[GenMetricRule] getNotationMetrics(GenMetricContainer c) : c.metrics.select(m | !{ m.target }.typeSelect(GenNotationElementTarget).isEmpty()) ;
+cached List[GenMetricRule] getDiagramMetrics(GenMetricContainer c) : c.metrics.select(m | !{ m.target }.typeSelect(GenDiagramElementTarget).isEmpty()) ;
+cached List[GenMetricRule] getDomainMetrics(GenMetricContainer c) : c.metrics.select(m | !{ m.target }.typeSelect(GenDomainElementTarget).isEmpty()) ;
+
+String exprFieldName(GenMetricRule m) : "expression" + validJavaIdentifier(m.key).toFirstUpper() ;
+String calcMethodName(GenMetricRule m) : "calc" + validJavaIdentifier(m.key).toFirstUpper() ;
+
+//
+// CodeGenUtil#validJavaIdentifier()
+//
+String validJavaIdentifier(String identifier) :
+JAVA org.eclipse.emf.codegen.util.CodeGenUtil.validJavaIdentifier(java.lang.String)
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/MetricsResultView.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,277 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - refactoring (https://bugs.eclipse.org/230014)
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE className FOR gmfgen::GenDiagram»ResultView«ENDDEFINE»
+
+«DEFINE Class FOR GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static class «EXPAND className» «EXPAND supertypes» «EXPAND implements»{
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static final String VIEW_ID = "«getMetricViewID()»";«EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static int MAX_VISIBLE_KEY_CHAR_COUNT = 8;
+
+ «EXPAND viewerField-»
+
+ «EXPAND inputField-»
+
+ «EXPAND setInputMethod-»
+
+ «EXPAND adjustLayoutMethod-»
+
+ «EXPAND createPartControlMethod-»
+
+ «EXPAND handleOpenMethod-»
+
+ «EXPAND calcMetricMaxValueStrLenMapMethod-»
+
+ «EXPAND setFocusMethod-»
+
+ «EXPAND labelProviderClass-»
+
+ «EXPAND additions-»
+ }
+«ENDDEFINE»
+
+«DEFINE supertypes FOR gmfgen::GenDiagram»extends org.eclipse.ui.part.ViewPart«ENDDEFINE»
+«DEFINE implements FOR gmfgen::GenDiagram»implements org.eclipse.jface.viewers.IOpenListener«ENDDEFINE»
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE viewerField FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.jface.viewers.TableViewer viewer;
+«ENDDEFINE»
+
+«DEFINE inputField FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.ecore.resource.Resource diagramResource;
+«ENDDEFINE»
+
+
+«DEFINE setInputMethod FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ void setInput(org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart diagramPart) {
+ diagramResource = diagramPart.getDiagram().eResource();
+ setTitleToolTip(diagramResource.getURI().path());
+ java.util.List metrics = calculateMetrics(diagramPart);
+ adjustLayout(metrics);
+ viewer.setInput(metrics);
+ }
+«ENDDEFINE»
+
+«DEFINE adjustLayoutMethod FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void adjustLayout(java.util.List metricResultList) {
+ java.util.Map maxValStrMap = calcMetricMaxValueStrLenMap(metricResultList);
+ org.eclipse.swt.widgets.Table table = viewer.getTable();
+ org.eclipse.jface.viewers.TableLayout layout = new org.eclipse.jface.viewers.TableLayout();
+ org.eclipse.swt.graphics.GC gc = new org.eclipse.swt.graphics.GC(table);
+
+ gc.setFont(org.eclipse.jface.resource.JFaceResources.getDialogFont());
+ int padding = gc.stringExtent("X").x * 2;«EXPAND xpt::Common::nonNLS»
+ for (int i = 0; i < getMetricKeys().length; i++) {
+ final String nextKey = getMetricKeys()[i];
+ String valueStr = (String) maxValStrMap.get(nextKey);
+ int minWidth = valueStr != null ? gc.stringExtent(valueStr).x + padding : 20;
+ layout.addColumnData(new org.eclipse.jface.viewers.ColumnPixelData(minWidth, true));
+ }
+ gc.dispose();
+
+ layout.addColumnData(new org.eclipse.jface.viewers.ColumnWeightData(1, 50, true));
+ viewer.getTable().setLayout(layout);
+ viewer.getTable().layout(true, true);
+ }
+«ENDDEFINE»
+
+«DEFINE createPartControlMethod FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void createPartControl(org.eclipse.swt.widgets.Composite parent) {
+ this.viewer = new org.eclipse.jface.viewers.TableViewer(parent, org.eclipse.swt.SWT.FULL_SELECTION);
+ final org.eclipse.swt.widgets.Table table = viewer.getTable();
+ table.setHeaderVisible(true);
+ table.setLinesVisible(true);
+
+ for (int i = 0; i < getMetricKeys().length; i++) {
+ org.eclipse.swt.widgets.TableColumn column = new org.eclipse.swt.widgets.TableColumn(table, org.eclipse.swt.SWT.NONE);
+ column.setAlignment(org.eclipse.swt.SWT.RIGHT);
+ column.setMoveable(true);
+ column.setText(getMetricKeys()[i]);
+ column.setToolTipText(getMetricToolTips()[i]);
+ }
+
+ org.eclipse.swt.widgets.TableColumn objectColumn = new org.eclipse.swt.widgets.TableColumn(table, org.eclipse.swt.SWT.NONE);
+ objectColumn.setText("Element");
+ objectColumn.setToolTipText("Measurement element");
+
+ viewer.setLabelProvider(new Labels());
+ viewer.setContentProvider(new org.eclipse.jface.viewers.ArrayContentProvider());
+ viewer.addOpenListener(this);
+
+ org.eclipse.swt.events.SelectionListener headerSelListener = new org.eclipse.swt.events.SelectionListener() {
+ public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
+ table.setSortColumn((org.eclipse.swt.widgets.TableColumn) e.getSource());
+ table.setSortDirection((table.getSortDirection() != org.eclipse.swt.SWT.DOWN) ? org.eclipse.swt.SWT.DOWN : org.eclipse.swt.SWT.UP);
+ viewer.refresh();
+ }
+ public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
+ }
+ };
+ org.eclipse.swt.widgets.TableColumn[] columns = viewer.getTable().getColumns();
+ for (int i = 0; i < columns.length; i++) {
+ columns[i].addSelectionListener(headerSelListener);
+ }
+
+ viewer.setSorter(new org.eclipse.jface.viewers.ViewerSorter() {
+ public int compare(org.eclipse.jface.viewers.Viewer viewer, Object e1, Object e2) {
+ org.eclipse.swt.widgets.TableColumn c = table.getSortColumn();
+ int result = 0;
+ if (c != null) {
+ Metric mc1 = ((ElementMetrics) e1).getMetricByKey(c.getText());
+ Metric mc2 = ((ElementMetrics) e2).getMetricByKey(c.getText());
+ result = (mc1 != null && mc2 != null) ?
+ mc1.compareTo(mc2) : (mc1 == null ? -1 : 1);
+ } else {
+ result = ((ElementMetrics) e1).targetElementQName.compareTo(((ElementMetrics) e2).targetElementQName);
+ }
+ return table.getSortDirection() == org.eclipse.swt.SWT.DOWN ? result : -result;
+ }
+ });
+ «EXPAND createPartControlMethod_refreshInput FOR editorGen.editor-»
+ }
+«ENDDEFINE»
+
+«DEFINE createPartControlMethod_refreshInput FOR GenEditorView-»
+ org.eclipse.ui.IEditorPart editor = getSite().getPage().getActiveEditor();
+ if (editor != null && editor.getClass().equals(«editorGen.editor.getQualifiedClassName()».class)) {
+ setInput((«editorGen.editor.getQualifiedClassName()») editor);
+ }
+«ENDDEFINE»
+
+«DEFINE handleOpenMethod FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void open(org.eclipse.jface.viewers.OpenEvent event) {
+ try {
+ org.eclipse.ui.IEditorPart editorPart = getSite().getPage().openEditor(
+ new org.eclipse.ui.part.FileEditorInput(org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(diagramResource)),
+ «editorGen.editor.getQualifiedClassName()».ID);
+ if (editorPart == null) {
+ return;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart diagramPart =
+ (org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart) editorPart.getAdapter(
+ org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart.class);
+ ElementMetrics selection = (ElementMetrics) ((org.eclipse.jface.viewers.IStructuredSelection) event.getSelection()).getFirstElement();
+ String viewID = selection.diagramElementID;
+ if (viewID != null) {
+ org.eclipse.gmf.runtime.notation.View targetView = (org.eclipse.gmf.runtime.notation.View) diagramPart.getDiagram().eResource().getEObject(viewID);
+ if (targetView != null) {
+ org.eclipse.gef.EditPart targetEditPart = (org.eclipse.gef.EditPart) diagramPart.getDiagramGraphicalViewer().getEditPartRegistry().get(targetView);
+ if (targetEditPart != null) {
+ «getDiagramEditorUtilQualifiedClassName()».selectElementsInDiagram(diagramPart, java.util.Collections.singletonList(targetEditPart));
+ }
+ }
+ }
+ } catch (org.eclipse.ui.PartInitException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Can't open diagram editor", e); //$NON-NLS-1$
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE calcMetricMaxValueStrLenMapMethod FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static java.util.Map calcMetricMaxValueStrLenMap(java.util.List allMetrics) {
+ java.util.Map metric2MaxStrLen = new java.util.HashMap();
+ for (int i = 0; i < getMetricKeys().length; i++) {
+ String nextKey = getMetricKeys()[i];
+ int trimPos = Math.min(nextKey.length(), MAX_VISIBLE_KEY_CHAR_COUNT);
+ metric2MaxStrLen.put(nextKey, nextKey.substring(0, trimPos));
+ }
+ for (java.util.Iterator it = allMetrics.iterator(); it.hasNext();) {
+ ElementMetrics elementMetrics = (ElementMetrics) it.next();
+ for (int i = 0; i < elementMetrics.metrics.length; i++) {
+ Metric metric = elementMetrics.metrics[i];
+ String valueStr = (String) metric2MaxStrLen.get(metric.key);
+ if (valueStr == null || metric.displayValue.length() > valueStr.length()) {
+ metric2MaxStrLen.put(metric.key, metric.displayValue);
+ }
+ }
+ }
+ return metric2MaxStrLen;
+ }
+«ENDDEFINE»
+
+«DEFINE setFocusMethod FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void setFocus() {
+ }
+«ENDDEFINE»
+
+«DEFINE labelProviderClass FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private class Labels extends org.eclipse.jface.viewers.LabelProvider implements org.eclipse.jface.viewers.ITableLabelProvider, org.eclipse.jface.viewers.ITableColorProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private boolean isElementColumn(int columnIndex) {
+ return columnIndex >= getMetricKeys().length;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.swt.graphics.Image getColumnImage(Object element, int columnIndex) {
+ return isElementColumn(columnIndex) ? ((ElementMetrics) element).elementImage : null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public String getColumnText(Object element, int columnIndex) {
+ ElementMetrics elementMetrics = (ElementMetrics) element;
+ if (columnIndex == getMetricKeys().length) {
+ return elementMetrics.targetElementQName;
+ }
+ final String key = getMetricKeys()[columnIndex];
+ Metric metric = elementMetrics.getMetricByKey(key);
+ return (metric != null) ? metric.displayValue : "-"; //$NON-NLS-1$
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.swt.graphics.Color getBackground(Object element, int columnIndex) {
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.swt.graphics.Color getForeground(Object element, int columnIndex) {
+ if (isElementColumn(columnIndex)) {
+ return null;
+ }
+ ElementMetrics columnElement = (ElementMetrics) element;
+ final String key = getMetricKeys()[columnIndex];
+ Metric metric = columnElement.getMetricByKey(key);
+ if (metric != null && metric.value != null) {
+ if (metric.highLimit != null && metric.highLimit.longValue() < metric.value.longValue()) {
+ return «EXPAND labelProvider_colorMore»;
+ } else if (metric.lowLimit != null && metric.lowLimit.longValue() > metric.value.longValue()) {
+ return «EXPAND labelProvider_colorLess»;
+ }
+ }
+ return null;
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE labelProvider_colorMore FOR gmfgen::GenDiagram»org.eclipse.draw2d.ColorConstants.red«ENDDEFINE»
+«DEFINE labelProvider_colorLess FOR gmfgen::GenDiagram»org.eclipse.draw2d.ColorConstants.blue«ENDDEFINE»
+
+
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ModelingAssistantProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«EXTENSION xpt::diagram::Utils»
+«EXTENSION xpt::providers::i18n»
+
+«DEFINE ModelingAssistantProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «modelingAssistantProviderClassName»
+ extends org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List getTypesForPopupBar(org.eclipse.core.runtime.IAdaptable host) {
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart =
+ (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) host.getAdapter(
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
+ «FOREACH getAllContainers() AS container-»
+ «IF container.getAssistantNodes().size() > 0-»
+ if (editPart instanceof «container.getEditPartQualifiedClassName()») {
+ java.util.List types = new java.util.ArrayList();
+ «FOREACH container.getAssistantNodes() AS node-»
+ types.add(«getElementTypesQualifiedClassName()».«node.getUniqueIdentifier()»);
+ «ENDFOREACH-»
+ return types;
+ }
+ «ENDIF-»
+ «ENDFOREACH-»
+ return java.util.Collections.EMPTY_LIST;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List getRelTypesOnSource(org.eclipse.core.runtime.IAdaptable source) {
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart sourceEditPart =
+ (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) source.getAdapter(
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
+ «FOREACH getNodes() AS source-»
+ «IF getOutgoingLinks(source).size() > 0-»
+ if (sourceEditPart instanceof «source.getEditPartQualifiedClassName()») {
+ java.util.List types = new java.util.ArrayList();
+ «FOREACH getOutgoingLinks(source) AS link-»
+ types.add(«getElementTypesQualifiedClassName()».«link.getUniqueIdentifier()»);
+ «ENDFOREACH-»
+ return types;
+ }
+ «ENDIF-»
+ «ENDFOREACH-»
+ return java.util.Collections.EMPTY_LIST;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List getRelTypesOnTarget(org.eclipse.core.runtime.IAdaptable target) {
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart =
+ (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) target.getAdapter(
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
+ «FOREACH getNodes() AS target-»
+ «IF getIncomingLinks(target).size() > 0-»
+ if (targetEditPart instanceof «target.getEditPartQualifiedClassName()») {
+ java.util.List types = new java.util.ArrayList();
+ «FOREACH getIncomingLinks(target) AS link-»
+ types.add(«getElementTypesQualifiedClassName()».«link.getUniqueIdentifier()»);
+ «ENDFOREACH-»
+ return types;
+ }
+ «ENDIF-»
+ «ENDFOREACH-»
+ return java.util.Collections.EMPTY_LIST;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List getRelTypesOnSourceAndTarget(
+ org.eclipse.core.runtime.IAdaptable source, org.eclipse.core.runtime.IAdaptable target) {
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart sourceEditPart =
+ (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) source.getAdapter(
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart =
+ (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) target.getAdapter(
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
+ «FOREACH getNodes() AS source-»
+ «IF getOutgoingLinks(source).size() > 0-»
+ if (sourceEditPart instanceof «source.getEditPartQualifiedClassName()») {
+ java.util.List types = new java.util.ArrayList();
+ «FOREACH getOutgoingLinks(source) AS link-»
+ «FOREACH link.getAssistantTargets() AS target-»
+ if (targetEditPart instanceof «target.getEditPartQualifiedClassName()») {
+ types.add(«getElementTypesQualifiedClassName()».«link.getUniqueIdentifier()»);
+ }
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ return types;
+ }
+ «ENDIF-»
+ «ENDFOREACH-»
+ return java.util.Collections.EMPTY_LIST;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List getTypesForSource(org.eclipse.core.runtime.IAdaptable target,
+ org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart targetEditPart =
+ (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) target.getAdapter(
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
+ «FOREACH getNodes() AS target-»
+ «IF getIncomingLinks(target).size() > 0-»
+ if (targetEditPart instanceof «target.getEditPartQualifiedClassName()») {
+ java.util.List types = new java.util.ArrayList();
+ «FOREACH getIncomingLinks(target) AS link-»
+ «FOREACH link.getAssistantSources() AS source-»
+ if (relationshipType == «getElementTypesQualifiedClassName()».«link.getUniqueIdentifier()») {
+ types.add(«getElementTypesQualifiedClassName()».«source.getUniqueIdentifier()»);
+ }
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ return types;
+ }
+ «ENDIF-»
+ «ENDFOREACH-»
+ return java.util.Collections.EMPTY_LIST;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public java.util.List getTypesForTarget(org.eclipse.core.runtime.IAdaptable source,
+ org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart sourceEditPart =
+ (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) source.getAdapter(
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
+ «FOREACH getNodes() AS source-»
+ «IF getOutgoingLinks(source).size() > 0-»
+ if (sourceEditPart instanceof «source.getEditPartQualifiedClassName()») {
+ java.util.List types = new java.util.ArrayList();
+ «FOREACH getOutgoingLinks(source) AS link-»
+ «FOREACH link.getAssistantTargets() AS target-»
+ if (relationshipType == «getElementTypesQualifiedClassName()».«link.getUniqueIdentifier()») {
+ types.add(«getElementTypesQualifiedClassName()».«target.getUniqueIdentifier()»);
+ }
+ «ENDFOREACH-»
+ «ENDFOREACH-»
+ return types;
+ }
+ «ENDIF-»
+ «ENDFOREACH-»
+ return java.util.Collections.EMPTY_LIST;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EObject selectExistingElementForSource(
+ org.eclipse.core.runtime.IAdaptable target,
+ org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
+ return selectExistingElement(target, getTypesForSource(target, relationshipType));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EObject selectExistingElementForTarget(
+ org.eclipse.core.runtime.IAdaptable source,
+ org.eclipse.gmf.runtime.emf.type.core.IElementType relationshipType) {
+ return selectExistingElement(source, getTypesForTarget(source, relationshipType));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.ecore.EObject selectExistingElement(
+ org.eclipse.core.runtime.IAdaptable host, java.util.Collection types) {
+ if (types.isEmpty()) {
+ return null;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart editPart =
+ (org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart) host.getAdapter(
+ org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart.class);
+ if (editPart == null) {
+ return null;
+ }
+ org.eclipse.gmf.runtime.notation.Diagram diagram =
+ (org.eclipse.gmf.runtime.notation.Diagram) editPart.getRoot().getContents().getModel();
+ java.util.Collection elements = new java.util.HashSet();
+ for (java.util.Iterator it = diagram.getElement().eAllContents(); it.hasNext();) {
+ org.eclipse.emf.ecore.EObject element = (org.eclipse.emf.ecore.EObject) it.next();
+ if (isApplicableElement(element, types)) {
+ elements.add(element);
+ }
+ }
+ if (elements.isEmpty()) {
+ return null;
+ }
+ return selectElement((org.eclipse.emf.ecore.EObject[]) elements.toArray(
+ new org.eclipse.emf.ecore.EObject[elements.size()]));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected boolean isApplicableElement(org.eclipse.emf.ecore.EObject element, java.util.Collection types) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType type =
+ org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getElementType(element);
+ return types.contains(type);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.emf.ecore.EObject selectElement(org.eclipse.emf.ecore.EObject[] elements) {
+ org.eclipse.swt.widgets.Shell shell = org.eclipse.swt.widgets.Display.getCurrent().getActiveShell();
+ org.eclipse.jface.viewers.ILabelProvider labelProvider =
+ new org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider(
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getItemProvidersAdapterFactory());
+ org.eclipse.ui.dialogs.ElementListSelectionDialog dialog =
+ new org.eclipse.ui.dialogs.ElementListSelectionDialog(shell, labelProvider);
+ dialog.setMessage(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForModelingAssistantProvider().messageKey()) FOR editorGen»);
+ dialog.setTitle(«EXPAND xpt::Externalizer::accessorCall(i18nKeyForModelingAssistantProvider().titleKey()) FOR editorGen»);
+ dialog.setMultipleSelection(false);
+ dialog.setElements(elements);
+ org.eclipse.emf.ecore.EObject selected = null;
+ if (dialog.open() == org.eclipse.jface.window.Window.OK) {
+ selected = (org.eclipse.emf.ecore.EObject) dialog.getFirstResult();
+ }
+ return selected;
+ }
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»«ENDDEFINE»
+
+«DEFINE i18nValues FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForModelingAssistantProvider().titleKey(), "Select domain model element")-»
+«EXPAND xpt::Externalizer::messageEntry(i18nKeyForModelingAssistantProvider().messageKey(), "Available domain model elements:")-»
+«ENDDEFINE»
+
+«DEFINE i18nAccessors FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForModelingAssistantProvider().titleKey())-»
+ «EXPAND xpt::Externalizer::accessorField(i18nKeyForModelingAssistantProvider().messageKey())-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ParserProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::providers::ParserUtils»
+
+«DEFINE ParserProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «parserProviderClassName» extends org.eclipse.gmf.runtime.common.core.service.AbstractProvider
+ implements org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider {
+ «EXPAND parsers-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(int visualID) {
+ switch (visualID) {
+ «EXPAND getParsers-»
+ }
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.gmf.runtime.common.ui.services.parser.IParser getParser(
+ org.eclipse.core.runtime.IAdaptable hint) {
+ String vid = (String) hint.getAdapter(String.class);
+ if (vid != null) {
+ return getParser(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(vid));
+ }
+ org.eclipse.gmf.runtime.notation.View view =
+ (org.eclipse.gmf.runtime.notation.View) hint.getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null) {
+ return getParser(«EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(view));
+ }
+ return null;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
+ if (operation instanceof org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation) {
+ org.eclipse.core.runtime.IAdaptable hint =
+ ((org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation) operation).getHint();
+ if («getElementTypesQualifiedClassName()».getElement(hint) == null) {
+ return false;
+ }
+ return getParser(hint) != null;
+ }
+ return false;
+ }
+ «EXPAND HintAdapterClass»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE parsers FOR gmfgen::GenDiagram-»
+ «EXPAND parsers FOREACH topLevelNodes-»
+ «EXPAND parsers FOREACH childNodes-»
+ «EXPAND parsers FOREACH links-»
+«ENDDEFINE»
+
+«DEFINE parsers FOR gmfgen::GenNode-»
+ «EXPAND parser FOREACH labels-»
+«ENDDEFINE»
+
+«DEFINE parsers FOR gmfgen::GenChildLabelNode-»
+ «EXPAND parser(this) FOR labelModelFacet-»
+«ENDDEFINE»
+
+«DEFINE parsers FOR gmfgen::GenLink-»
+ «EXPAND parser FOREACH labels-»
+«ENDDEFINE»
+
+«DEFINE parser FOR gmfgen::GenLabel-»
+ «EXPAND parser(this) FOR modelFacet-»
+«ENDDEFINE»
+
+«DEFINE parser(gmfgen::GenCommonBase element) FOR gmfgen::LabelModelFacet-»
+«ENDDEFINE»
+
+«DEFINE parser(gmfgen::GenCommonBase element) FOR gmfgen::FeatureLabelModelFacet-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserFieldName(element)»;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserAccessorName(element)»() {
+ if («parserFieldName(element)» == null) {
+ «parserFieldName(element)» = «parserCreatorName(element)»();
+ }
+ return «parserFieldName(element)»;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.gmf.runtime.common.ui.services.parser.IParser «parserCreatorName(element)»() {
+ org.eclipse.emf.ecore.EAttribute[] features = new org.eclipse.emf.ecore.EAttribute[] {
+ «FOREACH metaFeatures AS feature-»
+ «EXPAND MetaModel::MetaFeature FOR feature»,
+ «ENDFOREACH-»
+ };
+ «IF viewMethod.literal == editMethod.literal-»
+ «EXPAND parserQualifiedClassName(viewMethod) FOR element.getDiagram()» parser =
+ new «EXPAND parserQualifiedClassName(viewMethod) FOR element.getDiagram()»(features);
+ «IF viewMethod.literal != gmfgen::LabelTextAccessMethod::NATIVE.literal-»
+ «EXPAND setReaderPatterns("parser")-»
+ «EXPAND setWriterPatterns("parser")-»
+ «ENDIF-»
+ return parser;
+ «ELSE-»
+ «EXPAND parserQualifiedClassName(viewMethod) FOR element.getDiagram()» reader =
+ new «EXPAND parserQualifiedClassName(viewMethod) FOR element.getDiagram()»(features);
+ «IF viewMethod.literal != gmfgen::LabelTextAccessMethod::NATIVE.literal-»
+ «EXPAND setReaderPatterns("reader")-»
+ «ENDIF-»
+ «EXPAND parserQualifiedClassName(editMethod) FOR element.getDiagram()» writer =
+ new «EXPAND parserQualifiedClassName(editMethod) FOR element.getDiagram()»(features);
+ «IF editMethod.literal != gmfgen::LabelTextAccessMethod::NATIVE.literal-»
+ «EXPAND setWriterPatterns("writer")-»
+ «ENDIF-»
+ return new «EXPAND xpt::parsers::CompositeParser::qualifiedClassName FOR element.getDiagram()»(reader, writer);
+ «ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE parserQualifiedClassName(gmfgen::LabelTextAccessMethod method) FOR gmfgen::GenDiagram-»
+ «IF gmfgen::LabelTextAccessMethod::NATIVE.literal == method.literal-»
+ «EXPAND xpt::parsers::NativeParser::qualifiedClassName-»
+ «ELSEIF gmfgen::LabelTextAccessMethod::PRINTF.literal == method.literal-»
+ «EXPAND xpt::parsers::PrintfParser::qualifiedClassName-»
+ «ELSEIF gmfgen::LabelTextAccessMethod::REGEXP.literal == method.literal-»
+ «EXPAND xpt::parsers::RegexpParser::qualifiedClassName-»
+ «ELSE-»
+ «EXPAND xpt::parsers::MessageFormatParser::qualifiedClassName-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setReaderPatterns(String parserVar) FOR gmfgen::FeatureLabelModelFacet-»
+ «IF isPatternSpecified(viewPattern)-»
+ «parserVar».setViewPattern("«viewPattern»");
+ «ENDIF-»
+ «IF isPatternSpecified(editorPattern)-»
+ «parserVar».setEditorPattern("«editorPattern»");
+ «ELSE-»
+ «IF isPatternSpecified(viewPattern)-»
+ «parserVar».setEditorPattern("«viewPattern»");
+ «ENDIF-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE setWriterPatterns(String parserVar) FOR gmfgen::FeatureLabelModelFacet-»
+ «IF isPatternSpecified(editPattern)-»
+ «parserVar».setEditPattern("«editPattern»");
+ «ELSE-»
+ «IF isPatternSpecified(viewPattern)-»
+ «parserVar».setEditPattern("«viewPattern»");
+ «ENDIF-»
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE getParsers FOR gmfgen::GenDiagram-»
+ «EXPAND getParsers FOREACH topLevelNodes-»
+ «EXPAND getParsers FOREACH childNodes-»
+ «EXPAND getParsers FOREACH links-»
+«ENDDEFINE»
+
+«DEFINE getParsers FOR gmfgen::GenNode-»
+ «EXPAND getParser FOREACH labels-»
+«ENDDEFINE»
+
+«DEFINE getParsers FOR gmfgen::GenChildLabelNode-»
+ «EXPAND getParser(this) FOR labelModelFacet-»
+«ENDDEFINE»
+
+«DEFINE getParsers FOR gmfgen::GenLink-»
+ «EXPAND getParser FOREACH labels-»
+«ENDDEFINE»
+
+«DEFINE getParser FOR gmfgen::GenLabel-»
+ «EXPAND getParser(this) FOR modelFacet-»
+«ENDDEFINE»
+
+«DEFINE getParser(gmfgen::GenCommonBase element) FOR gmfgen::LabelModelFacet-»
+«ENDDEFINE»
+
+«DEFINE getParser(gmfgen::GenCommonBase element) FOR gmfgen::FeatureLabelModelFacet-»
+ «EXPAND xpt::Common::caseVisualID FOR element» return «parserAccessorName(element)»();
+«ENDDEFINE»
+
+«DEFINE HintAdapterClass FOR gmfgen::GenDiagram-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static class HintAdapter extends org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final org.eclipse.gmf.runtime.emf.type.core.IElementType elementType;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public HintAdapter(org.eclipse.gmf.runtime.emf.type.core.IElementType type,
+ org.eclipse.emf.ecore.EObject object, String parserHint) {
+ super(object, parserHint);
+ assert type != null;
+ elementType = type;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public Object getAdapter(Class adapter) {
+ if (org.eclipse.gmf.runtime.emf.type.core.IElementType.class.equals(adapter)) {
+ return elementType;
+ }
+ return super.getAdapter(adapter);
+ }
+ }
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ParserUtils.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+import "http://www.eclipse.org/emf/2002/GenModel";
+
+String parserFieldName(gmfgen::GenCommonBase element) :
+ element.getUniqueIdentifier().toFirstLower() + "Parser"
+;
+
+String parserAccessorName(gmfgen::GenCommonBase element) :
+ "get" + element.getUniqueIdentifier().toFirstUpper() + "Parser"
+;
+
+String parserCreatorName(gmfgen::GenCommonBase element) :
+ "create" + element.getUniqueIdentifier().toFirstUpper() + "Parser"
+;
+
+boolean isPatternSpecified(String pattern) :
+ pattern != null && pattern.length() > 0
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ShortcutsDecoratorProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2006,2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+
+«DEFINE ShortcutsDecoratorProvider FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+ «EXPAND xpt::Common::generatedClassComment»
+public class «shortcutsDecoratorProviderClassName» extends org.eclipse.gmf.runtime.common.core.service.AbstractProvider implements org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider {
+
+ «EXPAND attributes-»
+
+ «EXPAND provides-»
+
+ «EXPAND createDecorators-»
+
+ «EXPAND ShortcutsDecorator-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE attributes FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public static final String SHORTCUTS_DECORATOR_ID = "shortcuts"; «EXPAND xpt::Common::nonNLS»
+«ENDDEFINE»
+
+«DEFINE provides FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
+ if (!(operation instanceof org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation)) {
+ return false;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget = ((org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation) operation).getDecoratorTarget();
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) decoratorTarget.getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ return view != null && «EXPAND xpt::editor::VisualIDRegistry::modelID».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view));
+}
+«ENDDEFINE»
+
+«DEFINE createDecorators FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void createDecorators(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) decoratorTarget.getAdapter(org.eclipse.gmf.runtime.notation.View.class);
+ if (view != null) {
+ org.eclipse.emf.ecore.EAnnotation annotation = view.getEAnnotation("Shortcut"); «EXPAND xpt::Common::nonNLS»
+ if (annotation != null) {
+ decoratorTarget.installDecorator(SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget));
+ }
+ }
+}
+«ENDDEFINE»
+
+«DEFINE ShortcutsDecorator FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedClassComment»
+protected class ShortcutsDecorator extends org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator {
+
+ «EXPAND SD_constructor-»
+
+ «EXPAND SD_activate-»
+
+ «EXPAND SD_refresh-»
+
+ «EXPAND SD_additions-»
+}
+«ENDDEFINE»
+
+«DEFINE SD_constructor FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public ShortcutsDecorator(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) {
+ super(decoratorTarget);
+}
+«ENDDEFINE»
+
+«DEFINE SD_activate FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void activate() {
+ refresh();
+}
+«ENDDEFINE»
+
+«DEFINE SD_refresh FOR gmfgen::GenDiagram-»
+ «EXPAND xpt::Common::generatedMemberComment»
+public void refresh() {
+ removeDecoration();
+ org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) getDecoratorTarget().getAdapter(org.eclipse.gef.EditPart.class);
+ org.eclipse.swt.graphics.Image image = «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().getBundledImage("icons/shortcut.gif"); «EXPAND xpt::Common::nonNLS»
+ if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart) {
+ setDecoration(getDecoratorTarget().addShapeDecoration(image, org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget.Direction.SOUTH_WEST, 0, false));
+ } else if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) {
+ setDecoration(getDecoratorTarget().addConnectionDecoration(image, 50, false));
+ }
+}
+«ENDDEFINE»
+
+«DEFINE SD_additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ValidationDecoratorProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 2007 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE ValidationDecoratorProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «validationDecoratorProviderClassName»
+ extends org.eclipse.gmf.runtime.common.core.service.AbstractProvider
+ implements org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static final String KEY = "validationStatus"; «EXPAND xpt::Common::nonNLS»
+ «IF editorGen.application == null-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static final String MARKER_TYPE = «editorGen.plugin.getActivatorQualifiedClassName()».ID +
+ ".«getValidationDiagnosticMarkerType()»"; «EXPAND xpt::Common::nonNLS»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static MarkerObserver fileObserver;
+ «ENDIF-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static java.util.Map/*<String, List<IDecorator>>*/ allDecorators = new java.util.HashMap();
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void createDecorators(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) {
+ org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) decoratorTarget.getAdapter(org.eclipse.gef.EditPart.class);
+ if (editPart instanceof org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart ||
+ editPart instanceof org.eclipse.gef.editparts.AbstractConnectionEditPart) {
+ Object model = editPart.getModel();
+ if ((model instanceof org.eclipse.gmf.runtime.notation.View)) {
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) model;
+ if (!(view instanceof org.eclipse.gmf.runtime.notation.Edge) && !view.isSetElement()) {
+ return;
+ }
+ }
+ org.eclipse.gef.EditDomain ed = editPart.getViewer().getEditDomain();
+ if (!(ed instanceof org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain)) {
+ return;
+ }
+ if (((org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain) ed).getEditorPart() instanceof
+ «editorGen.editor.getQualifiedClassName()») {
+ decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
+ }
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean provides(org.eclipse.gmf.runtime.common.core.service.IOperation operation) {
+ if (!(operation instanceof org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation)) {
+ return false;
+ }
+ org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget =
+ ((org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation) operation).getDecoratorTarget();
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) decoratorTarget.getAdapter(
+ org.eclipse.gmf.runtime.notation.View.class);
+ return view != null && «EXPAND xpt::editor::VisualIDRegistry::modelID».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»(view));
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static void refreshDecorators(org.eclipse.gmf.runtime.notation.View view) {
+ refreshDecorators(org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.getIdStr(view), view.getDiagram());
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static void refreshDecorators(String viewId, org.eclipse.gmf.runtime.notation.Diagram diagram) {
+ final java.util.List decorators = viewId != null ? (java.util.List) allDecorators.get(viewId) : null;
+ if (decorators == null || decorators.isEmpty() || diagram == null) {
+ return;
+ }
+ final org.eclipse.gmf.runtime.notation.Diagram fdiagram = diagram;
+ org.eclipse.ui.PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ try {
+ org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(fdiagram).runExclusive(new Runnable() {
+
+ public void run() {
+ for (java.util.Iterator it = decorators.iterator(); it.hasNext();) {
+ org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecorator decorator =
+ (org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecorator) it.next();
+ decorator.refresh();
+ }
+ }
+ });
+ } catch (Exception e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Decorator refresh failure", e); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+ });
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static class StatusDecorator extends org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String viewId;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public StatusDecorator(org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget decoratorTarget) {
+ super(decoratorTarget);
+ try {
+ final org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getDecoratorTarget().getAdapter(
+ org.eclipse.gmf.runtime.notation.View.class);
+ org.eclipse.emf.transaction.util.TransactionUtil.getEditingDomain(view).runExclusive(new Runnable() {
+
+ public void run() {
+ StatusDecorator.this.viewId = view != null ?
+ org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.getIdStr(view) : null;
+ }
+ });
+ } catch (Exception e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "ViewID access failure", e); «EXPAND xpt::Common::nonNLS»
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void refresh() {
+ removeDecoration();
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getDecoratorTarget().getAdapter(
+ org.eclipse.gmf.runtime.notation.View.class);
+ if (view == null || view.eResource() == null) {
+ return;
+ }
+ org.eclipse.gef.EditPart editPart = (org.eclipse.gef.EditPart) getDecoratorTarget().getAdapter(org.eclipse.gef.EditPart.class);
+ if (editPart == null || editPart.getViewer() == null) {
+ return;
+ }
+
+ // query for all the validation markers of the current resource
+ «IF editorGen.application == null-»
+ String elementId = org.eclipse.gmf.runtime.diagram.core.util.ViewUtil.getIdStr(view);
+ if (elementId == null) {
+ return;
+ }
+ int severity = org.eclipse.core.resources.IMarker.SEVERITY_INFO;
+ org.eclipse.core.resources.IMarker foundMarker = null;
+ org.eclipse.core.resources.IResource resource = org.eclipse.emf.workspace.util.WorkspaceSynchronizer.getFile(view.eResource());
+ if (resource == null || !resource.exists()) {
+ return;
+ }
+ org.eclipse.core.resources.IMarker[] markers = null;
+ try {
+ markers = resource.findMarkers(MARKER_TYPE, true, org.eclipse.core.resources.IResource.DEPTH_INFINITE);
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Validation markers refresh failure", e); «EXPAND xpt::Common::nonNLS»
+ }
+ «ELSE-»
+ int severity = org.eclipse.core.runtime.IStatus.INFO;
+ «EXPAND xpt::editor::ValidationMarker::qualifiedClassName» foundMarker = null;
+ «EXPAND xpt::editor::ValidationMarker::qualifiedClassName»[] markers =
+ «EXPAND xpt::editor::ValidationMarker::qualifiedClassName».getMarkers(editPart.getViewer(), viewId);
+ «ENDIF-»
+ if (markers == null || markers.length == 0) {
+ return;
+ }
+ org.eclipse.draw2d.Label toolTip = null;
+ for (int i = 0; i < markers.length; i++) {
+ «IF editorGen.application == null-»
+ org.eclipse.core.resources.IMarker marker = markers[i];
+ String attribute = marker.getAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, ""); «EXPAND xpt::Common::nonNLS»
+ if (attribute.equals(elementId)) {
+ int nextSeverity = marker.getAttribute(org.eclipse.core.resources.IMarker.SEVERITY,
+ org.eclipse.core.resources.IMarker.SEVERITY_INFO);
+ «ELSE-»
+ «EXPAND xpt::editor::ValidationMarker::qualifiedClassName» marker = markers[i];
+ int nextSeverity = marker.getStatusSeverity();
+ «ENDIF-»
+ org.eclipse.swt.graphics.Image nextImage = getImage(nextSeverity);
+ if (foundMarker == null) {
+ foundMarker = marker;
+ toolTip = new org.eclipse.draw2d.Label(
+ «IF editorGen.application == null-»
+ marker.getAttribute(org.eclipse.core.resources.IMarker.MESSAGE, ""), «EXPAND xpt::Common::nonNLS»
+ «ELSE-»
+ marker.getMessage(),
+ «ENDIF-»
+ nextImage);
+ } else {
+ if (toolTip.getChildren().isEmpty()) {
+ org.eclipse.draw2d.Label comositeLabel = new org.eclipse.draw2d.Label();
+ org.eclipse.draw2d.FlowLayout fl = new org.eclipse.draw2d.FlowLayout(false);
+ fl.setMinorSpacing(0);
+ comositeLabel.setLayoutManager(fl);
+ comositeLabel.add(toolTip);
+ toolTip = comositeLabel;
+ }
+ toolTip.add(new org.eclipse.draw2d.Label(
+ «IF editorGen.application == null-»
+ marker.getAttribute(org.eclipse.core.resources.IMarker.MESSAGE, ""), «EXPAND xpt::Common::nonNLS»
+ «ELSE-»
+ marker.getMessage(),
+ «ENDIF-»
+ nextImage));
+ }
+ severity = (nextSeverity > severity) ? nextSeverity : severity;
+ «IF editorGen.application == null-»
+ }
+ «ENDIF-»
+ }
+ if (foundMarker == null) {
+ return;
+ }
+
+ // add decoration
+ if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
+ if (view instanceof org.eclipse.gmf.runtime.notation.Edge) {
+ setDecoration(getDecoratorTarget().addConnectionDecoration(getImage(severity), 50, true));
+ } else {
+ int margin = -1;
+ if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
+ margin = org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil.getMapMode(
+ ((org.eclipse.gef.GraphicalEditPart) editPart).getFigure()).DPtoLP(margin);
+ }
+ setDecoration(getDecoratorTarget().addShapeDecoration(getImage(severity),
+ org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget.Direction.NORTH_EAST, margin, true));
+ }
+ getDecoration().setToolTip(toolTip);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.swt.graphics.Image getImage(int severity) {
+ String imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_ERROR_TSK;
+ switch (severity) {
+ «IF editorGen.application == null-»
+ case org.eclipse.core.resources.IMarker.SEVERITY_ERROR:
+ imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_ERROR_TSK;
+ break;
+ case org.eclipse.core.resources.IMarker.SEVERITY_WARNING:
+ imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_WARN_TSK;
+ break;
+ «ELSE-»
+ case org.eclipse.core.runtime.IStatus.ERROR:
+ imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_ERROR_TSK;
+ break;
+ case org.eclipse.core.runtime.IStatus.WARNING:
+ imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_WARN_TSK;
+ break;
+ «ENDIF-»
+ default:
+ imageName = org.eclipse.ui.ISharedImages.IMG_OBJS_INFO_TSK;
+ }
+ return org.eclipse.ui.PlatformUI.getWorkbench().getSharedImages().getImage(imageName);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void activate() {
+ if (viewId == null) {
+ return;
+ }
+
+ // add self to global decorators registry
+ java.util.List list = (java.util.List) allDecorators.get(viewId);
+ if (list == null) {
+ list = new java.util.ArrayList(2);
+ list.add(this);
+ allDecorators.put(viewId, list);
+ } else if (!list.contains(this)) {
+ list.add(this);
+ }
+ «IF editorGen.application == null-»
+
+ // start listening to changes in resources
+ org.eclipse.gmf.runtime.notation.View view = (org.eclipse.gmf.runtime.notation.View) getDecoratorTarget().getAdapter(
+ org.eclipse.gmf.runtime.notation.View.class);
+ if (view == null) {
+ return;
+ }
+ org.eclipse.gmf.runtime.notation.Diagram diagramView = view.getDiagram();
+ if (diagramView == null) {
+ return;
+ }
+ if (fileObserver == null) {
+ org.eclipse.gmf.runtime.common.ui.resources.FileChangeManager.getInstance().addFileObserver(
+ fileObserver = new MarkerObserver(diagramView));
+ }
+ «ENDIF-»
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void deactivate() {
+ if (viewId == null) {
+ return;
+ }
+
+ // remove self from global decorators registry
+ java.util.List list = (java.util.List) allDecorators.get(viewId);
+ if (list != null) {
+ list.remove(this);
+ if (list.isEmpty()) {
+ allDecorators.remove(viewId);
+ }
+ }
+ «IF editorGen.application == null-»
+
+ // stop listening to changes in resources if there are no more decorators
+ if (fileObserver != null && allDecorators.isEmpty()) {
+ org.eclipse.gmf.runtime.common.ui.resources.FileChangeManager.getInstance().removeFileObserver(fileObserver);
+ fileObserver = null;
+ }
+ «ENDIF-»
+ super.deactivate();
+ }
+ }
+ «IF editorGen.application == null-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ static class MarkerObserver implements org.eclipse.gmf.runtime.common.ui.resources.IFileObserver {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.gmf.runtime.notation.Diagram diagram;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private MarkerObserver(org.eclipse.gmf.runtime.notation.Diagram diagram) {
+ this.diagram = diagram;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void handleFileRenamed(org.eclipse.core.resources.IFile oldFile, org.eclipse.core.resources.IFile file) {
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void handleFileMoved(org.eclipse.core.resources.IFile oldFile, org.eclipse.core.resources.IFile file) {
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void handleFileDeleted(org.eclipse.core.resources.IFile file) {
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void handleFileChanged(org.eclipse.core.resources.IFile file) {
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void handleMarkerAdded(org.eclipse.core.resources.IMarker marker) {
+ if (marker.getAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, null) != null) {
+ handleMarkerChanged(marker);
+ }
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void handleMarkerDeleted(org.eclipse.core.resources.IMarker marker, java.util.Map attributes) {
+ String viewId = (String) attributes.get(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID);
+ refreshDecorators(viewId, diagram);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void handleMarkerChanged(org.eclipse.core.resources.IMarker marker) {
+ if (!MARKER_TYPE.equals(getType(marker))) {
+ return;
+ }
+ String viewId = marker.getAttribute(
+ org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, ""); «EXPAND xpt::Common::nonNLS»
+ refreshDecorators(viewId, diagram);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private String getType(org.eclipse.core.resources.IMarker marker) {
+ try {
+ return marker.getType();
+ } catch (org.eclipse.core.runtime.CoreException e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError(
+ "Validation marker refresh failure", e); «EXPAND xpt::Common::nonNLS»
+ return ""; «EXPAND xpt::Common::nonNLS»
+ }
+ }
+ }
+ «ENDIF-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ValidationProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,331 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ * Artem Tikhomirov (Borland) - introduced GenAuditContext entity
+ * straightforward and simple #validate() implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::GenModelUtils»
+«EXTENSION xpt::EMFUtils»
+«EXTENSION xpt::GenAuditRoot»
+
+
+«DEFINE ValidationProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «validationProviderClassName»
+ extends org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider {
+
+ «EXPAND constraintsActive-»
+
+ «EXPAND shouldConstraintsBePrivate-»
+
+ «EXPAND runWithActiveConstraints-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ protected org.eclipse.jface.action.IAction createAction(String actionId,
+ org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor partDescriptor) {
+ if («editorGen.editor.packageName».ValidateAction.VALIDATE_ACTION_KEY.equals(actionId)) {
+ return new «editorGen.editor.packageName».ValidateAction(partDescriptor);
+ }
+ return super.createAction(actionId, partDescriptor);
+ }
+
+
+ «EXPAND isInDefaultEditorContext-»
+
+«EXPAND selectors FOR editorGen.audits-»
+
+«EXPAND strategy_support»
+
+«EXPAND constraintAdapters(this) FOR editorGen.audits-»
+
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE constraintsActive FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+private static boolean constraintsActive = false;
+«ENDDEFINE»
+
+«DEFINE shouldConstraintsBePrivate FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static boolean shouldConstraintsBePrivate() {
+ return false;
+}
+«ENDDEFINE»
+
+«DEFINE runWithActiveConstraints FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+public static void runWithConstraints(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain, Runnable operation) {
+ final Runnable op = operation;
+ Runnable task = new Runnable() {
+ public void run() {
+ try {
+ constraintsActive = true;
+ op.run();
+ } finally {
+ constraintsActive = false;
+ }
+ }
+ };
+ if(editingDomain != null) {
+ try {
+ editingDomain.runExclusive(task);
+ } catch (Exception e) {
+ «editorGen.plugin.getActivatorQualifiedClassName()».getInstance().logError("Validation failed", e); «EXPAND xpt::Common::nonNLS»
+ }
+ } else {
+ task.run();
+ }
+}
+«ENDDEFINE»
+
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
+
+«DEFINE selectors FOR GenAuditRoot-»
+«FOREACH clientContexts AS ctx»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static class «ctx.className» implements org.eclipse.emf.validation.model.IClientSelector {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean selects(Object object) {
+«IF ctx.ruleTargets.typeSelect(GenDiagramElementTarget).size() > 0 -»
+ if (isInDefaultEditorContext(object) && object instanceof org.eclipse.gmf.runtime.notation.View) {
+ final int id = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»((org.eclipse.gmf.runtime.notation.View) object);
+ boolean result = false;
+«FOREACH getTargetDiagramElements(ctx) AS e-»
+ result = result || id == «EXPAND xpt::editor::VisualIDRegistry::visualID FOR e»;
+«ENDFOREACH-»
+ return result;
+ }
+ return false;
+«ELSE-»
+ return isInDefaultEditorContext(object);
+«ENDIF-»
+ }
+ }
+«ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE isInDefaultEditorContext FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::generatedMemberComment»
+static boolean isInDefaultEditorContext(Object object) {
+ if(shouldConstraintsBePrivate() && !constraintsActive) {
+ return false;
+ }
+ if (object instanceof org.eclipse.gmf.runtime.notation.View) {
+ return constraintsActive && «EXPAND xpt::editor::VisualIDRegistry::modelID».equals(«EXPAND xpt::editor::VisualIDRegistry::getModelIDMethodCall»((org.eclipse.gmf.runtime.notation.View) object));
+ }
+ return true;
+}
+«ENDDEFINE»
+
+
+«DEFINE strategy_support FOR GenDiagram-»
+«IF hasDiagramElementTargetRule(editorGen.audits)-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static org.eclipse.emf.validation.service.ITraversalStrategy getNotationTraversalStrategy(
+ org.eclipse.emf.validation.service.IBatchValidator validator) {
+ return new CtxSwitchStrategy(validator);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private static class CtxSwitchStrategy implements org.eclipse.emf.validation.service.ITraversalStrategy {
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.validation.service.ITraversalStrategy defaultStrategy;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private int currentSemanticCtxId = -1;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private boolean ctxChanged = true;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.ecore.EObject currentTarget;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private org.eclipse.emf.ecore.EObject preFetchedNextTarget;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private final int[] contextSwitchingIdentifiers;
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ CtxSwitchStrategy(org.eclipse.emf.validation.service.IBatchValidator validator) {
+ this.defaultStrategy = validator.getDefaultTraversalStrategy();
+ this.contextSwitchingIdentifiers = new int[] {
+ «EXPAND xpt::editor::VisualIDRegistry::visualID FOREACH getAllTargetDiagramElements(editorGen.audits) SEPARATOR ","»
+ };
+ java.util.Arrays.sort(this.contextSwitchingIdentifiers);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void elementValidated(org.eclipse.emf.ecore.EObject element,
+ org.eclipse.core.runtime.IStatus status) {
+ defaultStrategy.elementValidated(element, status);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean hasNext() {
+ return defaultStrategy.hasNext();
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public boolean isClientContextChanged() {
+ if (preFetchedNextTarget == null) {
+ preFetchedNextTarget = next();
+ prepareNextClientContext(preFetchedNextTarget);
+ }
+ return ctxChanged;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.emf.ecore.EObject next() {
+ org.eclipse.emf.ecore.EObject nextTarget = preFetchedNextTarget;
+ if (nextTarget == null) {
+ nextTarget = defaultStrategy.next();
+ }
+ this.preFetchedNextTarget = null;
+ return this.currentTarget = nextTarget;
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public void startTraversal(java.util.Collection traversalRoots, org.eclipse.core.runtime.IProgressMonitor monitor) {
+ defaultStrategy.startTraversal(traversalRoots, monitor);
+ }
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ private void prepareNextClientContext(org.eclipse.emf.ecore.EObject nextTarget) {
+ if (nextTarget != null && currentTarget != null) {
+ if (nextTarget instanceof org.eclipse.gmf.runtime.notation.View) {
+ final int id = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR editorGen.diagram»((org.eclipse.gmf.runtime.notation.View) nextTarget);
+ int nextSemanticId = (id != -1 && java.util.Arrays.binarySearch(contextSwitchingIdentifiers, id) >= 0) ? id : -1;
+ if ((currentSemanticCtxId != -1 && currentSemanticCtxId != nextSemanticId)
+ || (nextSemanticId != -1 && nextSemanticId != currentSemanticCtxId)) {
+ this.ctxChanged = true;
+ }«/*[artem] not sure why not ctxChanged = <expr>, is it intentional not to reset ctxChanged if condition did not match? I doubt. FIXME?*/»
+ currentSemanticCtxId = nextSemanticId;
+ } else {
+ // context of domain model
+ this.ctxChanged = currentSemanticCtxId != -1;
+ currentSemanticCtxId = -1;
+ }
+ } else {
+ this.ctxChanged = false;
+ }
+ }
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+
+«DEFINE constraintAdapters(GenDiagram diagram) FOR GenAuditRoot-»
+«IF diagram.editorGen.expressionProviders != null-»
+«EXPAND constraintAdapter(diagram.editorGen.expressionProviders) FOREACH rules.select(a | a.requiresConstraintAdapter)-»
+«IF !rules.select(a | a.requiresConstraintAdapter).isEmpty()»
+«EXPAND constraintAdapters_formatMethod»
+«ENDIF»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE constraintAdapter(GenExpressionProviderContainer container) FOR GenAuditRule-»
+«IF target != null && target.getContext() != null-»
+
+ «EXPAND xpt::Common::generatedMemberComment»
+ public static class «getConstraintAdapterLocalClassName()» extends org.eclipse.emf.validation.AbstractModelConstraint {
+
+«IF rule.provider.getLanguage().value != GenLanguage::java.value-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ private «container.getAbstractExpressionQualifiedClassName()» expression;
+
+«ENDIF-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ public org.eclipse.core.runtime.IStatus validate(org.eclipse.emf.validation.IValidationContext ctx) {
+ «EXPAND constraintAdapter_initContext(this) FOR target-»
+ «EXPAND constraintAdapter_validateMethod(this) FOR rule.provider-»
+ }
+ }
+«ENDIF-»
+«ENDDEFINE»
+
+
+«DEFINE constraintAdapters_formatMethod FOR GenAuditRoot-»
+ «EXPAND xpt::Common::generatedMemberComment»
+ static String formatElement(org.eclipse.emf.ecore.EObject object) {
+ return org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil.getQualifiedName(object, true);
+ }
+«ENDDEFINE»
+
+/*
+ * Expects 'context' variable to be initialized
+ */
+«DEFINE constraintAdapter_validateMethod(GenAuditRule audit) FOR GenExpressionProviderBase»«ERROR "No idea how to evaluate an audit rule for " + this»«ENDDEFINE»
+
+«DEFINE constraintAdapter_validateMethod(GenAuditRule audit) FOR GenExpressionInterpreter-»
+ if (expression == null) {
+ expression = «EXPAND xpt::expressions::getExpression::getExpression(audit.rule, audit.target.getContext())»;
+ }
+ Object result = expression.evaluate(context);
+ if (result instanceof Boolean && ((Boolean) result).booleanValue()) {
+ return org.eclipse.core.runtime.Status.OK_STATUS;«REM»XXX why not ctx.createSuccessStatus()???«ENDREM»
+ }
+ return ctx.createFailureStatus(new Object[] { formatElement(ctx.getTarget()) });
+«ENDDEFINE»
+
+«DEFINE constraintAdapter_validateMethod(GenAuditRule audit) FOR GenJavaExpressionProvider-»
+«IF injectExpressionBody && audit.rule.body != null && audit.rule.body.length() != 0-»
+ «audit.rule.body»
+«ELSEIF throwException || (injectExpressionBody && (audit.rule.body == null || audit.rule.body.length() == 0))-»
+ // TODO: put validation code here
+ // Ensure that you remove @generated tag or use @generated NOT
+ //
+ // To construct approprate return value, use ctx.createSuccessStatus()
+ // or ctx.createFailureStatus(...)
+ throw new java.lang.UnsupportedOperationException("No user java implementation provided for #validate(IValidationContext) operation");«EXPAND xpt::Common::nonNLS»
+«ELSE-»
+ return ctx.createFailureStatus(new Object[] { "No user java implementation provided for #validate(IValidationContext) operation" });«EXPAND xpt::Common::nonNLS»
+«ENDIF-»
+«ENDDEFINE»
+
+/*
+ * Contract: declare variable with the name 'context' of appropriate type
+ */
+«DEFINE constraintAdapter_initContext(GenAuditRule audit) FOR GenAuditable-»
+«EXPAND MetaModel::DeclareAndAssign("context", "ctx.getTarget()", false) FOR getContext()»
+«ENDDEFINE»
+
+«DEFINE constraintAdapter_initContext(GenAuditRule audit) FOR GenDomainAttributeTarget-»
+ final Object«REM»Actual context type is genDomainAttributeTarget.getContext()«ENDREM» context = ctx.getTarget().eGet(«EXPAND MetaModel::MetaFeature FOR attribute»);
+«REM»
+ For now, leave reflective access that gives Object-compatible result.
+
+ FIXME: introduce MetaModel::DeclareAndAssignAttributeValueAsObject, that would
+ check if attibute type is primitive and wrap accordingly, but access attribute directly!
+«ENDREM-»
+ if (context == null) {
+«IF nullAsError-»
+ return ctx.createFailureStatus(new Object[] { formatElement(ctx.getTarget()) });
+«ELSE-»
+ return org.eclipse.core.runtime.Status.OK_STATUS;
+«ENDIF-»
+ }
+«ENDDEFINE»
+
+«DEFINE constraintAdapter_initContext(GenAuditRule audit) FOR GenAuditedMetricTarget-»
+final Number context = «IF metric == null /*though metamodel constraint should not allow this*/»null /*FIXME: metric target was not correctly specified in the model*/«ELSE»«EXPAND MetricProvider::invokeCalcMethod("ctx.getTarget()", false) FOR metric»«ENDIF»;
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/ViewProvider.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2007 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:
+ * Alexander Shatalin (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+
+«EXTENSION xpt::diagram::Utils»
+
+«DEFINE ViewProvider FOR gmfgen::GenDiagram-»
+«EXPAND xpt::Common::copyright FOR getDiagram().editorGen-»
+package «providersPackageName»;
+
+«EXPAND xpt::Common::generatedClassComment»
+public class «notationViewProviderClassName» extends org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider {
+ «EXPAND getDiagramViewClass-»
+ «EXPAND getNodeViewClass-»
+ «EXPAND getEdgeViewClass-»
+ «EXPAND getSemanticElementType-»
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE getDiagramViewClass FOR gmfgen::GenDiagram-»
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected Class getDiagramViewClass(org.eclipse.core.runtime.IAdaptable semanticAdapter, String diagramKind) {
+ «REM»When diagram domain element is null only diagram kind is checked«ENDREM-»
+ «EXPAND defineSemanticElement FOR domainDiagramElement-»
+ if («EXPAND xpt::editor::VisualIDRegistry::modelID».equals(diagramKind)«EXPAND checkSemanticElement(this) FOR domainDiagramElement») {
+ return «getNotationViewFactoryQualifiedClassName()».class;
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE defineSemanticElement FOR genmodel::GenClass-»
+org.eclipse.emf.ecore.EObject semanticElement = getSemanticElement(semanticAdapter);
+«ENDDEFINE»
+
+«DEFINE checkSemanticElement(gmfgen::GenDiagram diagram) FOR genmodel::GenClass» && «EXPAND xpt::editor::VisualIDRegistry::getDiagramVisualIDMethodCall FOR diagram»(semanticElement) != -1«ENDDEFINE»
+
+«DEFINE getNodeViewClass FOR gmfgen::GenDiagram-»
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected Class getNodeViewClass(org.eclipse.core.runtime.IAdaptable semanticAdapter,
+ org.eclipse.gmf.runtime.notation.View containerView, String semanticHint) {
+ if (containerView == null) {
+ return null;
+ }
+ org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(semanticAdapter);
+ org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(semanticAdapter);
+ int visualID;
+ if (semanticHint == null) {
+ // Semantic hint is not specified. Can be a result of call from CanonicalEditPolicy.
+ // In this situation there should be NO elementType, visualID will be determined
+ // by VisualIDRegistry.getNodeVisualID() for domainElement.
+ if (elementType != null || domainElement == null) {
+ return null;
+ }
+ visualID = «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(containerView, domainElement);
+ } else {
+ visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(semanticHint);
+ if (elementType != null) {
+ // Semantic hint is specified together with element type.
+ // Both parameters should describe exactly the same diagram element.
+ // In addition we check that visualID returned by VisualIDRegistry.getNodeVisualID() for
+ // domainElement (if specified) is the same as in element type.
+ if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType)
+ || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
+ return null; // foreign element type
+ }
+ String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
+ if (!semanticHint.equals(elementTypeHint)) {
+ return null; // if semantic hint is specified it should be the same as in element type
+ }
+ if (domainElement != null && visualID != «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(containerView, domainElement)) {
+ return null; // visual id for node EClass should match visual id from element type
+ }
+ } else {
+ // Element type is not specified. Domain element should be present (except pure design elements).
+ // This method is called with EObjectAdapter as parameter from:
+ // - ViewService.createNode(View container, EObject eObject, String type, PreferencesHint preferencesHint)
+ // - generated ViewFactory.decorateView() for parent element
+ «IF getElements(this).select(e | e.elementType != null).size() > 0-»
+ if (!«getEditPartQualifiedClassName()».MODEL_ID.equals(«getVisualIDRegistryQualifiedClassName()».getModelID(containerView))) {
+ return null; // foreign diagram
+ }
+ switch (visualID) {
+ «IF getElements(this).typeSelect(gmfgen::GenNode).elementType.typeSelect(gmfgen::NotationType).size() > 0-»
+ «EXPAND caseVisualID FOREACH getElements(this).typeSelect(gmfgen::GenNode).elementType.typeSelect(gmfgen::NotationType)-»
+ break; // pure design element
+ «ENDIF-»
+ «IF getElements(this).typeSelect(gmfgen::GenNode).elementType.typeSelect(gmfgen::MetamodelType).size() > 0 ||
+ getElements(this).typeSelect(gmfgen::GenNode).elementType.typeSelect(gmfgen::SpecializationType).size() > 0-»
+ «EXPAND caseVisualID FOREACH getElements(this).typeSelect(gmfgen::GenNode).elementType.typeSelect(gmfgen::MetamodelType)-»
+ «EXPAND caseVisualID FOREACH getElements(this).typeSelect(gmfgen::GenNode).elementType.typeSelect(gmfgen::SpecializationType)-»
+ if (domainElement == null || visualID != «EXPAND xpt::editor::VisualIDRegistry::getNodeVisualIDMethodCall»(containerView, domainElement)) {
+ return null; // visual id in semantic hint should match visual id for domain element
+ }
+ break;
+ «ENDIF-»
+ «EXPAND checkChildrenVisualIDs FOREACH getElements(this).select(e | e.elementType != null)-»
+ default:
+ return null;
+ }
+ «ELSE-»
+ return null;
+ «ENDIF-»
+ }
+ }
+ return getNodeViewClass(containerView, visualID);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected Class getNodeViewClass(org.eclipse.gmf.runtime.notation.View containerView, int visualID) {
+ if (containerView == null || !«EXPAND xpt::editor::VisualIDRegistry::canCreateNodeMethodCall»(containerView, visualID)) {
+ return null;
+ }
+ switch (visualID) {
+ «EXPAND caseContainerVisualID FOREACH getAllChildContainers()-»
+ «EXPAND caseEntry FOREACH links.labels-»
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE caseVisualID FOR gmfgen::ElementType-»
+ «EXPAND xpt::Common::caseVisualID FOR diagramElement»
+«ENDDEFINE»
+
+«DEFINE checkChildrenVisualIDs FOR gmfgen::GenCommonBase-»
+«ENDDEFINE»
+
+«DEFINE checkChildrenVisualIDs FOR gmfgen::GenNode-»
+ «EXPAND xpt::Common::caseVisualID FOREACH labels-»
+ «EXPAND xpt::Common::caseVisualID FOREACH compartments-»
+ «IF !labels.isEmpty() || !compartments.isEmpty()-»
+if («EXPAND xpt::editor::VisualIDRegistry::visualID» != «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(containerView)
+ || containerView.getElement() != domainElement) {
+ return null; // wrong container
+}
+break;
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE checkChildrenVisualIDs FOR gmfgen::GenLink-»
+ «EXPAND xpt::Common::caseVisualID FOREACH labels-»
+ «IF !labels.isEmpty()-»
+if («EXPAND xpt::editor::VisualIDRegistry::visualID» != «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall FOR getDiagram()»(containerView)
+ || containerView.getElement() != domainElement) {
+ return null; // wrong container
+}
+break;
+ «ENDIF-»
+«ENDDEFINE»
+
+«DEFINE caseContainerVisualID FOR gmfgen::GenChildContainer-»
+ «EXPAND caseEntry-»
+«ENDDEFINE»
+
+«DEFINE caseContainerVisualID FOR gmfgen::GenNode-»
+ «EXPAND caseEntry-»
+ «EXPAND caseEntry FOREACH labels-»
+«ENDDEFINE»
+
+«DEFINE caseEntry FOR gmfgen::GenCommonBase-»
+ «EXPAND xpt::Common::caseVisualID» return «getNotationViewFactoryQualifiedClassName()».class;
+«ENDDEFINE»
+
+«DEFINE getEdgeViewClass FOR gmfgen::GenDiagram-»
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected Class getEdgeViewClass(org.eclipse.core.runtime.IAdaptable semanticAdapter,
+ org.eclipse.gmf.runtime.notation.View containerView, String semanticHint) {
+ org.eclipse.gmf.runtime.emf.type.core.IElementType elementType = getSemanticElementType(semanticAdapter);
+ if (!«getElementTypesQualifiedClassName()».isKnownElementType(elementType)
+ || (!(elementType instanceof org.eclipse.gmf.runtime.emf.type.core.IHintedType))) {
+ return null; // foreign element type
+ }
+ String elementTypeHint = ((org.eclipse.gmf.runtime.emf.type.core.IHintedType) elementType).getSemanticHint();
+ if (elementTypeHint == null) {
+ return null; // our hint is visual id and must be specified
+ }
+ if (semanticHint != null && !semanticHint.equals(elementTypeHint)) {
+ return null; // if semantic hint is specified it should be the same as in element type
+ }
+ int visualID = «EXPAND xpt::editor::VisualIDRegistry::getVisualIDMethodCall»(elementTypeHint);
+ org.eclipse.emf.ecore.EObject domainElement = getSemanticElement(semanticAdapter);
+ if (domainElement != null && visualID != «EXPAND xpt::editor::VisualIDRegistry::getLinkWithClassVisualIDMethodCall»(domainElement)) {
+ return null; // visual id for link EClass should match visual id from element type
+ }
+ return getEdgeViewClass(visualID);
+}
+
+«EXPAND xpt::Common::generatedMemberComment»
+protected Class getEdgeViewClass(int visualID) {
+ switch (visualID) {
+ «EXPAND caseEntry FOREACH links-»
+ }
+ return null;
+}
+«ENDDEFINE»
+
+«DEFINE getSemanticElementType FOR gmfgen::GenDiagram-»
+
+«EXPAND xpt::Common::generatedMemberComment»
+private org.eclipse.gmf.runtime.emf.type.core.IElementType getSemanticElementType(
+ org.eclipse.core.runtime.IAdaptable semanticAdapter) {
+ if (semanticAdapter == null) {
+ return null;
+ }
+ return (org.eclipse.gmf.runtime.emf.type.core.IElementType) semanticAdapter.getAdapter(
+ org.eclipse.gmf.runtime.emf.type.core.IElementType.class);
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/extensions.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2007, 2008 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:
+ * Dmitry Stadnik (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2008/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/GenModel"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION xpt::diagram::Utils»
+
+«DEFINE extensions FOR gmfgen::GenDiagram-»
+
+ <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <viewProvider class="«getNotationViewProviderQualifiedClassName()»">
+ <Priority name="«notationViewProviderPriority»"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="«editorGen.modelID»"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Node" semanticHints=""/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Edge" semanticHints=""/>
+ </viewProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <editpartProvider class="«getEditPartProviderQualifiedClassName()»">
+ <Priority name="«editPartProviderPriority»"/>
+ </editpartProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <modelingAssistantProvider class="«getModelingAssistantProviderQualifiedClassName()»">
+ <Priority name="«modelingAssistantProviderPriority»"/>
+ </modelingAssistantProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <IconProvider class="«getIconProviderQualifiedClassName()»">
+ <Priority name="«iconProviderPriority»"/>
+ </IconProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <ParserProvider class="«getParserProviderQualifiedClassName()»">
+ <Priority name="«parserProviderPriority»"/>
+ </ParserProvider>
+ </extension>
+«IF generateShortcutIcon()-»
+
+ <extension point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <decoratorProvider class="«getShortcutsDecoratorProviderQualifiedClassName()»">
+ <Priority name="«shortcutsDecoratorProviderPriority»"/>
+ </decoratorProvider>
+ </extension>
+«ENDIF-»
+
+ <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+«FOREACH getElements() AS e-»
+«EXPAND elementTypeSafe FOR e.elementType-»
+«ENDFOREACH-»
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
+ «EXPAND xpt::Common::xmlGeneratedTag»
+ <clientContext id="«editorGen.plugin.iD».TypeContext">
+ <enablement>
+ <test
+ property="org.eclipse.gmf.runtime.emf.core.editingDomain"
+ value="«editingDomainID»"/>
+ </enablement>
+ </clientContext>
+ <binding context="«editorGen.plugin.iD».TypeContext">
+«FOREACH getElements() AS e-»
+ <elementType ref="«e.elementType.uniqueIdentifier»"/>
+«ENDFOREACH-»
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ </binding>
+ </extension>
+«ENDDEFINE»
+
+«DEFINE elementTypeSafe FOR gmfgen::ElementType-»
+«IF !definedExternally-»
+«EXPAND elementType-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE elementType FOR gmfgen::ElementType»
+«ERROR "Unknown element type: " + this»
+«ENDDEFINE»
+
+«DEFINE elementType FOR gmfgen::MetamodelType-»
+ <metamodel nsURI="«getMetaClass().genPackage.ecorePackage.nsURI»">
+ <metamodelType
+ id="«uniqueIdentifier»"
+«IF null != displayName-»
+ name="%metatype.name.«diagramElement.getUniqueIdentifier()»"
+«ENDIF-»
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="«getMetaClass().ecoreClass.name»"
+ edithelper="«getEditHelperQualifiedClassName()»">
+ <param name="semanticHint" value="«diagramElement.visualID»"/>
+ </metamodelType>
+ </metamodel>
+«ENDDEFINE»
+
+«DEFINE elementType FOR gmfgen::SpecializationType-»
+«IF null == getMetamodelClass()-»
+«EXPAND specializationType-»
+«ELSE-»
+ <metamodel nsURI="«getMetamodelClass().genPackage.ecorePackage.nsURI»">
+«EXPAND specializationType-»
+ </metamodel>
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE specializationType FOR gmfgen::SpecializationType-»
+ <specializationType
+ id="«uniqueIdentifier»"
+«IF null != displayName-»
+ name="%metatype.name.«diagramElement.getUniqueIdentifier()»"
+«ENDIF-»
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"«IF editHelperAdviceClassName != null»
+ edithelperadvice="«getEditHelperAdviceQualifiedClassName()»"«ENDIF»>
+ <specializes id="«null == metamodelType ? "org.eclipse.gmf.runtime.emf.type.core.null" : metamodelType.uniqueIdentifier»"/>
+ <param name="semanticHint" value="«diagramElement.visualID»"/>
+ </specializationType>
+«ENDDEFINE»
+
+«DEFINE elementType FOR gmfgen::NotationType-»
+ <specializationType
+ id="«uniqueIdentifier»"
+«IF null != displayName-»
+ name="%metatype.name.«diagramElement.getUniqueIdentifier()»"
+«ENDIF-»
+ kind="org.eclipse.gmf.runtime.diagram.ui.util.INotationType">
+ <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
+ <param name="semanticHint" value="«diagramElement.visualID»"/>
+ </specializationType>
+«ENDDEFINE»
+
+«DEFINE i18n FOR gmfgen::GenDiagram-»
+
+# Providers
+«EXPAND internal_i18n FOREACH getElements().elementType»
+«ENDDEFINE»
+
+«DEFINE internal_i18n FOR gmfgen::ElementType-»
+«IF null != displayName && !definedExternally»metatype.name.«diagramElement.getUniqueIdentifier()»=«displayName»«ENDIF»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/codegen.templates/xpt/providers/i18n.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2007 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:
+ * Anna Karjakina (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2008/GenModel";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+String i18nKeyForModelingAssistantProvider(gmfgen::GenDiagram diagram) :
+diagram.modelingAssistantProviderClassName
+;
+
+String titleKey(String dialogKey) :
+ dialogKey+"Title"
+;
+
+String messageKey(String dialogKey) :
+ dialogKey+"Message"
+;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/Attrs.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,50 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«REM»Define attributes for Figures (for DecorationFigure subclasses see Decoration.xpt)«ENDREM»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::Figure»
+«REM»Polymorphic entry point for any Figure's subclass attributes«ENDREM»
+«EXPAND attr::Figure::figureAttrs(figureVarName)»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::Shape-»
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::Label-»
+«figureVarName».setText("«text»");
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::RoundedRectangle-»
+«figureVarName».setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map FOR cornerWidth», «EXPAND MapMode::map FOR cornerHeight»));
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::CustomFigure-»
+«EXPAND attr::CustomClass::Init(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE Init(EString figureVarName) FOR gmfgraph::Polyline-»
+«FOREACH template AS pt-»
+«figureVarName».addPoint(new org.eclipse.draw2d.geometry.Point(«EXPAND MapMode::map FOR pt»));
+«ENDFOREACH-»
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/Border.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2006, 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE Init(String figureVarName) FOR gmfgraph::Border-»
+«figureVarName».setBorder(«EXPAND border(figureVarName)»);
+«ENDDEFINE»
+
+«DEFINE InitMethods FOR gmfgraph::Figure»
+«FOREACH getBordersInUse() AS b»«EXPAND initMethod(getBordersInUse().indexOf(b)) FOR b»«ENDFOREACH-»
+«ENDDEFINE»
+
+«DEFINE initMethod(int c) FOR gmfgraph::CustomBorder-»
+ /**
+ * @generated
+ */
+ private org.eclipse.draw2d.Border createBorder«c»() {
+ «EXPAND Runtime::newInstance("result")»
+ «EXPAND attr::CustomClass::Init("result")»
+ return result;
+ }
+«ENDDEFINE»
+
+«DEFINE border(String figureVarName) FOR gmfgraph::Border»
+«ERROR "This is an abstract definition border(String, Border) invoked for " + this»
+«ENDDEFINE»
+
+«DEFINE border(String figureVarName) FOR gmfgraph::LineBorder-»
+new org.eclipse.draw2d.LineBorder(«IF null == color»null«ELSE»«EXPAND attr::Figure::color(figureVarName.toUpperCase() + "_BORDER") FOR color»«ENDIF», «EXPAND MapMode::map FOR width»)«ENDDEFINE»
+
+«DEFINE border(String figureVarName) FOR gmfgraph::MarginBorder-»
+new org.eclipse.draw2d.MarginBorder(«EXPAND MapMode::map FOR insets»)«ENDDEFINE»
+
+«DEFINE border(String figureVarName) FOR gmfgraph::CompoundBorder-»
+new org.eclipse.draw2d.CompoundBorder(«IF outer == null»null«ELSE»«EXPAND border(figureVarName) FOR outer»«ENDIF», «IF inner == null»null«ELSE»«EXPAND border(figureVarName) FOR inner»«ENDIF»)
+«ENDDEFINE»
+
+«DEFINE border(String figureVarName) FOR gmfgraph::CustomBorder-»
+createBorder«getBordersInUse().size()»()«getBordersInUse().add(this)->""-»
+«ENDDEFINE»
+
+«DEFINE border(String figureVarName) FOR gmfgraph::BorderRef-»
+«EXPAND border(figureVarName) FOR actual-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/Children.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE CreateChildren FOR gmfgraph::RealFigure-»
+ /**
+ * @generated
+ */
+ private void createContents(){
+«EXPAND instantiate(0, this, "this") FOREACH children»
+ }
+«ENDDEFINE»
+
+«DEFINE instantiate(EInt count, gmfgraph::RealFigure parentFigure, String parentFigureVariable) FOR gmfgraph::Figure»
+«ERROR "Abstract instantiate(int, RealFigure, String)"»
+«ENDDEFINE»
+
+«DEFINE instantiate(EInt count, gmfgraph::RealFigure parentFigure, EString parentFigureVariable) FOR gmfgraph::FigureRef-»
+/*FIXME referenced figures are just not yet fully-functional; need process attrs and layout here*/
+«EXPAND instantiate(count, parentFigure, parentFigureVariable) FOR figure-»
+«ENDDEFINE»
+
+«DEFINE instantiate(EInt count, gmfgraph::RealFigure parentFigure, EString parentFigureVariable) FOR gmfgraph::RealFigure»
+«LET figureVariableName(count) AS figureVarName»
+«EXPAND newFigureInstance(figureVarName)»
+«EXPAND Attrs::Init(figureVarName)-»
+«IF null == layoutData || null == parentFigure.layout-»«REM»Check for (parentLayout != null) to avoid generating data that won't be used. Not sure it's essential, but it was that way with old jet templates«ENDREM»
+«parentFigureVariable».add(«figureVarName»);
+«ELSE-»
+«EXPAND LayoutData::Init(parentFigureVariable, figureVarName) FOR layoutData-»
+«ENDIF-»
+«EXPAND Layout::Init(figureVarName) FOR layout-»
+«EXPAND instantiate(count + 1, this, figureVarName) FOREACH children-»
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE newFigureInstance(String figureVarName) FOR gmfgraph::RealFigure»«IF needsField()»«figureVarName» = «EXPAND Runtime::newInstance»;«ELSE»«EXPAND Runtime::newInstance(figureVarName)»«ENDIF»«ENDDEFINE»
+
+«DEFINE newFigureInstance(String figureVarName) FOR gmfgraph::ScalablePolygon-»
+«LET figureVarName.toFirstUpper() + "Class" AS localClassName-»
+class «localClassName» extends «EXPAND Runtime::fqn» {
+«EXPAND xtras::ScalablePolygon::behaviour-»
+};
+«IF !needsField()»«localClassName» «ENDIF»«figureVarName» = new «localClassName»();
+«ENDLET-»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/Decoration.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«REM»Instantiate and define attributes for DecorationFigures«ENDREM»
+
+«DEFINE Instantiate(EString figureVarName) FOR gmfgraph::DecorationFigure-»
+«EXPAND Runtime::newInstance(figureVarName)»
+«EXPAND Attrs::Init(figureVarName)»
+«ENDDEFINE»
+
+«REM»Guess, can't delegate to attrs through Attrs::Init because there's already Init for Polyline«ENDREM»
+«DEFINE Instantiate(EString figureVarName) FOR gmfgraph::PolylineDecoration-»
+«EXPAND Runtime::newInstance(figureVarName)»
+«EXPAND attr::Decoration::polylineAttrs(figureVarName)-»
+«ENDDEFINE»
+
+«REM»Copy of above template for PolylineDecoration, just because PolygonDecoration doesn't extend PolylineDecoration in draw2d and gmfgraph«ENDREM»
+«DEFINE Instantiate(EString figureVarName) FOR gmfgraph::PolygonDecoration-»
+«EXPAND Runtime::newInstance(figureVarName)»
+«EXPAND attr::Decoration::polylineAttrs(figureVarName)-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/Extras.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,49 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«DEFINE localCoordinates FOR gmfgraph::RealFigure»
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = «!children.typeSelect(Polyline).isEmpty()»;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+«ENDDEFINE»
+
+«DEFINE localCoordinates FOR gmfgraph::Polyline-»
+«ENDDEFINE»
+
+«DEFINE localCoordinates FOR gmfgraph::Label-»
+«ENDDEFINE»
+
+
+«DEFINE extraMethods FOR gmfgraph::Figure-»
+«ENDDEFINE»
+
+«DEFINE extraMethods FOR gmfgraph::ScalablePolygon-»
+«EXPAND xtras::ScalablePolygon::behaviour-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/Layout.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2006, 2008 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ * Michael Golubev (Borland) - GridLayout attributes
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::Layout-»
+«owningFigureVariable».setLayoutManager(«EXPAND Runtime::newInstance»);
+«ENDDEFINE»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::LayoutRef-»
+«EXPAND Init(owningFigureVariable) FOR actual-»
+«ENDDEFINE»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::BorderLayout-»
+«LET "layout" + owningFigureVariable.toFirstUpper() AS layoutVarName»
+ «EXPAND Runtime::newInstance(layoutVarName)»
+«IF null != spacing-»
+ «layoutVarName».setHorizontalSpacing(«spacing.dx»);// TODO mapMode?
+ «layoutVarName».setVerticalSpacing(«spacing.dy»);
+«ENDIF-»
+ «owningFigureVariable».setLayoutManager(«layoutVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::GridLayout-»
+«LET "layout" + owningFigureVariable.toFirstUpper() AS layoutVarName»
+ «EXPAND Runtime::newInstance(layoutVarName)»
+ «layoutVarName».numColumns = «numColumns»;
+ «layoutVarName».makeColumnsEqualWidth = «equalWidth»;
+«IF null != spacing-»
+ «layoutVarName».horizontalSpacing = «spacing.dx»;
+ «layoutVarName».verticalSpacing = «spacing.dy»;
+«ENDIF-»
+«IF null != margins-»
+ «layoutVarName».marginWidth = «margins.dx»;
+ «layoutVarName».marginHeight = «margins.dy»;
+«ENDIF-»
+ «owningFigureVariable».setLayoutManager(«layoutVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::FlowLayout-»
+«LET "layout" + owningFigureVariable.toFirstUpper() AS layoutVarName»
+ «EXPAND Runtime::newInstance(layoutVarName)»
+ «layoutVarName».setStretchMinorAxis(«matchMinorSize»);
+ «layoutVarName».setMinorAlignment(«EXPAND Runtime::fqn».«EXPAND alignment(forceSingleLine) FOR minorAlignment»);
+«IF forceSingleLine»
+ «layoutVarName».setSpacing(«majorSpacing»);
+ «layoutVarName».setVertical(«vertical»);
+«ELSE»
+ «layoutVarName».setMajorAlignment(«EXPAND Runtime::fqn».«EXPAND alignment(forceSingleLine) FOR majorAlignment»);
+ «layoutVarName».setMajorSpacing(«majorSpacing»);
+ «layoutVarName».setMinorSpacing(«minorSpacing»);
+ «layoutVarName».setHorizontal(«!vertical»);
+«ENDIF»
+ «owningFigureVariable».setLayoutManager(«layoutVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE Init(EString owningFigureVariable) FOR gmfgraph::CustomLayout-»
+«LET "layout" + owningFigureVariable.toFirstUpper() AS layoutVarName»
+ «EXPAND Runtime::newInstance(layoutVarName)»
+«EXPAND attr::CustomClass::Init(layoutVarName)-»
+ «owningFigureVariable».setLayoutManager(«layoutVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE alignment(EBoolean forceSingleLine) FOR gmfgraph::Alignment-»
+«IF value == Alignment::BEGINNING.value-»
+«IF forceSingleLine»ALIGN_TOPLEFT«ELSE»ALIGN_LEFTTOP«ENDIF-»
+«ELSEIF value == Alignment::END.value-»
+«IF forceSingleLine»ALIGN_BOTTOMRIGHT«ELSE»ALIGN_RIGHTBOTTOM«ENDIF-»
+«ELSE-»
+ALIGN_CENTER«ENDIF-»
+«REM»XXX implement as extension
+switch (value) {
+ case Alignment.BEGINNING : ""
+ default : ""
+}«ENDREM»
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/LayoutData.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::LayoutData»
+«ERROR "Abstract definition, there should be specific template for " + this»
+«ENDDEFINE»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::BorderLayoutData»
+«parentFigureVariable».add(«owningFigureVariable», org.eclipse.draw2d.BorderLayout.«borderLayoutConstant(this)»);
+«ENDDEFINE»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::XYLayoutData»
+«parentFigureVariable».add(«owningFigureVariable», «EXPAND newRectangle»);
+«ENDDEFINE»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::CustomLayoutData»
+«LET "constraint" + owningFigureVariable.toFirstUpper() AS constraintVarName-»
+«qualifiedClassName» «constraintVarName» = new «qualifiedClassName»();
+«EXPAND attr::CustomClass::Init(constraintVarName)»
+«parentFigureVariable».add(«owningFigureVariable», «constraintVarName»);
+«ENDLET-»
+«ENDDEFINE»
+
+«DEFINE Init(EString parentFigureVariable, EString owningFigureVariable) FOR gmfgraph::GridLayoutData»
+«LET "constraint" + owningFigureVariable.toFirstUpper() AS constraintVarName»
+«EXPAND Runtime::newInstance(constraintVarName)»
+«constraintVarName».verticalAlignment = «EXPAND Runtime::fqn».«verticalAlignment.name»;«REM».literal, not .name!«ENDREM»
+«constraintVarName».horizontalAlignment = «EXPAND Runtime::fqn».«horizontalAlignment.name»;
+«constraintVarName».horizontalIndent = «horizontalIndent»;
+«constraintVarName».horizontalSpan = «horizontalSpan»;
+«constraintVarName».verticalSpan = «verticalSpan»;
+«constraintVarName».grabExcessHorizontalSpace = «grabExcessHorizontalSpace»;
+«constraintVarName».grabExcessVerticalSpace = «grabExcessVerticalSpace»;
+«IF null != sizeHint-»
+«constraintVarName».widthHint = «sizeHint.dx»;
+«constraintVarName».heightHint = «sizeHint.dy»;
+«ENDIF-»
+«parentFigureVariable».add(«owningFigureVariable», «constraintVarName»);
+«ENDLET»
+«ENDDEFINE»
+
+«DEFINE newRectangle FOR gmfgraph::XYLayoutData»
+new org.eclipse.draw2d.geometry.Rectangle(«IF null != topLeft-»
+«EXPAND MapMode::map FOR topLeft», «ELSE»0, 0, «ENDIF-»
+«IF null != size-»
+«EXPAND MapMode::map FOR size»«ELSE»0, 0«ENDIF»)
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/MapMode.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,35 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«REM»No mapMode at all«ENDREM»
+
+«DEFINE map FOR gmfgraph::Dimension-»
+«dx», «dy-»
+«ENDDEFINE»
+
+«DEFINE map FOR gmfgraph::Point-»
+«x», «y-»
+«ENDDEFINE»
+
+«DEFINE map FOR EInt»
+«this-»
+«ENDDEFINE»
+
+«DEFINE map FOR gmfgraph::Insets-»
+«top», «left», «bottom», «right-»
+«ENDDEFINE»
+
+«DEFINE Activator FOR Object-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/Runtime.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE newInstance(String figureVarName) FOR Figure»«EXPAND fqn» «figureVarName» = «EXPAND newInstance»;«ENDDEFINE»
+«DEFINE newInstance FOR Figure»new «EXPAND fqn»()«ENDDEFINE»
+
+«DEFINE newInstance(String layoutVarName) FOR Layout»«EXPAND fqn» «layoutVarName» = «EXPAND newInstance»;«ENDDEFINE»
+«DEFINE newInstance FOR Layout»new «EXPAND fqn»()«ENDDEFINE»
+
+«DEFINE newInstance(String constraintVarName) FOR LayoutData»«EXPAND fqn» «constraintVarName» = «EXPAND newInstance»;«ENDDEFINE»
+«DEFINE newInstance FOR LayoutData»new «EXPAND fqn»()«ENDDEFINE»
+
+«DEFINE newInstance(String borderVarName) FOR Border»«EXPAND fqn» «borderVarName» = «EXPAND newInstance»;«ENDDEFINE»
+«DEFINE newInstance FOR Border»new «EXPAND fqn»()«ENDDEFINE»
+
+
+«DEFINE fqn FOR Figure»«ERROR "Abstract definition fqn(Figure)"»«ENDDEFINE»
+«DEFINE fqn FOR Layout»«ERROR "Abstract definition fqn(Layout)"»«ENDDEFINE»
+«DEFINE fqn FOR LayoutData»«ERROR "Abstract definition fqn(LayoutData)"»«ENDDEFINE»
+«DEFINE fqn FOR Border»«ERROR "Abstract definition fqn(Border)"»«ENDDEFINE»
+
+////////////////////////
+«DEFINE fqn FOR CustomLayout»«qualifiedClassName»«ENDDEFINE»
+«DEFINE fqn FOR CustomBorder»«qualifiedClassName»«ENDDEFINE»
+«DEFINE fqn FOR CustomFigure»«qualifiedClassName»«ENDDEFINE»
+
+////////////////////////
+«DEFINE fqn FOR FlowLayout»«IF forceSingleLine»org.eclipse.draw2d.ToolbarLayout«ELSE»org.eclipse.draw2d.FlowLayout«ENDIF»«ENDDEFINE»
+
+«DEFINE fqn FOR XYLayout»org.eclipse.draw2d.XYLayout«ENDDEFINE»
+«DEFINE fqn FOR XYLayoutData»org.eclipse.draw2d.geometry.Rectangle«ENDDEFINE»
+
+«DEFINE fqn FOR GridLayout»org.eclipse.draw2d.GridLayout«ENDDEFINE»
+«DEFINE fqn FOR GridLayoutData»org.eclipse.draw2d.GridData«ENDDEFINE»
+
+«DEFINE fqn FOR StackLayout»org.eclipse.draw2d.StackLayout«ENDDEFINE»
+«DEFINE fqn FOR BorderLayout»org.eclipse.draw2d.BorderLayout«ENDDEFINE»
+
+////////////////////////
+«DEFINE fqn FOR FigureRef»«EXPAND fqn FOR figure»«ENDDEFINE»
+«DEFINE fqn FOR Label»«IF isFullRuntime()»org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel«ELSE»org.eclipse.draw2d.Label«ENDIF»«ENDDEFINE»
+«DEFINE fqn FOR LabeledContainer»org.eclipse.draw2d.LabeledContainer«ENDDEFINE»
+«DEFINE fqn FOR Rectangle»org.eclipse.draw2d.RectangleFigure«ENDDEFINE»
+«DEFINE fqn FOR RoundedRectangle»org.eclipse.draw2d.RoundedRectangle«ENDDEFINE»
+«DEFINE fqn FOR Ellipse»org.eclipse.draw2d.Ellipse«ENDDEFINE»
+«DEFINE fqn FOR Polygon»org.eclipse.draw2d.Polygon«ENDDEFINE»
+«REM»FIXME«ENDREM»«DEFINE fqn FOR ScalablePolygon»org.eclipse.draw2d.Shape«ENDDEFINE»
+«DEFINE fqn FOR PolygonDecoration»org.eclipse.draw2d.PolygonDecoration«ENDDEFINE»
+«DEFINE fqn FOR Polyline»org.eclipse.draw2d.Polyline«ENDDEFINE»
+«DEFINE fqn FOR PolylineDecoration»org.eclipse.draw2d.PolylineDecoration«ENDDEFINE»
+«DEFINE fqn FOR PolylineConnection»«IF isFullRuntime()»org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx«ELSE»org.eclipse.draw2d.PolylineConnection«ENDIF»«ENDDEFINE»
+
+«REM»
+to utilize around, need to fix XpandExecutionContextImpl to get aspects not only from relative aspects/ path, but from
+template file as well.
+// Full GMF Runtime
+////////////////////////
+«AROUND fqn FOR PolylineConnection»«IF isFullRuntime()»org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx«ELSE»«targetDef.proceed()»«ENDIF»«ENDAROUND»
+«AROUND fqn FOR Label»«IF isFullRuntime()»org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel«ELSE»«targetDef.proceed()»«ENDIF»«ENDAROUND»
+«ENDREM»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/Util.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/gmf/2006/GraphicalDefinition";
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+String compilationUnitName(gmfgraph::FigureDescriptor figure) :
+ figure.name.toFirstUpper()
+;
+
+Boolean hasSourceDecoration(gmfgraph::PolylineConnection figure) :
+ null != figure.sourceDecoration
+;
+
+List[String] requiredBundles(List[String] referencedBundles) :
+ isFullRuntime() /*&& usesLabelOrPolyline) || usesMapMode()*/ ?
+ {"org.eclipse.core.runtime","org.eclipse.draw2d", "org.eclipse.gmf.runtime.draw2d.ui"}.union(referencedBundles).toList().purgeDups() :
+ {"org.eclipse.core.runtime","org.eclipse.draw2d"}.union(referencedBundles).toList().purgeDups()
+;
+
+String additionalStaticFields() :
+GLOBALVAR outputStaticFields
+;
+
+EBoolean hasTargetDecoration(gmfgraph::PolylineConnection figure) :
+ null != figure.targetDecoration
+;
+
+cached boolean isFullRuntime() :
+ internalCheckRuntimeToken() != null ? internalCheckRuntimeToken().toLowerCase() == "full" : true
+;
+
+private String internalCheckRuntimeToken() : GLOBALVAR runtimeToken;
+
+boolean needsField(gmfgraph::RealFigure figure) :
+ // XXX consider adding generation option "fields for all figures"
+ figure.descriptor != null && figure.descriptor.accessors.figure.contains(figure)
+;
+
+String figureVariableName(gmfgraph::RealFigure figure, EInt count) :
+ needsField(figure)
+ ? figureFieldName(figure)
+ : ( figure.name != null && figure.name.trim().length() > 0
+ ? figure.name.toFirstLower() + count
+ : variableNameStem(figure) + count )
+;
+
+String nameStem(FigureRef fig) : variableNameStem(fig.figure);
+String nameStem(Figure fig) : variableNameStem(fig);
+
+// actually, should be smth like fig.eClass().name
+private String variableNameStem(Figure fig) : "fig";
+private String variableNameStem(RealFigure fig) : "fig";
+private String variableNameStem(Shape fig) : "shape";
+private String variableNameStem(Rectangle fig) : "rect";
+private String variableNameStem(RoundedRectangle fig) : "rrect";
+private String variableNameStem(Ellipse fig) : "elli";
+private String variableNameStem(Polyline fig) : "polyline";
+private String variableNameStem(Label fig) : "l";
+private String variableNameStem(DecorationFigure fig) : "dec";
+private String variableNameStem(ConnectionFigure fig) : "conn";
+
+
+// assert needsField() == true
+String figureFieldName(gmfgraph::RealFigure figure) :
+ figureFieldName(figure.descriptor.accessors.select(a | (figure == a.figure)))
+;
+
+private String figureFieldName(List[ChildAccess] aaa) :
+ aaa.collect(x | figureFieldName(x)).toList().first()
+;
+
+String figureFieldName(gmfgraph::ChildAccess childAccess) :
+ "f" + (childAccess.accessor.startsWith("get") && childAccess.accessor.length() > 3 ? childAccess.accessor.subString(3) : childAccess.accessor)
+;
+
+String borderLayoutConstant(gmfgraph::BorderLayoutData layoutData) :
+ switch (layoutData.alignment) {
+ case Alignment::BEGINNING : ( layoutData.vertical ? "TOP" : "LEFT" )
+ case Alignment::END : ( layoutData.vertical ? "BOTTOM" : "RIGHT" )
+ default : "CENTER"
+ }
+;
+
+cached List[gmfgraph::CustomBorder] getBordersInUse() : {} ;
+
+
+cached List[FigureAccessor] allCustomAccessors(FigureDescriptor fd) :
+ filterCustom( { fd.actualFigure } ).customChildren
+;
+
+// all CustimFigures in the hierarchy of each figure
+private List[CustomFigure] filterCustom(List[Figure] figures) :
+ figures.isEmpty() ? {}
+ : figures.typeSelect(CustomFigure).union(filterCustom(figures.typeSelect(RealFigure).children))
+;
+
+EString messageFormat(EString pattern, List[Object] argument) :
+ JAVA java.text.MessageFormat.format(java.lang.String, java.lang.Object.List)
+;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/attr/CustomClass.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,37 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION Util»
+
+«DEFINE Init(EString instanceVarName) FOR gmfgraph::CustomClass»
+«EXPAND customAttribute(instanceVarName) FOREACH attributes»
+«ENDDEFINE»
+
+«DEFINE customAttribute(EString instanceVarName) FOR gmfgraph::CustomAttribute»
+«EXPAND customAttrValueImpl-»
+«IF directAccess»
+«instanceVarName».«name» = «EXPAND customAttrValue»;
+«ELSE»
+«instanceVarName».set«name.toFirstUpper()»(«EXPAND customAttrValue»);
+«ENDIF»
+«ENDDEFINE»
+
+«DEFINE customAttrValueImpl FOR gmfgraph::CustomAttribute»
+«IF multiStatementValue-»
+«messageFormat(value, {"attr" + name.toFirstUpper()})-»
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE customAttrValue FOR gmfgraph::CustomAttribute»
+«IF multiStatementValue»attr«name.toFirstUpper()»«ELSE-»«value»«ENDIF-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/attr/Decoration.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,53 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+«EXTENSION Util»
+
+«DEFINE polylineAttrs(String figureVarName) FOR gmfgraph::PolylineDecoration-»
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«EXPAND templatePoints(figureVarName)-»
+«EXPAND scale(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE polylineAttrs(String figureVarName) FOR gmfgraph::PolygonDecoration-»
+«EXPAND attr::Shape::shapeAttrs(figureVarName)-»
+«EXPAND attr::Figure::figureAttrs(figureVarName)-»
+«EXPAND templatePoints(figureVarName)-»
+«EXPAND scale(figureVarName)-»
+«ENDDEFINE»
+
+«DEFINE templatePoints(String figureVarName) FOR gmfgraph::Polyline-»
+«IF !template.isEmpty()-»
+org.eclipse.draw2d.geometry.PointList pl = new org.eclipse.draw2d.geometry.PointList();
+«EXPAND templatePoint("pl") FOREACH template-»
+«figureVarName».setTemplate(pl);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE templatePoint(String pointListVarName) FOR gmfgraph::Point-»
+«pointListVarName».addPoint(«EXPAND MapMode::map»);
+«ENDDEFINE»
+
+«DEFINE scale(String figureVarName) FOR gmfgraph::PolylineDecoration-»
+«IF !template.isEmpty()-»
+«figureVarName».setScale(«EXPAND MapMode::map FOR 7», «EXPAND MapMode::map FOR 3»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE scale(String figureVarName) FOR gmfgraph::PolygonDecoration-»
+«IF !template.isEmpty()-»
+«figureVarName».setScale(«EXPAND MapMode::map FOR 7», «EXPAND MapMode::map FOR 3»);
+«ENDIF-»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/attr/Figure.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,95 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+«EXTENSION Util»
+
+«DEFINE figureAttrs(EString figureVarName) FOR gmfgraph::Figure-»
+«EXPAND foregroundColor(this, figureVarName) FOR foregroundColor-»
+«EXPAND backgroundColor(this, figureVarName) FOR backgroundColor-»
+«EXPAND font(figureVarName) FOR font-»
+«EXPAND preferredSize(figureVarName) FOR preferredSize-»
+«EXPAND maximumSize(figureVarName) FOR maximumSize-»
+«EXPAND minimumSize(figureVarName) FOR minimumSize-»
+«EXPAND position(figureVarName) FOR location-»
+«EXPAND size(figureVarName) FOR size-»
+«EXPAND insets(figureVarName) FOR insets-»
+«EXPAND Border::Init(figureVarName) FOR border-»
+«ENDDEFINE»
+
+«DEFINE foregroundColor(gmfgraph::Figure figure, String figureVarName) FOR gmfgraph::Color-»
+ «figureVarName».setForegroundColor(«EXPAND color(figureVarName.toUpperCase() + "_FORE")»);
+«ENDDEFINE»
+«DEFINE backgroundColor(gmfgraph::Figure figure, String figureVarName) FOR gmfgraph::Color-»
+ «figureVarName».setBackgroundColor(«EXPAND color(figureVarName.toUpperCase() + "_BACK")»);
+«ENDDEFINE»
+
+«DEFINE preferredSize(EString figureVarName) FOR gmfgraph::Dimension-»
+«figureVarName».setPreferredSize(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE maximumSize(EString figureVarName) FOR gmfgraph::Dimension-»
+«figureVarName».setMaximumSize(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE minimumSize(EString figureVarName) FOR gmfgraph::Dimension-»
+«figureVarName».setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE position(String figureVarName) FOR gmfgraph::Point-»
+«figureVarName».setLocation(new org.eclipse.draw2d.geometry.Point(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE size(EString figureVarName) FOR gmfgraph::Point-»
+«figureVarName».setSize(«EXPAND MapMode::map»);
+«ENDDEFINE»
+
+«DEFINE insets(EString figureVarName) FOR gmfgraph::Insets-»
+«REM»using MarginBorder for insets is not good idea«ENDREM»
+«figureVarName».setBorder(new org.eclipse.draw2d.MarginBorder(«EXPAND MapMode::map»));
+«ENDDEFINE»
+
+«DEFINE font(String figureVarName) FOR gmfgraph::Font»
+«ERROR "This is abstact definition, just to overcome some xpand polymorphism limitations"»
+«ENDDEFINE»
+
+«DEFINE color(String variableName) FOR gmfgraph::Color»
+«ERROR "This is abstact definition, just to overcome some xpand polymorphism limitations"»
+«ENDDEFINE»
+
+«DEFINE color(String variableName) FOR gmfgraph::RGBColor-»
+«variableName-»
+«FILE "" staticFields»
+/**
+ * @generated
+ */
+static final org.eclipse.swt.graphics.Color «variableName» = new org.eclipse.swt.graphics.Color(null, «red», «green», «blue»);
+«ENDFILE»
+«ENDDEFINE»
+
+«DEFINE color(String variableName) FOR gmfgraph::ConstantColor-»
+org.eclipse.draw2d.ColorConstants.«value.literal-»
+«ENDDEFINE»
+
+«DEFINE font(String figureVarName) FOR gmfgraph::BasicFont-»
+«LET figureVarName.toUpperCase() + "_FONT" AS variableName»
+«figureVarName».setFont(«variableName»);
+«FILE "" staticFields»
+/**
+ * @generated
+ */
+static final org.eclipse.swt.graphics.Font «variableName» = new org.eclipse.swt.graphics.Font(org.eclipse.swt.widgets.Display.getCurrent(), «IF null == faceName || faceName.trim().length() == 0»org.eclipse.swt.widgets.Display.getDefault().getSystemFont().getFontData()[0].getName()«ELSE»"«faceName»"«ENDIF», «height», org.eclipse.swt.SWT.«style.literal»);
+«ENDFILE»
+«ENDLET»
+«ENDDEFINE»
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/attr/Shape.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,56 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+«REM»
+org.eclipse.draw2d.Shape
+ private boolean fill = true, outline = true, xorFill, xorOutline;
+«ENDREM»
+«DEFINE shapeAttrs(EString figureVarName) FOR Shape-»
+«EXPAND fill(figureVarName)-»
+«IF xorFill»«EXPAND xorFill(figureVarName)»«ENDIF-»
+«IF !outline»«EXPAND outline(figureVarName)»«ENDIF-»
+«IF xorOutline»«EXPAND xorOutline(figureVarName)»«ENDIF-»
+«IF lineWidth != 1»«EXPAND lineWidth(figureVarName)»«ENDIF-»
+«IF lineKind.value != LineKind::LINE_SOLID.value»«EXPAND lineKind(figureVarName)»«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE fill(EString figureVarName) FOR Shape-»
+«IF !fill»«figureVarName».setFill(«fill»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE fill(EString figureVarName) FOR Polygon-»
+«IF fill»«figureVarName».setFill(«fill»);
+«ENDIF-»
+«ENDDEFINE»
+
+«DEFINE xorFill(EString figureVarName) FOR Shape-»
+«figureVarName».setFillXOR(«xorFill»);
+«ENDDEFINE»
+
+«DEFINE outline(EString figureVarName) FOR Shape-»
+«figureVarName».setOutline(«outline»);
+«ENDDEFINE»
+
+«DEFINE xorOutline(EString figureVarName) FOR Shape-»
+«figureVarName».setOutlineXOR(«xorOutline»);
+«ENDDEFINE»
+
+«DEFINE lineWidth(EString figureVarName) FOR Shape-»
+«figureVarName».setLineWidth(«lineWidth»);
+«ENDDEFINE»
+
+«DEFINE lineKind(EString figureVarName) FOR Shape-»
+«figureVarName».setLineStyle(org.eclipse.draw2d.Graphics.«lineKind.literal»);
+«ENDDEFINE»
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/plugin/Activator.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,66 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+
+«DEFINE Init(String packageName, String pluginActivatorClassName, String pluginID) FOR Object-»
+package «packageName»;
+
+/**
+ * @generated
+ */
+public class «pluginActivatorClassName» extends org.eclipse.core.runtime.Plugin {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "«pluginID»"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private static «pluginActivatorClassName» ourInstance;
+
+ /**
+ * @generated
+ */
+ public «pluginActivatorClassName»() {
+ }
+
+ /**
+ * @generated
+ */
+ public void start(org.osgi.framework.BundleContext context) throws Exception {
+ super.start(context);
+ ourInstance = this;
+ }
+
+ /**
+ * @generated
+ */
+ public void stop(org.osgi.framework.BundleContext context) throws Exception {
+ ourInstance = null;
+ super.stop(context);
+ }
+
+ /**
+ * @generated
+ */
+ public static «pluginActivatorClassName» getDefault() {
+ return ourInstance;
+ }
+«EXPAND MapMode::Activator-»
+«EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE additions FOR Object»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/plugin/BuildProperties.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,18 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«DEFINE Init FOR Object-»
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/plugin/Manifest.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+«EXTENSION Util»
+
+/*
+ * FIXME add a simple model (either non-generated, .ecore only?) to descripbe GenConfig
+ */
+
+«DEFINE Init(String pluginID, String pluginActivatorQualifiedName, List[String] exportedPackages, List[String] referencedBundles) FOR Object-»
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName
+Bundle-SymbolicName: «pluginID»; singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Vendor: %providerName
+Bundle-Activator: «pluginActivatorQualifiedName»
+Bundle-Localization: plugin
+Export-Package:«EXPAND exportPackageHeader FOR exportedPackages»
+Require-Bundle:«EXPAND requireBundleHeader FOR requiredBundles(referencedBundles)»
+Eclipse-LazyStart: true
+«EXPAND additions-»
+«ENDDEFINE»
+
+«DEFINE exportPackageHeader FOR List[String]-»
+«EXPAND print FOREACH this SEPARATOR ",\n"-»
+«ENDDEFINE»
+
+«REM»FIXME Set[String] - improve union recognition«ENDREM»
+«DEFINE requireBundleHeader FOR Collection[Object]-»
+«EXPAND print FOREACH this.typeSelect(String) SEPARATOR ",\n"-»
+«ENDDEFINE»
+
+«DEFINE print FOR string» «this»«ENDDEFINE»
+
+«DEFINE additions FOR Object»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/plugin/PluginProperties.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,16 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«DEFINE Init(String pluginName, String providerName) FOR Object-»
+pluginName = «pluginName»
+providerName = «providerName»
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/rt_mm/MapMode.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,58 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«EXTENSION rt_mm::MapModeUtil»
+
+«REM»Using MapMode«ENDREM»
+
+«DEFINE map FOR gmfgraph::Dimension-»
+«EXPAND deviceToLogic FOR dx», «EXPAND deviceToLogic FOR dy-»
+«ENDDEFINE»
+
+«DEFINE map FOR gmfgraph::Point-»
+«EXPAND deviceToLogic FOR x», «EXPAND deviceToLogic FOR y-»
+«ENDDEFINE»
+
+«DEFINE map FOR int-»
+«EXPAND deviceToLogic-»
+«ENDDEFINE»
+
+«DEFINE map FOR gmfgraph::Insets-»
+«EXPAND deviceToLogic FOR top», «EXPAND deviceToLogic FOR left», «EXPAND deviceToLogic FOR bottom», «EXPAND deviceToLogic FOR right-»
+«ENDDEFINE»
+
+«DEFINE deviceToLogic FOR int-»
+«mapModeAccessor()»getMapMode().DPtoLP(«this»)
+«ENDDEFINE»
+
+«DEFINE Activator FOR Object-»
+ private org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode myMapMode = org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes.IDENTITY_MM;
+
+ /**
+ * @generated
+ */
+ public void setMapMode(org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode mapMode) {
+ myMapMode = mapMode;
+ if (myMapMode == null){
+ myMapMode = org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeTypes.IDENTITY_MM;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode getMapMode() {
+ return myMapMode;
+ }
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/rt_mm/MapModeUtil.ext Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,17 @@
+/*
+ * 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+import "http://www.eclipse.org/emf/2002/Ecore";
+
+String mapModeAccessor() :
+GLOBALVAR mapModeAccessor
+;
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/top/Descriptor.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+«EXTENSION Util»
+
+«DEFINE Top(String packageStmt) FOR gmfgraph::FigureDescriptor»
+«IF packageStmt != null && packageStmt.length() > 0»package «packageStmt»;
+«ENDIF-»
+/**
+ * @generated
+ */
+public class «compilationUnitName()» extends «EXPAND Runtime::fqn FOR actualFigure» {
+«EXPAND body»
+«additionalStaticFields()»
+}
+«ENDDEFINE»
+
+
+
+«DEFINE Inner FOR gmfgraph::FigureDescriptor»
+/**
+ * @generated
+ */
+public class «compilationUnitName()» extends «EXPAND Runtime::fqn FOR actualFigure» {
+«EXPAND body»
+}
+«additionalStaticFields()»
+«ENDDEFINE»
+
+«REM»«ENDREM»
+«DEFINE body FOR gmfgraph::FigureDescriptor»
+
+«EXPAND accessorField FOREACH accessors.select(a | !allCustomAccessors().typedFigure.contains(a.figure))»
+
+«EXPAND Figure::ClassBody(compilationUnitName()) FOR actualFigure»
+
+«EXPAND accessorToField FOREACH accessors.select(a | !allCustomAccessors().typedFigure.contains(a.figure))»
+«FOREACH accessors.select(a | allCustomAccessors().typedFigure.contains(a.figure)) AS a-»
+«EXPAND accessorToCustom(allCustomAccessors().select(fa | fa.typedFigure == a.figure)) FOR a»
+«ENDFOREACH-»
+«ENDDEFINE»
+
+
+«DEFINE accessorField FOR gmfgraph::ChildAccess-»
+ /**
+ * @generated
+ */
+ private «EXPAND Runtime::fqn FOR figure» «figureFieldName()»;
+«ENDDEFINE»
+
+«REM»ChildAccess points to figure we've generated, there's a field for it«ENDREM»
+«DEFINE accessorToField FOR gmfgraph::ChildAccess-»
+ /**
+ * @generated
+ */
+ public «EXPAND Runtime::fqn FOR figure» «accessor»() {
+ return «figureFieldName()»;
+ }
+«ENDDEFINE»
+
+«REM»ChildAccess points to some child of a CustomFigure, need to delegate to it's accessor
+Perhaps, should add support for ChildAccess not being generated (in case they are have same name as
+FigureAccessor.accessor
+«ENDREM»
+«DEFINE accessorToCustom(List[FigureAccessor] fa) FOR gmfgraph::ChildAccess-»
+ /**
+ * @generated
+ */
+ public «EXPAND Runtime::fqn FOR figure» «accessor»() {
+ return «fa.accessor.first()»;
+ }
+«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/top/Figure.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2006, 2007 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:
+ * Artem Tikhomirov (Borland) - initial API and implementation
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+«IMPORT "templates"»
+«EXTENSION Util»
+
+«DEFINE ClassBody(String cuName) FOR gmfgraph::Figure»«ERROR "abstract ClassBody(Figure)"»«ENDDEFINE»
+
+«DEFINE ClassBody(String cuName) FOR gmfgraph::FigureRef-»
+«EXPAND ClassBody(cuName) FOR figure-»
+«ENDDEFINE»
+
+«DEFINE ClassBody(String cuName) FOR gmfgraph::RealFigure-»
+ /**
+ * @generated
+ */
+ public «cuName»() {
+«getBordersInUse().clear()->""-»
+ «EXPAND Layout::Init("this") FOR layout-»
+ «EXPAND Attrs::Init("this")-»
+«IF !children.typeSelect(Figure).isEmpty()-»
+ createContents();
+ }
+«EXPAND Children::CreateChildren-»
+«EXPAND Border::InitMethods»
+«ELSE-»
+ }
+«ENDIF-»
+«EXPAND Extras::extraMethods»
+«EXPAND Extras::localCoordinates»
+«EXPAND additions-»
+«ENDDEFINE»
+
+«DEFINE ClassBody(String cuName) FOR gmfgraph::PolylineConnection-»
+ /**
+ * @generated
+ */
+ public «cuName»() {
+ «EXPAND Attrs::Init("this")»
+«IF !children.typeSelect(Label).isEmpty()-»
+ createContents();
+«ENDIF-»
+«IF hasSourceDecoration()-»
+ setSourceDecoration(createSourceDecoration());
+«ENDIF-»
+«IF hasTargetDecoration()-»
+ setTargetDecoration(createTargetDecoration());
+«ENDIF-»
+ }
+«IF !children.typeSelect(Label).isEmpty()»
+«REM»
+ Copy of Children::CreateChildren with temp workaround to generate child figures for labels only.
+ Though this is temp workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=193180, I'm not sure
+ what's the right approach with e.g. decoration as child of a link.
+«ENDREM»
+ /**
+ * @generated
+ */
+ private void createContents(){
+«EXPAND Children::instantiate(0, this, "this") FOREACH children.typeSelect(Label)»
+ }
+«ENDIF-»
+«IF hasSourceDecoration()»
+ /**
+ * @generated
+ */
+ private org.eclipse.draw2d.RotatableDecoration createSourceDecoration() {
+ «EXPAND Decoration::Instantiate("df") FOR sourceDecoration-»
+ return df;
+ }
+«ENDIF-»
+«IF hasTargetDecoration()»
+ /**
+ * @generated
+ */
+ private org.eclipse.draw2d.RotatableDecoration createTargetDecoration() {
+ «EXPAND Decoration::Instantiate("df") FOR targetDecoration-»
+ return df;
+ }
+«ENDIF-»
+«EXPAND additions-»
+«ENDDEFINE»
+
+«REM»Our regular way to add smth inside generated class body«ENDREM»
+«DEFINE additions FOR gmfgraph::Figure»«ENDDEFINE»
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/graphdef.codegen.templates/xtras/ScalablePolygon.xpt Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,94 @@
+/*
+ * 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
+ */
+
+«IMPORT "http://www.eclipse.org/gmf/2006/GraphicalDefinition"»
+«IMPORT "http://www.eclipse.org/emf/2002/Ecore"»
+
+
+«DEFINE behaviour FOR gmfgraph::ScalablePolygon-»
+ /**
+ * @generated
+ */
+ private final org.eclipse.draw2d.geometry.PointList myTemplate = new org.eclipse.draw2d.geometry.PointList();
+ /**
+ * @generated
+ */
+ private org.eclipse.draw2d.geometry.Rectangle myTemplateBounds;
+
+ /**
+ * @generated
+ */
+ public void addPoint(org.eclipse.draw2d.geometry.Point point){
+ myTemplate.addPoint(point);
+ myTemplateBounds = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected void fillShape(org.eclipse.draw2d.Graphics graphics) {
+ org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
+ graphics.pushState();
+ graphics.translate(bounds.x, bounds.y);
+ graphics.fillPolygon(scalePointList());
+ graphics.popState();
+ }
+
+ /**
+ * @generated
+ */
+ protected void outlineShape(org.eclipse.draw2d.Graphics graphics) {
+ org.eclipse.draw2d.geometry.Rectangle bounds = getBounds();
+ graphics.pushState();
+ graphics.translate(bounds.x, bounds.y);
+ graphics.drawPolygon(scalePointList());
+ graphics.popState();
+ }
+
+ /**
+ * @generated
+ */
+ private org.eclipse.draw2d.geometry.Rectangle getTemplateBounds(){
+ if (myTemplateBounds == null){
+ myTemplateBounds = myTemplate.getBounds().getCopy().union(0, 0);
+ //just safety -- we are going to use this as divider
+ if (myTemplateBounds.width < 1){
+ myTemplateBounds.width = 1;
+ }
+ if (myTemplateBounds.height < 1){
+ myTemplateBounds.height = 1;
+ }
+ }
+ return myTemplateBounds;
+ }
+
+ /**
+ * @generated
+ */
+ private int[] scalePointList() {
+ org.eclipse.draw2d.geometry.Rectangle pointsBounds = getTemplateBounds();
+ org.eclipse.draw2d.geometry.Rectangle actualBounds = getBounds();
+
+ float xScale = ((float) actualBounds.width) / pointsBounds.width;
+ float yScale = ((float) actualBounds.height) / pointsBounds.height;
+
+ if (xScale == 1 && yScale == 1) {
+ return myTemplate.toIntArray();
+ }
+ int[] scaled = (int[]) myTemplate.toIntArray().clone();
+ for (int i = 0; i < scaled.length; i += 2) {
+ scaled[i] = (int) Math.floor(scaled[i] * xScale);
+ scaled[i + 1] = (int) Math.floor(scaled[i + 1] * yScale);
+ }
+ return scaled;
+ }
+«ENDDEFINE»
\ No newline at end of file
Binary file carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/modeling32.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/plugin.properties Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,12 @@
+###############################################################################
+# Copyright (c) 2009 Borland Software Corporation and others.
+# 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:
+# Borland Software Corporation - initial API and implementation
+###############################################################################
+pluginName = Legacy GMF templates
+providerName = Eclipse Modeling Project
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/carbidecpp22devenv/plugins/org.eclipse.gmf.templates.legacy_1.0.0.v20090614-0839/plugin.xml Fri Dec 04 11:06:59 2009 -0600
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.gmf.xpand.migration.templates">
+ <xpand-root
+ currentLocation="/org.eclipse.gmf.templates.legacy/codegen.templates"
+ originalLocation="/org.eclipse.gmf.codegen/templates">
+ </xpand-root>
+ <xpand-root
+ currentLocation="/org.eclipse.gmf.templates.legacy/codegen.templates-dynmodel"
+ originalLocation="/org.eclipse.gmf.codegen/templates-dynmodel">
+ </xpand-root>
+ <xpand-root
+ currentLocation="/org.eclipse.gmf.templates.legacy/codegen.lite.templates"
+ originalLocation="/org.eclipse.gmf.codegen.lite/templates">
+ </xpand-root>
+ <xpand-root
+ currentLocation="/org.eclipse.gmf.templates.legacy/graphdef.codegen.templates"
+ originalLocation="/org.eclipse.gmf.graphdef.codegen/templates">
+ </xpand-root>
+ </extension>
+
+</plugin>