diff options
author | mgolubev | 2012-04-23 16:36:02 +0000 |
---|---|---|
committer | mgolubev | 2012-04-23 16:36:02 +0000 |
commit | 54ed65e0a7c88c4d020081d7b51cf9994930c3cb (patch) | |
tree | 1570f9586d5b2306cbf6afa3e26caf8eec048745 | |
parent | 4bce58657b67117b9658df74fd73e76a14afa8f9 (diff) | |
download | org.eclipse.gmf-tooling-158116-374609-(models-only)-samples-taipan-choice-labels.tar.gz org.eclipse.gmf-tooling-158116-374609-(models-only)-samples-taipan-choice-labels.tar.xz org.eclipse.gmf-tooling-158116-374609-(models-only)-samples-taipan-choice-labels.zip |
[374609] - amend Taipan sample with showcase for choice labels158116-374609-(models-only)-samples-taipan-choice-labels
20 files changed, 964 insertions, 198 deletions
diff --git a/examples/org.eclipse.gmf.examples.taipan.edit/plugin.properties b/examples/org.eclipse.gmf.examples.taipan.edit/plugin.properties index 4df3fb742..a51cd6585 100644 --- a/examples/org.eclipse.gmf.examples.taipan.edit/plugin.properties +++ b/examples/org.eclipse.gmf.examples.taipan.edit/plugin.properties @@ -70,3 +70,9 @@ _UI_Unknown_feature = Unspecified _UI_Ship_route_feature = Route _UI_Destination_type = Destination +_UI_Ship_shipClass_feature = Ship Class +_UI_ShipClass_TRIBAL_literal = TRIBAL +_UI_ShipClass_AMPHION_literal = AMPHION +_UI_ShipClass_FRIGAT_literal = FRIGAT +_UI_ShipClass_BATTLESHIP_literal = BATTLESHIP +_UI_ShipClass_CRUISER_literal = CRUISER diff --git a/examples/org.eclipse.gmf.examples.taipan.edit/src/org/eclipse/gmf/examples/taipan/provider/ShipItemProvider.java b/examples/org.eclipse.gmf.examples.taipan.edit/src/org/eclipse/gmf/examples/taipan/provider/ShipItemProvider.java index e0f5f7208..08319d0b9 100644 --- a/examples/org.eclipse.gmf.examples.taipan.edit/src/org/eclipse/gmf/examples/taipan/provider/ShipItemProvider.java +++ b/examples/org.eclipse.gmf.examples.taipan.edit/src/org/eclipse/gmf/examples/taipan/provider/ShipItemProvider.java @@ -62,6 +62,7 @@ public class ShipItemProvider extends ItemProviderAdapter implements IEditingDom super.getPropertyDescriptors(object); addNamePropertyDescriptor(object); + addShipClassPropertyDescriptor(object); addDestinationPropertyDescriptor(object); addRoutePropertyDescriptor(object); } @@ -81,6 +82,18 @@ public class ShipItemProvider extends ItemProviderAdapter implements IEditingDom } /** + * This adds a property descriptor for the Ship Class feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + protected void addShipClassPropertyDescriptor(Object object) { + itemPropertyDescriptors.add(createItemPropertyDescriptor(((ComposeableAdapterFactory) adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Ship_shipClass_feature"), //$NON-NLS-1$ + getString("_UI_PropertyDescriptor_description", "_UI_Ship_shipClass_feature", "_UI_Ship_type"), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + TaiPanPackage.Literals.SHIP__SHIP_CLASS, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); + } + + /** * This adds a property descriptor for the Destination feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -171,6 +184,7 @@ public class ShipItemProvider extends ItemProviderAdapter implements IEditingDom switch (notification.getFeatureID(Ship.class)) { case TaiPanPackage.SHIP__NAME: + case TaiPanPackage.SHIP__SHIP_CLASS: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true)); return; case TaiPanPackage.SHIP__CARGO: diff --git a/examples/org.eclipse.gmf.examples.taipan.edit/src/org/eclipse/gmf/examples/taipan/provider/TaiPanItemProviderAdapterFactory.java b/examples/org.eclipse.gmf.examples.taipan.edit/src/org/eclipse/gmf/examples/taipan/provider/TaiPanItemProviderAdapterFactory.java index 455989c42..be180be0a 100644 --- a/examples/org.eclipse.gmf.examples.taipan.edit/src/org/eclipse/gmf/examples/taipan/provider/TaiPanItemProviderAdapterFactory.java +++ b/examples/org.eclipse.gmf.examples.taipan.edit/src/org/eclipse/gmf/examples/taipan/provider/TaiPanItemProviderAdapterFactory.java @@ -384,7 +384,7 @@ public class TaiPanItemProviderAdapterFactory extends TaiPanAdapterFactory imple public Object adapt(Object object, Object type) { if (isFactoryForType(type)) { Object adapter = super.adapt(object, type); - if (!(type instanceof Class) || (((Class<?>) type).isInstance(adapter))) { + if (!(type instanceof Class<?>) || (((Class<?>) type).isInstance(adapter))) { return adapter; } } diff --git a/examples/org.eclipse.gmf.examples.taipan/models/taipan.ecore b/examples/org.eclipse.gmf.examples.taipan/models/taipan.ecore index e6cea3148..075d6aeb7 100644 --- a/examples/org.eclipse.gmf.examples.taipan/models/taipan.ecore +++ b/examples/org.eclipse.gmf.examples.taipan/models/taipan.ecore @@ -1,66 +1,74 @@ -<?xml version="1.0" encoding="UTF-8"?> -<ecore:EPackage xmi:version="2.0" - xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="taipan" - nsURI="http://www.eclipse.org/examples/gmf/taipan" nsPrefix="taipan"> - <eClassifiers xsi:type="ecore:EClass" name="Aquatory"> - <eStructuralFeatures xsi:type="ecore:EReference" name="ports" upperBound="-1" - eType="#//Port" containment="true"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="routes" upperBound="-1" - eType="#//Route" containment="true"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="ships" upperBound="-1" - eType="#//Ship" containment="true"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Destination" abstract="true" interface="true"/> - <eClassifiers xsi:type="ecore:EClass" name="Port" eSuperTypes="#//Destination"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="location" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="buildings" upperBound="-1" - eType="#//Building" containment="true"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="register" upperBound="-1" - eType="#//Ship"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Building"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="info" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="street" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Route" eSuperTypes="#//Destination"> - <eStructuralFeatures xsi:type="ecore:EReference" name="source" lowerBound="1" - eType="#//Destination"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="destination" lowerBound="1" - eType="#//Destination"/> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="reliability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble" - defaultValueLiteral="1"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Ship"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="destination" eType="#//Port"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="route" eType="#//Route"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="cargo" upperBound="-1" - eType="#//Item" containment="true"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Item" abstract="true"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="article" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="LargeItem" eSuperTypes="#//Item"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="weight" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="SmallItems" eSuperTypes="#//Item"> - <eStructuralFeatures xsi:type="ecore:EAttribute" name="quantity" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="EmptyBox" eSuperTypes="#//Item"/> - <eClassifiers xsi:type="ecore:EClass" name="Warship" eSuperTypes="#//Ship"> - <eStructuralFeatures xsi:type="ecore:EReference" name="escortOrder" eType="#//EscortShipsOrder" - containment="true"/> - <eStructuralFeatures xsi:type="ecore:EReference" name="attackOrders" upperBound="-1" - eType="#//BesiegePortOrder" containment="true"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="Order" abstract="true" interface="true"/> - <eClassifiers xsi:type="ecore:EClass" name="EscortShipsOrder" eSuperTypes="#//Order"> - <eStructuralFeatures xsi:type="ecore:EReference" name="ships" lowerBound="1" upperBound="-1" - eType="#//Ship"/> - </eClassifiers> - <eClassifiers xsi:type="ecore:EClass" name="BesiegePortOrder" eSuperTypes="#//Order"> - <eStructuralFeatures xsi:type="ecore:EReference" name="port" lowerBound="1" eType="#//Port"/> - </eClassifiers> -</ecore:EPackage> +<?xml version="1.0" encoding="UTF-8"?>
+<ecore:EPackage xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="taipan"
+ nsURI="http://www.eclipse.org/examples/gmf/taipan" nsPrefix="taipan">
+ <eClassifiers xsi:type="ecore:EClass" name="Aquatory">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="ports" upperBound="-1"
+ eType="#//Port" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="routes" upperBound="-1"
+ eType="#//Route" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="ships" upperBound="-1"
+ eType="#//Ship" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Destination" abstract="true" interface="true"/>
+ <eClassifiers xsi:type="ecore:EEnum" name="ShipClass">
+ <eLiterals name="TRIBAL"/>
+ <eLiterals name="AMPHION" value="1"/>
+ <eLiterals name="FRIGAT" value="2"/>
+ <eLiterals name="BATTLESHIP" value="3"/>
+ <eLiterals name="CRUISER" value="4"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Port" eSuperTypes="#//Destination">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="location" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="buildings" upperBound="-1"
+ eType="#//Building" containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="register" upperBound="-1"
+ eType="#//Ship"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Building">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="info" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="street" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Route" eSuperTypes="#//Destination">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="source" lowerBound="1"
+ eType="#//Destination"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="destination" lowerBound="1"
+ eType="#//Destination"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="reliability" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"
+ defaultValueLiteral="1"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Ship">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="shipClass" eType="#//ShipClass"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="destination" eType="#//Port"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="route" eType="#//Route"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="cargo" upperBound="-1"
+ eType="#//Item" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Item" abstract="true">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="article" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="LargeItem" eSuperTypes="#//Item">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="weight" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="SmallItems" eSuperTypes="#//Item">
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="quantity" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="EmptyBox" eSuperTypes="#//Item"/>
+ <eClassifiers xsi:type="ecore:EClass" name="Warship" eSuperTypes="#//Ship">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="escortOrder" eType="#//EscortShipsOrder"
+ containment="true"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="attackOrders" upperBound="-1"
+ eType="#//BesiegePortOrder" containment="true"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="Order" abstract="true" interface="true"/>
+ <eClassifiers xsi:type="ecore:EClass" name="EscortShipsOrder" eSuperTypes="#//Order">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="ships" lowerBound="1" upperBound="-1"
+ eType="#//Ship"/>
+ </eClassifiers>
+ <eClassifiers xsi:type="ecore:EClass" name="BesiegePortOrder" eSuperTypes="#//Order">
+ <eStructuralFeatures xsi:type="ecore:EReference" name="port" lowerBound="1" eType="#//Port"/>
+ </eClassifiers>
+</ecore:EPackage>
diff --git a/examples/org.eclipse.gmf.examples.taipan/models/taipan.emf b/examples/org.eclipse.gmf.examples.taipan/models/taipan.emf new file mode 100644 index 000000000..ba96096c2 --- /dev/null +++ b/examples/org.eclipse.gmf.examples.taipan/models/taipan.emf @@ -0,0 +1,77 @@ +@namespace(uri="http://www.eclipse.org/examples/gmf/taipan", prefix="taipan") +package taipan; + +class Aquatory { + val Port[*] ports; + val Route[*] routes; + val Ship[*] ships; +} + +abstract interface Destination { +} + +enum ShipClass { + TRIBAL; + AMPHION; + FRIGAT; + BATTLESHIP; + CRUISER; +} + +class Port extends Destination { + attr String location; + val Building[*] buildings; + ref Ship[*] register; +} + +class Building { + attr String info; + attr String street; +} + +class Route extends Destination { + ref Destination[1] source; + ref Destination[1] destination; + attr String description; + attr double reliability = "1"; +} + +class Ship { + attr String name; + attr ShipClass shipClass; + ref Port destination; + ref Route route; + val Item[*] cargo; +} + +abstract class Item { + attr String article; +} + +class LargeItem extends Item { + attr float weight; +} + +class SmallItems extends Item { + attr int quantity; +} + +class EmptyBox extends Item { +} + +class Warship extends Ship { + val EscortShipsOrder escortOrder; + val BesiegePortOrder[*] attackOrders; +} + +abstract interface Order { +} + +class EscortShipsOrder extends Order { + ref Ship[+] ships; +} + +class BesiegePortOrder extends Order { + ref Port[1] port; +} + diff --git a/examples/org.eclipse.gmf.examples.taipan/models/taipan.genmodel b/examples/org.eclipse.gmf.examples.taipan/models/taipan.genmodel index 6a75b916d..6a1b9f994 100644 --- a/examples/org.eclipse.gmf.examples.taipan/models/taipan.genmodel +++ b/examples/org.eclipse.gmf.examples.taipan/models/taipan.genmodel @@ -1,60 +1,68 @@ -<?xml version="1.0" encoding="UTF-8"?> -<genmodel:GenModel xmi:version="2.0" - xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" - xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.gmf.examples.taipan/src" - editorDirectory="/org.eclipse.gmf.examples.taipan.editor/src" modelPluginID="org.eclipse.gmf.examples.taipan" - modelName="TaiPan" nonNLSMarkers="true" codeFormatting="true" importerID="org.eclipse.emf.importer.ecore" - complianceLevel="5.0"> - <foreignModel>taipan.ecore</foreignModel> - <genPackages prefix="TaiPan" basePackage="org.eclipse.gmf.examples" disposableProviderFactory="true" - ecorePackage="taipan.ecore#/"> - <genClasses ecoreClass="taipan.ecore#//Aquatory"> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Aquatory/ports"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Aquatory/routes"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Aquatory/ships"/> - </genClasses> - <genClasses image="false" ecoreClass="taipan.ecore#//Destination"/> - <genClasses ecoreClass="taipan.ecore#//Port"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Port/location"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Port/buildings"/> - <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference taipan.ecore#//Port/register"/> - </genClasses> - <genClasses ecoreClass="taipan.ecore#//Building"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Building/info"/> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Building/street"/> - </genClasses> - <genClasses ecoreClass="taipan.ecore#//Route"> - <genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference taipan.ecore#//Route/source"/> - <genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference taipan.ecore#//Route/destination"/> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Route/description"/> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Route/reliability"/> - </genClasses> - <genClasses ecoreClass="taipan.ecore#//Ship"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Ship/name"/> - <genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference taipan.ecore#//Ship/destination"/> - <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference taipan.ecore#//Ship/route"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Ship/cargo"/> - </genClasses> - <genClasses ecoreClass="taipan.ecore#//Item"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Item/article"/> - </genClasses> - <genClasses ecoreClass="taipan.ecore#//LargeItem"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//LargeItem/weight"/> - </genClasses> - <genClasses ecoreClass="taipan.ecore#//SmallItems"> - <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//SmallItems/quantity"/> - </genClasses> - <genClasses ecoreClass="taipan.ecore#//EmptyBox"/> - <genClasses ecoreClass="taipan.ecore#//Warship"> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Warship/escortOrder"/> - <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Warship/attackOrders"/> - </genClasses> - <genClasses image="false" ecoreClass="taipan.ecore#//Order"/> - <genClasses ecoreClass="taipan.ecore#//EscortShipsOrder"> - <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference taipan.ecore#//EscortShipsOrder/ships"/> - </genClasses> - <genClasses ecoreClass="taipan.ecore#//BesiegePortOrder"> - <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference taipan.ecore#//BesiegePortOrder/port"/> - </genClasses> - </genPackages> -</genmodel:GenModel> +<?xml version="1.0" encoding="UTF-8"?>
+<genmodel:GenModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.gmf.examples.taipan/src"
+ editorDirectory="/org.eclipse.gmf.examples.taipan.editor/src" modelPluginID="org.eclipse.gmf.examples.taipan"
+ modelName="TaiPan" nonNLSMarkers="true" codeFormatting="true" importerID="org.eclipse.emf.importer.ecore"
+ complianceLevel="5.0">
+ <foreignModel>taipan.ecore</foreignModel>
+ <genPackages prefix="TaiPan" basePackage="org.eclipse.gmf.examples" disposableProviderFactory="true"
+ ecorePackage="taipan.ecore#/">
+ <genEnums typeSafeEnumCompatible="false" ecoreEnum="taipan.ecore#//ShipClass">
+ <genEnumLiterals ecoreEnumLiteral="taipan.ecore#//ShipClass/TRIBAL"/>
+ <genEnumLiterals ecoreEnumLiteral="taipan.ecore#//ShipClass/AMPHION"/>
+ <genEnumLiterals ecoreEnumLiteral="taipan.ecore#//ShipClass/FRIGAT"/>
+ <genEnumLiterals ecoreEnumLiteral="taipan.ecore#//ShipClass/BATTLESHIP"/>
+ <genEnumLiterals ecoreEnumLiteral="taipan.ecore#//ShipClass/CRUISER"/>
+ </genEnums>
+ <genClasses ecoreClass="taipan.ecore#//Aquatory">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Aquatory/ports"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Aquatory/routes"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Aquatory/ships"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="taipan.ecore#//Destination"/>
+ <genClasses ecoreClass="taipan.ecore#//Port">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Port/location"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Port/buildings"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference taipan.ecore#//Port/register"/>
+ </genClasses>
+ <genClasses ecoreClass="taipan.ecore#//Building">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Building/info"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Building/street"/>
+ </genClasses>
+ <genClasses ecoreClass="taipan.ecore#//Route">
+ <genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference taipan.ecore#//Route/source"/>
+ <genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference taipan.ecore#//Route/destination"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Route/description"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Route/reliability"/>
+ </genClasses>
+ <genClasses ecoreClass="taipan.ecore#//Ship">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Ship/name"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Ship/shipClass"/>
+ <genFeatures notify="false" createChild="false" ecoreFeature="ecore:EReference taipan.ecore#//Ship/destination"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference taipan.ecore#//Ship/route"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Ship/cargo"/>
+ </genClasses>
+ <genClasses ecoreClass="taipan.ecore#//Item">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//Item/article"/>
+ </genClasses>
+ <genClasses ecoreClass="taipan.ecore#//LargeItem">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//LargeItem/weight"/>
+ </genClasses>
+ <genClasses ecoreClass="taipan.ecore#//SmallItems">
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute taipan.ecore#//SmallItems/quantity"/>
+ </genClasses>
+ <genClasses ecoreClass="taipan.ecore#//EmptyBox"/>
+ <genClasses ecoreClass="taipan.ecore#//Warship">
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Warship/escortOrder"/>
+ <genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference taipan.ecore#//Warship/attackOrders"/>
+ </genClasses>
+ <genClasses image="false" ecoreClass="taipan.ecore#//Order"/>
+ <genClasses ecoreClass="taipan.ecore#//EscortShipsOrder">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference taipan.ecore#//EscortShipsOrder/ships"/>
+ </genClasses>
+ <genClasses ecoreClass="taipan.ecore#//BesiegePortOrder">
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference taipan.ecore#//BesiegePortOrder/port"/>
+ </genClasses>
+ </genPackages>
+</genmodel:GenModel>
diff --git a/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfgen b/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfgen index 21ad370f2..e7d92be0c 100644 --- a/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfgen +++ b/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfgen @@ -16,7 +16,7 @@ name="Port Location" description="Empty port location check" id="port_location" - rule="//@expressionProviders/@providers.0/@expressions.9" + rule="//@expressionProviders/@providers.0/@expressions.10" message="Port location should not be empty" category="//@audits/@categories.0"> <target @@ -45,7 +45,7 @@ name="Large Item Weight" description="Large item weight check" id="litem_weight" - rule="//@expressionProviders/@providers.0/@expressions.10" + rule="//@expressionProviders/@providers.0/@expressions.11" message="Large item weight should be greater than zero." category="//@audits/@categories.0"> <target @@ -59,7 +59,7 @@ name="Ship Type" description="Ship type check" id="ship_type" - rule="//@expressionProviders/@providers.0/@expressions.11" + rule="//@expressionProviders/@providers.0/@expressions.12" message="Invalid ship type." category="//@audits/@categories.0"> <target @@ -78,7 +78,7 @@ name="Route Reliability" description="Safety of the route." key="RouteRelb" - rule="//@expressionProviders/@providers.0/@expressions.8" + rule="//@expressionProviders/@providers.0/@expressions.9" lowLimit="0.1" highLimit="0.9"> <target @@ -105,7 +105,6 @@ visualID="1000" editPartClassName="AquatoryEditPart" itemSemanticEditPolicyClassName="AquatoryItemSemanticEditPolicy" - notationViewFactoryClassName="AquatoryViewFactory" canonicalEditPolicyClassName="AquatoryCanonicalEditPolicy" iconProviderPriority="Low" creationWizardIconPath="{reuseEMFIcon}" @@ -184,7 +183,7 @@ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="LargeItemFigure" - classBody="
/**
 * @generated
 */
public class LargeItemFigure extends org.eclipse.gmf.examples.taipan.figures.PileShape {


	/**
	 * @generated
	 */
	private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureLargeItemArticleLabel; 
	/**
	 * @generated
	 */
	private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureLargeItemWeightLabel; 


	/**
	 * @generated
	 */
	public LargeItemFigure() {
				

		createContents();
	}
	/**
	 * @generated
	 */
	private void createContents(){


fFigureLargeItemArticleLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();
fFigureLargeItemArticleLabel.setText("");

this.add(fFigureLargeItemArticleLabel);



fFigureLargeItemWeightLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();
fFigureLargeItemWeightLabel.setText("");

this.add(fFigureLargeItemWeightLabel);


	}




	/**
	 * @generated
	 */
	private boolean myUseLocalCoordinates = false;

	/**
	 * @generated
	 */
	protected boolean useLocalCoordinates() {
		return myUseLocalCoordinates;
	}

	/**
	 * @generated
	 */
	protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
		myUseLocalCoordinates = useLocalCoordinates;
	}



	/**
	 * @generated
	 */
	public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureLargeItemArticleLabel() {
		return fFigureLargeItemArticleLabel;
	}
	/**
	 * @generated
	 */
	public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureLargeItemWeightLabel() {
		return fFigureLargeItemWeightLabel;
	}


}

"/> + classBody="
/**
 * @generated
 */
public class LargeItemFigure extends org.eclipse.gmf.examples.taipan.figures.PileShape {


	/**
	 * @generated
	 */
	private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureLargeItemArticleLabel; 
	/**
	 * @generated
	 */
	private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureLargeItemWeightLabel; 


	/**
	 * @generated
	 */
	public LargeItemFigure() {
				

		createContents();
	}
	/**
	 * @generated
	 */
	private void createContents(){


fFigureLargeItemArticleLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();

fFigureLargeItemArticleLabel.setText("");

this.add(fFigureLargeItemArticleLabel);



fFigureLargeItemWeightLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();

fFigureLargeItemWeightLabel.setText("");

this.add(fFigureLargeItemWeightLabel);


	}





	/**
	 * @generated
	 */
	public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureLargeItemArticleLabel() {
		return fFigureLargeItemArticleLabel;
	}
	/**
	 * @generated
	 */
	public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureLargeItemWeightLabel() {
		return fFigureLargeItemWeightLabel;
	}


}

"/> <modelFacet> <metaClass href="taipan.genmodel#//taipan/LargeItem"/> @@ -253,7 +252,7 @@ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="EmptyBoxFigure" - classBody="
/**
 * @generated
 */
public class EmptyBoxFigure extends org.eclipse.gmf.runtime.lite.svg.SVGFigure {




	/**
	 * @generated
	 */
	public EmptyBoxFigure() {
				this.setURI("platform:/plugin/org.eclipse.gmf.examples.taipan/images/box.svg");
	}
	
	/**
	 * @generated
	 */
	public void setBackgroundColor(org.eclipse.swt.graphics.Color value) {
				String svalue = org.eclipse.gmf.runtime.lite.svg.SVGUtils.toSVGColor(getDocument(), value);
				org.w3c.dom.NodeList nodes = getNodes("//:rect"); //$NON-NLS-1$
		for (int i = 0; i < nodes.getLength(); i++) {
			((org.w3c.dom.Element) nodes.item(i)).setAttributeNS(null, "fill", //$NON-NLS-1$
				svalue);
		}
				super.setBackgroundColor(value);
			}
	
	/**
	 * @generated
	 */
	public void setForegroundColor(org.eclipse.swt.graphics.Color value) {
				String svalue = org.eclipse.gmf.runtime.lite.svg.SVGUtils.toSVGColor(getDocument(), value);
				org.w3c.dom.NodeList nodes = getNodes("//:line|//:rect"); //$NON-NLS-1$
		for (int i = 0; i < nodes.getLength(); i++) {
			((org.w3c.dom.Element) nodes.item(i)).setAttributeNS(null, "stroke", //$NON-NLS-1$
				svalue);
		}
				super.setForegroundColor(value);
			}


	/**
	 * @generated
	 */
	private boolean myUseLocalCoordinates = false;

	/**
	 * @generated
	 */
	protected boolean useLocalCoordinates() {
		return myUseLocalCoordinates;
	}

	/**
	 * @generated
	 */
	protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
		myUseLocalCoordinates = useLocalCoordinates;
	}





}

"/> + classBody="
/**
 * @generated
 */
public class EmptyBoxFigure extends org.eclipse.gmf.runtime.lite.svg.SVGFigure {




	/**
	 * @generated
	 */
	public EmptyBoxFigure() {
				this.setURI("platform:/plugin/org.eclipse.gmf.examples.taipan/images/box.svg");
	}
	
	/**
	 * @generated
	 */
	public void setBackgroundColor(org.eclipse.swt.graphics.Color value) {
				String svalue = org.eclipse.gmf.runtime.lite.svg.SVGUtils.toSVGColor(getDocument(), value);
				org.w3c.dom.NodeList nodes = getNodes("//:rect"); //$NON-NLS-1$
		for (int i = 0; i < nodes.getLength(); i++) {
			((org.w3c.dom.Element) nodes.item(i)).setAttributeNS(null, "fill", //$NON-NLS-1$
				svalue);
		}
				super.setBackgroundColor(value);
			}
	
	/**
	 * @generated
	 */
	public void setForegroundColor(org.eclipse.swt.graphics.Color value) {
				String svalue = org.eclipse.gmf.runtime.lite.svg.SVGUtils.toSVGColor(getDocument(), value);
				org.w3c.dom.NodeList nodes = getNodes("//:line|//:rect"); //$NON-NLS-1$
		for (int i = 0; i < nodes.getLength(); i++) {
			((org.w3c.dom.Element) nodes.item(i)).setAttributeNS(null, "stroke", //$NON-NLS-1$
				svalue);
		}
				super.setForegroundColor(value);
			}





}

"/> <modelFacet> <metaClass href="taipan.genmodel#//taipan/EmptyBox"/> @@ -316,6 +315,8 @@ editMethod="NATIVE"> <metaFeatures href="taipan.genmodel#//taipan/Port/location"/> + <editableMetaFeatures + href="taipan.genmodel#//taipan/Port/location"/> </modelFacet> </labels> </topLevelNodes> @@ -336,7 +337,7 @@ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="ShipFigure" - classBody="
/**
 * @generated
 */
public class ShipFigure extends org.eclipse.gmf.examples.taipan.figures.ShipShape {


	/**
	 * @generated
	 */
	private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureShipNameLabel; 


	/**
	 * @generated
	 */
	public ShipFigure() {
		
	org.eclipse.draw2d.GridLayout layoutThis = new org.eclipse.draw2d.GridLayout();
	layoutThis.numColumns = 2;
	layoutThis.makeColumnsEqualWidth = false;
	this.setLayoutManager(layoutThis);

		

		createContents();
	}
	/**
	 * @generated
	 */
	private void createContents(){


fFigureShipNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();
fFigureShipNameLabel.setText("");


org.eclipse.draw2d.GridData constraintFFigureShipNameLabel = new org.eclipse.draw2d.GridData();
constraintFFigureShipNameLabel.verticalAlignment = org.eclipse.draw2d.GridData.BEGINNING;
constraintFFigureShipNameLabel.horizontalAlignment = org.eclipse.draw2d.GridData.BEGINNING;
constraintFFigureShipNameLabel.horizontalIndent = 0;
constraintFFigureShipNameLabel.horizontalSpan = 1;
constraintFFigureShipNameLabel.verticalSpan = 1;
constraintFFigureShipNameLabel.grabExcessHorizontalSpace = false;
constraintFFigureShipNameLabel.grabExcessVerticalSpace = false;
this.add(fFigureShipNameLabel, constraintFFigureShipNameLabel);



	}




	/**
	 * @generated
	 */
	private boolean myUseLocalCoordinates = false;

	/**
	 * @generated
	 */
	protected boolean useLocalCoordinates() {
		return myUseLocalCoordinates;
	}

	/**
	 * @generated
	 */
	protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
		myUseLocalCoordinates = useLocalCoordinates;
	}



	/**
	 * @generated
	 */
	public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureShipNameLabel() {
		return fFigureShipNameLabel;
	}


}

"/> + classBody="
/**
 * @generated
 */
public class ShipFigure extends org.eclipse.gmf.examples.taipan.figures.ShipShape {


	/**
	 * @generated
	 */
	private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureShipNameLabel; 


	/**
	 * @generated
	 */
	public ShipFigure() {
		
	org.eclipse.draw2d.GridLayout layoutThis = new org.eclipse.draw2d.GridLayout();
	layoutThis.numColumns = 2;
	layoutThis.makeColumnsEqualWidth = false;
	this.setLayoutManager(layoutThis);

		

		createContents();
	}
	/**
	 * @generated
	 */
	private void createContents(){


fFigureShipNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();

fFigureShipNameLabel.setText("");


org.eclipse.draw2d.GridData constraintFFigureShipNameLabel = new org.eclipse.draw2d.GridData();
constraintFFigureShipNameLabel.verticalAlignment = org.eclipse.draw2d.GridData.BEGINNING;
constraintFFigureShipNameLabel.horizontalAlignment = org.eclipse.draw2d.GridData.BEGINNING;
constraintFFigureShipNameLabel.horizontalIndent = 0;
constraintFFigureShipNameLabel.horizontalSpan = 1;
constraintFFigureShipNameLabel.verticalSpan = 1;
constraintFFigureShipNameLabel.grabExcessHorizontalSpace = false;
constraintFFigureShipNameLabel.grabExcessVerticalSpace = false;
this.add(fFigureShipNameLabel, constraintFFigureShipNameLabel);



	}





	/**
	 * @generated
	 */
	public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureShipNameLabel() {
		return fFigureShipNameLabel;
	}


}

"/> <modelFacet modelElementSelector="//@expressionProviders/@providers.0/@expressions.0"> <metaClass @@ -366,6 +367,48 @@ href="taipan.genmodel#//taipan/Ship/name"/> </modelFacet> </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5006" + editPartClassName="ShipDestination2EditPart" + itemSemanticEditPolicyClassName="ShipDestination2ItemSemanticEditPolicy" + notationViewFactoryClassName="ShipDestinationViewFactory" + elementIcon="true"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="//@labelParsers/@implementations.2"> + <metaFeatures + href="taipan.genmodel#//taipan/Ship/destination"/> + <editableMetaFeatures + href="taipan.genmodel#//taipan/Ship/destination"/> + </modelFacet> + </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5007" + editPartClassName="ShipShipClassEditPart" + itemSemanticEditPolicyClassName="ShipShipClassItemSemanticEditPolicy" + notationViewFactoryClassName="ShipShipClassViewFactory" + elementIcon="true"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="//@labelParsers/@implementations.3"> + <metaFeatures + href="taipan.genmodel#//taipan/Ship/shipClass"/> + <editableMetaFeatures + href="taipan.genmodel#//taipan/Ship/shipClass"/> + </modelFacet> + </labels> </topLevelNodes> <topLevelNodes visualID="2003" @@ -384,7 +427,7 @@ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="WarshipFigure" - classBody="
/**
 * @generated
 */
public class WarshipFigure extends org.eclipse.gmf.examples.taipan.figures.WarshipShape {


	/**
	 * @generated
	 */
	private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureWarshipNameLabel; 


	/**
	 * @generated
	 */
	public WarshipFigure() {
		
	org.eclipse.draw2d.GridLayout layoutThis = new org.eclipse.draw2d.GridLayout();
	layoutThis.numColumns = 2;
	layoutThis.makeColumnsEqualWidth = false;
	this.setLayoutManager(layoutThis);

		

		createContents();
	}
	/**
	 * @generated
	 */
	private void createContents(){


fFigureWarshipNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();
fFigureWarshipNameLabel.setText("");


org.eclipse.draw2d.GridData constraintFFigureWarshipNameLabel = new org.eclipse.draw2d.GridData();
constraintFFigureWarshipNameLabel.verticalAlignment = org.eclipse.draw2d.GridData.BEGINNING;
constraintFFigureWarshipNameLabel.horizontalAlignment = org.eclipse.draw2d.GridData.BEGINNING;
constraintFFigureWarshipNameLabel.horizontalIndent = 0;
constraintFFigureWarshipNameLabel.horizontalSpan = 1;
constraintFFigureWarshipNameLabel.verticalSpan = 1;
constraintFFigureWarshipNameLabel.grabExcessHorizontalSpace = false;
constraintFFigureWarshipNameLabel.grabExcessVerticalSpace = false;
this.add(fFigureWarshipNameLabel, constraintFFigureWarshipNameLabel);



	}




	/**
	 * @generated
	 */
	private boolean myUseLocalCoordinates = false;

	/**
	 * @generated
	 */
	protected boolean useLocalCoordinates() {
		return myUseLocalCoordinates;
	}

	/**
	 * @generated
	 */
	protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
		myUseLocalCoordinates = useLocalCoordinates;
	}



	/**
	 * @generated
	 */
	public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureWarshipNameLabel() {
		return fFigureWarshipNameLabel;
	}


}

"/> + classBody="
/**
 * @generated
 */
public class WarshipFigure extends org.eclipse.gmf.examples.taipan.figures.WarshipShape {


	/**
	 * @generated
	 */
	private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel fFigureWarshipNameLabel; 


	/**
	 * @generated
	 */
	public WarshipFigure() {
		
	org.eclipse.draw2d.GridLayout layoutThis = new org.eclipse.draw2d.GridLayout();
	layoutThis.numColumns = 2;
	layoutThis.makeColumnsEqualWidth = false;
	this.setLayoutManager(layoutThis);

		

		createContents();
	}
	/**
	 * @generated
	 */
	private void createContents(){


fFigureWarshipNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel();

fFigureWarshipNameLabel.setText("");


org.eclipse.draw2d.GridData constraintFFigureWarshipNameLabel = new org.eclipse.draw2d.GridData();
constraintFFigureWarshipNameLabel.verticalAlignment = org.eclipse.draw2d.GridData.BEGINNING;
constraintFFigureWarshipNameLabel.horizontalAlignment = org.eclipse.draw2d.GridData.BEGINNING;
constraintFFigureWarshipNameLabel.horizontalIndent = 0;
constraintFFigureWarshipNameLabel.horizontalSpan = 1;
constraintFFigureWarshipNameLabel.verticalSpan = 1;
constraintFFigureWarshipNameLabel.grabExcessHorizontalSpace = false;
constraintFFigureWarshipNameLabel.grabExcessVerticalSpace = false;
this.add(fFigureWarshipNameLabel, constraintFFigureWarshipNameLabel);



	}





	/**
	 * @generated
	 */
	public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getFigureWarshipNameLabel() {
		return fFigureWarshipNameLabel;
	}


}

"/> <modelFacet> <metaClass href="taipan.genmodel#//taipan/Warship"/> @@ -413,6 +456,26 @@ href="taipan.genmodel#//taipan/Ship/name"/> </modelFacet> </labels> + <labels + xsi:type="gmfgen:GenExternalNodeLabel" + visualID="5008" + editPartClassName="WarshipDestinationEditPart" + itemSemanticEditPolicyClassName="WarshipDestinationItemSemanticEditPolicy" + elementIcon="true"> + <diagramRunTimeClass + href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/> + <viewmap + xsi:type="gmfgen:FigureViewmap" + figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel"/> + <modelFacet + xsi:type="gmfgen:FeatureLabelModelFacet" + parser="//@labelParsers/@implementations.4"> + <metaFeatures + href="taipan.genmodel#//taipan/Ship/destination"/> + <editableMetaFeatures + href="taipan.genmodel#//taipan/Ship/destination"/> + </modelFacet> + </labels> </topLevelNodes> <links visualID="4001" @@ -451,7 +514,7 @@ </viewmap> <modelFacet xsi:type="gmfgen:DesignLabelModelFacet" - parser="//@labelParsers/@implementations.2"/> + parser="//@labelParsers/@implementations.5"/> </labels> </links> <links @@ -472,7 +535,7 @@ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx"/> <modelFacet xsi:type="gmfgen:TypeLinkModelFacet" - modelElementSelector="//@expressionProviders/@providers.0/@expressions.1"> + modelElementSelector="//@expressionProviders/@providers.0/@expressions.2"> <metaClass href="taipan.genmodel#//taipan/Route"/> <containmentMetaFeature @@ -483,7 +546,7 @@ xsi:type="gmfgen:GenFeatureSeqInitializer"> <initializers xsi:type="gmfgen:GenFeatureValueSpec" - value="//@expressionProviders/@providers.0/@expressions.2"> + value="//@expressionProviders/@providers.0/@expressions.3"> <feature href="taipan.genmodel#//taipan/Route/reliability"/> </initializers> @@ -510,7 +573,7 @@ </viewmap> <modelFacet xsi:type="gmfgen:FeatureLabelModelFacet" - parser="//@labelParsers/@implementations.3" + parser="//@labelParsers/@implementations.6" viewPattern="route : {0}" editorPattern="{0}" editPattern="{0}"> @@ -534,7 +597,7 @@ </viewmap> <modelFacet xsi:type="gmfgen:FeatureLabelModelFacet" - parser="//@labelParsers/@implementations.3" + parser="//@labelParsers/@implementations.6" viewPattern="reliability : {0,number,percent}" editorPattern="{0,number,percent}" editPattern="{0,number,percent}"> @@ -560,10 +623,10 @@ <viewmap xsi:type="gmfgen:InnerClassViewmap" className="UnreliableRouteFigure" - classBody="
/**
 * @generated
 */
public class UnreliableRouteFigure extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {




	/**
	 * @generated
	 */
	public UnreliableRouteFigure() {
		this.setLineWidth(1);
this.setLineStyle(org.eclipse.draw2d.Graphics.LINE_DASH);

	}




}

"/> + classBody="
/**
 * @generated
 */
public class UnreliableRouteFigure extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {




	/**
	 * @generated
	 */
	public UnreliableRouteFigure() {
		this.setLineStyle(org.eclipse.draw2d.Graphics.LINE_DASH);

	}




}

"/> <modelFacet xsi:type="gmfgen:TypeLinkModelFacet" - modelElementSelector="//@expressionProviders/@providers.0/@expressions.3"> + modelElementSelector="//@expressionProviders/@providers.0/@expressions.4"> <metaClass href="taipan.genmodel#//taipan/Route"/> <containmentMetaFeature @@ -574,7 +637,7 @@ xsi:type="gmfgen:GenFeatureSeqInitializer"> <initializers xsi:type="gmfgen:GenFeatureValueSpec" - value="//@expressionProviders/@providers.0/@expressions.4"> + value="//@expressionProviders/@providers.0/@expressions.5"> <feature href="taipan.genmodel#//taipan/Route/reliability"/> </initializers> @@ -601,7 +664,7 @@ </viewmap> <modelFacet xsi:type="gmfgen:FeatureLabelModelFacet" - parser="//@labelParsers/@implementations.3" + parser="//@labelParsers/@implementations.6" viewPattern="route : {0}" editorPattern="{0}" editPattern="{0}"> @@ -625,7 +688,7 @@ </viewmap> <modelFacet xsi:type="gmfgen:FeatureLabelModelFacet" - parser="//@labelParsers/@implementations.3" + parser="//@labelParsers/@implementations.6" viewPattern="reliability : {0,number,percent}" editorPattern="{0,number,percent}" editPattern="{0,number,percent}"> @@ -685,7 +748,7 @@ href="taipan.genmodel#//taipan/BesiegePortOrder/port"/> </modelFacet> <creationConstraints - sourceEnd="//@expressionProviders/@providers.0/@expressions.5"/> + sourceEnd="//@expressionProviders/@providers.0/@expressions.6"/> </links> <links visualID="4006" @@ -716,8 +779,8 @@ href="taipan.genmodel#//taipan/EscortShipsOrder/ships"/> </modelFacet> <creationConstraints - sourceEnd="//@expressionProviders/@providers.0/@expressions.6" - targetEnd="//@expressionProviders/@providers.0/@expressions.7"/> + sourceEnd="//@expressionProviders/@providers.0/@expressions.7" + targetEnd="//@expressionProviders/@providers.0/@expressions.8"/> </links> <links visualID="4007" @@ -992,6 +1055,8 @@ xsi:type="gmfgen:GenConstraint" body="not self.oclIsKindOf(Warship)"/> <expressions + body="_item.location"/> + <expressions xsi:type="gmfgen:GenConstraint" body="reliability >= 0.5"/> <expressions @@ -1044,6 +1109,16 @@ viewMethod="PRINTF" editMethod="REGEXP"/> <implementations + xsi:type="gmfgen:OclChoiceParser" + uses="//@diagram/@topLevelNodes.1/@labels.1/@modelFacet"/> + <implementations + xsi:type="gmfgen:PredefinedEnumParser" + uses="//@diagram/@topLevelNodes.1/@labels.2/@modelFacet"/> + <implementations + xsi:type="gmfgen:OclChoiceParser" + uses="//@diagram/@topLevelNodes.2/@labels.1/@modelFacet" + showExpression="//@expressionProviders/@providers.0/@expressions.1"/> + <implementations xsi:type="gmfgen:ExternalParser" uses="//@diagram/@links.0/@labels.0/@modelFacet"/> <implementations diff --git a/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfgraph b/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfgraph index c5c0dc0c6..d20328d53 100644 --- a/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfgraph +++ b/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfgraph @@ -112,6 +112,18 @@ <accessors figure="//@figures.0/@descriptors.8/@actualFigure/@children.0"/> </descriptors> + <descriptors + name="label_ship_destination"> + <actualFigure + xsi:type="gmfgraph:Label" + name="label_ship_destination"/> + </descriptors> + <descriptors + name="label_ship_class"> + <actualFigure + xsi:type="gmfgraph:Label" + name="label_ship_class"/> + </descriptors> </figures> <figures name="links" @@ -305,4 +317,13 @@ figure="WarshipFigure" elementIcon="false" accessor="//@figures.0/@descriptors.8/@accessors.0"/> + <labels + name="ShipChoiceDestinationCustomToString" + figure="label_ship_destination"/> + <labels + name="ShipChoiceEnumClass" + figure="label_ship_class"/> + <labels + name="ShipChoiceDestinationDefaultToString" + figure="label_ship_destination"/> </gmfgraph:Canvas> diff --git a/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfmap b/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfmap index 463bc083a..e5afcbdb8 100644 --- a/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfmap +++ b/examples/org.eclipse.gmf.examples.taipan/models/taipan.gmfmap @@ -19,6 +19,8 @@ href="taipan.gmfgraph#PortLocation"/> <features href="taipan.ecore#//Port/location"/> + <editableFeatures + href="taipan.ecore#//Port/location"/> </labelMappings> <relatedDiagrams href="port.gmfmap#//@diagram"/> @@ -46,6 +48,23 @@ <features href="taipan.ecore#//Ship/name"/> </labelMappings> + <labelMappings + xsi:type="gmfmap:OclChoiceLabelMapping"> + <diagramLabel + href="taipan.gmfgraph#ShipChoiceDestinationDefaultToString"/> + <feature + xsi:type="ecore:EReference" + href="taipan.ecore#//Ship/destination"/> + </labelMappings> + <labelMappings + xsi:type="gmfmap:FeatureLabelMapping"> + <diagramLabel + href="taipan.gmfgraph#ShipChoiceEnumClass"/> + <features + href="taipan.ecore#//Ship/shipClass"/> + <editableFeatures + href="taipan.ecore#//Ship/shipClass"/> + </labelMappings> <tool xsi:type="gmftool:CreationTool" href="taipan.gmftool#//@palette/@tools.0/@tools.1"/> @@ -152,6 +171,16 @@ <features href="taipan.ecore#//Ship/name"/> </labelMappings> + <labelMappings + xsi:type="gmfmap:OclChoiceLabelMapping"> + <diagramLabel + href="taipan.gmfgraph#ShipChoiceDestinationCustomToString"/> + <feature + xsi:type="ecore:EReference" + href="taipan.ecore#//Ship/destination"/> + <showExpression + body="_item.location"/> + </labelMappings> <tool xsi:type="gmftool:CreationTool" href="taipan.gmftool#//@palette/@tools.0/@tools.2"/> diff --git a/examples/org.eclipse.gmf.examples.taipan/models/taipan.trace b/examples/org.eclipse.gmf.examples.taipan/models/taipan.trace index f632c0625..8192545cd 100644 --- a/examples/org.eclipse.gmf.examples.taipan/models/taipan.trace +++ b/examples/org.eclipse.gmf.examples.taipan/models/taipan.trace @@ -15,6 +15,12 @@ <nodeLabelTraces visualID="5004" queryText="true"/> + <nodeLabelTraces + visualID="5006" + queryText="true"/> + <nodeLabelTraces + visualID="5007" + queryText="true"/> <compartmentTraces visualID="7001" queryText="true"/> @@ -28,6 +34,9 @@ <nodeLabelTraces visualID="5005" queryText="true"/> + <nodeLabelTraces + visualID="5008" + queryText="true"/> <compartmentTraces visualID="7003" queryText="true"/> diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/Ship.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/Ship.java index 8f05db8e2..d1b665fb4 100644 --- a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/Ship.java +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/Ship.java @@ -24,6 +24,7 @@ import org.eclipse.emf.ecore.EObject; * The following features are supported: * <ul> * <li>{@link org.eclipse.gmf.examples.taipan.Ship#getName <em>Name</em>}</li> + * <li>{@link org.eclipse.gmf.examples.taipan.Ship#getShipClass <em>Ship Class</em>}</li> * <li>{@link org.eclipse.gmf.examples.taipan.Ship#getDestination <em>Destination</em>}</li> * <li>{@link org.eclipse.gmf.examples.taipan.Ship#getRoute <em>Route</em>}</li> * <li>{@link org.eclipse.gmf.examples.taipan.Ship#getCargo <em>Cargo</em>}</li> @@ -63,6 +64,35 @@ public interface Ship extends EObject { void setName(String value); /** + * Returns the value of the '<em><b>Ship Class</b></em>' attribute. + * The literals are from the enumeration {@link org.eclipse.gmf.examples.taipan.ShipClass}. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Ship Class</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Ship Class</em>' attribute. + * @see org.eclipse.gmf.examples.taipan.ShipClass + * @see #setShipClass(ShipClass) + * @see org.eclipse.gmf.examples.taipan.TaiPanPackage#getShip_ShipClass() + * @model + * @generated + */ + ShipClass getShipClass(); + + /** + * Sets the value of the '{@link org.eclipse.gmf.examples.taipan.Ship#getShipClass <em>Ship Class</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Ship Class</em>' attribute. + * @see org.eclipse.gmf.examples.taipan.ShipClass + * @see #getShipClass() + * @generated + */ + void setShipClass(ShipClass value); + + /** * Returns the value of the '<em><b>Destination</b></em>' reference. * <!-- begin-user-doc --> * <p> diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/ShipClass.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/ShipClass.java new file mode 100644 index 000000000..1eefc1749 --- /dev/null +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/ShipClass.java @@ -0,0 +1,291 @@ +/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.gmf.examples.taipan;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.util.Enumerator;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the literals of the enumeration '<em><b>Ship Class</b></em>',
+ * and utility methods for working with them.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.gmf.examples.taipan.TaiPanPackage#getShipClass()
+ * @model
+ * @generated
+ */
+public enum ShipClass implements Enumerator {
+ /**
+ * The '<em><b>TRIBAL</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #TRIBAL_VALUE
+ * @generated
+ * @ordered
+ */
+ TRIBAL(0, "TRIBAL", "TRIBAL"), //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>AMPHION</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #AMPHION_VALUE
+ * @generated
+ * @ordered
+ */
+ AMPHION(1, "AMPHION", "AMPHION"), //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>FRIGAT</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #FRIGAT_VALUE
+ * @generated
+ * @ordered
+ */
+ FRIGAT(2, "FRIGAT", "FRIGAT"), //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>BATTLESHIP</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #BATTLESHIP_VALUE
+ * @generated
+ * @ordered
+ */
+ BATTLESHIP(3, "BATTLESHIP", "BATTLESHIP"), //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>CRUISER</b></em>' literal object.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #CRUISER_VALUE
+ * @generated
+ * @ordered
+ */
+ CRUISER(4, "CRUISER", "CRUISER"); //$NON-NLS-1$ //$NON-NLS-2$
+
+ /**
+ * The '<em><b>TRIBAL</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>TRIBAL</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #TRIBAL
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int TRIBAL_VALUE = 0;
+
+ /**
+ * The '<em><b>AMPHION</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>AMPHION</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #AMPHION
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int AMPHION_VALUE = 1;
+
+ /**
+ * The '<em><b>FRIGAT</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>FRIGAT</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #FRIGAT
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int FRIGAT_VALUE = 2;
+
+ /**
+ * The '<em><b>BATTLESHIP</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>BATTLESHIP</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #BATTLESHIP
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int BATTLESHIP_VALUE = 3;
+
+ /**
+ * The '<em><b>CRUISER</b></em>' literal value.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of '<em><b>CRUISER</b></em>' literal object isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @see #CRUISER
+ * @model
+ * @generated
+ * @ordered
+ */
+ public static final int CRUISER_VALUE = 4;
+
+ /**
+ * An array of all the '<em><b>Ship Class</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final ShipClass[] VALUES_ARRAY = new ShipClass[] { TRIBAL, AMPHION, FRIGAT, BATTLESHIP, CRUISER, };
+
+ /**
+ * A public read-only list of all the '<em><b>Ship Class</b></em>' enumerators.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final List<ShipClass> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
+
+ /**
+ * Returns the '<em><b>Ship Class</b></em>' literal with the specified literal value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static ShipClass get(String literal) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ ShipClass result = VALUES_ARRAY[i];
+ if (result.toString().equals(literal)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Ship Class</b></em>' literal with the specified name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static ShipClass getByName(String name) {
+ for (int i = 0; i < VALUES_ARRAY.length; ++i) {
+ ShipClass result = VALUES_ARRAY[i];
+ if (result.getName().equals(name)) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the '<em><b>Ship Class</b></em>' literal with the specified integer value.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static ShipClass get(int value) {
+ switch (value) {
+ case TRIBAL_VALUE:
+ return TRIBAL;
+ case AMPHION_VALUE:
+ return AMPHION;
+ case FRIGAT_VALUE:
+ return FRIGAT;
+ case BATTLESHIP_VALUE:
+ return BATTLESHIP;
+ case CRUISER_VALUE:
+ return CRUISER;
+ }
+ return null;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final int value;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String name;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private final String literal;
+
+ /**
+ * Only this class can construct instances.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private ShipClass(int value, String name, String literal) {
+ this.value = value;
+ this.name = name;
+ this.literal = literal;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getValue() {
+ return value;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String getLiteral() {
+ return literal;
+ }
+
+ /**
+ * Returns the literal value of the enumerator, which is its string representation.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public String toString() {
+ return literal;
+ }
+
+} //ShipClass
diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/TaiPanPackage.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/TaiPanPackage.java index f5fe40976..ca39a8623 100644 --- a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/TaiPanPackage.java +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/TaiPanPackage.java @@ -13,6 +13,7 @@ package org.eclipse.gmf.examples.taipan; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; @@ -368,13 +369,22 @@ public interface TaiPanPackage extends EPackage { int SHIP__NAME = 0; /** + * The feature id for the '<em><b>Ship Class</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int SHIP__SHIP_CLASS = 1; + + /** * The feature id for the '<em><b>Destination</b></em>' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int SHIP__DESTINATION = 1; + int SHIP__DESTINATION = 2; /** * The feature id for the '<em><b>Route</b></em>' reference. @@ -383,7 +393,7 @@ public interface TaiPanPackage extends EPackage { * @generated * @ordered */ - int SHIP__ROUTE = 2; + int SHIP__ROUTE = 3; /** * The feature id for the '<em><b>Cargo</b></em>' containment reference list. @@ -392,7 +402,7 @@ public interface TaiPanPackage extends EPackage { * @generated * @ordered */ - int SHIP__CARGO = 3; + int SHIP__CARGO = 4; /** * The number of structural features of the '<em>Ship</em>' class. @@ -401,7 +411,7 @@ public interface TaiPanPackage extends EPackage { * @generated * @ordered */ - int SHIP_FEATURE_COUNT = 4; + int SHIP_FEATURE_COUNT = 5; /** * The feature id for the '<em><b>Article</b></em>' attribute. @@ -503,6 +513,15 @@ public interface TaiPanPackage extends EPackage { int WARSHIP__NAME = SHIP__NAME; /** + * The feature id for the '<em><b>Ship Class</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int WARSHIP__SHIP_CLASS = SHIP__SHIP_CLASS; + + /** * The feature id for the '<em><b>Destination</b></em>' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -602,6 +621,16 @@ public interface TaiPanPackage extends EPackage { int BESIEGE_PORT_ORDER_FEATURE_COUNT = ORDER_FEATURE_COUNT + 1; /** + * The meta object id for the '{@link org.eclipse.gmf.examples.taipan.ShipClass <em>Ship Class</em>}' enum. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.gmf.examples.taipan.ShipClass + * @see org.eclipse.gmf.examples.taipan.impl.TaiPanPackageImpl#getShipClass() + * @generated + */ + int SHIP_CLASS = 14; + + /** * Returns the meta object for class '{@link org.eclipse.gmf.examples.taipan.Aquatory <em>Aquatory</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -719,6 +748,17 @@ public interface TaiPanPackage extends EPackage { EAttribute getShip_Name(); /** + * Returns the meta object for the attribute '{@link org.eclipse.gmf.examples.taipan.Ship#getShipClass <em>Ship Class</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Ship Class</em>'. + * @see org.eclipse.gmf.examples.taipan.Ship#getShipClass() + * @see #getShip() + * @generated + */ + EAttribute getShip_ShipClass(); + + /** * Returns the meta object for the reference '{@link org.eclipse.gmf.examples.taipan.Ship#getDestination <em>Destination</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -909,6 +949,16 @@ public interface TaiPanPackage extends EPackage { EReference getBesiegePortOrder_Port(); /** + * Returns the meta object for enum '{@link org.eclipse.gmf.examples.taipan.ShipClass <em>Ship Class</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for enum '<em>Ship Class</em>'. + * @see org.eclipse.gmf.examples.taipan.ShipClass + * @generated + */ + EEnum getShipClass(); + + /** * Returns the meta object for class '{@link org.eclipse.gmf.examples.taipan.Route <em>Route</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1114,6 +1164,14 @@ public interface TaiPanPackage extends EPackage { EAttribute SHIP__NAME = eINSTANCE.getShip_Name(); /** + * The meta object literal for the '<em><b>Ship Class</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute SHIP__SHIP_CLASS = eINSTANCE.getShip_ShipClass(); + + /** * The meta object literal for the '<em><b>Destination</b></em>' reference feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -1274,6 +1332,16 @@ public interface TaiPanPackage extends EPackage { EReference BESIEGE_PORT_ORDER__PORT = eINSTANCE.getBesiegePortOrder_Port(); /** + * The meta object literal for the '{@link org.eclipse.gmf.examples.taipan.ShipClass <em>Ship Class</em>}' enum. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see org.eclipse.gmf.examples.taipan.ShipClass + * @see org.eclipse.gmf.examples.taipan.impl.TaiPanPackageImpl#getShipClass() + * @generated + */ + EEnum SHIP_CLASS = eINSTANCE.getShipClass(); + + /** * The meta object literal for the '{@link org.eclipse.gmf.examples.taipan.impl.RouteImpl <em>Route</em>}' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/LargeItemImpl.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/LargeItemImpl.java index d382b0a78..9b93b8f08 100644 --- a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/LargeItemImpl.java +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/LargeItemImpl.java @@ -99,7 +99,7 @@ public class LargeItemImpl extends ItemImpl implements LargeItem { public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TaiPanPackage.LARGE_ITEM__WEIGHT: - return new Float(getWeight()); + return getWeight(); } return super.eGet(featureID, resolve, coreType); } @@ -113,7 +113,7 @@ public class LargeItemImpl extends ItemImpl implements LargeItem { public void eSet(int featureID, Object newValue) { switch (featureID) { case TaiPanPackage.LARGE_ITEM__WEIGHT: - setWeight(((Float) newValue).floatValue()); + setWeight((Float) newValue); return; } super.eSet(featureID, newValue); diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/RouteImpl.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/RouteImpl.java index 851031b50..19a30968a 100644 --- a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/RouteImpl.java +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/RouteImpl.java @@ -254,7 +254,7 @@ public class RouteImpl extends EObjectImpl implements Route { case TaiPanPackage.ROUTE__DESCRIPTION: return getDescription(); case TaiPanPackage.ROUTE__RELIABILITY: - return new Double(getReliability()); + return getReliability(); } return super.eGet(featureID, resolve, coreType); } @@ -277,7 +277,7 @@ public class RouteImpl extends EObjectImpl implements Route { setDescription((String) newValue); return; case TaiPanPackage.ROUTE__RELIABILITY: - setReliability(((Double) newValue).doubleValue()); + setReliability((Double) newValue); return; } super.eSet(featureID, newValue); diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/ShipImpl.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/ShipImpl.java index 654c9453b..dbd20bceb 100644 --- a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/ShipImpl.java +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/ShipImpl.java @@ -31,6 +31,7 @@ import org.eclipse.gmf.examples.taipan.Item; import org.eclipse.gmf.examples.taipan.Port; import org.eclipse.gmf.examples.taipan.Route; import org.eclipse.gmf.examples.taipan.Ship; +import org.eclipse.gmf.examples.taipan.ShipClass; import org.eclipse.gmf.examples.taipan.TaiPanPackage; /** @@ -41,6 +42,7 @@ import org.eclipse.gmf.examples.taipan.TaiPanPackage; * The following features are implemented: * <ul> * <li>{@link org.eclipse.gmf.examples.taipan.impl.ShipImpl#getName <em>Name</em>}</li> + * <li>{@link org.eclipse.gmf.examples.taipan.impl.ShipImpl#getShipClass <em>Ship Class</em>}</li> * <li>{@link org.eclipse.gmf.examples.taipan.impl.ShipImpl#getDestination <em>Destination</em>}</li> * <li>{@link org.eclipse.gmf.examples.taipan.impl.ShipImpl#getRoute <em>Route</em>}</li> * <li>{@link org.eclipse.gmf.examples.taipan.impl.ShipImpl#getCargo <em>Cargo</em>}</li> @@ -72,6 +74,26 @@ public class ShipImpl extends EObjectImpl implements Ship { protected String name = NAME_EDEFAULT; /** + * The default value of the '{@link #getShipClass() <em>Ship Class</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getShipClass() + * @generated + * @ordered + */ + protected static final ShipClass SHIP_CLASS_EDEFAULT = ShipClass.TRIBAL; + + /** + * The cached value of the '{@link #getShipClass() <em>Ship Class</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getShipClass() + * @generated + * @ordered + */ + protected ShipClass shipClass = SHIP_CLASS_EDEFAULT; + + /** * The cached value of the '{@link #getDestination() <em>Destination</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -146,6 +168,27 @@ public class ShipImpl extends EObjectImpl implements Ship { * <!-- end-user-doc --> * @generated */ + public ShipClass getShipClass() { + return shipClass; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setShipClass(ShipClass newShipClass) { + ShipClass oldShipClass = shipClass; + shipClass = newShipClass == null ? SHIP_CLASS_EDEFAULT : newShipClass; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, TaiPanPackage.SHIP__SHIP_CLASS, oldShipClass, shipClass)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public Port getDestination() { if (destination != null && destination.eIsProxy()) { InternalEObject oldDestination = (InternalEObject) destination; @@ -253,6 +296,8 @@ public class ShipImpl extends EObjectImpl implements Ship { switch (featureID) { case TaiPanPackage.SHIP__NAME: return getName(); + case TaiPanPackage.SHIP__SHIP_CLASS: + return getShipClass(); case TaiPanPackage.SHIP__DESTINATION: if (resolve) return getDestination(); @@ -279,6 +324,9 @@ public class ShipImpl extends EObjectImpl implements Ship { case TaiPanPackage.SHIP__NAME: setName((String) newValue); return; + case TaiPanPackage.SHIP__SHIP_CLASS: + setShipClass((ShipClass) newValue); + return; case TaiPanPackage.SHIP__DESTINATION: setDestination((Port) newValue); return; @@ -304,6 +352,9 @@ public class ShipImpl extends EObjectImpl implements Ship { case TaiPanPackage.SHIP__NAME: setName(NAME_EDEFAULT); return; + case TaiPanPackage.SHIP__SHIP_CLASS: + setShipClass(SHIP_CLASS_EDEFAULT); + return; case TaiPanPackage.SHIP__DESTINATION: setDestination((Port) null); return; @@ -327,6 +378,8 @@ public class ShipImpl extends EObjectImpl implements Ship { switch (featureID) { case TaiPanPackage.SHIP__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case TaiPanPackage.SHIP__SHIP_CLASS: + return shipClass != SHIP_CLASS_EDEFAULT; case TaiPanPackage.SHIP__DESTINATION: return destination != null; case TaiPanPackage.SHIP__ROUTE: @@ -350,6 +403,8 @@ public class ShipImpl extends EObjectImpl implements Ship { StringBuffer result = new StringBuffer(super.toString()); result.append(" (name: "); //$NON-NLS-1$ result.append(name); + result.append(", shipClass: "); //$NON-NLS-1$ + result.append(shipClass); result.append(')'); return result.toString(); } diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/SmallItemsImpl.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/SmallItemsImpl.java index 080c592c2..aca545a95 100644 --- a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/SmallItemsImpl.java +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/SmallItemsImpl.java @@ -87,7 +87,7 @@ public class SmallItemsImpl extends ItemImpl implements SmallItems { public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case TaiPanPackage.SMALL_ITEMS__QUANTITY: - return new Integer(getQuantity()); + return getQuantity(); } return super.eGet(featureID, resolve, coreType); } @@ -100,7 +100,7 @@ public class SmallItemsImpl extends ItemImpl implements SmallItems { public void eSet(int featureID, Object newValue) { switch (featureID) { case TaiPanPackage.SMALL_ITEMS__QUANTITY: - setQuantity(((Integer) newValue).intValue()); + setQuantity((Integer) newValue); return; } super.eSet(featureID, newValue); diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/TaiPanFactoryImpl.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/TaiPanFactoryImpl.java index e4b9eb817..147f9bc28 100644 --- a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/TaiPanFactoryImpl.java +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/TaiPanFactoryImpl.java @@ -12,6 +12,7 @@ package org.eclipse.gmf.examples.taipan.impl; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EDataType; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.impl.EFactoryImpl; @@ -94,6 +95,36 @@ public class TaiPanFactoryImpl extends EFactoryImpl implements TaiPanFactory { * <!-- end-user-doc --> * @generated */ + @Override + public Object createFromString(EDataType eDataType, String initialValue) { + switch (eDataType.getClassifierID()) { + case TaiPanPackage.SHIP_CLASS: + return createShipClassFromString(eDataType, initialValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + @Override + public String convertToString(EDataType eDataType, Object instanceValue) { + switch (eDataType.getClassifierID()) { + case TaiPanPackage.SHIP_CLASS: + return convertShipClassToString(eDataType, instanceValue); + default: + throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$ + } + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public Aquatory createAquatory() { AquatoryImpl aquatory = new AquatoryImpl(); return aquatory; @@ -184,6 +215,27 @@ public class TaiPanFactoryImpl extends EFactoryImpl implements TaiPanFactory { * <!-- end-user-doc --> * @generated */ + public ShipClass createShipClassFromString(EDataType eDataType, String initialValue) { + ShipClass result = ShipClass.get(initialValue); + if (result == null) + throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + return result; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public String convertShipClassToString(EDataType eDataType, Object instanceValue) { + return instanceValue == null ? null : instanceValue.toString(); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public Route createRoute() { RouteImpl route = new RouteImpl(); return route; diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/TaiPanPackageImpl.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/TaiPanPackageImpl.java index 4bcc3cc49..2a65907ef 100644 --- a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/TaiPanPackageImpl.java +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/impl/TaiPanPackageImpl.java @@ -13,6 +13,7 @@ package org.eclipse.gmf.examples.taipan.impl; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EClass; +import org.eclipse.emf.ecore.EEnum; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.EReference; @@ -30,6 +31,7 @@ import org.eclipse.gmf.examples.taipan.Order; import org.eclipse.gmf.examples.taipan.Port; import org.eclipse.gmf.examples.taipan.Route; import org.eclipse.gmf.examples.taipan.Ship; +import org.eclipse.gmf.examples.taipan.ShipClass; import org.eclipse.gmf.examples.taipan.SmallItems; import org.eclipse.gmf.examples.taipan.TaiPanFactory; import org.eclipse.gmf.examples.taipan.TaiPanPackage; @@ -132,6 +134,13 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { * <!-- end-user-doc --> * @generated */ + private EEnum shipClassEEnum = null; + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ private EClass routeEClass = null; /** @@ -168,20 +177,10 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { private static boolean isInited = false; /** - * Creates, registers, and initializes the <b>Package</b> for this - * model, and for any others upon which it depends. Simple - * dependencies are satisfied by calling this method on all - * dependent packages before doing anything else. This method drives - * initialization for interdependent packages directly, in parallel - * with this package, itself. - * <p>Of this package and its interdependencies, all packages which - * have not yet been registered by their URI values are first created - * and registered. The packages are then initialized in two steps: - * meta-model objects for all of the packages are created before any - * are initialized, since one package's meta-model objects may refer to - * those of another. - * <p>Invocation of this method will not affect any packages that have - * already been initialized. + * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends. + * + * <p>This method is used to initialize {@link TaiPanPackage#eINSTANCE} when that field is accessed. + * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #eNS_URI @@ -194,7 +193,7 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { return (TaiPanPackage) EPackage.Registry.INSTANCE.getEPackage(TaiPanPackage.eNS_URI); // Obtain or create and register package - TaiPanPackageImpl theTaiPanPackage = (TaiPanPackageImpl) (EPackage.Registry.INSTANCE.getEPackage(eNS_URI) instanceof TaiPanPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(eNS_URI) + TaiPanPackageImpl theTaiPanPackage = (TaiPanPackageImpl) (EPackage.Registry.INSTANCE.get(eNS_URI) instanceof TaiPanPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new TaiPanPackageImpl()); isInited = true; @@ -208,6 +207,8 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { // Mark meta-data to indicate it can't be changed theTaiPanPackage.freeze(); + // Update the registry and return the package + EPackage.Registry.INSTANCE.put(TaiPanPackage.eNS_URI, theTaiPanPackage); return theTaiPanPackage; } @@ -315,8 +316,17 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { * <!-- end-user-doc --> * @generated */ + public EAttribute getShip_ShipClass() { + return (EAttribute) shipEClass.getEStructuralFeatures().get(1); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EReference getShip_Destination() { - return (EReference) shipEClass.getEStructuralFeatures().get(1); + return (EReference) shipEClass.getEStructuralFeatures().get(2); } /** @@ -325,7 +335,7 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { * @generated */ public EReference getShip_Route() { - return (EReference) shipEClass.getEStructuralFeatures().get(2); + return (EReference) shipEClass.getEStructuralFeatures().get(3); } /** @@ -334,7 +344,7 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { * @generated */ public EReference getShip_Cargo() { - return (EReference) shipEClass.getEStructuralFeatures().get(3); + return (EReference) shipEClass.getEStructuralFeatures().get(4); } /** @@ -477,6 +487,15 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { * <!-- end-user-doc --> * @generated */ + public EEnum getShipClass() { + return shipClassEEnum; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public EClass getRoute() { return routeEClass; } @@ -597,6 +616,7 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { shipEClass = createEClass(SHIP); createEAttribute(shipEClass, SHIP__NAME); + createEAttribute(shipEClass, SHIP__SHIP_CLASS); createEReference(shipEClass, SHIP__DESTINATION); createEReference(shipEClass, SHIP__ROUTE); createEReference(shipEClass, SHIP__CARGO); @@ -623,6 +643,9 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { besiegePortOrderEClass = createEClass(BESIEGE_PORT_ORDER); createEReference(besiegePortOrderEClass, BESIEGE_PORT_ORDER__PORT); + + // Create enums + shipClassEEnum = createEEnum(SHIP_CLASS); } /** @@ -701,6 +724,8 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { initEClass(shipEClass, Ship.class, "Ship", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS); //$NON-NLS-1$ initEAttribute(getShip_Name(), ecorePackage.getEString(), "name", null, 0, 1, Ship.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + initEAttribute(getShip_ShipClass(), this.getShipClass(), + "shipClass", null, 0, 1, Ship.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference(getShip_Destination(), this.getPort(), null, "destination", null, 0, 1, Ship.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ initEReference(getShip_Route(), this.getRoute(), null, @@ -738,6 +763,14 @@ public class TaiPanPackageImpl extends EPackageImpl implements TaiPanPackage { initEReference(getBesiegePortOrder_Port(), this.getPort(), null, "port", null, 1, 1, BesiegePortOrder.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); //$NON-NLS-1$ + // Initialize enums and add enum literals + initEEnum(shipClassEEnum, ShipClass.class, "ShipClass"); //$NON-NLS-1$ + addEEnumLiteral(shipClassEEnum, ShipClass.TRIBAL); + addEEnumLiteral(shipClassEEnum, ShipClass.AMPHION); + addEEnumLiteral(shipClassEEnum, ShipClass.FRIGAT); + addEEnumLiteral(shipClassEEnum, ShipClass.BATTLESHIP); + addEEnumLiteral(shipClassEEnum, ShipClass.CRUISER); + // Create resource createResource(eNS_URI); } diff --git a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/util/TaiPanSwitch.java b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/util/TaiPanSwitch.java index 899a43bdf..2a036d84d 100644 --- a/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/util/TaiPanSwitch.java +++ b/examples/org.eclipse.gmf.examples.taipan/src/org/eclipse/gmf/examples/taipan/util/TaiPanSwitch.java @@ -14,6 +14,8 @@ package org.eclipse.gmf.examples.taipan.util; import java.util.List; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; +import org.eclipse.emf.ecore.EPackage; +import org.eclipse.emf.ecore.util.Switch; import org.eclipse.gmf.examples.taipan.*; /** @@ -29,7 +31,7 @@ import org.eclipse.gmf.examples.taipan.*; * @see org.eclipse.gmf.examples.taipan.TaiPanPackage * @generated */ -public class TaiPanSwitch<T> { +public class TaiPanSwitch<T> extends Switch<T> { /** * The cached model package @@ -52,30 +54,16 @@ public class TaiPanSwitch<T> { } /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. - * <!-- begin-user-doc --> - * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. - * @generated - */ - public T doSwitch(EObject theEObject) { - return doSwitch(theEObject.eClass(), theEObject); - } - - /** - * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. + * Checks whether this is a switch for the given package. * <!-- begin-user-doc --> * <!-- end-user-doc --> - * @return the first non-null result returned by a <code>caseXXX</code> call. + * @parameter ePackage the package in question. + * @return whether this is a switch for the given package. * @generated */ - protected T doSwitch(EClass theEClass, EObject theEObject) { - if (theEClass.eContainer() == modelPackage) { - return doSwitch(theEClass.getClassifierID(), theEObject); - } else { - List<EClass> eSuperTypes = theEClass.getESuperTypes(); - return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(eSuperTypes.get(0), theEObject); - } + @Override + protected boolean isSwitchFor(EPackage ePackage) { + return ePackage == modelPackage; } /** @@ -85,6 +73,7 @@ public class TaiPanSwitch<T> { * @return the first non-null result returned by a <code>caseXXX</code> call. * @generated */ + @Override protected T doSwitch(int classifierID, EObject theEObject) { switch (classifierID) { case TaiPanPackage.AQUATORY: { @@ -427,6 +416,7 @@ public class TaiPanSwitch<T> { * @see #doSwitch(org.eclipse.emf.ecore.EObject) * @generated */ + @Override public T defaultCase(EObject object) { return null; } |