Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordsciamma2007-11-07 15:06:37 +0000
committerdsciamma2007-11-07 15:06:37 +0000
commit21a2d2906573fe5ad0edbc3fa84bbaa40dea0c1d (patch)
treedb523cbceacabd9f816fae88a7aa1ec9697829ce
downloadorg.eclipse.ecoretools-21a2d2906573fe5ad0edbc3fa84bbaa40dea0c1d.tar.gz
org.eclipse.ecoretools-21a2d2906573fe5ad0edbc3fa84bbaa40dea0c1d.tar.xz
org.eclipse.ecoretools-21a2d2906573fe5ad0edbc3fa84bbaa40dea0c1d.zip
Initial contribution
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/.classpath8
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/.cvsignore1
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/.options7
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/.project28
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/META-INF/MANIFEST.MF52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/about.html29
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/build.properties11
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/commands/RemoveDiagramCommand.java69
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/figures/PackageLabelRectangle.java62
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/policies/PackageComponentEditPolicy.java79
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/policies/PackageDiagramDragDropEditPolicy.java79
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/outline/EcoreDiagramOutlinePage.java59
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/outline/EcoreModelNavigator.java60
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/sheet/ObjectAdapter.java64
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/sheet/TabbedPropertiesTypeMapper.java42
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/2EReferences.gifbin0 -> 874 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/2EReferences_24.gifbin0 -> 920 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink.gifbin0 -> 208 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink_24.gifbin0 -> 932 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation.gifbin0 -> 554 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation_24.gifbin0 -> 179 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EAttribute.gifbin0 -> 123 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EAttribute_24.gifbin0 -> 145 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EClass.gifbin0 -> 206 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EClass_24.gifbin0 -> 1107 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EDataType.gifbin0 -> 199 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EDataType_24.gifbin0 -> 953 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnum.gifbin0 -> 131 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral.gifbin0 -> 109 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral_24.gifbin0 -> 126 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnum_24.gifbin0 -> 172 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EOperation.gifbin0 -> 150 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EOperation_24.gifbin0 -> 202 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EPackage.gifbin0 -> 207 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EPackage_24.gifbin0 -> 1014 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EReference.gifbin0 -> 183 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EReference_24.gifbin0 -> 914 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry.gifbin0 -> 213 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry_24.gifbin0 -> 145 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/Ecore.gifbin0 -> 379 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/Ecore_24.gifbin0 -> 992 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/Inheritance.gifbin0 -> 299 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/Inheritance_24.gifbin0 -> 964 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/Interface.gifbin0 -> 574 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/Interface_24.gifbin0 -> 1078 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/RegisteredPackage.gifbin0 -> 363 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/RegisteredPackage_24.gifbin0 -> 1025 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/incomingLinksNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/linkSourceNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/linkTargetNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/linksNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceN.gifbin0 -> 128 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceNToM.gifbin0 -> 138 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceNToUnbounded.gifbin0 -> 144 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOne.gifbin0 -> 127 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOneToN.gifbin0 -> 136 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOneToUnbounded.gifbin0 -> 142 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZero.gifbin0 -> 131 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToN.gifbin0 -> 140 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToOne.gifbin0 -> 164 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToUnbounded.gifbin0 -> 146 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/obj16/EcoreDiagramFile.gifbin0 -> 344 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/outgoingLinksNavigatorGroup.gifbin0 -> 709 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/shortcut.gifbin0 -> 93 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/icons/wizban/NewEcoreWizard.gifbin0 -> 2466 bytes
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/messages.properties122
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfgen1413
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfgraph263
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfmap339
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmftool180
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.trace129
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/plugin.properties59
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/plugin.xml751
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationCreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationReferencesCreateCommand.java96
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationReferencesReorientCommand.java159
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAttributeCreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClass2CreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassCreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassESuperTypesCreateCommand.java95
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassESuperTypesReorientCommand.java158
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EDataType2CreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EDataTypeCreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnum2CreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnumCreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnumLiteralCreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EOperationCreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EPackageCreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReference2CreateCommand.java96
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReference2ReorientCommand.java159
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReferenceCreateCommand.java141
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReferenceReorientCommand.java165
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EStringToStringMapEntryCreateCommand.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EcoreCreateShortcutDecorationsCommand.java73
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EcoreReorientConnectionViewCommand.java79
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EAnnotationEditHelper.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EAttributeEditHelper.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EClassEditHelper.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EDataTypeEditHelper.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EEnumEditHelper.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EEnumLiteralEditHelper.java68
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EOperationEditHelper.java50
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EPackageEditHelper.java49
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EReferenceEditHelper.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EStringToStringMapEntryEditHelper.java51
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EcoreBaseEditHelper.java80
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationDetailsEditPart.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationEditPart.java384
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationReferencesEditPart.java82
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationSourceEditPart.java552
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAttributeEditPart.java620
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClass2EditPart.java315
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassAttributes2EditPart.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassAttributesEditPart.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassESuperTypesEditPart.java95
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassEditPart.java328
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassName2EditPart.java580
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassNameEditPart.java580
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassOperations2EditPart.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassOperationsEditPart.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataType2EditPart.java335
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeEditPart.java348
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeInstanceClass2EditPart.java559
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeInstanceClassEditPart.java559
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeName2EditPart.java552
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeNameEditPart.java552
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnum2EditPart.java317
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumEditPart.java330
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiteralEditPart.java559
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiterals2EditPart.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiteralsEditPart.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumName2EditPart.java552
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumNameEditPart.java552
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EOperationEditPart.java776
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackage2EditPart.java374
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageContentsEditPart.java83
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageEditPart.java56
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageNameEditPart.java552
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReference2EditPart.java101
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceEditPart.java165
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceLowerBoundUpperBoundEditPart.java536
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceNameEditPart.java535
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EStringToStringMapEntryEditPart.java559
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EcoreEditPartFactory.java256
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationDetailsCanonicalEditPolicy.java82
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationDetailsItemSemanticEditPolicy.java38
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationItemSemanticEditPolicy.java122
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationReferencesItemSemanticEditPolicy.java30
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAttributeItemSemanticEditPolicy.java83
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClass2ItemSemanticEditPolicy.java165
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributes2CanonicalEditPolicy.java82
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributes2ItemSemanticEditPolicy.java38
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributesCanonicalEditPolicy.java82
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributesItemSemanticEditPolicy.java38
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassESuperTypesItemSemanticEditPolicy.java31
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassItemSemanticEditPolicy.java169
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperations2CanonicalEditPolicy.java82
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperations2ItemSemanticEditPolicy.java38
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperationsCanonicalEditPolicy.java82
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperationsItemSemanticEditPolicy.java38
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EDataType2ItemSemanticEditPolicy.java107
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EDataTypeItemSemanticEditPolicy.java112
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnum2ItemSemanticEditPolicy.java142
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumItemSemanticEditPolicy.java146
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralItemSemanticEditPolicy.java83
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiterals2CanonicalEditPolicy.java82
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiterals2ItemSemanticEditPolicy.java38
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralsCanonicalEditPolicy.java82
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralsItemSemanticEditPolicy.java38
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EOperationItemSemanticEditPolicy.java83
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackage2ItemSemanticEditPolicy.java137
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageCanonicalEditPolicy.java339
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageContentsCanonicalEditPolicy.java86
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageContentsItemSemanticEditPolicy.java52
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageItemSemanticEditPolicy.java91
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EReference2ItemSemanticEditPolicy.java31
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EReferenceItemSemanticEditPolicy.java79
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java35
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreBaseItemSemanticEditPolicy.java454
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreTextNonResizableEditPolicy.java212
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreTextSelectionEditPolicy.java196
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/OpenDiagramEditPolicy.java430
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/expressions/EcoreAbstractExpression.java222
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/expressions/EcoreOCLFactory.java196
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreAbstractNavigatorItem.java70
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorContentProvider.java229
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorItem.java118
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorLabelProvider.java106
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorActionProvider.java181
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorContentProvider.java703
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorGroup.java109
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorItem.java96
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorLabelProvider.java536
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorLinkHelper.java130
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorSorter.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/AbstractParser.java400
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/CompositeParser.java85
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/MessageFormatParser.java214
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreateShortcutAction.java111
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreationWizard.java156
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreationWizardPage.java95
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramActionBarContributor.java35
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramContentInitializer.java380
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditor.java384
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditorPlugin.java260
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditorUtil.java394
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramUpdateCommand.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramUpdater.java910
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDocumentProvider.java993
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDomainModelElementTester.java97
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreElementChooserDialog.java376
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreInitDiagramFileAction.java99
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreLinkDescriptor.java104
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreLoadResourceAction.java75
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreMatchingStrategy.java46
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreNewDiagramFileWizard.java175
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreNodeDescriptor.java69
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcorePaletteFactory.java278
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreShortcutPropertyTester.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreUriEditorInputTester.java34
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreVisualIDRegistry.java435
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/Messages.java581
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/ModelElementSelectionPage.java154
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/ValidateAction.java270
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramAppearancePreferencePage.java29
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramConnectionsPreferencePage.java29
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramGeneralPreferencePage.java29
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramPreferenceInitializer.java42
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramPrintingPreferencePage.java29
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramRulersAndGridPreferencePage.java29
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreEditPartProvider.java153
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreElementTypes.java313
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreIconProvider.java43
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreMarkerNavigationProvider.java93
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreModelingAssistantProvider.java301
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreParserProvider.java544
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreShortcutsDecoratorProvider.java99
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreValidationDecoratorProvider.java417
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreValidationProvider.java94
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreViewProvider.java370
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/ElementInitializers.java170
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/sheet/EcorePropertySection.java122
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/sheet/EcoreSheetLabelProvider.java91
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationDetailsViewFactory.java76
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationReferencesViewFactory.java65
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationSourceViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationViewFactory.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAttributeViewFactory.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClass2ViewFactory.java83
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassAttributes2ViewFactory.java76
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassAttributesViewFactory.java76
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassESuperTypesViewFactory.java50
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassName2ViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassNameViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassOperations2ViewFactory.java76
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassOperationsViewFactory.java76
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassViewFactory.java92
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataType2ViewFactory.java81
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeInstanceClass2ViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeInstanceClassViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeName2ViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeNameViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeViewFactory.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnum2ViewFactory.java81
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiteralViewFactory.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiterals2ViewFactory.java76
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiteralsViewFactory.java76
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumName2ViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumNameViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumViewFactory.java90
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EOperationViewFactory.java47
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackage2ViewFactory.java95
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageContentsViewFactory.java76
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageNameViewFactory.java33
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageViewFactory.java43
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReference2ViewFactory.java65
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceLowerBoundUpperBound2ViewFactory.java51
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceLowerBoundUpperBoundViewFactory.java51
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceName2ViewFactory.java51
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceNameViewFactory.java44
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceViewFactory.java83
-rw-r--r--plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EStringToStringMapEntryViewFactory.java47
282 files changed, 39378 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/.classpath b/plugins/org.eclipse.emf.ecoretools.diagram/.classpath
new file mode 100644
index 0000000..7aed21c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="custom-src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/.cvsignore b/plugins/org.eclipse.emf.ecoretools.diagram/.cvsignore
new file mode 100644
index 0000000..ba077a4
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/.cvsignore
@@ -0,0 +1 @@
+bin
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/.options b/plugins/org.eclipse.emf.ecoretools.diagram/.options
new file mode 100644
index 0000000..a2fccaf
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/.options
@@ -0,0 +1,7 @@
+# Tracing options for the org.eclipse.emf.ecoretools.diagram plug-in
+
+# Common issues
+org.eclipse.emf.ecoretools.diagram/debug=false
+
+# Visual IDs
+org.eclipse.emf.ecoretools.diagram/debug/visualID=false
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/.project b/plugins/org.eclipse.emf.ecoretools.diagram/.project
new file mode 100644
index 0000000..93de345
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.emf.ecoretools.diagram</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.ecoretools.diagram/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..bf45881
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/META-INF/MANIFEST.MF
@@ -0,0 +1,52 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %pluginName (Incubation)
+Bundle-SymbolicName: org.eclipse.emf.ecoretools.diagram;singleton:=true
+Bundle-Version: 0.8.0.qualifier
+Bundle-ClassPath: .
+Bundle-Activator: org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin
+Bundle-Vendor: %providerName
+Bundle-Localization: plugin
+Export-Package: org.eclipse.emf.ecoretools.diagram.edit.commands;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.edit.figures;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.edit.helpers;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.edit.parts;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.edit.policies;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.expressions;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.navigator;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.outline;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.parsers;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.part;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.preferences;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.providers;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.sheet;x-internal:=true,
+ org.eclipse.emf.ecoretools.diagram.view.factories;x-internal:=true
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.core.expressions,
+ org.eclipse.jface,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.views,
+ org.eclipse.ui.navigator,
+ 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,
+ org.eclipse.gmf.runtime.diagram.ui.properties,
+ org.eclipse.gmf.runtime.diagram.ui.providers,
+ org.eclipse.gmf.runtime.diagram.ui.providers.ide,
+ org.eclipse.gmf.runtime.diagram.ui.render,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor,
+ org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide,
+ org.eclipse.emf.ecore;visibility:=reexport,
+ org.eclipse.emf.ecore.edit;visibility:=reexport,
+ org.eclipse.ocl.ecore;visibility:=reexport,
+ org.eclipse.gmf.runtime.draw2d.ui;visibility:=reexport,
+ org.eclipse.gef;visibility:=reexport,
+ org.eclipse.ui.navigator.resources,
+ org.eclipse.gmf.runtime.diagram.ui.outline
+Eclipse-LazyStart: true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/about.html b/plugins/org.eclipse.emf.ecoretools.diagram/about.html
new file mode 100644
index 0000000..984e460
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/about.html
@@ -0,0 +1,29 @@
+<!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>November 7, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). 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, &quot;Program&quot; 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 (&quot;Redistributor&quot;) 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
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/build.properties b/plugins/org.eclipse.emf.ecoretools.diagram/build.properties
new file mode 100644
index 0000000..a4d748d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/build.properties
@@ -0,0 +1,11 @@
+bin.includes = .,\
+ icons/,\
+ META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ messages.properties,\
+ about.html
+jars.compile.order = .
+source.. = src/,\
+ custom-src/
+output.. = bin/
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/commands/RemoveDiagramCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/commands/RemoveDiagramCommand.java
new file mode 100644
index 0000000..a22b2d6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/commands/RemoveDiagramCommand.java
@@ -0,0 +1,69 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import java.util.Iterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.MultiDiagramLinkStyle;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+
+public class RemoveDiagramCommand extends AbstractTransactionalCommand {
+
+ private MultiDiagramLinkStyle diagramFacet;
+
+ public RemoveDiagramCommand(MultiDiagramLinkStyle linkStyle) {
+ // editing domain is taken for original diagram,
+ // if we open diagram from another file, we should use another editing
+ // domain
+ super(TransactionUtil.getEditingDomain(linkStyle), "RemoveDiagram", null);
+ diagramFacet = linkStyle;
+ }
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ try {
+ for (Iterator it = diagramFacet.getDiagramLinks().iterator(); it.hasNext();) {
+ Diagram diagram = (Diagram) it.next();
+ if (diagram != null) {
+ // Close associated diagram
+ URI uri = diagram.eResource().getURI();
+ uri = uri.appendFragment(diagram.eResource().getURIFragment(diagram));
+ IEditorInput editorInput = new URIEditorInput(uri);
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorPart editor = page.findEditor(editorInput);
+ if (editor != null) {
+ page.closeEditor(editor, true);
+ }
+ // Remove from ressource
+ assert diagramFacet.eResource() != null;
+ diagramFacet.eResource().getContents().remove(diagram);
+ }
+ }
+ diagramFacet.getDiagramLinks().clear();
+ return CommandResult.newOKCommandResult();
+ } catch (Exception ex) {
+ throw new ExecutionException("Can't remove diagram", ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/figures/PackageLabelRectangle.java b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/figures/PackageLabelRectangle.java
new file mode 100644
index 0000000..dfd671d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/figures/PackageLabelRectangle.java
@@ -0,0 +1,62 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.figures;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+public class PackageLabelRectangle extends RectangleFigure {
+
+ @Override
+ protected void outlineShape(Graphics graphics) {
+ Rectangle r = getBounds();
+ int x = r.x + lineWidth / 2;
+ int y = r.y + lineWidth / 2;
+ int h = r.height;
+ int w = r.width - Math.max(1, lineWidth);
+ WrappingLabel label = (WrappingLabel) getChildren().get(0);
+ Insets inset = ((MarginBorder) getBorder()).getInsets(this);
+ int labelWidth = label.getBounds().width + inset.left + inset.right;
+ if (labelWidth > w) {
+ labelWidth = w - 1;
+ }
+
+ Point point1 = new Point(x, y);
+ Point point3 = new Point(x + labelWidth, y + h);
+
+ Rectangle desiredBounds = new Rectangle(point1, point3);
+ graphics.drawRectangle(desiredBounds);
+ }
+
+ @Override
+ protected void fillShape(Graphics graphics) {
+ Rectangle r = getBounds();
+ int x = r.x + lineWidth / 2;
+ int y = r.y + lineWidth / 2;
+ int h = r.height;
+ WrappingLabel label = (WrappingLabel) getChildren().get(0);
+ Insets inset = ((MarginBorder) getBorder()).getInsets(this);
+ int labelWidth = label.getBounds().width + inset.left + inset.right;
+
+ Point point1 = new Point(x, y);
+ Point point3 = new Point(x + labelWidth, y + h);
+
+ Rectangle desiredBounds = new Rectangle(point1, point3);
+ graphics.fillRectangle(desiredBounds);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/policies/PackageComponentEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/policies/PackageComponentEditPolicy.java
new file mode 100644
index 0000000..b26eaa2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/policies/PackageComponentEditPolicy.java
@@ -0,0 +1,79 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.List;
+
+import org.eclipse.emf.ecoretools.diagram.edit.commands.RemoveDiagramCommand;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ComponentEditPolicy;
+import org.eclipse.gmf.runtime.notation.MultiDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+public class PackageComponentEditPolicy extends ComponentEditPolicy {
+
+ /**
+ * Takes into account linked diagrams
+ */
+ @Override
+ protected Command createDeleteViewCommand(GroupRequest deleteRequest) {
+ CompositeCommand cc = new CompositeCommand(null);
+
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ if (editingDomain == null) {
+ return null;
+ }
+ List toDel = deleteRequest.getEditParts();
+ if (toDel == null || toDel.isEmpty()) {
+ deleteLinkedDiagram(cc, getHost());
+ cc.compose(new DeleteCommand(editingDomain, (View) getHost().getModel()));
+ } else {
+ for (int i = 0; i < toDel.size(); i++) {
+ IGraphicalEditPart gep = (IGraphicalEditPart) toDel.get(i);
+ deleteLinkedDiagram(cc, gep);
+ cc.compose(new DeleteCommand(editingDomain, (View) gep.getModel()));
+ }
+ }
+ return new ICommandProxy(cc.reduce());
+ }
+
+ private void deleteLinkedDiagram(CompositeCommand cc, EditPart editPart) {
+ View view = (View) editPart.getModel();
+ MultiDiagramLinkStyle style = (MultiDiagramLinkStyle) view.getStyle(NotationPackage.eINSTANCE.getMultiDiagramLinkStyle());
+ if (style != null) {
+ cc.compose(new RemoveDiagramCommand(style));
+ }
+ }
+
+ private TransactionalEditingDomain getEditingDomain() {
+ if (getHost() instanceof IGraphicalEditPart) {
+ return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ } else if (getHost() instanceof IEditingDomainProvider) {
+ Object domain = ((IEditingDomainProvider) getHost()).getEditingDomain();
+ if (domain instanceof TransactionalEditingDomain) {
+ return (TransactionalEditingDomain) domain;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/policies/PackageDiagramDragDropEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/policies/PackageDiagramDragDropEditPolicy.java
new file mode 100644
index 0000000..82bcd60
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/edit/policies/PackageDiagramDragDropEditPolicy.java
@@ -0,0 +1,79 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DiagramDragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.DropObjectsRequest;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+public class PackageDiagramDragDropEditPolicy extends DiagramDragDropEditPolicy {
+
+ public Command getDropObjectsCommand(DropObjectsRequest dropRequest) {
+ List viewDescriptors = new ArrayList();
+ for (Iterator it = dropRequest.getObjects().iterator(); it.hasNext();) {
+ Object nextObject = it.next();
+ if (false == nextObject instanceof EObject) {
+ continue;
+ }
+ // Continue if element already in diagram
+ if (isElementInDiagram(nextObject, dropRequest)) {
+ continue;
+ }
+ viewDescriptors.add(new CreateViewRequest.ViewDescriptor(new EObjectAdapter((EObject) nextObject), Node.class, null, getDiagramPreferencesHint()));
+ }
+ return createShortcutsCommand(dropRequest, viewDescriptors);
+ }
+
+ private boolean isElementInDiagram(Object nextObject, Request request) {
+ if (getView(request).getDiagram().getElement().equals(nextObject)) {
+ return true;
+ }
+ for (Iterator it = getView(request).getDiagram().getChildren().iterator(); it.hasNext();) {
+ View nextView = (View) it.next();
+ if (nextView.getElement().equals(nextObject)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private Command createShortcutsCommand(DropObjectsRequest dropRequest, List viewDescriptors) {
+ Command command = createViewsAndArrangeCommand(dropRequest, viewDescriptors);
+ if (command != null) {
+ return command;
+ }
+ return null;
+ }
+
+ protected View getView(Request request) {
+ EditPart targetEditPart = getTargetEditPart(request);
+ return (View) targetEditPart.getModel();
+ }
+
+ protected PreferencesHint getDiagramPreferencesHint() {
+ return EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/outline/EcoreDiagramOutlinePage.java b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/outline/EcoreDiagramOutlinePage.java
new file mode 100644
index 0000000..006b18b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/outline/EcoreDiagramOutlinePage.java
@@ -0,0 +1,59 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.outline;
+
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.outline.AbstractDiagramsOutlinePage;
+import org.eclipse.gmf.runtime.diagram.ui.outline.AbstractModelNavigator;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.IPageSite;
+
+/**
+ * A customized outline page for rendering both a Thumbnail view of the editor
+ * and/or a tree structure of the underlying model
+ *
+ * @author <a href="mailto:david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class EcoreDiagramOutlinePage extends AbstractDiagramsOutlinePage {
+
+ /**
+ * Constructor
+ *
+ * @param editor
+ * the Editor
+ */
+ public EcoreDiagramOutlinePage(DiagramEditor editor) {
+ super(editor);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.outline.AbstractDiagramsOutlinePage#createNavigator(org.eclipse.swt.widgets.Composite,
+ * org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer,
+ * org.eclipse.ui.part.IPageSite)
+ */
+ @Override
+ protected AbstractModelNavigator createNavigator(Composite parent, IDiagramGraphicalViewer viewer, IPageSite pageSite) {
+ return new EcoreModelNavigator(parent, viewer, pageSite);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.outline.AbstractDiagramsOutlinePage#getPreferenceStore()
+ */
+ @Override
+ protected IPreferenceStore getPreferenceStore() {
+ return EcoreDiagramEditorPlugin.getInstance().getPreferenceStore();
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/outline/EcoreModelNavigator.java b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/outline/EcoreModelNavigator.java
new file mode 100644
index 0000000..c0ef9f7
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/outline/EcoreModelNavigator.java
@@ -0,0 +1,60 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.outline;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.outline.AbstractModelNavigator;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.IPageSite;
+
+/**
+ * A navigator that gives a model-oriented view in the outline.
+ *
+ * @author <a href="mailto:david.sciamma@anyware-tech.com">David Sciamma</a>
+ */
+public class EcoreModelNavigator extends AbstractModelNavigator {
+
+ /**
+ * Constructor
+ *
+ * @param parent
+ * the parent Composite
+ * @param viewer
+ * the Viewer
+ * @param pageSite
+ * the IPageSite
+ */
+ public EcoreModelNavigator(Composite parent, IDiagramGraphicalViewer viewer, IPageSite pageSite) {
+ super(parent, viewer, pageSite);
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.outline.AbstractModelNavigator#getAdapterFactory()
+ */
+ @Override
+ protected AdapterFactory getAdapterFactory() {
+ return EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory();
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.outline.AbstractModelNavigator#getPreferenceStore()
+ */
+ @Override
+ protected IPreferenceStore getPreferenceStore() {
+ return EcoreDiagramEditorPlugin.getInstance().getPreferenceStore();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/sheet/ObjectAdapter.java b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/sheet/ObjectAdapter.java
new file mode 100644
index 0000000..863e828
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/sheet/ObjectAdapter.java
@@ -0,0 +1,64 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.sheet;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * Provides a single static method to adapt a given object into an EObject
+ *
+ * Creation 19 sept. 06
+ *
+ * @author Alfredo Serrano
+ *
+ */
+public final class ObjectAdapter {
+
+ private ObjectAdapter() {
+ // Instantiation forbidden
+ }
+
+ /**
+ * Returns the EObject associated with the given object. Returns
+ * <code>null</code> if no such object can be found.
+ *
+ *
+ * @param object
+ * The object to look up its associated EObject
+ * @return the EObject associated to the given object, or <code>null</code>
+ * if this object does not have any.
+ */
+ public static EObject adaptObject(Object object) {
+ if (object == null) {
+ return null;
+ } else if (object instanceof EObject) {
+ return (EObject) object;
+ } else if (object instanceof IAdaptable) {
+ // Try IAdaptable
+ IAdaptable adapted = (IAdaptable) object;
+ Object eObject = adapted.getAdapter(EObject.class);
+ if (eObject != null) {
+ return (EObject) eObject;
+ }
+ } else {
+ // Try registered adapter
+ Object adapted = Platform.getAdapterManager().getAdapter(object, EObject.class);
+ if (adapted != null) {
+ return (EObject) adapted;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/sheet/TabbedPropertiesTypeMapper.java b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/sheet/TabbedPropertiesTypeMapper.java
new file mode 100644
index 0000000..75d5ee0
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/custom-src/org/eclipse/emf/ecoretools/diagram/sheet/TabbedPropertiesTypeMapper.java
@@ -0,0 +1,42 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.sheet;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper;
+
+/**
+ * An implementation of AbstractTypeMapper. This class matches the type of
+ * selected objects inside the workbench part with the input type attributes
+ * defined in the PropertySection extensions. We can either match objects from a
+ * tree editor or elements based on Eclipse GEF like EditParts.
+ *
+ * Creation 19 sept. 06
+ *
+ * @author Alfredo Serrano
+ *
+ */
+public class TabbedPropertiesTypeMapper extends AbstractTypeMapper {
+
+ /**
+ * @see org.eclipse.ui.views.properties.tabbed.AbstractTypeMapper#mapType(java.lang.Object)
+ */
+ public Class<?> mapType(Object object) {
+
+ EObject eObject = ObjectAdapter.adaptObject(object);
+ if (eObject != null) {
+ return eObject.getClass();
+ }
+ return super.mapType(object);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/2EReferences.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/2EReferences.gif
new file mode 100644
index 0000000..fad5482
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/2EReferences.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/2EReferences_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/2EReferences_24.gif
new file mode 100644
index 0000000..ad3247a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/2EReferences_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink.gif
new file mode 100644
index 0000000..772b6a2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink_24.gif
new file mode 100644
index 0000000..4b0dace
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation.gif
new file mode 100644
index 0000000..0df81a3
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation_24.gif
new file mode 100644
index 0000000..c597b41
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAttribute.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAttribute.gif
new file mode 100644
index 0000000..bc9944a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAttribute.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAttribute_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAttribute_24.gif
new file mode 100644
index 0000000..c089ece
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EAttribute_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EClass.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EClass.gif
new file mode 100644
index 0000000..2b8da63
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EClass.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EClass_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EClass_24.gif
new file mode 100644
index 0000000..1c9afc6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EClass_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EDataType.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EDataType.gif
new file mode 100644
index 0000000..5d31048
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EDataType.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EDataType_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EDataType_24.gif
new file mode 100644
index 0000000..dd737d6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EDataType_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnum.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnum.gif
new file mode 100644
index 0000000..343d086
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnum.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral.gif
new file mode 100644
index 0000000..7bb44f5
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral_24.gif
new file mode 100644
index 0000000..6ed49bf
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnum_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnum_24.gif
new file mode 100644
index 0000000..9389a9a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EEnum_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EOperation.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EOperation.gif
new file mode 100644
index 0000000..5818a30
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EOperation.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EOperation_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EOperation_24.gif
new file mode 100644
index 0000000..082f3e6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EOperation_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EPackage.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EPackage.gif
new file mode 100644
index 0000000..30c5c10
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EPackage.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EPackage_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EPackage_24.gif
new file mode 100644
index 0000000..a1f3bd2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EPackage_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EReference.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EReference.gif
new file mode 100644
index 0000000..88cdf2a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EReference.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EReference_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EReference_24.gif
new file mode 100644
index 0000000..6db388b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EReference_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry.gif
new file mode 100644
index 0000000..97aad29
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry_24.gif
new file mode 100644
index 0000000..c089ece
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/Ecore.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Ecore.gif
new file mode 100644
index 0000000..4125865
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Ecore.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/Ecore_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Ecore_24.gif
new file mode 100644
index 0000000..d03e0ed
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Ecore_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/Inheritance.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Inheritance.gif
new file mode 100644
index 0000000..215e838
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Inheritance.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/Inheritance_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Inheritance_24.gif
new file mode 100644
index 0000000..a86e79c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Inheritance_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/Interface.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Interface.gif
new file mode 100644
index 0000000..7614139
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Interface.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/Interface_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Interface_24.gif
new file mode 100644
index 0000000..25f38f3
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/Interface_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/RegisteredPackage.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/RegisteredPackage.gif
new file mode 100644
index 0000000..34ecebd
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/RegisteredPackage.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/RegisteredPackage_24.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/RegisteredPackage_24.gif
new file mode 100644
index 0000000..6dce975
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/RegisteredPackage_24.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/incomingLinksNavigatorGroup.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/incomingLinksNavigatorGroup.gif
new file mode 100644
index 0000000..fca9c53
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/incomingLinksNavigatorGroup.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/linkSourceNavigatorGroup.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/linkSourceNavigatorGroup.gif
new file mode 100644
index 0000000..fca9c53
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/linkSourceNavigatorGroup.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/linkTargetNavigatorGroup.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/linkTargetNavigatorGroup.gif
new file mode 100644
index 0000000..fca9c53
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/linkTargetNavigatorGroup.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/linksNavigatorGroup.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/linksNavigatorGroup.gif
new file mode 100644
index 0000000..fca9c53
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/linksNavigatorGroup.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceN.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceN.gif
new file mode 100644
index 0000000..dabbb66
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceN.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceNToM.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceNToM.gif
new file mode 100644
index 0000000..f8d02d1
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceNToM.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceNToUnbounded.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceNToUnbounded.gif
new file mode 100644
index 0000000..b4ddddc
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceNToUnbounded.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOne.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOne.gif
new file mode 100644
index 0000000..034a760
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOne.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOneToN.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOneToN.gif
new file mode 100644
index 0000000..2d26fbc
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOneToN.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOneToUnbounded.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOneToUnbounded.gif
new file mode 100644
index 0000000..2aaa95f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceOneToUnbounded.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZero.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZero.gif
new file mode 100644
index 0000000..ea6d32e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZero.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToN.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToN.gif
new file mode 100644
index 0000000..42f593e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToN.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToOne.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToOne.gif
new file mode 100644
index 0000000..b69f3a1
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToOne.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToUnbounded.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToUnbounded.gif
new file mode 100644
index 0000000..7cc70be
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/multiplicity/EOccurrenceZeroToUnbounded.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/obj16/EcoreDiagramFile.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/obj16/EcoreDiagramFile.gif
new file mode 100644
index 0000000..44f054e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/obj16/EcoreDiagramFile.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/outgoingLinksNavigatorGroup.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/outgoingLinksNavigatorGroup.gif
new file mode 100644
index 0000000..fca9c53
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/outgoingLinksNavigatorGroup.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/shortcut.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/shortcut.gif
new file mode 100644
index 0000000..c8ebb31
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/shortcut.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/icons/wizban/NewEcoreWizard.gif b/plugins/org.eclipse.emf.ecoretools.diagram/icons/wizban/NewEcoreWizard.gif
new file mode 100644
index 0000000..14e1405
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/icons/wizban/NewEcoreWizard.gif
Binary files differ
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/messages.properties b/plugins/org.eclipse.emf.ecoretools.diagram/messages.properties
new file mode 100644
index 0000000..0f85cad
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/messages.properties
@@ -0,0 +1,122 @@
+
+# TODO: manually put keys and values
+EcoreDiagramEditorUtil_OpenModelResourceErrorDialogTitle=Error
+EcoreDiagramEditorUtil_OpenModelResourceErrorDialogMessage=Failed to load model file {0}
+EcoreDiagramEditorUtil_CreateDiagramProgressTask=Creating diagram and model files
+EcoreDiagramEditorUtil_CreateDiagramCommandLabel=Creating diagram and model
+EcoreDocumentProvider_isModifiable=Updating cache failed
+EcoreDocumentProvider_handleElementContentChanged=Failed to refresh hierarchy for changed resource
+EcoreDocumentProvider_IncorrectInputError={1}
+EcoreDocumentProvider_NoDiagramInResourceError=Diagram is not present in resource
+EcoreDocumentProvider_DiagramLoadingError=Error loading diagram
+EcoreDocumentProvider_UnsynchronizedFileSaveError=The file has been changed on the file system
+EcoreDocumentProvider_SaveDiagramTask=Saving diagram
+EcoreDocumentProvider_SaveNextResourceTask=Saving {0}
+EcoreDocumentProvider_SaveAsOperation=Saving {0} diagram as
+EcoreInitDiagramFileAction_InitDiagramFileResourceErrorDialogTitle=Error
+EcoreInitDiagramFileAction_InitDiagramFileResourceErrorDialogMessage=Model file loading failed
+EcoreInitDiagramFileAction_InitDiagramFileWizardTitle=Initialize new {0} diagram file
+EcoreInitDiagramFileAction_OpenModelFileDialogTitle=Select domain model
+EcoreNewDiagramFileWizard_CreationPageName=Initialize new diagram file
+EcoreNewDiagramFileWizard_CreationPageTitle=Diagram file
+EcoreNewDiagramFileWizard_CreationPageDescription=Create new diagram based on {0} model content
+EcoreNewDiagramFileWizard_RootSelectionPageName=Select diagram root element
+EcoreNewDiagramFileWizard_RootSelectionPageTitle=Diagram root element
+EcoreNewDiagramFileWizard_RootSelectionPageDescription=Select semantic model element to be depicted on diagram
+EcoreNewDiagramFileWizard_RootSelectionPageSelectionTitle=Select diagram root element:
+EcoreNewDiagramFileWizard_RootSelectionPageNoSelectionMessage=Diagram root element is not selected
+EcoreNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage=Invalid diagram root element is selected
+EcoreNewDiagramFileWizard_InitDiagramCommand=Initializing diagram contents
+EcoreNewDiagramFileWizard_IncorrectRootError=Incorrect model object stored as a root resource object
+Objects1Group_title=Objects
+Objects1Group_desc=Diagram Nodes
+Connections2Group_title=Connections
+Connections2Group_desc=Links
+EPackage1CreationTool_title=EPackage
+EPackage1CreationTool_desc=Create Package
+EClass2CreationTool_title=EClass
+EClass2CreationTool_desc=Create Class
+EDataType3CreationTool_title=EDataType
+EDataType3CreationTool_desc=Create DataType
+EEnum4CreationTool_title=EEnum
+EEnum4CreationTool_desc=Create Enumeration
+EAnnotation5CreationTool_title=EAnnotation
+EAnnotation5CreationTool_desc=Create Annotation
+EOperation7CreationTool_title=EOperation
+EOperation7CreationTool_desc=Create Operation
+EAttribute8CreationTool_title=EAttribute
+EAttribute8CreationTool_desc=Create Attribute
+EEnumLiteral9CreationTool_title=EEnumLiteral
+EEnumLiteral9CreationTool_desc=Create Enumeration literal
+DetailsEntry10CreationTool_title=Details Entry
+DetailsEntry10CreationTool_desc=Create Annotation details
+EReference1CreationTool_title=EReference
+EReference1CreationTool_desc=Create Association link
+EReferenceisContainment2CreationTool_title=EReference isContainment
+EReferenceisContainment2CreationTool_desc=Create Aggregation link
+Inheritance3CreationTool_title=Inheritance
+Inheritance3CreationTool_desc=Create Generalization link
+EAnnotationlink4CreationTool_title=EAnnotation link
+EAnnotationlink4CreationTool_desc=Create Annotation reference link
+EClassAttributesEditPart_title=attributes
+EClassOperationsEditPart_title=operations
+EClassAttributes2EditPart_title=attributes
+EClassOperations2EditPart_title=operations
+EEnumLiteralsEditPart_title=literals
+EAnnotationDetailsEditPart_title=details
+EEnumLiterals2EditPart_title=literals
+
+CommandName_OpenDiagram=Open Diagram
+NavigatorGroupName_EPackage_79_links=links
+NavigatorGroupName_EClass_1001_incominglinks=incoming links
+NavigatorGroupName_EClass_1001_outgoinglinks=outgoing links
+NavigatorGroupName_EPackage_1002_incominglinks=incoming links
+NavigatorGroupName_EAnnotation_1003_incominglinks=incoming links
+NavigatorGroupName_EAnnotation_1003_outgoinglinks=outgoing links
+NavigatorGroupName_EDataType_1004_incominglinks=incoming links
+NavigatorGroupName_EEnum_1005_incominglinks=incoming links
+NavigatorGroupName_EAttribute_2001_incominglinks=incoming links
+NavigatorGroupName_EOperation_2002_incominglinks=incoming links
+NavigatorGroupName_EClass_2003_incominglinks=incoming links
+NavigatorGroupName_EClass_2003_outgoinglinks=outgoing links
+NavigatorGroupName_EDataType_2004_incominglinks=incoming links
+NavigatorGroupName_EEnum_2005_incominglinks=incoming links
+NavigatorGroupName_EEnumLiteral_2006_incominglinks=incoming links
+NavigatorGroupName_EAnnotationReferences_3001_target=target
+NavigatorGroupName_EAnnotationReferences_3001_source=source
+NavigatorGroupName_EReference_3002_target=target
+NavigatorGroupName_EReference_3002_source=source
+NavigatorGroupName_EReference_3003_target=target
+NavigatorGroupName_EReference_3003_source=source
+NavigatorGroupName_EClassESuperTypes_3004_target=target
+NavigatorGroupName_EClassESuperTypes_3004_source=source
+EPackageContentsEditPart_title=contents
+Inheritance2CreationTool_title=Inheritance
+Inheritance2CreationTool_desc=Create Generalization link
+EAnnotationlink3CreationTool_title=EAnnotation link
+EAnnotationlink3CreationTool_desc=Create Annotation reference link
+NavigatorGroupName_EClassESuperTypes_3003_target=target
+NavigatorGroupName_EClassESuperTypes_3003_source=source
+EcoreCreationWizardTitle=New Ecore Diagram
+EcoreCreationWizard_DiagramModelFilePageTitle=Create Ecore Diagram
+EcoreCreationWizard_DiagramModelFilePageDescription=Select file that will contain diagram model.
+EcoreCreationWizard_DomainModelFilePageTitle=Create Ecore Diagram
+EcoreCreationWizard_DomainModelFilePageDescription=Select file that will contain domain model.
+EcoreCreationWizardOpenEditorError=Error opening diagram editor
+EcoreCreationWizardCreationError=Creation Problems
+EcoreCreationWizardPageExtensionError=File name should have {0} extension.
+EcoreDiagramEditor_SavingDeletedFile=The original file "{0}" has been deleted.
+EcoreDiagramEditor_SaveAsErrorTitle=Problem During Save As...
+EcoreDiagramEditor_SaveAsErrorMessage=Save could not be completed. Target file is already open in another editor.
+EcoreDiagramEditor_SaveErrorTitle=Save Problems
+EcoreDiagramEditor_SaveErrorMessage=Could not save file.
+EcoreElementChooserDialog_SelectModelElementTitle=Select model element
+ModelElementSelectionPageMessage=Select model element:
+ValidateActionMessage=Validate
+NavigatorActionProvider_OpenDiagramActionName=Open Diagram
+AbstractParser_UnexpectedValueTypeMessage=Value of type {0} is expected
+AbstractParser_WrongStringConversionMessage=String value does not convert to {0} value
+AbstractParser_UnknownLiteralMessage=Unknown literal: {0}
+MessageFormatParser_InvalidInputError=Invalid input at {0}
+EcoreModelingAssistantProviderTitle=Select domain model element
+EcoreModelingAssistantProviderMessage=Available domain model elements:
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfgen b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfgen
new file mode 100644
index 0000000..c33bd8c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfgen
@@ -0,0 +1,1413 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gmfgen:GenEditorGenerator xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmfgen="http://www.eclipse.org/gmf/2006/GenModel" packageNamePrefix="org.eclipse.emf.ecoretools.diagram"
+ diagramFileExtension="ecorediag"
+ copyrightText="Copyright (c) 2007 Anyware Technologies&#xD;&#xA;&#xD;&#xA;All rights reserved. This program and the accompanying materials&#xD;&#xA;are made available under the terms of the Eclipse Public License v1.0&#xD;&#xA;which accompanies this distribution, and is available at&#xD;&#xA;http://www.eclipse.org/legal/epl-v10.html&#xD;&#xA;&#xD;&#xA;Contributors:&#xD;&#xA; Anyware Technologies - initial API and implementation">
+ <diagram
+ visualID="79"
+ editPartClassName="EPackageEditPart"
+ itemSemanticEditPolicyClassName="EPackageItemSemanticEditPolicy"
+ notationViewFactoryClassName="EPackageViewFactory"
+ canonicalEditPolicyClassName="EPackageCanonicalEditPolicy"
+ iconProviderPriority="Low"
+ creationWizardIconPath="icons/Ecore.gif"
+ validationProviderPriority="Low">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Diagram"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EPackageEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.FreeformLayer"/>
+ <containsShortcutsTo>ecore</containsShortcutsTo>
+ <shortcutsProvidedFor>ecore</shortcutsProvidedFor>
+ <domainDiagramElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage"/>
+ <childNodes
+ xsi:type="gmfgen:GenChildLabelNode"
+ visualID="2001"
+ editPartClassName="EAttributeEditPart"
+ itemSemanticEditPolicyClassName="EAttributeItemSemanticEditPolicy"
+ notationViewFactoryClassName="EAttributeViewFactory"
+ canonicalEditPolicyClassName="EAttributeCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="EAttributeGraphicalNodeEditPolicy"
+ createCommandClassName="EAttributeCreateCommand"
+ containers="//@diagram/@compartments.0 //@diagram/@compartments.3"
+ labelElementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EAttributeEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EAttribute"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass/eStructuralFeatures"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass/eAttributes"/>
+ </modelFacet>
+ <labelModelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </labelModelFacet>
+ </childNodes>
+ <childNodes
+ xsi:type="gmfgen:GenChildLabelNode"
+ visualID="2002"
+ editPartClassName="EOperationEditPart"
+ itemSemanticEditPolicyClassName="EOperationItemSemanticEditPolicy"
+ notationViewFactoryClassName="EOperationViewFactory"
+ canonicalEditPolicyClassName="EOperationCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="EOperationGraphicalNodeEditPolicy"
+ createCommandClassName="EOperationCreateCommand"
+ containers="//@diagram/@compartments.1 //@diagram/@compartments.4"
+ labelElementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EOperationEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EOperation"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass/eOperations"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass/eOperations"/>
+ </modelFacet>
+ <labelModelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </labelModelFacet>
+ </childNodes>
+ <childNodes
+ visualID="2003"
+ editPartClassName="EClass2EditPart"
+ itemSemanticEditPolicyClassName="EClass2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EClass2ViewFactory"
+ canonicalEditPolicyClassName="EClass2CanonicalEditPolicy"
+ compartments="//@diagram/@compartments.3 //@diagram/@compartments.4"
+ graphicalNodeEditPolicyClassName="EClass2GraphicalNodeEditPolicy"
+ createCommandClassName="EClass2CreateCommand"
+ containers="//@diagram/@compartments.2">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ metamodelType="//@diagram/@topLevelNodes.0/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ layoutType="TOOLBAR_LAYOUT"
+ className="ClassFigure"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class ClassFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigureClassNameLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public ClassFigure() {&#xA;&#x9;&#x9;&#xA;&#xA;&#x9;org.eclipse.draw2d.ToolbarLayout layoutThis = new org.eclipse.draw2d.ToolbarLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(true);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.ToolbarLayout.ALIGN_CENTER&#xA;);&#xA;&#xA;&#x9;layoutThis.setSpacing(0);&#xA;&#x9;layoutThis.setVertical(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(100)&#xA;, getMapMode().DPtoLP(30)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;fFigureClassNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigureClassNameLabel.setText(&quot;&lt;..>&quot;);&#xA;&#xA;this.add(fFigureClassNameLabel);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureClassNameLabel() {&#xA;&#x9;&#x9;return fFigureClassNameLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ </modelFacet>
+ <labels
+ visualID="4002"
+ editPartClassName="EClassName2EditPart"
+ itemSemanticEditPolicyClassName="EClassName2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EClassName2ViewFactory"
+ elementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureClassNameLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="2004"
+ editPartClassName="EDataType2EditPart"
+ itemSemanticEditPolicyClassName="EDataType2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EDataType2ViewFactory"
+ canonicalEditPolicyClassName="EDataType2CanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="EDataType2GraphicalNodeEditPolicy"
+ createCommandClassName="EDataType2CreateCommand"
+ containers="//@diagram/@compartments.2">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EDataTypeEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ layoutType="TOOLBAR_LAYOUT"
+ className="DataTypeFigure"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class DataTypeFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigureDataTypeNameLabel; &#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigureDataTypeJavaLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public DataTypeFigure() {&#xA;&#x9;&#x9;&#xA;&#xA;&#x9;org.eclipse.draw2d.ToolbarLayout layoutThis = new org.eclipse.draw2d.ToolbarLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(true);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.ToolbarLayout.ALIGN_CENTER&#xA;);&#xA;&#xA;&#x9;layoutThis.setSpacing(1);&#xA;&#x9;layoutThis.setVertical(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setOutlineXOR(true);&#xA;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(100)&#xA;, getMapMode().DPtoLP(30)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel dataTypeFixedNameLabel0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;dataTypeFixedNameLabel0.setText(&quot;&lt;&lt;datatype>>&quot;);&#xA;&#xA;this.add(dataTypeFixedNameLabel0);&#xA;&#xA;&#xA;&#xA;fFigureDataTypeNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigureDataTypeNameLabel.setText(&quot;&lt;..>&quot;);&#xA;&#xA;this.add(fFigureDataTypeNameLabel);&#xA;&#xA;&#xA;&#xA;fFigureDataTypeJavaLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigureDataTypeJavaLabel.setText(&quot;&quot;);&#xA;&#xA;this.add(fFigureDataTypeJavaLabel);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureDataTypeNameLabel() {&#xA;&#x9;&#x9;return fFigureDataTypeNameLabel;&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureDataTypeJavaLabel() {&#xA;&#x9;&#x9;return fFigureDataTypeJavaLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EDataType"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ <modelElementSelector
+ body="not oclIsKindOf(ecore::EEnum)"/>
+ </modelFacet>
+ <labels
+ visualID="4003"
+ editPartClassName="EDataTypeName2EditPart"
+ itemSemanticEditPolicyClassName="EDataTypeName2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EDataTypeName2ViewFactory"
+ elementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureDataTypeNameLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="4004"
+ editPartClassName="EDataTypeInstanceClass2EditPart"
+ itemSemanticEditPolicyClassName="EDataTypeInstanceClass2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EDataTypeInstanceClass2ViewFactory"
+ readOnly="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureDataTypeJavaLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ viewPattern="&lt;&lt;javaclass>> {0}">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClassifier/instanceClassName"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ visualID="2005"
+ editPartClassName="EEnum2EditPart"
+ itemSemanticEditPolicyClassName="EEnum2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EEnum2ViewFactory"
+ canonicalEditPolicyClassName="EEnum2CanonicalEditPolicy"
+ compartments="//@diagram/@compartments.5"
+ graphicalNodeEditPolicyClassName="EEnum2GraphicalNodeEditPolicy"
+ createCommandClassName="EEnum2CreateCommand"
+ containers="//@diagram/@compartments.2">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EEnumEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ layoutType="TOOLBAR_LAYOUT"
+ className="EnumerationFigure"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class EnumerationFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigureEnumerationNameLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public EnumerationFigure() {&#xA;&#x9;&#x9;&#xA;&#xA;&#x9;org.eclipse.draw2d.ToolbarLayout layoutThis = new org.eclipse.draw2d.ToolbarLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(true);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.ToolbarLayout.ALIGN_CENTER&#xA;);&#xA;&#xA;&#x9;layoutThis.setSpacing(0);&#xA;&#x9;layoutThis.setVertical(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(100)&#xA;, getMapMode().DPtoLP(30)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel enumerationFixedNameLabel0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;enumerationFixedNameLabel0.setText(&quot;&lt;&lt;enumeration>>&quot;);&#xA;&#xA;this.add(enumerationFixedNameLabel0);&#xA;&#xA;&#xA;&#xA;fFigureEnumerationNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigureEnumerationNameLabel.setText(&quot;&lt;..>&quot;);&#xA;&#xA;this.add(fFigureEnumerationNameLabel);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureEnumerationNameLabel() {&#xA;&#x9;&#x9;return fFigureEnumerationNameLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EEnum"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ </modelFacet>
+ <labels
+ visualID="4005"
+ editPartClassName="EEnumName2EditPart"
+ itemSemanticEditPolicyClassName="EEnumName2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EEnumName2ViewFactory"
+ elementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureEnumerationNameLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </childNodes>
+ <childNodes
+ xsi:type="gmfgen:GenChildLabelNode"
+ visualID="2006"
+ editPartClassName="EEnumLiteralEditPart"
+ itemSemanticEditPolicyClassName="EEnumLiteralItemSemanticEditPolicy"
+ notationViewFactoryClassName="EEnumLiteralViewFactory"
+ canonicalEditPolicyClassName="EEnumLiteralCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="EEnumLiteralGraphicalNodeEditPolicy"
+ createCommandClassName="EEnumLiteralCreateCommand"
+ containers="//@diagram/@compartments.5 //@diagram/@compartments.7"
+ labelElementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EEnumLiteralEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EEnumLiteral"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EEnum/eLiterals"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EEnum/eLiterals"/>
+ </modelFacet>
+ <labelModelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </labelModelFacet>
+ </childNodes>
+ <childNodes
+ xsi:type="gmfgen:GenChildLabelNode"
+ visualID="2007"
+ editPartClassName="EStringToStringMapEntryEditPart"
+ itemSemanticEditPolicyClassName="EStringToStringMapEntryItemSemanticEditPolicy"
+ notationViewFactoryClassName="EStringToStringMapEntryViewFactory"
+ canonicalEditPolicyClassName="EStringToStringMapEntryCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="EStringToStringMapEntryGraphicalNodeEditPolicy"
+ createCommandClassName="EStringToStringMapEntryCreateCommand"
+ containers="//@diagram/@compartments.6"
+ labelElementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EStringToStringMapEntryEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EStringToStringMapEntry"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EAnnotation/details"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EAnnotation/details"/>
+ </modelFacet>
+ <labelModelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ viewPattern=""
+ editPattern="">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EStringToStringMapEntry/key"/>
+ </labelModelFacet>
+ </childNodes>
+ <topLevelNodes
+ visualID="1001"
+ editPartClassName="EClassEditPart"
+ itemSemanticEditPolicyClassName="EClassItemSemanticEditPolicy"
+ notationViewFactoryClassName="EClassViewFactory"
+ canonicalEditPolicyClassName="EClassCanonicalEditPolicy"
+ compartments="//@diagram/@compartments.0 //@diagram/@compartments.1"
+ graphicalNodeEditPolicyClassName="EClassGraphicalNodeEditPolicy"
+ createCommandClassName="EClassCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EClassEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ layoutType="TOOLBAR_LAYOUT"
+ className="ClassFigure"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class ClassFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigureClassNameLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public ClassFigure() {&#xA;&#x9;&#x9;&#xA;&#xA;&#x9;org.eclipse.draw2d.ToolbarLayout layoutThis = new org.eclipse.draw2d.ToolbarLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(true);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.ToolbarLayout.ALIGN_CENTER&#xA;);&#xA;&#xA;&#x9;layoutThis.setSpacing(0);&#xA;&#x9;layoutThis.setVertical(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(100)&#xA;, getMapMode().DPtoLP(30)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;fFigureClassNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigureClassNameLabel.setText(&quot;&lt;..>&quot;);&#xA;&#xA;this.add(fFigureClassNameLabel);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureClassNameLabel() {&#xA;&#x9;&#x9;return fFigureClassNameLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ </modelFacet>
+ <labels
+ visualID="4001"
+ editPartClassName="EClassNameEditPart"
+ itemSemanticEditPolicyClassName="EClassNameItemSemanticEditPolicy"
+ notationViewFactoryClassName="EClassNameViewFactory"
+ elementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureClassNameLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <topLevelNodes
+ visualID="1002"
+ editPartClassName="EPackage2EditPart"
+ itemSemanticEditPolicyClassName="EPackage2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EPackage2ViewFactory"
+ canonicalEditPolicyClassName="EPackage2CanonicalEditPolicy"
+ compartments="//@diagram/@compartments.2"
+ graphicalNodeEditPolicyClassName="EPackageGraphicalNodeEditPolicy"
+ createCommandClassName="EPackageCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ metamodelType="//@diagram/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ layoutType="TOOLBAR_LAYOUT"
+ className="PackageFigure"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class PackageFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.draw2d.RectangleFigure fFigurePackageBodyRectangle; &#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigurePackageNameLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public PackageFigure() {&#xA;&#x9;&#x9;&#xA;&#xA;&#x9;org.eclipse.draw2d.ToolbarLayout layoutThis = new org.eclipse.draw2d.ToolbarLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(true);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.ToolbarLayout.ALIGN_CENTER&#xA;);&#xA;&#xA;&#x9;layoutThis.setSpacing(0);&#xA;&#x9;layoutThis.setVertical(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setFill(false);&#xA;this.setOutline(false);&#xA;this.setLineWidth(2);&#xA;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(100)&#xA;, getMapMode().DPtoLP(100)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;org.eclipse.draw2d.RectangleFigure packageLabelRectangle0 = new org.eclipse.draw2d.RectangleFigure();&#xA;packageLabelRectangle0.setLineWidth(2);&#xA;&#xA;packageLabelRectangle0.setBorder(new org.eclipse.draw2d.MarginBorder(getMapMode().DPtoLP(5)&#xA;, getMapMode().DPtoLP(5)&#xA;, getMapMode().DPtoLP(5)&#xA;, getMapMode().DPtoLP(5)&#xA;));&#xA;&#xA;this.add(packageLabelRectangle0);&#xA;&#xA;&#xA;&#x9;org.eclipse.draw2d.ToolbarLayout layoutPackageLabelRectangle0 = new org.eclipse.draw2d.ToolbarLayout();&#xA;&#x9;layoutPackageLabelRectangle0.setStretchMinorAxis(false);&#xA;&#x9;layoutPackageLabelRectangle0.setMinorAlignment(org.eclipse.draw2d.ToolbarLayout.ALIGN_TOPLEFT&#xA;);&#xA;&#xA;&#x9;layoutPackageLabelRectangle0.setSpacing(5);&#xA;&#x9;layoutPackageLabelRectangle0.setVertical(false);&#xA;&#xA;&#x9;packageLabelRectangle0.setLayoutManager(layoutPackageLabelRectangle0);&#xA;&#xA;&#xA;&#xA;fFigurePackageNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigurePackageNameLabel.setText(&quot;&lt;..>&quot;);&#xA;&#xA;packageLabelRectangle0.add(fFigurePackageNameLabel);&#xA;&#xA;&#xA;&#xA;&#xA;fFigurePackageBodyRectangle = new org.eclipse.draw2d.RectangleFigure();&#xA;fFigurePackageBodyRectangle.setLineWidth(2);&#xA;&#xA;this.add(fFigurePackageBodyRectangle);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.draw2d.RectangleFigure getFigurePackageBodyRectangle() {&#xA;&#x9;&#x9;return fFigurePackageBodyRectangle;&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigurePackageNameLabel() {&#xA;&#x9;&#x9;return fFigurePackageNameLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <behaviour
+ xsi:type="gmfgen:OpenDiagramBehaviour"/>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eSubpackages"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eSubpackages"/>
+ </modelFacet>
+ <labels
+ visualID="4006"
+ editPartClassName="EPackageNameEditPart"
+ itemSemanticEditPolicyClassName="EPackageNameItemSemanticEditPolicy"
+ notationViewFactoryClassName="EPackageNameViewFactory"
+ elementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigurePackageNameLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <topLevelNodes
+ visualID="1003"
+ editPartClassName="EAnnotationEditPart"
+ itemSemanticEditPolicyClassName="EAnnotationItemSemanticEditPolicy"
+ notationViewFactoryClassName="EAnnotationViewFactory"
+ canonicalEditPolicyClassName="EAnnotationCanonicalEditPolicy"
+ compartments="//@diagram/@compartments.6"
+ graphicalNodeEditPolicyClassName="EAnnotationGraphicalNodeEditPolicy"
+ createCommandClassName="EAnnotationCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EAnnotationEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ layoutType="TOOLBAR_LAYOUT"
+ className="AnnotationFigure"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class AnnotationFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigureAnnotationNameLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public AnnotationFigure() {&#xA;&#x9;&#x9;&#xA;&#xA;&#x9;org.eclipse.draw2d.ToolbarLayout layoutThis = new org.eclipse.draw2d.ToolbarLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(true);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.ToolbarLayout.ALIGN_CENTER&#xA;);&#xA;&#xA;&#x9;layoutThis.setSpacing(0);&#xA;&#x9;layoutThis.setVertical(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(100)&#xA;, getMapMode().DPtoLP(30)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;fFigureAnnotationNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigureAnnotationNameLabel.setText(&quot;&lt;..>&quot;);&#xA;&#xA;this.add(fFigureAnnotationNameLabel);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureAnnotationNameLabel() {&#xA;&#x9;&#x9;return fFigureAnnotationNameLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EAnnotation"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EModelElement/eAnnotations"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EModelElement/eAnnotations"/>
+ </modelFacet>
+ <labels
+ visualID="4007"
+ editPartClassName="EAnnotationSourceEditPart"
+ itemSemanticEditPolicyClassName="EAnnotationSourceItemSemanticEditPolicy"
+ notationViewFactoryClassName="EAnnotationSourceViewFactory"
+ elementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureAnnotationNameLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EAnnotation/source"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <topLevelNodes
+ visualID="1004"
+ editPartClassName="EDataTypeEditPart"
+ itemSemanticEditPolicyClassName="EDataTypeItemSemanticEditPolicy"
+ notationViewFactoryClassName="EDataTypeViewFactory"
+ canonicalEditPolicyClassName="EDataTypeCanonicalEditPolicy"
+ graphicalNodeEditPolicyClassName="EDataTypeGraphicalNodeEditPolicy"
+ createCommandClassName="EDataTypeCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ metamodelType="//@diagram/@childNodes.3/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ layoutType="TOOLBAR_LAYOUT"
+ className="DataTypeFigure"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class DataTypeFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigureDataTypeNameLabel; &#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigureDataTypeJavaLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public DataTypeFigure() {&#xA;&#x9;&#x9;&#xA;&#xA;&#x9;org.eclipse.draw2d.ToolbarLayout layoutThis = new org.eclipse.draw2d.ToolbarLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(true);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.ToolbarLayout.ALIGN_CENTER&#xA;);&#xA;&#xA;&#x9;layoutThis.setSpacing(1);&#xA;&#x9;layoutThis.setVertical(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setOutlineXOR(true);&#xA;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(100)&#xA;, getMapMode().DPtoLP(30)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel dataTypeFixedNameLabel0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;dataTypeFixedNameLabel0.setText(&quot;&lt;&lt;datatype>>&quot;);&#xA;&#xA;this.add(dataTypeFixedNameLabel0);&#xA;&#xA;&#xA;&#xA;fFigureDataTypeNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigureDataTypeNameLabel.setText(&quot;&lt;..>&quot;);&#xA;&#xA;this.add(fFigureDataTypeNameLabel);&#xA;&#xA;&#xA;&#xA;fFigureDataTypeJavaLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigureDataTypeJavaLabel.setText(&quot;&quot;);&#xA;&#xA;this.add(fFigureDataTypeJavaLabel);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureDataTypeNameLabel() {&#xA;&#x9;&#x9;return fFigureDataTypeNameLabel;&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureDataTypeJavaLabel() {&#xA;&#x9;&#x9;return fFigureDataTypeJavaLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EDataType"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ <modelElementSelector
+ body="not oclIsKindOf(ecore::EEnum)"/>
+ </modelFacet>
+ <labels
+ visualID="4008"
+ editPartClassName="EDataTypeNameEditPart"
+ itemSemanticEditPolicyClassName="EDataTypeNameItemSemanticEditPolicy"
+ notationViewFactoryClassName="EDataTypeNameViewFactory"
+ elementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureDataTypeNameLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="4009"
+ editPartClassName="EDataTypeInstanceClassEditPart"
+ itemSemanticEditPolicyClassName="EDataTypeInstanceClassItemSemanticEditPolicy"
+ notationViewFactoryClassName="EDataTypeInstanceClassViewFactory"
+ readOnly="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureDataTypeJavaLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ viewPattern="&lt;&lt;javaclass>> {0}">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClassifier/instanceClassName"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <topLevelNodes
+ visualID="1005"
+ editPartClassName="EEnumEditPart"
+ itemSemanticEditPolicyClassName="EEnumItemSemanticEditPolicy"
+ notationViewFactoryClassName="EEnumViewFactory"
+ canonicalEditPolicyClassName="EEnumCanonicalEditPolicy"
+ compartments="//@diagram/@compartments.7"
+ graphicalNodeEditPolicyClassName="EEnumGraphicalNodeEditPolicy"
+ createCommandClassName="EEnumCreateCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"
+ metamodelType="//@diagram/@childNodes.4/@elementType"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ layoutType="TOOLBAR_LAYOUT"
+ className="EnumerationFigure"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class EnumerationFigure extends org.eclipse.draw2d.RectangleFigure {&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel fFigureEnumerationNameLabel; &#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public EnumerationFigure() {&#xA;&#x9;&#x9;&#xA;&#xA;&#x9;org.eclipse.draw2d.ToolbarLayout layoutThis = new org.eclipse.draw2d.ToolbarLayout();&#xA;&#x9;layoutThis.setStretchMinorAxis(true);&#xA;&#x9;layoutThis.setMinorAlignment(org.eclipse.draw2d.ToolbarLayout.ALIGN_CENTER&#xA;);&#xA;&#xA;&#x9;layoutThis.setSpacing(0);&#xA;&#x9;layoutThis.setVertical(true);&#xA;&#xA;&#x9;this.setLayoutManager(layoutThis);&#xA;&#xA;&#x9;&#x9;this.setMinimumSize(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(100)&#xA;, getMapMode().DPtoLP(30)&#xA;));&#xA;&#x9;&#x9;createContents();&#xA;&#x9;}&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private void createContents(){&#xA;&#xA;&#xA;org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel enumerationFixedNameLabel0 = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;enumerationFixedNameLabel0.setText(&quot;&lt;&lt;enumeration>>&quot;);&#xA;&#xA;this.add(enumerationFixedNameLabel0);&#xA;&#xA;&#xA;&#xA;fFigureEnumerationNameLabel = new org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel();&#xA;fFigureEnumerationNameLabel.setText(&quot;&lt;..>&quot;);&#xA;&#xA;this.add(fFigureEnumerationNameLabel);&#xA;&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private boolean myUseLocalCoordinates = false;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected boolean useLocalCoordinates() {&#xA;&#x9;&#x9;return myUseLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;protected void setUseLocalCoordinates(boolean useLocalCoordinates) {&#xA;&#x9;&#x9;myUseLocalCoordinates = useLocalCoordinates;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel getFigureEnumerationNameLabel() {&#xA;&#x9;&#x9;return fFigureEnumerationNameLabel;&#xA;&#x9;}&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet>
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EEnum"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EPackage/eClassifiers"/>
+ </modelFacet>
+ <labels
+ visualID="4010"
+ editPartClassName="EEnumNameEditPart"
+ itemSemanticEditPolicyClassName="EEnumNameItemSemanticEditPolicy"
+ notationViewFactoryClassName="EEnumNameViewFactory"
+ elementIcon="true">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigureEnumerationNameLabel"
+ figureQualifiedClassName="org.eclipse.gmf.runtime.draw2d.ui.figures.WrapLabel"/>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </modelFacet>
+ </labels>
+ </topLevelNodes>
+ <links
+ visualID="3001"
+ editPartClassName="EAnnotationReferencesEditPart"
+ itemSemanticEditPolicyClassName="EAnnotationReferencesItemSemanticEditPolicy"
+ notationViewFactoryClassName="EAnnotationReferencesViewFactory"
+ createCommandClassName="EAnnotationReferencesCreateCommand"
+ reorientCommandClassName="EAnnotationReferencesReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ className="DashedLineConnection"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class DashedLineConnection extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public DashedLineConnection() {&#xA;&#x9;&#x9;this.setLineStyle(org.eclipse.draw2d.Graphics.LINE_DASH);&#xA;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.draw2d</requiredPluginIDs>
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLinkModelFacet">
+ <metaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EAnnotation/references"/>
+ </modelFacet>
+ </links>
+ <links
+ visualID="3002"
+ editPartClassName="EReferenceEditPart"
+ itemSemanticEditPolicyClassName="EReferenceItemSemanticEditPolicy"
+ notationViewFactoryClassName="EReferenceViewFactory"
+ createCommandClassName="EReferenceCreateCommand"
+ reorientCommandClassName="EReferenceReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:MetamodelType"
+ editHelperClassName="EReferenceEditHelper"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ className="SolidLineWDstArrow"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class SolidLineWDstArrow extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public SolidLineWDstArrow() {&#xA;&#x9;&#x9;&#xA;&#x9;&#x9;setTargetDecoration(createTargetDecoration());&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.draw2d.RotatableDecoration createTargetDecoration() {&#xA;&#x9;&#x9;org.eclipse.draw2d.PolylineDecoration df = new org.eclipse.draw2d.PolylineDecoration();&#xA;org.eclipse.draw2d.geometry.PointList pl = new org.eclipse.draw2d.geometry.PointList();&#xA;pl.addPoint(getMapMode().DPtoLP(-1)&#xA;, getMapMode().DPtoLP(1)&#xA;);&#xA;pl.addPoint(getMapMode().DPtoLP(0)&#xA;, getMapMode().DPtoLP(0)&#xA;);&#xA;pl.addPoint(getMapMode().DPtoLP(-1)&#xA;, getMapMode().DPtoLP(-1)&#xA;);&#xA;df.setTemplate(pl);&#xA;df.setScale(getMapMode().DPtoLP(7)&#xA;, getMapMode().DPtoLP(3)&#xA;);&#xA;&#x9;&#x9;return df;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.draw2d</requiredPluginIDs>
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:TypeLinkModelFacet">
+ <metaClass
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EReference"/>
+ <containmentMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass/eStructuralFeatures"/>
+ <childMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass/eStructuralFeatures"/>
+ <modelElementSelector
+ body="not containment and not container"/>
+ <modelElementInitializer
+ xsi:type="gmfgen:GenFeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfgen:GenFeatureValueSpec"
+ body="false">
+ <feature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EReference/containment"/>
+ </initializers>
+ </modelElementInitializer>
+ <targetMetaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ETypedElement/eType"/>
+ </modelFacet>
+ <labels
+ visualID="4011"
+ editPartClassName="EReferenceNameEditPart"
+ itemSemanticEditPolicyClassName="EReferenceNameItemSemanticEditPolicy"
+ notationViewFactoryClassName="EReferenceNameViewFactory"
+ alignment="SOURCE">
+ <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.WrapLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ x="-10"
+ y="-10"/>
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ENamedElement/name"/>
+ </modelFacet>
+ </labels>
+ <labels
+ visualID="4012"
+ editPartClassName="EReferenceLowerBoundUpperBoundEditPart"
+ itemSemanticEditPolicyClassName="EReferenceLowerBoundUpperBoundItemSemanticEditPolicy"
+ notationViewFactoryClassName="EReferenceLowerBoundUpperBoundViewFactory"
+ alignment="SOURCE">
+ <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.WrapLabel">
+ <attributes
+ xsi:type="gmfgen:LabelOffsetAttributes"
+ x="10"
+ y="10"/>
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLabelModelFacet"
+ viewPattern="{0}..{1,choice,-1#*|-1&lt;{1}}"
+ editPattern="{0}..{1}">
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ETypedElement/lowerBound"/>
+ <metaFeatures
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/ETypedElement/upperBound"/>
+ </modelFacet>
+ </labels>
+ <creationConstraints>
+ <targetEnd
+ body="self.oclIsKindOf(ecore::EClass)"/>
+ </creationConstraints>
+ </links>
+ <links
+ visualID="3003"
+ editPartClassName="EReference2EditPart"
+ itemSemanticEditPolicyClassName="EReference2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EReference2ViewFactory"
+ createCommandClassName="EReference2CreateCommand"
+ reorientCommandClassName="EReference2ReorientCommand">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Edge"/>
+ <elementType
+ xsi:type="gmfgen:SpecializationType"/>
+ <viewmap
+ xsi:type="gmfgen:InnerClassViewmap"
+ className="SolidLineWDstClosedArrow"
+ classBody="&#xA;/**&#xA; * @generated&#xA; */&#xA;public class SolidLineWDstClosedArrow extends org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx {&#xA;&#xA;&#xA;&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;public SolidLineWDstClosedArrow() {&#xA;&#x9;&#x9;&#xA;&#x9;&#x9;setTargetDecoration(createTargetDecoration());&#xA;&#x9;}&#xA;&#xA;&#x9;/**&#xA;&#x9; * @generated&#xA;&#x9; */&#xA;&#x9;private org.eclipse.draw2d.RotatableDecoration createTargetDecoration() {&#xA;&#x9;&#x9;org.eclipse.draw2d.PolygonDecoration df = new org.eclipse.draw2d.PolygonDecoration();&#xA;&#x9;df.setBackgroundColor(org.eclipse.draw2d.ColorConstants.white);&#xA;org.eclipse.draw2d.geometry.PointList pl = new org.eclipse.draw2d.geometry.PointList();&#xA;pl.addPoint(getMapMode().DPtoLP(0)&#xA;, getMapMode().DPtoLP(0)&#xA;);&#xA;pl.addPoint(getMapMode().DPtoLP(-2)&#xA;, getMapMode().DPtoLP(2)&#xA;);&#xA;pl.addPoint(getMapMode().DPtoLP(-2)&#xA;, getMapMode().DPtoLP(-2)&#xA;);&#xA;pl.addPoint(getMapMode().DPtoLP(0)&#xA;, getMapMode().DPtoLP(0)&#xA;);&#xA;df.setTemplate(pl);&#xA;df.setScale(getMapMode().DPtoLP(7)&#xA;, getMapMode().DPtoLP(3)&#xA;);&#xA;&#x9;&#x9;return df;&#xA;&#x9;}&#xA;&#xA;&#xA;&#xA;&#xA;}&#xA;&#xA;">
+ <requiredPluginIDs>org.eclipse.draw2d</requiredPluginIDs>
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ <modelFacet
+ xsi:type="gmfgen:FeatureLinkModelFacet">
+ <metaFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#//ecore/EClass/eSuperTypes"/>
+ </modelFacet>
+ <creationConstraints>
+ <targetEnd
+ body="self &lt;> oppositeEnd and not oppositeEnd.eSuperTypes->includes(self) and not self.eAllSuperTypes->includes(oppositeEnd)"/>
+ </creationConstraints>
+ </links>
+ <compartments
+ visualID="5001"
+ editPartClassName="EClassAttributesEditPart"
+ itemSemanticEditPolicyClassName="EClassAttributesItemSemanticEditPolicy"
+ notationViewFactoryClassName="EClassAttributesViewFactory"
+ canonicalEditPolicyClassName="EClassAttributesCanonicalEditPolicy"
+ childNodes="//@diagram/@childNodes.0"
+ title="attributes"
+ needsTitle="false"
+ node="//@diagram/@topLevelNodes.0">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ </compartments>
+ <compartments
+ visualID="5002"
+ editPartClassName="EClassOperationsEditPart"
+ itemSemanticEditPolicyClassName="EClassOperationsItemSemanticEditPolicy"
+ notationViewFactoryClassName="EClassOperationsViewFactory"
+ canonicalEditPolicyClassName="EClassOperationsCanonicalEditPolicy"
+ childNodes="//@diagram/@childNodes.1"
+ title="operations"
+ needsTitle="false"
+ node="//@diagram/@topLevelNodes.0">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ </compartments>
+ <compartments
+ visualID="5003"
+ editPartClassName="EPackageContentsEditPart"
+ itemSemanticEditPolicyClassName="EPackageContentsItemSemanticEditPolicy"
+ notationViewFactoryClassName="EPackageContentsViewFactory"
+ canonicalEditPolicyClassName="EPackageContentsCanonicalEditPolicy"
+ childNodes="//@diagram/@childNodes.2 //@diagram/@childNodes.3 //@diagram/@childNodes.4"
+ title="contents"
+ needsTitle="false"
+ node="//@diagram/@topLevelNodes.1"
+ listLayout="false">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:ParentAssignedViewmap"
+ getterName="getFigurePackageBodyRectangle"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure"/>
+ </compartments>
+ <compartments
+ visualID="5004"
+ editPartClassName="EClassAttributes2EditPart"
+ itemSemanticEditPolicyClassName="EClassAttributes2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EClassAttributes2ViewFactory"
+ canonicalEditPolicyClassName="EClassAttributes2CanonicalEditPolicy"
+ childNodes="//@diagram/@childNodes.0"
+ title="attributes"
+ needsTitle="false"
+ node="//@diagram/@childNodes.2">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ </compartments>
+ <compartments
+ visualID="5005"
+ editPartClassName="EClassOperations2EditPart"
+ itemSemanticEditPolicyClassName="EClassOperations2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EClassOperations2ViewFactory"
+ canonicalEditPolicyClassName="EClassOperations2CanonicalEditPolicy"
+ childNodes="//@diagram/@childNodes.1"
+ title="operations"
+ needsTitle="false"
+ node="//@diagram/@childNodes.2">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ </compartments>
+ <compartments
+ visualID="5006"
+ editPartClassName="EEnumLiteralsEditPart"
+ itemSemanticEditPolicyClassName="EEnumLiteralsItemSemanticEditPolicy"
+ notationViewFactoryClassName="EEnumLiteralsViewFactory"
+ canonicalEditPolicyClassName="EEnumLiteralsCanonicalEditPolicy"
+ childNodes="//@diagram/@childNodes.5"
+ title="literals"
+ needsTitle="false"
+ node="//@diagram/@childNodes.4">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ </compartments>
+ <compartments
+ visualID="5007"
+ editPartClassName="EAnnotationDetailsEditPart"
+ itemSemanticEditPolicyClassName="EAnnotationDetailsItemSemanticEditPolicy"
+ notationViewFactoryClassName="EAnnotationDetailsViewFactory"
+ canonicalEditPolicyClassName="EAnnotationDetailsCanonicalEditPolicy"
+ childNodes="//@diagram/@childNodes.6"
+ title="details"
+ needsTitle="false"
+ node="//@diagram/@topLevelNodes.2">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ </compartments>
+ <compartments
+ visualID="5008"
+ editPartClassName="EEnumLiterals2EditPart"
+ itemSemanticEditPolicyClassName="EEnumLiterals2ItemSemanticEditPolicy"
+ notationViewFactoryClassName="EEnumLiterals2ViewFactory"
+ canonicalEditPolicyClassName="EEnumLiterals2CanonicalEditPolicy"
+ childNodes="//@diagram/@childNodes.5"
+ title="literals"
+ needsTitle="false"
+ node="//@diagram/@topLevelNodes.4">
+ <diagramRunTimeClass
+ href="../../../plugin/org.eclipse.gmf.runtime.notation/model/notation.genmodel#//notation/Node"/>
+ <viewmap
+ xsi:type="gmfgen:FigureViewmap"
+ figureQualifiedClassName="org.eclipse.draw2d.RectangleFigure">
+ <requiredPluginIDs>org.eclipse.gmf.runtime.draw2d.ui</requiredPluginIDs>
+ </viewmap>
+ </compartments>
+ <palette>
+ <groups
+ title="Objects"
+ description="Diagram Nodes"
+ collapse="true">
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EPackage"
+ description="Create Package"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EPackage_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EPackage.gif"
+ genNodes="//@diagram/@topLevelNodes.1"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EClass"
+ description="Create Class"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EClass_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EClass.gif"
+ genNodes="//@diagram/@topLevelNodes.0 //@diagram/@childNodes.2"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EDataType"
+ description="Create DataType"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EDataType_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EDataType.gif"
+ genNodes="//@diagram/@childNodes.3 //@diagram/@topLevelNodes.3"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EEnum"
+ description="Create Enumeration"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EENum_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EENum.gif"
+ genNodes="//@diagram/@childNodes.4 //@diagram/@topLevelNodes.4"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EAnnotation"
+ description="Create Annotation"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation.gif"
+ genNodes="//@diagram/@topLevelNodes.2"/>
+ <entries
+ xsi:type="gmfgen:Separator"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EOperation"
+ description="Create Operation"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EOperation_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EOperation.gif"
+ genNodes="//@diagram/@childNodes.1"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EAttribute"
+ description="Create Attribute"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EAttribute_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EAttribute.gif"
+ genNodes="//@diagram/@childNodes.0"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EEnumLiteral"
+ description="Create Enumeration literal"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral.gif"
+ genNodes="//@diagram/@childNodes.5"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Details Entry"
+ description="Create Annotation details"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry.gif"
+ genNodes="//@diagram/@childNodes.6"/>
+ </groups>
+ <groups
+ title="Connections"
+ description="Links"
+ collapse="true">
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EReference"
+ description="Create Association link"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EReference_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/EReference.gif"
+ genLinks="//@diagram/@links.1"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="Inheritance"
+ description="Create Generalization link"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/Inheritance_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/Inheritance.gif"
+ genLinks="//@diagram/@links.2"/>
+ <entries
+ xsi:type="gmfgen:ToolEntry"
+ title="EAnnotation link"
+ description="Create Annotation reference link"
+ largeIconPath="/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink_24.gif"
+ smallIconPath="/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink.gif"
+ genLinks="//@diagram/@links.0"/>
+ </groups>
+ </palette>
+ <preferencePages
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.emf.ecore.ediagram.general"
+ name="Ecore Diagram (2)">
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.emf.ecoretools.diagram.appearance"
+ name="Appearance"
+ kind="Appearance"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.emf.ecoretools.diagram.connections"
+ name="Connections"
+ kind="Connections"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.emf.ecoretools.diagram.printing"
+ name="Printing"
+ kind="Printing"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.emf.ecoretools.diagram.rulersAndGrid"
+ name="Rulers And Grid"
+ kind="RulersAndGrid"/>
+ <children
+ xsi:type="gmfgen:GenStandardPreferencePage"
+ iD="org.eclipse.emf.ecoretools.diagram.pathmaps"
+ name="Pathmaps"
+ kind="Pathmaps"/>
+ </preferencePages>
+ </diagram>
+ <plugin
+ iD="org.eclipse.emf.ecoretools.diagram"
+ name="Ecore Tools Diagram (Incubation)"
+ provider="Eclipse.org"
+ version="0.8.0.qualifier"/>
+ <editor
+ iconPath="icons/Ecore.gif"/>
+ <navigator>
+ <childReferences
+ child="//@diagram"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.0"
+ child="//@diagram/@childNodes.0"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.0"
+ child="//@diagram/@childNodes.1"/>
+ <childReferences
+ parent="//@diagram"
+ child="//@diagram/@topLevelNodes.0"/>
+ <childReferences
+ parent="//@diagram/@childNodes.2"
+ child="//@diagram/@childNodes.0"/>
+ <childReferences
+ parent="//@diagram/@childNodes.2"
+ child="//@diagram/@childNodes.1"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.1"
+ child="//@diagram/@childNodes.2"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.1"
+ child="//@diagram/@childNodes.3"/>
+ <childReferences
+ parent="//@diagram/@childNodes.4"
+ child="//@diagram/@childNodes.5"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.1"
+ child="//@diagram/@childNodes.4"/>
+ <childReferences
+ parent="//@diagram"
+ child="//@diagram/@topLevelNodes.1"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.2"
+ child="//@diagram/@childNodes.6"/>
+ <childReferences
+ parent="//@diagram"
+ child="//@diagram/@topLevelNodes.2"/>
+ <childReferences
+ parent="//@diagram"
+ child="//@diagram/@topLevelNodes.3"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.4"
+ child="//@diagram/@childNodes.5"/>
+ <childReferences
+ parent="//@diagram"
+ child="//@diagram/@topLevelNodes.4"/>
+ <childReferences
+ parent="//@diagram"
+ child="//@diagram/@links.0"
+ groupName="links"
+ groupIcon="icons/linksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@topLevelNodes.0"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.0"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@topLevelNodes.1"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.1"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@topLevelNodes.2"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.2"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@topLevelNodes.3"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.3"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@topLevelNodes.4"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.4"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@childNodes.0"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.0"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@childNodes.1"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.1"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@childNodes.2"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.2"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@childNodes.3"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.3"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@childNodes.4"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.4"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@childNodes.5"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.5"
+ child="//@diagram/@links.0"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.0"
+ child="//@diagram/@topLevelNodes.2"
+ referenceType="in_source"
+ groupName="source"
+ groupIcon="icons/linkSourceNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.2"
+ child="//@diagram/@links.0"
+ referenceType="out_target"
+ groupName="outgoing links"
+ groupIcon="icons/outgoingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram"
+ child="//@diagram/@links.1"
+ groupName="links"
+ groupIcon="icons/linksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.1"
+ child="//@diagram/@topLevelNodes.0"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.0"
+ child="//@diagram/@links.1"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.1"
+ child="//@diagram/@topLevelNodes.3"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.3"
+ child="//@diagram/@links.1"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.1"
+ child="//@diagram/@topLevelNodes.4"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.4"
+ child="//@diagram/@links.1"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.1"
+ child="//@diagram/@childNodes.2"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.2"
+ child="//@diagram/@links.1"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.1"
+ child="//@diagram/@childNodes.3"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.3"
+ child="//@diagram/@links.1"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.1"
+ child="//@diagram/@childNodes.4"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.4"
+ child="//@diagram/@links.1"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.1"
+ child="//@diagram/@topLevelNodes.0"
+ referenceType="in_source"
+ groupName="source"
+ groupIcon="icons/linkSourceNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.0"
+ child="//@diagram/@links.1"
+ referenceType="out_target"
+ groupName="outgoing links"
+ groupIcon="icons/outgoingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.1"
+ child="//@diagram/@childNodes.2"
+ referenceType="in_source"
+ groupName="source"
+ groupIcon="icons/linkSourceNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.2"
+ child="//@diagram/@links.1"
+ referenceType="out_target"
+ groupName="outgoing links"
+ groupIcon="icons/outgoingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram"
+ child="//@diagram/@links.2"
+ groupName="links"
+ groupIcon="icons/linksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.2"
+ child="//@diagram/@topLevelNodes.0"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.0"
+ child="//@diagram/@links.2"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.2"
+ child="//@diagram/@childNodes.2"
+ referenceType="out_target"
+ groupName="target"
+ groupIcon="icons/linkTargetNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.2"
+ child="//@diagram/@links.2"
+ referenceType="in_source"
+ groupName="incoming links"
+ groupIcon="icons/incomingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.2"
+ child="//@diagram/@topLevelNodes.0"
+ referenceType="in_source"
+ groupName="source"
+ groupIcon="icons/linkSourceNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@topLevelNodes.0"
+ child="//@diagram/@links.2"
+ referenceType="out_target"
+ groupName="outgoing links"
+ groupIcon="icons/outgoingLinksNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@links.2"
+ child="//@diagram/@childNodes.2"
+ referenceType="in_source"
+ groupName="source"
+ groupIcon="icons/linkSourceNavigatorGroup.gif"/>
+ <childReferences
+ parent="//@diagram/@childNodes.2"
+ child="//@diagram/@links.2"
+ referenceType="out_target"
+ groupName="outgoing links"
+ groupIcon="icons/outgoingLinksNavigatorGroup.gif"/>
+ </navigator>
+ <diagramUpdater/>
+ <propertySheet>
+ <tabs
+ xsi:type="gmfgen:GenStandardPropertyTab"
+ iD="appearance"/>
+ <tabs
+ xsi:type="gmfgen:GenStandardPropertyTab"
+ iD="diagram"/>
+ <tabs
+ xsi:type="gmfgen:GenCustomPropertyTab"
+ iD="domain"
+ label="Core">
+ <filter
+ xsi:type="gmfgen:TypeTabFilter">
+ <types>org.eclipse.gmf.runtime.notation.View</types>
+ <types>org.eclipse.gef.EditPart</types>
+ <generatedTypes>abstractNavigatorItem</generatedTypes>
+ </filter>
+ </tabs>
+ </propertySheet>
+ <domainGenModel
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.genmodel#/"/>
+ <expressionProviders>
+ <providers
+ xsi:type="gmfgen:GenExpressionInterpreter"
+ expressions="//@diagram/@childNodes.3/@modelFacet/@modelElementSelector //@diagram/@links.1/@modelFacet/@modelElementSelector //@diagram/@links.1/@modelFacet/@modelElementInitializer/@initializers.0 //@diagram/@links.1/@creationConstraints/@targetEnd //@diagram/@links.2/@creationConstraints/@targetEnd"/>
+ </expressionProviders>
+</gmfgen:GenEditorGenerator>
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfgraph b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfgraph
new file mode 100644
index 0000000..b9d8572
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfgraph
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gmfgraph:Canvas xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmfgraph="http://www.eclipse.org/gmf/2006/GraphicalDefinition" name="Ecore Canvas">
+ <figures
+ name="Ecore Figure Gallery">
+ <descriptors
+ name="RectangleFigure">
+ <actualFigure
+ xsi:type="gmfgraph:Rectangle"/>
+ </descriptors>
+ <descriptors
+ name="LabelFigure">
+ <actualFigure
+ xsi:type="gmfgraph:Label"/>
+ </descriptors>
+ <descriptors
+ name="PackageFigure">
+ <actualFigure
+ xsi:type="gmfgraph:Rectangle"
+ name=""
+ outline="false"
+ fill="false"
+ lineWidth="2">
+ <layout
+ xsi:type="gmfgraph:FlowLayout"
+ vertical="true"
+ matchMinorSize="true"
+ forceSingleLine="true"
+ minorAlignment="CENTER"
+ majorSpacing="0"
+ minorSpacing="0"/>
+ <minimumSize
+ dx="100"
+ dy="100"/>
+ <children
+ xsi:type="gmfgraph:Rectangle"
+ name="PackageLabelRectangle"
+ lineWidth="2">
+ <layout
+ xsi:type="gmfgraph:FlowLayout"
+ forceSingleLine="true"/>
+ <insets
+ top="5"
+ left="5"
+ bottom="5"
+ right="5"/>
+ <children
+ xsi:type="gmfgraph:Label"
+ name="PackageNameLabel"
+ text="&lt;..>"/>
+ </children>
+ <children
+ xsi:type="gmfgraph:Rectangle"
+ name="PackageBodyRectangle"
+ lineWidth="2"/>
+ </actualFigure>
+ <accessors
+ figure="//@figures.0/@descriptors.2/@actualFigure/@children.1"/>
+ <accessors
+ figure="//@figures.0/@descriptors.2/@actualFigure/@children.0/@children.0"/>
+ </descriptors>
+ <descriptors
+ name="EnumerationFigure">
+ <actualFigure
+ xsi:type="gmfgraph:Rectangle"
+ name="">
+ <layout
+ xsi:type="gmfgraph:FlowLayout"
+ vertical="true"
+ matchMinorSize="true"
+ forceSingleLine="true"
+ majorAlignment="CENTER"
+ minorAlignment="CENTER"
+ majorSpacing="0"
+ minorSpacing="0"/>
+ <minimumSize
+ dx="100"
+ dy="30"/>
+ <children
+ xsi:type="gmfgraph:Label"
+ name="EnumerationFixedNameLabel"
+ text="&lt;&lt;enumeration>>"/>
+ <children
+ xsi:type="gmfgraph:Label"
+ name="EnumerationNameLabel"
+ text="&lt;..>"/>
+ </actualFigure>
+ <accessors
+ figure="//@figures.0/@descriptors.3/@actualFigure/@children.1"/>
+ </descriptors>
+ <descriptors
+ name="DataTypeFigure">
+ <actualFigure
+ xsi:type="gmfgraph:Rectangle"
+ name=""
+ xorOutline="true">
+ <layout
+ xsi:type="gmfgraph:FlowLayout"
+ vertical="true"
+ matchMinorSize="true"
+ forceSingleLine="true"
+ majorAlignment="CENTER"
+ minorAlignment="CENTER"
+ majorSpacing="1"
+ minorSpacing="0"/>
+ <minimumSize
+ dx="100"
+ dy="30"/>
+ <children
+ xsi:type="gmfgraph:Label"
+ name="DataTypeFixedNameLabel"
+ text="&lt;&lt;datatype>>"/>
+ <children
+ xsi:type="gmfgraph:Label"
+ name="DataTypeNameLabel"
+ text="&lt;..>"/>
+ <children
+ xsi:type="gmfgraph:Label"
+ name="DataTypeJavaLabel"
+ text=""/>
+ </actualFigure>
+ <accessors
+ figure="//@figures.0/@descriptors.4/@actualFigure/@children.1"/>
+ <accessors
+ figure="//@figures.0/@descriptors.4/@actualFigure/@children.2"/>
+ </descriptors>
+ <descriptors
+ name="AnnotationFigure">
+ <actualFigure
+ xsi:type="gmfgraph:Rectangle"
+ name="">
+ <layout
+ xsi:type="gmfgraph:FlowLayout"
+ vertical="true"
+ matchMinorSize="true"
+ forceSingleLine="true"
+ majorAlignment="CENTER"
+ minorAlignment="CENTER"
+ majorSpacing="0"
+ minorSpacing="0"/>
+ <minimumSize
+ dx="100"
+ dy="30"/>
+ <children
+ xsi:type="gmfgraph:Label"
+ name="AnnotationNameLabel"
+ text="&lt;..>"/>
+ </actualFigure>
+ <accessors
+ figure="//@figures.0/@descriptors.5/@actualFigure/@children.0"/>
+ </descriptors>
+ <descriptors
+ name="ClassFigure">
+ <actualFigure
+ xsi:type="gmfgraph:Rectangle"
+ name="">
+ <layout
+ xsi:type="gmfgraph:FlowLayout"
+ vertical="true"
+ matchMinorSize="true"
+ forceSingleLine="true"
+ majorAlignment="CENTER"
+ minorAlignment="CENTER"
+ majorSpacing="0"
+ minorSpacing="0"/>
+ <minimumSize
+ dx="100"
+ dy="30"/>
+ <children
+ xsi:type="gmfgraph:Label"
+ name="ClassNameLabel"
+ text="&lt;..>"/>
+ </actualFigure>
+ <accessors
+ figure="//@figures.0/@descriptors.6/@actualFigure/@children.0"/>
+ </descriptors>
+ </figures>
+ <nodes
+ name="Package"
+ figure="PackageFigure"/>
+ <nodes
+ name="Enumeration"
+ figure="EnumerationFigure"/>
+ <nodes
+ name="DataType"
+ figure="DataTypeFigure"/>
+ <nodes
+ name="Annotation"
+ figure="AnnotationFigure"/>
+ <nodes
+ name="Class"
+ figure="ClassFigure"/>
+ <compartments
+ name="attributes"
+ figure="RectangleFigure"
+ collapsible="true"/>
+ <compartments
+ name="operations"
+ figure="RectangleFigure"
+ collapsible="true"/>
+ <compartments
+ name="details"
+ figure="RectangleFigure"
+ collapsible="true"/>
+ <compartments
+ name="literals"
+ figure="RectangleFigure"
+ collapsible="true"/>
+ <compartments
+ name="contents"
+ figure="PackageFigure"
+ collapsible="true"
+ accessor="//@figures.0/@descriptors.2/@accessors.0"/>
+ <labels
+ name="MultiplicityLabel"
+ figure="LabelFigure"
+ elementIcon="false">
+ <facets
+ xsi:type="gmfgraph:AlignmentFacet"/>
+ <facets
+ xsi:type="gmfgraph:LabelOffsetFacet"
+ x="10"
+ y="10"/>
+ </labels>
+ <labels
+ name="EReferenceNameLabel"
+ figure="LabelFigure"
+ elementIcon="false">
+ <facets
+ xsi:type="gmfgraph:AlignmentFacet"/>
+ <facets
+ xsi:type="gmfgraph:LabelOffsetFacet"
+ x="-10"
+ y="-10"/>
+ </labels>
+ <labels
+ name="PackageNameLabel"
+ figure="PackageFigure"
+ accessor="//@figures.0/@descriptors.2/@accessors.1"/>
+ <labels
+ name="EnumerationNameLabel"
+ figure="EnumerationFigure"
+ accessor="//@figures.0/@descriptors.3/@accessors.0"/>
+ <labels
+ name="DataTypeNameLabel"
+ figure="DataTypeFigure"
+ accessor="//@figures.0/@descriptors.4/@accessors.0"/>
+ <labels
+ name="DataTypeJavaLabel"
+ figure="DataTypeFigure"
+ elementIcon="false"
+ accessor="//@figures.0/@descriptors.4/@accessors.1"/>
+ <labels
+ name="AnnotationNameLabel"
+ figure="AnnotationFigure"
+ accessor="//@figures.0/@descriptors.5/@accessors.0"/>
+ <labels
+ name="ClassNameLabel"
+ figure="ClassFigure"
+ accessor="//@figures.0/@descriptors.6/@accessors.0"/>
+</gmfgraph:Canvas>
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfmap b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfmap
new file mode 100644
index 0000000..a7ffc52
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmfmap
@@ -0,0 +1,339 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gmfmap:Mapping 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"
+ xmlns:gmfmap="http://www.eclipse.org/gmf/2006/mappings"
+ xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
+ <nodes>
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage/eClassifiers"/>
+ <ownedChild>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping">
+ <diagramLabel
+ href="ecore.gmfgraph#ClassNameLabel"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ENamedElement/name"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.0/@tools.1"/>
+ <diagramNode
+ href="ecore.gmfgraph#Class"/>
+ <children
+ compartment="//@nodes.0/@ownedChild/@compartments.0">
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass/eStructuralFeatures"/>
+ <childrenFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass/eAttributes"/>
+ <ownedChild>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EAttribute"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <diagramLabel
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/basic.gmfgraph#Label"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ENamedElement/name"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.0/@tools.7"/>
+ <diagramNode
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/basic.gmfgraph#Label"/>
+ </ownedChild>
+ </children>
+ <children
+ compartment="//@nodes.0/@ownedChild/@compartments.1">
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass/eOperations"/>
+ <ownedChild>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EOperation"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping"
+ viewPattern=""
+ editorPattern=""
+ editPattern="">
+ <diagramLabel
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/basic.gmfgraph#Label"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ENamedElement/name"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.0/@tools.6"/>
+ <diagramNode
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/basic.gmfgraph#Label"/>
+ </ownedChild>
+ </children>
+ <compartments
+ children="//@nodes.0/@ownedChild/@children.0">
+ <compartment
+ href="ecore.gmfgraph#attributes"/>
+ </compartments>
+ <compartments
+ children="//@nodes.0/@ownedChild/@children.1">
+ <compartment
+ href="ecore.gmfgraph#operations"/>
+ </compartments>
+ </ownedChild>
+ </nodes>
+ <nodes>
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage/eSubpackages"/>
+ <ownedChild
+ relatedDiagrams="//@diagram">
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping">
+ <diagramLabel
+ href="ecore.gmfgraph#PackageNameLabel"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ENamedElement/name"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.0/@tools.0"/>
+ <diagramNode
+ href="ecore.gmfgraph#Package"/>
+ <children
+ compartment="//@nodes.1/@ownedChild/@compartments.0"
+ referencedChild="//@nodes.0/@ownedChild">
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage/eClassifiers"/>
+ </children>
+ <children
+ compartment="//@nodes.1/@ownedChild/@compartments.0"
+ referencedChild="//@nodes.3/@ownedChild">
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage/eClassifiers"/>
+ </children>
+ <children
+ compartment="//@nodes.1/@ownedChild/@compartments.0"
+ referencedChild="//@nodes.4/@ownedChild">
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage/eClassifiers"/>
+ </children>
+ <compartments
+ children="//@nodes.1/@ownedChild/@children.2 //@nodes.1/@ownedChild/@children.1 //@nodes.1/@ownedChild/@children.0">
+ <compartment
+ href="ecore.gmfgraph#contents"/>
+ </compartments>
+ </ownedChild>
+ </nodes>
+ <nodes>
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EModelElement/eAnnotations"/>
+ <ownedChild>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EAnnotation"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping">
+ <diagramLabel
+ href="ecore.gmfgraph#AnnotationNameLabel"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EAnnotation/source"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.0/@tools.4"/>
+ <diagramNode
+ href="ecore.gmfgraph#Annotation"/>
+ <children
+ compartment="//@nodes.2/@ownedChild/@compartments.0">
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EAnnotation/details"/>
+ <ownedChild>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EStringToStringMapEntry"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping"
+ viewPattern=""
+ editPattern="">
+ <diagramLabel
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/basic.gmfgraph#Label"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EStringToStringMapEntry/key"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.0/@tools.9"/>
+ <diagramNode
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/basic.gmfgraph#Label"/>
+ </ownedChild>
+ </children>
+ <compartments
+ children="//@nodes.2/@ownedChild/@children.0">
+ <compartment
+ href="ecore.gmfgraph#details"/>
+ </compartments>
+ </ownedChild>
+ </nodes>
+ <nodes>
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage/eClassifiers"/>
+ <ownedChild>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EDataType"/>
+ <domainSpecialization
+ body="not oclIsKindOf(ecore::EEnum)"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping">
+ <diagramLabel
+ href="ecore.gmfgraph#DataTypeNameLabel"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ENamedElement/name"/>
+ </labelMappings>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping"
+ readOnly="true"
+ viewPattern="&lt;&lt;javaclass>> {0}">
+ <diagramLabel
+ href="ecore.gmfgraph#DataTypeJavaLabel"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClassifier/instanceClassName"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.0/@tools.2"/>
+ <diagramNode
+ href="ecore.gmfgraph#DataType"/>
+ </ownedChild>
+ </nodes>
+ <nodes>
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage/eClassifiers"/>
+ <ownedChild>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EEnum"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping">
+ <diagramLabel
+ href="ecore.gmfgraph#EnumerationNameLabel"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ENamedElement/name"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.0/@tools.3"/>
+ <diagramNode
+ href="ecore.gmfgraph#Enumeration"/>
+ <children
+ compartment="//@nodes.4/@ownedChild/@compartments.0">
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EEnum/eLiterals"/>
+ <ownedChild>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EEnumLiteral"/>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping">
+ <diagramLabel
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/basic.gmfgraph#Label"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ENamedElement/name"/>
+ </labelMappings>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.0/@tools.8"/>
+ <diagramNode
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/basic.gmfgraph#Label"/>
+ </ownedChild>
+ </children>
+ <compartments
+ children="//@nodes.4/@ownedChild/@children.0">
+ <compartment
+ href="ecore.gmfgraph#literals"/>
+ </compartments>
+ </ownedChild>
+ </nodes>
+ <links>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.1/@tools.2"/>
+ <diagramLink
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/classDiagram.gmfgraph#DashedConnection"/>
+ <linkMetaFeature
+ xsi:type="ecore:EReference"
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EAnnotation/references"/>
+ </links>
+ <links>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EReference"/>
+ <domainSpecialization
+ body="not containment and not container"/>
+ <domainInitializer
+ xsi:type="gmfmap:FeatureSeqInitializer">
+ <initializers
+ xsi:type="gmfmap:FeatureValueSpec"
+ body="false">
+ <feature
+ xsi:type="ecore:EAttribute"
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EReference/containment"/>
+ </initializers>
+ </domainInitializer>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping">
+ <diagramLabel
+ href="ecore.gmfgraph#EReferenceNameLabel"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ENamedElement/name"/>
+ </labelMappings>
+ <labelMappings
+ xsi:type="gmfmap:FeatureLabelMapping"
+ viewPattern="{0}..{1,choice,-1#*|-1&lt;{1}}"
+ editPattern="{0}..{1}">
+ <diagramLabel
+ href="ecore.gmfgraph#MultiplicityLabel"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ETypedElement/lowerBound"/>
+ <features
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ETypedElement/upperBound"/>
+ </labelMappings>
+ <containmentFeature
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass/eStructuralFeatures"/>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.1/@tools.0"/>
+ <diagramLink
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/classDiagram.gmfgraph#SolidConnectionWDstArrow"/>
+ <linkMetaFeature
+ xsi:type="ecore:EReference"
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//ETypedElement/eType"/>
+ <creationConstraints>
+ <targetEnd
+ body="self.oclIsKindOf(ecore::EClass)"/>
+ </creationConstraints>
+ </links>
+ <links>
+ <tool
+ xsi:type="gmftool:CreationTool"
+ href="ecore.gmftool#//@palette/@tools.1/@tools.1"/>
+ <diagramLink
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/classDiagram.gmfgraph#SolidConnectionWDstClosedArrow"/>
+ <linkMetaFeature
+ xsi:type="ecore:EReference"
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EClass/eSuperTypes"/>
+ <creationConstraints>
+ <targetEnd
+ body="self &lt;> oppositeEnd and not oppositeEnd.eSuperTypes->includes(self) and not self.eAllSuperTypes->includes(oppositeEnd)"/>
+ </creationConstraints>
+ </links>
+ <diagram>
+ <diagramCanvas
+ href="../../../plugin/org.eclipse.gmf.graphdef/models/basic.gmfgraph#Surface"/>
+ <domainModel
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#/"/>
+ <domainMetaElement
+ href="../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EPackage"/>
+ <palette
+ href="ecore.gmftool#//@palette"/>
+ </diagram>
+</gmfmap:Mapping>
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmftool b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmftool
new file mode 100644
index 0000000..9e882d0
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.gmftool
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gmftool:ToolRegistry xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:gmftool="http://www.eclipse.org/gmf/2005/ToolDefinition">
+ <palette
+ title="Ecore Palette"
+ description="Ecore Diagram Palette">
+ <tools
+ xsi:type="gmftool:ToolGroup"
+ title="Objects"
+ description="Diagram Nodes"
+ collapsible="true">
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EPackage"
+ description="Create Package">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EPackage.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EPackage_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EClass"
+ description="Create Class">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EClass.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EClass_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EDataType"
+ description="Create DataType">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EDataType.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EDataType_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EEnum"
+ description="Create Enumeration">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EENum.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EENum_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EAnnotation"
+ description="Create Annotation">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EAnnotation.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EAnnotation_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:PaletteSeparator"/>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EOperation"
+ description="Create Operation">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EOperation.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EOperation_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EAttribute"
+ description="Create Attribute">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EAttribute.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EAttribute_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EEnumLiteral"
+ description="Create Enumeration literal">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EEnumLiteral.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EEnumLiteral_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="Details Entry"
+ description="Create Annotation details">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EStringToStringMapEntry.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EStringToStringMapEntry_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ </tools>
+ <tools
+ xsi:type="gmftool:ToolGroup"
+ title="Connections"
+ description="Links"
+ collapsible="true">
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EReference"
+ description="Create Association link">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EReference.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\EReference_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="Inheritance"
+ description="Create Generalization link">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\Inheritance.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\Inheritance_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ <tools
+ xsi:type="gmftool:CreationTool"
+ title="EAnnotation link"
+ description="Create Annotation reference link">
+ <smallIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\AnnotationLink.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ <largeIcon
+ xsi:type="gmftool:BundleImage"
+ path="icons\AnnotationLink_24.gif"
+ bundle="org.eclipse.emf.ecoretools.diagram"/>
+ </tools>
+ </tools>
+ </palette>
+</gmftool:ToolRegistry>
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.trace b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.trace
new file mode 100644
index 0000000..cf6d1e5
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/models/ecore.trace
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<trace:TraceModel xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:trace="http://www.eclipse.org/gmf/2006/Trace">
+ <nodeTraces
+ visualID="2001"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EClass') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and _containmentMF_.name = 'eClassifiers')">
+ <nodeLabelTraces
+ visualID="5001"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7001"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7002"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7003"
+ queryText="true"/>
+ </nodeTraces>
+ <nodeTraces
+ visualID="2002"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and _containmentMF_.name = 'eSubpackages')">
+ <nodeLabelTraces
+ visualID="5002"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7004"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7005"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7006"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7007"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7008"
+ queryText="true"/>
+ </nodeTraces>
+ <nodeTraces
+ visualID="2003"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EAnnotation') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EModelElement') and _containmentMF_.name = 'eAnnotations')">
+ <nodeLabelTraces
+ visualID="5003"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7009"
+ queryText="true"/>
+ </nodeTraces>
+ <nodeTraces
+ visualID="2004"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EDataType') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and _containmentMF_.name = 'eClassifiers')">
+ <nodeLabelTraces
+ visualID="5004"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7010"
+ queryText="true"/>
+ </nodeTraces>
+ <nodeTraces
+ visualID="2005"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EEnum') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and _containmentMF_.name = 'eClassifiers')">
+ <nodeLabelTraces
+ visualID="5005"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7011"
+ queryText="true"/>
+ <compartmentTraces
+ visualID="7012"
+ queryText="true"/>
+ </nodeTraces>
+ <childNodeTraces
+ visualID="3001"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EAttribute') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EClass') and _containmentMF_.name = 'eStructuralFeatures') and ( let _childMF_:ecore::EStructuralFeature = modelFacet.childMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _childMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EClass') and _childMF_.name = 'eAttributes')"/>
+ <childNodeTraces
+ visualID="3002"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EOperation') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EClass') and _containmentMF_.name = 'eOperations')"/>
+ <childNodeTraces
+ visualID="3003"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EAnnotation') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EModelElement') and _containmentMF_.name = 'eAnnotations')"/>
+ <childNodeTraces
+ visualID="3004"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EClass') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and _containmentMF_.name = 'eClassifiers')"/>
+ <childNodeTraces
+ visualID="3005"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and _containmentMF_.name = 'eSubpackages')"/>
+ <childNodeTraces
+ visualID="3006"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EDataType') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and _containmentMF_.name = 'eClassifiers')"/>
+ <childNodeTraces
+ visualID="3007"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EEnum') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EPackage') and _containmentMF_.name = 'eClassifiers')"/>
+ <childNodeTraces
+ visualID="3008"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EStringToStringMapEntry') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EAnnotation') and _containmentMF_.name = 'details')"/>
+ <childNodeTraces
+ visualID="3009"
+ queryText="(let _eClass_:ecore::EClass = modelFacet.metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EEnumLiteral') and (let _containmentMF_:ecore::EStructuralFeature = modelFacet.containmentMetaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _containmentMF_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EEnum') and _containmentMF_.name = 'eLiterals')"/>
+ <linkTraces
+ visualID="4001"
+ queryText="modelFacet.oclIsKindOf(gmfgen::FeatureLinkModelFacet) and (let _feature_:ecore::EStructuralFeature = modelFacet.oclAsType(gmfgen::FeatureLinkModelFacet).metaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _feature_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EAnnotation') and _feature_.name = 'references')"/>
+ <linkTraces
+ visualID="4002"
+ queryText="modelFacet.oclIsKindOf(gmfgen::TypeLinkModelFacet) and (let _eClass_:ecore::EClass = modelFacet.oclAsType(gmfgen::TypeLinkModelFacet).metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EReference')">
+ <linkLabelTraces
+ visualID="6001"
+ queryText="true"/>
+ <linkLabelTraces
+ visualID="6003"
+ queryText="true"/>
+ </linkTraces>
+ <linkTraces
+ visualID="4003"
+ queryText="modelFacet.oclIsKindOf(gmfgen::TypeLinkModelFacet) and (let _eClass_:ecore::EClass = modelFacet.oclAsType(gmfgen::TypeLinkModelFacet).metaClass.ecoreClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EReference')">
+ <linkLabelTraces
+ visualID="6002"
+ queryText="true"/>
+ <linkLabelTraces
+ visualID="6004"
+ queryText="true"/>
+ </linkTraces>
+ <linkTraces
+ visualID="4004"
+ queryText="modelFacet.oclIsKindOf(gmfgen::FeatureLinkModelFacet) and (let _feature_:ecore::EStructuralFeature = modelFacet.oclAsType(gmfgen::FeatureLinkModelFacet).metaFeature.ecoreFeature in (let _eClass_:ecore::EClass = _feature_.eContainingClass in _eClass_.ePackage.nsURI = 'http://www.eclipse.org/emf/2002/Ecore' and _eClass_.name = 'EClass') and _feature_.name = 'eSuperTypes')"/>
+</trace:TraceModel>
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/plugin.properties b/plugins/org.eclipse.emf.ecoretools.diagram/plugin.properties
new file mode 100644
index 0000000..f6485b7
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/plugin.properties
@@ -0,0 +1,59 @@
+pluginName=Ecore Diagram Plugin
+providerName=Eclipse.org
+
+preferences.general=Ecore Diagram
+preferences.appearance=Appearance
+preferences.connections=Connections
+preferences.printing=Printing
+preferences.rulersAndGrid=Rulers & Grid
+preferences.pathmaps=Path Maps
+
+editorName=Ecore Diagram Editing
+context.description=Ecore Diagram Editing
+context.name=In Ecore Diagram Editor
+newWizardName=Ecore Diagram
+newWizardDesc=Creates Ecore diagram.
+
+initDiagramActionLabel=Initialize ecorediag diagram file
+createShortcutActionLabel=Create Shortcut...
+loadResourceActionLabel=Load Resource...
+
+
+navigatorContentName=*.ecorediag diagram contents
+domainNavigatorContentName=*.ecore model contents
+update.diagram.name=Update Ecore diagram
+update.diagram.description=Perform Ecore diagram update
+
+
+# Property Sheet
+tab.appearance=Appearance
+tab.diagram=Rulers & Grid
+tab.all=All
+
+# Preferences
+preference.page.title.org.eclipse.emf.ecoretools.diagram.general=Ecore Tools Diagram
+preference.page.title.org.eclipse.emf.ecoretools.diagram.appearance=Appearance
+preference.page.title.org.eclipse.emf.ecoretools.diagram.connections=Connections
+preference.page.title.org.eclipse.emf.ecoretools.diagram.printing=Printing
+preference.page.title.org.eclipse.emf.ecoretools.diagram.rulersAndGrid=Rulers And Grid
+preference.page.title.org.eclipse.emf.ecoretools.diagram.pathmaps=Pathmaps
+
+
+# Providers
+metatype.name.EPackage_79=Undefined
+metatype.name.EClass_1001=EClass
+metatype.name.EPackage_1002=EPackage
+metatype.name.EAnnotation_1003=EAnnotation
+metatype.name.EDataType_1004=EDataType
+metatype.name.EEnum_1005=EEnum
+metatype.name.EAttribute_2001=EAttribute
+metatype.name.EOperation_2002=EOperation
+metatype.name.EClass_2003=EClass
+metatype.name.EDataType_2004=EDataType
+metatype.name.EEnum_2005=EEnum
+metatype.name.EEnumLiteral_2006=EEnumLiteral
+metatype.name.EStringToStringMapEntry_2007=EStringToStringMapEntry
+metatype.name.EAnnotationReferences_3001=Undefined
+metatype.name.EReference_3002=EReference
+metatype.name.EClassESuperTypes_3003=Undefined
+metatype.name.EReferenceEOpposite_3004=Undefined
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/plugin.xml b/plugins/org.eclipse.emf.ecoretools.diagram/plugin.xml
new file mode 100644
index 0000000..8e60efa
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/plugin.xml
@@ -0,0 +1,751 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <!--Shared Editing Domain -->
+
+ <extension point="org.eclipse.emf.transaction.editingDomains">
+ <editingDomain
+ factory="org.eclipse.emf.workspace.WorkspaceEditingDomainFactory"
+ id="org.eclipse.emf.ecoretools.diagram.EditingDomain"/>
+ </extension>
+
+ <extension point="org.eclipse.team.core.fileTypes">
+ <?gmfgen generated="true"?>
+ <fileTypes
+ type="text"
+ extension="ecorediag">
+ </fileTypes>
+ </extension>
+
+ <extension point="org.eclipse.emf.ecore.extension_parser">
+ <?gmfgen generated="true"?>
+ <parser
+ type="ecorediag"
+ class="org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory">
+ </parser>
+ </extension>
+
+ <extension point="org.eclipse.ui.editors">
+ <?gmfgen generated="true"?>
+ <editor
+ id="org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorID"
+ name="%editorName"
+ icon="icons/Ecore.gif"
+ extensions="ecorediag"
+ default="true"
+ class="org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor"
+ matchingStrategy="org.eclipse.emf.ecoretools.diagram.part.EcoreMatchingStrategy"
+ contributorClass="org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramActionBarContributor">
+ </editor>
+ </extension>
+
+ <extension point="org.eclipse.ui.contexts">
+ <?gmfgen generated="true"?>
+ <context
+ description="%context.description"
+ id="org.eclipse.emf.ecoretools.diagram.ui.diagramContext"
+ name="%context.name"
+ parentId="org.eclipse.gmf.runtime.diagram.ui.diagramContext">
+ </context>
+ </extension>
+
+ <extension point="org.eclipse.ui.newWizards">
+ <?gmfgen generated="true"?>
+ <wizard
+ name="%newWizardName"
+ icon="icons/Ecore.gif"
+ category="org.eclipse.emf.ecoretools.diagram"
+ class="org.eclipse.emf.ecoretools.diagram.part.EcoreCreationWizard"
+ id="org.eclipse.emf.ecoretools.diagram.part.EcoreCreationWizardID">
+ <description>%newWizardDesc</description>
+ </wizard>
+ <category
+ id="org.eclipse.emf.ecoretools.diagram"
+ name="Ecore Tools">
+ </category>
+ </extension>
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <?gmfgen generated="true"?>
+ <objectContribution
+ adaptable="false"
+ id="org.eclipse.emf.ecoretools.diagram.CreateShortcut"
+ objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart">
+ <action
+ class="org.eclipse.emf.ecoretools.diagram.part.EcoreCreateShortcutAction"
+ enablesFor="1"
+ id="org.eclipse.emf.ecoretools.diagram.CreateShortcutAction"
+ label="%createShortcutActionLabel"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
+ <objectContribution
+ adaptable="false"
+ id="org.eclipse.emf.ecoretools.diagram.LoadResource"
+ objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart">
+ <action
+ class="org.eclipse.emf.ecoretools.diagram.part.EcoreLoadResourceAction"
+ enablesFor="1"
+ id="org.eclipse.emf.ecoretools.diagram.LoadResourceAction"
+ label="%loadResourceActionLabel"
+ menubarPath="additions">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <?gmfgen generated="true"?>
+ <objectContribution
+ id="org.eclipse.emf.ecoretools.diagram.InitDiagram"
+ nameFilter="*.ecore"
+ objectClass="org.eclipse.core.resources.IFile">
+ <action
+ label="%initDiagramActionLabel"
+ class="org.eclipse.emf.ecoretools.diagram.part.EcoreInitDiagramFileAction"
+ menubarPath="additions"
+ enablesFor="1"
+ id="org.eclipse.emf.ecoretools.diagram.InitDiagramAction">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.action.globalActionHandlerProviders">
+ <?gmfgen generated="true"?>
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramGlobalActionHandlerProvider"
+ id="EcorePresentation">
+ <Priority name="Lowest"/>
+ <ViewId id="org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorID">
+ <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>
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.providers.ide.providers.DiagramIDEGlobalActionHandlerProvider"
+ id="EcorePresentationIDE">
+ <Priority name="Lowest"/>
+ <ViewId id="org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorID">
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="bookmark"/>
+ </ElementType>
+ </ViewId>
+ </GlobalActionHandlerProvider>
+ <GlobalActionHandlerProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.render.providers.DiagramUIRenderGlobalActionHandlerProvider"
+ id="EcoreRender">
+ <Priority name="Lowest"/>
+ <ViewId id="org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorID">
+ <ElementType class="org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart">
+ <GlobalActionId actionId="cut"/>
+ <GlobalActionId actionId="copy"/>
+ <GlobalActionId actionId="paste"/>
+ </ElementType>
+ </ViewId>
+ </GlobalActionHandlerProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
+ <?gmfgen generated="false"?>
+ <contributionItemProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContributionItemProvider"
+ checkPluginLoaded="false">
+ <Priority name="Low"/>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart"/>
+ <popupAction path="/editGroup" id="deleteFromModelAction"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ </popupContribution>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceNameEditPart"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
+ </popupContribution>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceLowerBoundUpperBoundEditPart"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
+ </popupContribution>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceName2EditPart"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
+ </popupContribution>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceLowerBoundUpperBound2EditPart"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
+ </popupContribution>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EClassESuperTypesEditPart"/>
+ <popupAction path="/editGroup" id="deleteFromModelAction"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ </popupContribution>
+ <popupContribution
+ class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria
+ objectClass="org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart">
+ </popupStructuredContributionCriteria>
+ <popupPredefinedItem
+ id="deleteFromModelAction"
+ remove="true">
+ </popupPredefinedItem>
+ <popupPredefinedItem
+ id="deleteFromDiagramAction"
+ remove="true">
+ </popupPredefinedItem>
+ </popupContribution>
+ </contributionItemProvider>
+ </extension>
+
+ <extension point="org.eclipse.core.runtime.preferences">
+ <?gmfgen generated="true"?>
+ <initializer class="org.eclipse.emf.ecoretools.diagram.preferences.DiagramPreferenceInitializer"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.preferencePages">
+ <?gmfgen generated="true"?>
+ <page
+ id="org.eclipse.emf.ecore.ediagram.general"
+ name="%preference.page.title.org.eclipse.emf.ecore.ediagram.general"
+ class="org.eclipse.emf.ecoretools.diagram.preferences.DiagramGeneralPreferencePage">
+ </page>
+ <page
+ id="org.eclipse.emf.ecoretools.diagram.appearance"
+ name="%preference.page.title.org.eclipse.emf.ecoretools.diagram.appearance"
+ category="org.eclipse.emf.ecore.ediagram.general"
+ class="org.eclipse.emf.ecoretools.diagram.preferences.DiagramAppearancePreferencePage">
+ </page>
+ <page
+ id="org.eclipse.emf.ecoretools.diagram.connections"
+ name="%preference.page.title.org.eclipse.emf.ecoretools.diagram.connections"
+ category="org.eclipse.emf.ecore.ediagram.general"
+ class="org.eclipse.emf.ecoretools.diagram.preferences.DiagramConnectionsPreferencePage">
+ </page>
+ <page
+ id="org.eclipse.emf.ecoretools.diagram.printing"
+ name="%preference.page.title.org.eclipse.emf.ecoretools.diagram.printing"
+ category="org.eclipse.emf.ecore.ediagram.general"
+ class="org.eclipse.emf.ecoretools.diagram.preferences.DiagramPrintingPreferencePage">
+ </page>
+ <page
+ id="org.eclipse.emf.ecoretools.diagram.rulersAndGrid"
+ name="%preference.page.title.org.eclipse.emf.ecoretools.diagram.rulersAndGrid"
+ category="org.eclipse.emf.ecore.ediagram.general"
+ class="org.eclipse.emf.ecoretools.diagram.preferences.DiagramRulersAndGridPreferencePage">
+ </page>
+ <page
+ id="org.eclipse.emf.ecoretools.diagram.pathmaps"
+ name="%preference.page.title.org.eclipse.emf.ecoretools.diagram.pathmaps"
+ category="org.eclipse.emf.ecore.ediagram.general"
+ class="org.eclipse.gmf.runtime.emf.ui.preferences.PathmapsPreferencePage">
+ </page>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
+ <?gmfgen generated="false"?>
+ <propertyContributor
+ contributorId="org.eclipse.emf.ecoretools.diagram"
+ labelProvider="org.eclipse.emf.ecoretools.diagram.sheet.EcoreSheetLabelProvider"
+ typeMapper="org.eclipse.emf.ecoretools.diagram.sheet.TabbedPropertiesTypeMapper">
+ <propertyCategory category="domain"/>
+ <propertyCategory category="visual"/>
+ <propertyCategory category="extra"/>
+ <propertyCategory category="advanced"/>
+ </propertyContributor>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
+ <?gmfgen generated="false"?>
+ <propertyTabs contributorId="org.eclipse.emf.ecoretools.diagram">
+ <propertyTab
+ category="visual"
+ id="property.tab.AppearancePropertySection"
+ label="%tab.appearance"/>
+ <propertyTab
+ category="visual"
+ id="property.tab.DiagramPropertySection"
+ label="%tab.diagram"/>
+ <propertyTab
+ category="advanced"
+ id="property.tab.AdvancedPropertySection"
+ label="Advanced"/>
+ </propertyTabs>
+ </extension>
+
+ <extension point="org.eclipse.ui.views.properties.tabbed.propertySections">
+ <?gmfgen generated="false"?>
+ <propertySections contributorId="org.eclipse.emf.ecoretools.diagram">
+ <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>
+ <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>
+ <propertySection
+ id="property.section.EcorePropertySection"
+ tab="property.tab.AdvancedPropertySection"
+ class="org.eclipse.emf.ecoretools.diagram.sheet.EcorePropertySection">
+ <input type="org.eclipse.emf.ecore.EObject"/>
+ <input type="org.eclipse.emf.ecoretools.diagram.navigator.EcoreAbstractNavigatorItem"/>
+ </propertySection>
+ </propertySections>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.diagram.core.viewProviders">
+ <?gmfgen generated="true"?>
+ <viewProvider class="org.eclipse.emf.ecoretools.diagram.providers.EcoreViewProvider">
+ <Priority name="Lowest"/>
+ <context viewClass="org.eclipse.gmf.runtime.notation.Diagram" semanticHints="Ecore"/>
+ <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">
+ <?gmfgen generated="true"?>
+ <editpartProvider class="org.eclipse.emf.ecoretools.diagram.providers.EcoreEditPartProvider">
+ <Priority name="Lowest"/>
+ </editpartProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.emf.ui.modelingAssistantProviders">
+ <?gmfgen generated="true"?>
+ <modelingAssistantProvider class="org.eclipse.emf.ecoretools.diagram.providers.EcoreModelingAssistantProvider">
+ <Priority name="Lowest"/>
+ </modelingAssistantProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.iconProviders">
+ <?gmfgen generated="true"?>
+ <IconProvider class="org.eclipse.emf.ecoretools.diagram.providers.EcoreIconProvider">
+ <Priority name="Low"/>
+ </IconProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.parserProviders">
+ <?gmfgen generated="true"?>
+ <ParserProvider class="org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider">
+ <Priority name="Lowest"/>
+ </ParserProvider>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypes">
+ <?gmfgen generated="true"?>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EPackage_79"
+ name="%metatype.name.EPackage_79"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EPackage"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EPackageEditHelper">
+ <param name="semanticHint" value="79"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EClass_1001"
+ name="%metatype.name.EClass_1001"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EClass"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EClassEditHelper">
+ <param name="semanticHint" value="1001"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <specializationType
+ id="org.eclipse.emf.ecoretools.diagram.EPackage_1002"
+ name="%metatype.name.EPackage_1002"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
+ <specializes id="org.eclipse.emf.ecoretools.diagram.EPackage_79"/>
+ <param name="semanticHint" value="1002"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EAnnotation_1003"
+ name="%metatype.name.EAnnotation_1003"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EAnnotation"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EAnnotationEditHelper">
+ <param name="semanticHint" value="1003"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <specializationType
+ id="org.eclipse.emf.ecoretools.diagram.EDataType_1004"
+ name="%metatype.name.EDataType_1004"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
+ <specializes id="org.eclipse.emf.ecoretools.diagram.EDataType_2004"/>
+ <param name="semanticHint" value="1004"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <specializationType
+ id="org.eclipse.emf.ecoretools.diagram.EEnum_1005"
+ name="%metatype.name.EEnum_1005"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
+ <specializes id="org.eclipse.emf.ecoretools.diagram.EEnum_2005"/>
+ <param name="semanticHint" value="1005"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EAttribute_2001"
+ name="%metatype.name.EAttribute_2001"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EAttribute"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EAttributeEditHelper">
+ <param name="semanticHint" value="2001"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EOperation_2002"
+ name="%metatype.name.EOperation_2002"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EOperation"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EOperationEditHelper">
+ <param name="semanticHint" value="2002"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <specializationType
+ id="org.eclipse.emf.ecoretools.diagram.EClass_2003"
+ name="%metatype.name.EClass_2003"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
+ <specializes id="org.eclipse.emf.ecoretools.diagram.EClass_1001"/>
+ <param name="semanticHint" value="2003"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EDataType_2004"
+ name="%metatype.name.EDataType_2004"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EDataType"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EDataTypeEditHelper">
+ <param name="semanticHint" value="2004"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EEnum_2005"
+ name="%metatype.name.EEnum_2005"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EEnum"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EEnumEditHelper">
+ <param name="semanticHint" value="2005"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EEnumLiteral_2006"
+ name="%metatype.name.EEnumLiteral_2006"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EEnumLiteral"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EEnumLiteralEditHelper">
+ <param name="semanticHint" value="2006"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EStringToStringMapEntry_2007"
+ name="%metatype.name.EStringToStringMapEntry_2007"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EStringToStringMapEntry"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EStringToStringMapEntryEditHelper">
+ <param name="semanticHint" value="2007"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <specializationType
+ id="org.eclipse.emf.ecoretools.diagram.EAnnotationReferences_3001"
+ name="%metatype.name.EAnnotationReferences_3001"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
+ <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
+ <param name="semanticHint" value="3001"/>
+ </specializationType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <metamodelType
+ id="org.eclipse.emf.ecoretools.diagram.EReference_3002"
+ name="%metatype.name.EReference_3002"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType"
+ eclass="EReference"
+ edithelper="org.eclipse.emf.ecoretools.diagram.edit.helpers.EReferenceEditHelper">
+ <param name="semanticHint" value="3002"/>
+ </metamodelType>
+ </metamodel>
+ <metamodel nsURI="http://www.eclipse.org/emf/2002/Ecore">
+ <specializationType
+ id="org.eclipse.emf.ecoretools.diagram.EClassESuperTypes_3003"
+ name="%metatype.name.EClassESuperTypes_3003"
+ kind="org.eclipse.gmf.runtime.emf.type.core.IHintedType">
+ <specializes id="org.eclipse.gmf.runtime.emf.type.core.null"/>
+ <param name="semanticHint" value="3003"/>
+ </specializationType>
+ </metamodel>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.emf.type.core.elementTypeBindings">
+ <?gmfgen generated="true"?>
+ <clientContext id="EcoreClientContext">
+ <enablement>
+ <test
+ property="org.eclipse.gmf.runtime.emf.core.editingDomain"
+ value="org.eclipse.emf.ecoretools.diagram.EditingDomain"/>
+ </enablement>
+ </clientContext>
+ <binding context="EcoreClientContext">
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EPackage_79"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EClass_1001"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EPackage_1002"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EAnnotation_1003"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EDataType_1004"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EEnum_1005"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EAttribute_2001"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EOperation_2002"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EClass_2003"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EDataType_2004"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EEnum_2005"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EEnumLiteral_2006"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EStringToStringMapEntry_2007"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EAnnotationReferences_3001"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EReference_3002"/>
+ <elementType ref="org.eclipse.emf.ecoretools.diagram.EClassESuperTypes_3003"/>
+ <advice ref="org.eclipse.gmf.runtime.diagram.core.advice.notationDepdendents"/>
+ </binding>
+ </extension>
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <?gmfgen generated="true"?>
+ <propertyTester
+ id="org.eclipse.emf.ecoretools.diagram.URIEditorInputPropertyTester"
+ type="org.eclipse.emf.common.ui.URIEditorInput"
+ namespace="org.eclipse.emf.ecoretools.diagram"
+ properties="isURIEditorInput"
+ class="org.eclipse.emf.ecoretools.diagram.part.EcoreUriEditorInputTester">
+ </propertyTester>
+ </extension>
+
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <?gmfgen generated="true"?>
+ <propertyTester
+ id="org.eclipse.emf.ecoretools.diagram.ShortcutPropertyTester"
+ type="org.eclipse.gmf.runtime.notation.View"
+ namespace="org.eclipse.emf.ecoretools.diagram"
+ properties="isShortcut"
+ class="org.eclipse.emf.ecoretools.diagram.part.EcoreShortcutPropertyTester">
+ </propertyTester>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.viewer">
+ <?gmfgen generated="true"?>
+ <viewerContentBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <contentExtension pattern="org.eclipse.emf.ecoretools.diagram.resourceContent"/>
+ <contentExtension pattern="org.eclipse.emf.ecoretools.diagram.domainResourceContent"/>
+ <contentExtension pattern="org.eclipse.emf.ecoretools.diagram.navigatorLinkHelper"/>
+ </includes>
+ </viewerContentBinding>
+ <viewerActionBinding viewerId="org.eclipse.ui.navigator.ProjectExplorer">
+ <includes>
+ <actionExtension pattern="org.eclipse.emf.ecoretools.diagram.navigatorActionProvider"/>
+ </includes>
+ </viewerActionBinding>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.navigatorContent">
+ <?gmfgen generated="true"?>
+ <navigatorContent
+ id="org.eclipse.emf.ecoretools.diagram.resourceContent"
+ name="%navigatorContentName"
+ priority="normal"
+ contentProvider="org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorContentProvider"
+ labelProvider="org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorLabelProvider"
+ icon="icons/Ecore.gif"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="ecorediag"/>
+ </and>
+ <instanceof value="org.eclipse.emf.ecoretools.diagram.navigator.EcoreAbstractNavigatorItem"/>
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="org.eclipse.emf.ecoretools.diagram.isShortcut"/>
+ </adapt>
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <or>
+ <instanceof value="org.eclipse.emf.ecoretools.diagram.navigator.EcoreAbstractNavigatorItem"/>
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="org.eclipse.emf.ecoretools.diagram.isShortcut"/>
+ </adapt>
+ </or>
+ </possibleChildren>
+ <commonSorter
+ id="org.eclipse.emf.ecoretools.diagram.navigatorSorter"
+ class="org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorSorter">
+ <parentExpression>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="ecorediag"/>
+ </and>
+ <instanceof value="org.eclipse.emf.ecoretools.diagram.navigator.EcoreAbstractNavigatorItem"/>
+ </or>
+ </parentExpression>
+ </commonSorter>
+ </navigatorContent>
+ <navigatorContent
+ id="org.eclipse.emf.ecoretools.diagram.domainResourceContent"
+ name="%domainNavigatorContentName"
+ priority="normal"
+ contentProvider="org.eclipse.emf.ecoretools.diagram.navigator.EcoreDomainNavigatorContentProvider"
+ labelProvider="org.eclipse.emf.ecoretools.diagram.navigator.EcoreDomainNavigatorLabelProvider"
+ icon="icons/Ecore.gif"
+ activeByDefault="true">
+ <triggerPoints>
+ <or>
+ <and>
+ <instanceof value="org.eclipse.core.resources.IFile"/>
+ <test property="org.eclipse.core.resources.extension" value="ecore"/>
+ </and>
+ <and>
+ <instanceof value="org.eclipse.emf.ecore.EObject"/>
+ <test property="org.eclipse.emf.ecoretools.diagram.isDomainModelElement"/>
+ </and>
+ </or>
+ </triggerPoints>
+ <possibleChildren>
+ <and>
+ <instanceof value="org.eclipse.emf.ecore.EObject"/>
+ <test property="org.eclipse.emf.ecoretools.diagram.isDomainModelElement"/>
+ </and>
+ </possibleChildren>
+ </navigatorContent>
+ <actionProvider
+ id="org.eclipse.emf.ecoretools.diagram.navigatorActionProvider"
+ class="org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorActionProvider">
+ <enablement>
+ <or>
+ <instanceof value="org.eclipse.emf.ecoretools.diagram.navigator.EcoreAbstractNavigatorItem"/>
+ <adapt type="org.eclipse.gmf.runtime.notation.View">
+ <test property="org.eclipse.emf.ecoretools.diagram.isShortcut"/>
+ </adapt>
+ </or>
+ </enablement>
+ </actionProvider>
+ </extension>
+
+ <extension point="org.eclipse.ui.navigator.linkHelper">
+ <?gmfgen generated="true"?>
+ <linkHelper
+ id="org.eclipse.emf.ecoretools.diagram.navigatorLinkHelper"
+ class="org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorLinkHelper">
+ <editorInputEnablement>
+ <and>
+ <instanceof value="org.eclipse.emf.common.ui.URIEditorInput"/>
+ <test property="org.eclipse.emf.ecoretools.diagram.isURIEditorInput"/>
+ </and>
+ </editorInputEnablement>
+ <selectionEnablement>
+ <instanceof value="org.eclipse.emf.ecoretools.diagram.navigator.EcoreAbstractNavigatorItem"/>
+ </selectionEnablement>
+ </linkHelper>
+ </extension>
+ <extension point="org.eclipse.ui.commands">
+ <?gmfgen generated="true"?>
+ <command
+ categoryId="org.eclipse.ui.category.edit"
+ defaultHandler="org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdateCommand"
+ description="%update.diagram.description"
+ id="org.eclipse.emf.ecoretools.diagram.updateDiagram"
+ name="%update.diagram.name"/>
+ </extension>
+
+ <extension point="org.eclipse.ui.bindings">
+ <?gmfgen generated="true"?>
+ <key
+ commandId="org.eclipse.emf.ecoretools.diagram.updateDiagram"
+ contextId="org.eclipse.emf.ecoretools.diagram.ui.diagramContext"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="F5"/>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.diagram.ui.decoratorProviders">
+ <?gmfgen generated="true"?>
+ <decoratorProvider class="org.eclipse.emf.ecoretools.diagram.providers.EcoreShortcutsDecoratorProvider">
+ <Priority name="Lowest"/>
+ </decoratorProvider>
+ </extension>
+
+ <extension point="org.eclipse.core.expressions.propertyTesters">
+ <?gmfgen generated="true"?>
+ <propertyTester
+ id="org.eclipse.emf.ecoretools.diagram.DomainModelElementPropertyTester"
+ type="org.eclipse.emf.ecore.EObject"
+ namespace="org.eclipse.emf.ecoretools.diagram"
+ properties="isDomainModelElement"
+ class="org.eclipse.emf.ecoretools.diagram.part.EcoreDomainModelElementTester">
+ </propertyTester>
+ </extension>
+
+ <extension point="org.eclipse.gmf.runtime.common.ui.services.action.contributionItemProviders">
+ <?gmfgen generated="true"?>
+ <contributionItemProvider
+ class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContributionItemProvider"
+ checkPluginLoaded="false">
+ <Priority name="Low"/>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart"/>
+ <popupAction path="/editGroup" id="deleteFromModelAction"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ </popupContribution>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceNameEditPart"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
+ </popupContribution>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceLowerBoundUpperBoundEditPart"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ <popupPredefinedItem id="deleteFromModelAction" remove="true"/>
+ </popupContribution>
+ <popupContribution class="org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextMenuProvider">
+ <popupStructuredContributionCriteria objectClass="org.eclipse.emf.ecoretools.diagram.edit.parts.EReference2EditPart"/>
+ <popupAction path="/editGroup" id="deleteFromModelAction"/>
+ <popupPredefinedItem id="deleteFromDiagramAction" remove="true"/>
+ </popupContribution>
+ </contributionItemProvider>
+ </extension>
+
+
+
+
+
+
+
+
+
+
+</plugin>
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationCreateCommand.java
new file mode 100644
index 0000000..26352fa
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationCreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAnnotationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EAnnotationCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEModelElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationReferencesCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationReferencesCreateCommand.java
new file mode 100644
index 0000000..a922137
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationReferencesCreateCommand.java
@@ -0,0 +1,96 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreBaseItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EAnnotationReferencesCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public EAnnotationReferencesCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && !(source instanceof EAnnotation)) {
+ return false;
+ }
+ if (target != null && !(target instanceof EObject)) {
+ 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
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEAnnotationReferences_3001(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ if (getSource() != null && getTarget() != null) {
+ getSource().getReferences().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+ /**
+ * @generated
+ */
+ protected EAnnotation getSource() {
+ return (EAnnotation) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getTarget() {
+ return (EObject) target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationReferencesReorientCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationReferencesReorientCommand.java
new file mode 100644
index 0000000..d532b62
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAnnotationReferencesReorientCommand.java
@@ -0,0 +1,159 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreBaseItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EAnnotationReferencesReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public EAnnotationReferencesReorientCommand(ReorientReferenceRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (!(referenceOwner instanceof EAnnotation)) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof EObject && newEnd instanceof EAnnotation)) {
+ return false;
+ }
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistEAnnotationReferences_3001(getNewSource(), getOldTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof EObject && newEnd instanceof EObject)) {
+ return false;
+ }
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistEAnnotationReferences_3001(getOldSource(), getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getReferences().remove(getOldTarget());
+ getNewSource().getReferences().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getOldSource().getReferences().remove(getOldTarget());
+ getOldSource().getReferences().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected EAnnotation getOldSource() {
+ return (EAnnotation) referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected EAnnotation getNewSource() {
+ return (EAnnotation) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getOldTarget() {
+ return (EObject) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getNewTarget() {
+ return (EObject) newEnd;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAttributeCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAttributeCreateCommand.java
new file mode 100644
index 0000000..0fd1f67
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EAttributeCreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAttributeCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EAttributeCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEClass();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClass2CreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClass2CreateCommand.java
new file mode 100644
index 0000000..3d6d0c2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClass2CreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClass2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EClass2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassCreateCommand.java
new file mode 100644
index 0000000..3ec3363
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassCreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EClassCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassESuperTypesCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassESuperTypesCreateCommand.java
new file mode 100644
index 0000000..ca9c134
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassESuperTypesCreateCommand.java
@@ -0,0 +1,95 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EClassESuperTypesCreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public EClassESuperTypesCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && !(source instanceof EClass)) {
+ return false;
+ }
+ if (target != null && !(target instanceof EClass)) {
+ return false;
+ }
+ if (getSource() == null) {
+ return true; // link creation is in progress; source is not
+ // defined yet
+ }
+ return true;
+ // target may be null here but it's possible to check constraint
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ if (getSource() != null && getTarget() != null) {
+ getSource().getESuperTypes().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getSource() {
+ return (EClass) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getTarget() {
+ return (EClass) target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassESuperTypesReorientCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassESuperTypesReorientCommand.java
new file mode 100644
index 0000000..f671f0a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EClassESuperTypesReorientCommand.java
@@ -0,0 +1,158 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EClassESuperTypesReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public EClassESuperTypesReorientCommand(ReorientReferenceRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (!(referenceOwner instanceof EClass)) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof EClass && newEnd instanceof EClass)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof EClass && newEnd instanceof EClass)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getESuperTypes().remove(getOldTarget());
+ getNewSource().getESuperTypes().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getOldSource().getESuperTypes().remove(getOldTarget());
+ getOldSource().getESuperTypes().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getOldSource() {
+ return (EClass) referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getNewSource() {
+ return (EClass) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getOldTarget() {
+ return (EClass) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getNewTarget() {
+ return (EClass) newEnd;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EDataType2CreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EDataType2CreateCommand.java
new file mode 100644
index 0000000..4c9e54c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EDataType2CreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EDataType2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EDataType2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EDataTypeCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EDataTypeCreateCommand.java
new file mode 100644
index 0000000..b45906e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EDataTypeCreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EDataTypeCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EDataTypeCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnum2CreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnum2CreateCommand.java
new file mode 100644
index 0000000..4e3e46b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnum2CreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnum2CreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EEnum2CreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnumCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnumCreateCommand.java
new file mode 100644
index 0000000..5a2bba8
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnumCreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EEnumCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnumLiteralCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnumLiteralCreateCommand.java
new file mode 100644
index 0000000..b8e0e62
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EEnumLiteralCreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumLiteralCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EEnumLiteralCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEEnum();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EOperationCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EOperationCreateCommand.java
new file mode 100644
index 0000000..8b48644
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EOperationCreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EOperationCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EOperationCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEClass();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EPackageCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EPackageCreateCommand.java
new file mode 100644
index 0000000..aaea177
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EPackageCreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackageCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EPackageCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEPackage();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReference2CreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReference2CreateCommand.java
new file mode 100644
index 0000000..43858bb
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReference2CreateCommand.java
@@ -0,0 +1,96 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreBaseItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EReference2CreateCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public EReference2CreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request.getLabel(), null, request);
+ this.source = source;
+ this.target = target;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && !(source instanceof EClass)) {
+ return false;
+ }
+ if (target != null && !(target instanceof EClass)) {
+ 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
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEClassESuperTypes_3003(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ if (getSource() != null && getTarget() != null) {
+ getSource().getESuperTypes().add(getTarget());
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getSource() {
+ return (EClass) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getTarget() {
+ return (EClass) target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReference2ReorientCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReference2ReorientCommand.java
new file mode 100644
index 0000000..b9fa802
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReference2ReorientCommand.java
@@ -0,0 +1,159 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreBaseItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EReference2ReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject referenceOwner;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public EReference2ReorientCommand(ReorientReferenceRelationshipRequest request) {
+ super(request.getLabel(), null, request);
+ reorientDirection = request.getDirection();
+ referenceOwner = request.getReferenceOwner();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (!(referenceOwner instanceof EClass)) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof EClass && newEnd instanceof EClass)) {
+ return false;
+ }
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistEClassESuperTypes_3003(getNewSource(), getOldTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof EClass && newEnd instanceof EClass)) {
+ return false;
+ }
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistEClassESuperTypes_3003(getOldSource(), getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getESuperTypes().remove(getOldTarget());
+ getNewSource().getESuperTypes().add(getOldTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getOldSource().getESuperTypes().remove(getOldTarget());
+ getOldSource().getESuperTypes().add(getNewTarget());
+ return CommandResult.newOKCommandResult(referenceOwner);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getOldSource() {
+ return (EClass) referenceOwner;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getNewSource() {
+ return (EClass) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getOldTarget() {
+ return (EClass) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getNewTarget() {
+ return (EClass) newEnd;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReferenceCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReferenceCreateCommand.java
new file mode 100644
index 0000000..7a506b6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReferenceCreateCommand.java
@@ -0,0 +1,141 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreBaseItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EReferenceCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ private final EObject source;
+
+ /**
+ * @generated
+ */
+ private final EObject target;
+
+ /**
+ * @generated
+ */
+ public EReferenceCreateCommand(CreateRelationshipRequest request, EObject source, EObject target) {
+ super(request);
+ this.source = source;
+ this.target = target;
+ if (request.getContainmentFeature() == null) {
+ setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
+ }
+
+ super.setElementToEdit(source);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (source == null && target == null) {
+ return false;
+ }
+ if (source != null && !(source instanceof EClass)) {
+ return false;
+ }
+ if (target != null && !(target instanceof EClassifier)) {
+ 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
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canCreateEReference_3002(getSource(), getTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject doDefaultElementCreation() {
+ // org.eclipse.emf.ecore.EReference newElement =
+ // (org.eclipse.emf.ecore.EReference) super.doDefaultElementCreation();
+ EReference newElement = EcoreFactory.eINSTANCE.createEReference();
+ getSource().getEStructuralFeatures().add(newElement);
+ newElement.setEType(getTarget());
+ EcoreElementTypes.Initializers.EReference_3002.init(newElement);
+ return newElement;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEClass();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in create link command"); //$NON-NLS-1$
+ }
+ return super.doExecuteWithResult(monitor, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected ConfigureRequest createConfigureRequest() {
+ ConfigureRequest request = super.createConfigureRequest();
+ request.setParameter(CreateRelationshipRequest.SOURCE, getSource());
+ request.setParameter(CreateRelationshipRequest.TARGET, getTarget());
+ return request;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setElementToEdit(EObject element) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getSource() {
+ return (EClass) source;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClassifier getTarget() {
+ return (EClassifier) target;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReferenceReorientCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReferenceReorientCommand.java
new file mode 100644
index 0000000..facf34d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EReferenceReorientCommand.java
@@ -0,0 +1,165 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreBaseItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.type.core.commands.EditElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EReferenceReorientCommand extends EditElementCommand {
+
+ /**
+ * @generated
+ */
+ private final int reorientDirection;
+
+ /**
+ * @generated
+ */
+ private final EObject oldEnd;
+
+ /**
+ * @generated
+ */
+ private final EObject newEnd;
+
+ /**
+ * @generated
+ */
+ public EReferenceReorientCommand(ReorientRelationshipRequest request) {
+ super(request.getLabel(), request.getRelationship(), request);
+ reorientDirection = request.getDirection();
+ oldEnd = request.getOldRelationshipEnd();
+ newEnd = request.getNewRelationshipEnd();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean canExecute() {
+ if (!(getElementToEdit() instanceof EReference)) {
+ return false;
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return canReorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return canReorientTarget();
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientSource() {
+ if (!(oldEnd instanceof EClass && newEnd instanceof EClass)) {
+ return false;
+ }
+ EClassifier target = getLink().getEType();
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistEReference_3002(getNewSource(), target);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean canReorientTarget() {
+ if (!(oldEnd instanceof EClassifier && newEnd instanceof EClassifier)) {
+ return false;
+ }
+ if (!(getLink().eContainer() instanceof EClass)) {
+ return false;
+ }
+ EClass source = (EClass) getLink().eContainer();
+ return EcoreBaseItemSemanticEditPolicy.LinkConstraints.canExistEReference_3002(source, getNewTarget());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ if (!canExecute()) {
+ throw new ExecutionException("Invalid arguments in reorient link command"); //$NON-NLS-1$
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_SOURCE) {
+ return reorientSource();
+ }
+ if (reorientDirection == ReorientRelationshipRequest.REORIENT_TARGET) {
+ return reorientTarget();
+ }
+ throw new IllegalStateException();
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientSource() throws ExecutionException {
+ getOldSource().getEStructuralFeatures().remove(getLink());
+ getNewSource().getEStructuralFeatures().add(getLink());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult reorientTarget() throws ExecutionException {
+ getLink().setEType(getNewTarget());
+ return CommandResult.newOKCommandResult(getLink());
+ }
+
+ /**
+ * @generated
+ */
+ protected EReference getLink() {
+ return (EReference) getElementToEdit();
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getOldSource() {
+ return (EClass) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getNewSource() {
+ return (EClass) newEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClassifier getOldTarget() {
+ return (EClassifier) oldEnd;
+ }
+
+ /**
+ * @generated
+ */
+ protected EClassifier getNewTarget() {
+ return (EClassifier) newEnd;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EStringToStringMapEntryCreateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EStringToStringMapEntryCreateCommand.java
new file mode 100644
index 0000000..c4819f7
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EStringToStringMapEntryCreateCommand.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.gmf.runtime.emf.type.core.commands.CreateElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EStringToStringMapEntryCreateCommand extends CreateElementCommand {
+
+ /**
+ * @generated
+ */
+ public EStringToStringMapEntryCreateCommand(CreateElementRequest req) {
+ super(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected EClass getEClassToEdit() {
+ return EcorePackage.eINSTANCE.getEAnnotation();
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getElementToEdit() {
+ EObject container = ((CreateElementRequest) getRequest()).getContainer();
+ if (container instanceof View) {
+ container = ((View) container).getElement();
+ }
+ return container;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EcoreCreateShortcutDecorationsCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EcoreCreateShortcutDecorationsCommand.java
new file mode 100644
index 0000000..c03029d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EcoreCreateShortcutDecorationsCommand.java
@@ -0,0 +1,73 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreCreateShortcutDecorationsCommand extends AbstractTransactionalCommand {
+
+ /**
+ * @generated
+ */
+ private List myDescriptors;
+
+ /**
+ * @generated
+ */
+ public EcoreCreateShortcutDecorationsCommand(TransactionalEditingDomain editingDomain, View parentView, List viewDescriptors) {
+ super(editingDomain, "Create Shortcuts", getWorkspaceFiles(parentView)); //$NON-NLS-1$
+ myDescriptors = viewDescriptors;
+ }
+
+ /**
+ * @generated
+ */
+ public EcoreCreateShortcutDecorationsCommand(TransactionalEditingDomain editingDomain, View parentView, CreateViewRequest.ViewDescriptor viewDescriptor) {
+ this(editingDomain, parentView, Collections.singletonList(viewDescriptor));
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ for (Iterator it = myDescriptors.iterator(); it.hasNext();) {
+ CreateViewRequest.ViewDescriptor nextDescriptor = (CreateViewRequest.ViewDescriptor) it.next();
+ View view = (View) nextDescriptor.getAdapter(View.class);
+ if (view != null && view.getEAnnotation("Shortcut") == null) { //$NON-NLS-1$
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", EPackageEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EcoreReorientConnectionViewCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EcoreReorientConnectionViewCommand.java
new file mode 100644
index 0000000..1f3476a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/commands/EcoreReorientConnectionViewCommand.java
@@ -0,0 +1,79 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.commands;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreReorientConnectionViewCommand extends AbstractTransactionalCommand {
+
+ /**
+ * @generated
+ */
+ private IAdaptable edgeAdaptor;
+
+ /**
+ * @generated
+ */
+ public EcoreReorientConnectionViewCommand(TransactionalEditingDomain editingDomain, String label) {
+ super(editingDomain, label, null);
+ }
+
+ /**
+ * @generated
+ */
+ public List getAffectedFiles() {
+ View view = (View) edgeAdaptor.getAdapter(View.class);
+ if (view != null) {
+ return getWorkspaceFiles(view);
+ }
+ return super.getAffectedFiles();
+ }
+
+ /**
+ * @generated
+ */
+ public IAdaptable getEdgeAdaptor() {
+ return edgeAdaptor;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEdgeAdaptor(IAdaptable edgeAdaptor) {
+ this.edgeAdaptor = edgeAdaptor;
+ }
+
+ /**
+ * @generated
+ */
+ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) {
+ assert null != edgeAdaptor : "Null child in EcoreReorientConnectionViewCommand"; //$NON-NLS-1$
+ Edge edge = (Edge) getEdgeAdaptor().getAdapter(Edge.class);
+ assert null != edge : "Null edge in EcoreReorientConnectionViewCommand"; //$NON-NLS-1$
+ View tempView = edge.getSource();
+ edge.setSource(edge.getTarget());
+ edge.setTarget(tempView);
+ return CommandResult.newOKCommandResult();
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EAnnotationEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EAnnotationEditHelper.java
new file mode 100644
index 0000000..ae57016
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EAnnotationEditHelper.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EAnnotationEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EAnnotation";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if (req.getElementToConfigure() instanceof EAnnotation) {
+ setDefaultNameForElement((EAnnotation) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(EAnnotation elementToConfigure) {
+ EModelElement container = elementToConfigure.getEModelElement();
+ Boolean foundName = false;
+ int count = 0;
+ while (!foundName && count < 10000) {
+ if (container.getEAnnotation(baseString + count) == null) {
+ elementToConfigure.setSource(baseString + count);
+ foundName = true;
+ }
+ count++;
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EAttributeEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EAttributeEditHelper.java
new file mode 100644
index 0000000..8cdc126
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EAttributeEditHelper.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EAttributeEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EAttribute";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if (req.getElementToConfigure() instanceof EAttribute) {
+ setDefaultNameForElement((EAttribute) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(EAttribute elementToConfigure) {
+ EClass container = elementToConfigure.getEContainingClass();
+ Boolean foundName = false;
+ int count = 0;
+ while (!foundName && count < 10000) {
+ if (container.getEStructuralFeature(baseString + count) == null) {
+ elementToConfigure.setName(baseString + count);
+ foundName = true;
+ }
+ count++;
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EClassEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EClassEditHelper.java
new file mode 100644
index 0000000..678e900
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EClassEditHelper.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EClassEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EClass";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if (req.getElementToConfigure() instanceof EClass) {
+ setDefaultNameForElement((EClass) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(EClass elementToConfigure) {
+ EPackage container = elementToConfigure.getEPackage();
+ Boolean foundName = false;
+ int count = 0;
+ while (!foundName && count < 10000) {
+ if (container.getEClassifier(baseString + count) == null) {
+ elementToConfigure.setName(baseString + count);
+ foundName = true;
+ }
+ count++;
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EDataTypeEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EDataTypeEditHelper.java
new file mode 100644
index 0000000..5bc9f03
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EDataTypeEditHelper.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EDataTypeEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EDataType";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if (req.getElementToConfigure() instanceof EDataType) {
+ setDefaultNameForElement((EDataType) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(EDataType elementToConfigure) {
+ EPackage container = elementToConfigure.getEPackage();
+ Boolean foundName = false;
+ int count = 0;
+ while (!foundName && count < 10000) {
+ if (container.getEClassifier(baseString + count) == null) {
+ elementToConfigure.setName(baseString + count);
+ foundName = true;
+ }
+ count++;
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EEnumEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EEnumEditHelper.java
new file mode 100644
index 0000000..2a1903f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EEnumEditHelper.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EEnumEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EEnum";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if (req.getElementToConfigure() instanceof EEnum) {
+ setDefaultNameForElement((EEnum) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(EEnum elementToConfigure) {
+ EPackage container = elementToConfigure.getEPackage();
+ Boolean foundName = false;
+ int count = 0;
+ while (!foundName && count < 10000) {
+ if (container.getEClassifier(baseString + count) == null) {
+ elementToConfigure.setName(baseString + count);
+ foundName = true;
+ }
+ count++;
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EEnumLiteralEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EEnumLiteralEditHelper.java
new file mode 100644
index 0000000..640c451
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EEnumLiteralEditHelper.java
@@ -0,0 +1,68 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EEnumLiteralEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EEnumLiteral";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if (req.getElementToConfigure() instanceof EEnumLiteral) {
+ setDefaultNameForElement((EEnumLiteral) req.getElementToConfigure());
+ setDefaultValueForElement((EEnumLiteral) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(EEnumLiteral elementToConfigure) {
+ EEnum container = elementToConfigure.getEEnum();
+ elementToConfigure.setName(baseString + (container.getELiterals().size() - 1));
+ // TODO : Wait for this issue to be fixed :
+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=201446
+ // EEnum container = elementToConfigure.getEEnum();
+ // Boolean foundName = false;
+ // int count = 0;
+ // while (!foundName && count < 10000) {
+ // if (container.getEEnumLiteral(baseString + count) == null) {
+ // elementToConfigure.setName(baseString + count);
+ // foundName = true;
+ // }
+ // count++;
+ // }
+ }
+
+ private void setDefaultValueForElement(EEnumLiteral elementToConfigure) {
+ EEnum container = elementToConfigure.getEEnum();
+ Boolean foundValue = false;
+ int count = 0;
+ while (!foundValue && count < 10000) {
+ EEnumLiteral currentLiteral = container.getEEnumLiteral(count);
+ // As the EEnumLiteral value is initialized with 0, we should ensure
+ // that the returned EEnumLiteral is not the elementToConfigure
+ if (currentLiteral == null || currentLiteral == elementToConfigure) {
+ elementToConfigure.setValue(count);
+ foundValue = true;
+ }
+ count++;
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EOperationEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EOperationEditHelper.java
new file mode 100644
index 0000000..828edb8
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EOperationEditHelper.java
@@ -0,0 +1,50 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EOperationEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EOperation";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if (req.getElementToConfigure() instanceof EOperation) {
+ setDefaultNameForElement((EOperation) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(EOperation elementToConfigure) {
+ EClass container = elementToConfigure.getEContainingClass();
+ int count = 0;
+ for (Iterator it = container.getEOperations().iterator(); it.hasNext();) {
+ EOperation eOperation = (EOperation) it.next();
+ if (eOperation.getName() != null) {
+ if (eOperation.getName().equals(baseString + count)) {
+ count++;
+ }
+ }
+ }
+ elementToConfigure.setName(baseString + count);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EPackageEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EPackageEditHelper.java
new file mode 100644
index 0000000..d931371
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EPackageEditHelper.java
@@ -0,0 +1,49 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EPackageEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EPackage";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if (req.getElementToConfigure() instanceof EPackage) {
+ setDefaultNameForElement((EPackage) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(EPackage elementToConfigure) {
+ EPackage container = elementToConfigure.getESuperPackage();
+ int count = 0;
+ for (Iterator it = container.getESubpackages().iterator(); it.hasNext();) {
+ EPackage ePackage = (EPackage) it.next();
+ if (ePackage.getName() != null) {
+ if (ePackage.getName().equals(baseString + count)) {
+ count++;
+ }
+ }
+ }
+ elementToConfigure.setName(baseString + count);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EReferenceEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EReferenceEditHelper.java
new file mode 100644
index 0000000..04e70bc
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EReferenceEditHelper.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EReferenceEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EReference";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if (req.getElementToConfigure() instanceof EReference) {
+ setDefaultNameForElement((EReference) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(EReference elementToConfigure) {
+ EClass container = elementToConfigure.getEContainingClass();
+ Boolean foundName = false;
+ int count = 0;
+ while (!foundName && count < 10000) {
+ if (container.getEStructuralFeature(baseString + count) == null) {
+ elementToConfigure.setName(baseString + count);
+ foundName = true;
+ }
+ count++;
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EStringToStringMapEntryEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EStringToStringMapEntryEditHelper.java
new file mode 100644
index 0000000..d44f281
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EStringToStringMapEntryEditHelper.java
@@ -0,0 +1,51 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.common.util.BasicEMap;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+
+/**
+ * @generated
+ */
+public class EStringToStringMapEntryEditHelper extends EcoreBaseEditHelper {
+
+ private final static String baseString = "EStringToStringMapEntry";
+
+ @Override
+ protected ICommand getConfigureCommand(ConfigureRequest req) {
+ if ((req.getElementToConfigure() instanceof BasicEMap.Entry) && (req.getElementToConfigure() instanceof EObject)) {
+ setDefaultNameForElement((BasicEMap.Entry) req.getElementToConfigure());
+ }
+ return super.getConfigureCommand(req);
+ }
+
+ private void setDefaultNameForElement(BasicEMap.Entry elementToConfigure) {
+ EAnnotation container = (EAnnotation) ((EObject) elementToConfigure).eContainer();
+ int count = 0;
+ for (Iterator it = container.getDetails().iterator(); it.hasNext();) {
+ BasicEMap.Entry eDetail = (BasicEMap.Entry) it.next();
+ if (eDetail.getKey() != null) {
+ if (eDetail.getKey().equals(baseString + count)) {
+ count++;
+ }
+ }
+ }
+ elementToConfigure.setKey(baseString + count);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EcoreBaseEditHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EcoreBaseEditHelper.java
new file mode 100644
index 0000000..24b0b6c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/helpers/EcoreBaseEditHelper.java
@@ -0,0 +1,80 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.helpers;
+
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+
+/**
+ * @generated
+ */
+public class EcoreBaseEditHelper extends AbstractEditHelper {
+
+ /**
+ * @generated
+ */
+ public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ protected ICommand getInsteadCommand(IEditCommandRequest req) {
+ ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
+ req.setParameter(EDIT_POLICY_COMMAND, null);
+ ICommand ehCommand = super.getInsteadCommand(req);
+ if (epCommand == null) {
+ return ehCommand;
+ }
+ if (ehCommand == null) {
+ return epCommand;
+ }
+ CompositeCommand command = new CompositeCommand(null);
+ command.add(epCommand);
+ command.add(ehCommand);
+ return command;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getCreateCommand(CreateElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getDestroyElementCommand(DestroyElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return null;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationDetailsEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationDetailsEditPart.java
new file mode 100644
index 0000000..2a9a79a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationDetailsEditPart.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EAnnotationDetailsCanonicalEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EAnnotationDetailsItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAnnotationDetailsEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5007;
+
+ /**
+ * @generated
+ */
+ public EAnnotationDetailsEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EAnnotationDetailsEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EAnnotationDetailsItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new EAnnotationDetailsCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ // nothing to do -- parent layout does not accept Double constraints as
+ // ratio
+ // super.setRatio(ratio);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationEditPart.java
new file mode 100644
index 0000000..7ec5429
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationEditPart.java
@@ -0,0 +1,384 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EAnnotationItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAnnotationEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 1003;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public EAnnotationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == EcoreElementTypes.EStringToStringMapEntry_2007) {
+ EditPart compartmentEditPart = getChildBySemanticHint(EcoreVisualIDRegistry.getType(EAnnotationDetailsEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EAnnotationItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ // 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);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+
+ ConstrainedToolbarLayoutEditPolicy lep = new ConstrainedToolbarLayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof ITextAwareEditPart) {
+ return new EcoreTextSelectionEditPolicy();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ AnnotationFigure figure = new AnnotationFigure();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public AnnotationFigure getPrimaryShape() {
+ return (AnnotationFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EAnnotationSourceEditPart) {
+ ((EAnnotationSourceEditPart) childEditPart).setLabel(getPrimaryShape().getFigureAnnotationNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects
+ * layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(EcoreVisualIDRegistry.getType(EAnnotationSourceEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ if (event.getNotifier() == getModel() && EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
+ handleMajorSemanticChange();
+ } else {
+ super.handleNotificationEvent(event);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public class AnnotationFigure extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureAnnotationNameLabel;
+
+ private final int BENT_CORNER_WIDTH = 12;
+
+ private final int BENT_CORNER_HEIGHT = 12;
+
+ @Override
+ protected void fillShape(Graphics graphics) {
+ Rectangle r = getBounds();
+ int x = r.x + lineWidth / 2;
+ int y = r.y + lineWidth / 2;
+ int h = r.height - Math.max(1, lineWidth);
+ int w = r.width - Math.max(1, lineWidth);
+
+ Point point1 = new Point(x, y);
+ Point point2 = new Point(x + w - BENT_CORNER_WIDTH, y);
+ Point point3 = new Point(x + w, y + BENT_CORNER_HEIGHT);
+ Point point4 = new Point(x + w, y + h);
+ Point point5 = new Point(x, y + h);
+
+ PointList desiredBounds = new PointList();
+ desiredBounds.addPoint(point1);
+ desiredBounds.addPoint(point2);
+ desiredBounds.addPoint(point3);
+ desiredBounds.addPoint(point4);
+ desiredBounds.addPoint(point5);
+
+ graphics.fillPolygon(desiredBounds);
+ }
+
+ @Override
+ protected void outlineShape(Graphics graphics) {
+ Rectangle r = getBounds();
+ int x = r.x + lineWidth / 2;
+ int y = r.y + lineWidth / 2;
+ int h = r.height - Math.max(1, lineWidth);
+ int w = r.width - Math.max(1, lineWidth);
+
+ Point point1 = new Point(x, y);
+ Point point2 = new Point(x + w - BENT_CORNER_WIDTH, y);
+ Point point3 = new Point(x + w, y + BENT_CORNER_HEIGHT);
+ Point point4 = new Point(x + w, y + h);
+ Point point5 = new Point(x, y + h);
+ Point point6 = new Point(x + w - BENT_CORNER_WIDTH, y + BENT_CORNER_HEIGHT);
+
+ PointList desiredBounds = new PointList();
+ desiredBounds.addPoint(point1);
+ desiredBounds.addPoint(point2);
+ desiredBounds.addPoint(point3);
+ desiredBounds.addPoint(point4);
+ desiredBounds.addPoint(point5);
+
+ graphics.drawPolygon(desiredBounds);
+ graphics.drawLine(point2, point3);
+ graphics.drawLine(point2, point6);
+ graphics.drawLine(point6, point3);
+ }
+
+ /**
+ * @generated
+ */
+ public AnnotationFigure() {
+
+ ToolbarLayout layoutThis = new ToolbarLayout();
+ layoutThis.setStretchMinorAxis(true);
+ layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+
+ layoutThis.setSpacing(0);
+ layoutThis.setVertical(true);
+
+ this.setLayoutManager(layoutThis);
+
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(30)));
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fFigureAnnotationNameLabel = new WrappingLabel();
+ fFigureAnnotationNameLabel.setAlignment(PositionConstants.TOP);
+ fFigureAnnotationNameLabel.setText("<..>");
+
+ this.add(fFigureAnnotationNameLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureAnnotationNameLabel() {
+ return fFigureAnnotationNameLabel;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationReferencesEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationReferencesEditPart.java
new file mode 100644
index 0000000..79ac6b7
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationReferencesEditPart.java
@@ -0,0 +1,82 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EAnnotationReferencesItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAnnotationReferencesEditPart extends ConnectionNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3001;
+
+ /**
+ * @generated
+ */
+ public EAnnotationReferencesEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EAnnotationReferencesItemSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected Connection createConnectionFigure() {
+ return new DashedLineConnection();
+ }
+
+ /**
+ * @generated
+ */
+ public DashedLineConnection getPrimaryShape() {
+ return (DashedLineConnection) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class DashedLineConnection extends PolylineConnectionEx {
+
+ /**
+ * @generated
+ */
+ public DashedLineConnection() {
+ this.setLineStyle(Graphics.LINE_DASH);
+
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationSourceEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationSourceEditPart.java
new file mode 100644
index 0000000..9df1d03
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAnnotationSourceEditPart.java
@@ -0,0 +1,552 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EAnnotationSourceEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4007;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EAnnotationSourceEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EAnnotation_1003, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAttributeEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAttributeEditPart.java
new file mode 100644
index 0000000..17935b1
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EAttributeEditPart.java
@@ -0,0 +1,620 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EAttributeItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextNonResizableEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EAttributeEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2001;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EAttributeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EAttributeItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new EcoreTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * Get the Image associated with the bounds of the EAttribute
+ *
+ * @generated NOT
+ */
+ protected Image getLabelIcon() {
+ String imageName = "EOccurrence";
+ int minOccurs = ((EAttribute) resolveSemanticElement()).getLowerBound();
+ int maxOccurs = ((EAttribute) resolveSemanticElement()).getUpperBound();
+ if (minOccurs >= 0 && (minOccurs <= maxOccurs || maxOccurs == -1)) {
+ switch (minOccurs) {
+ case 0:
+ imageName += "Zero";
+ break;
+ case 1:
+ imageName += "One";
+ break;
+ default:
+ imageName += "N";
+ break;
+ }
+
+ if (minOccurs != maxOccurs) {
+ switch (maxOccurs) {
+ case -1:
+ imageName += "ToUnbounded";
+ break;
+ case 0:
+ return null;
+ case 1:
+ imageName += "ToOne";
+ break;
+ default:
+ imageName += minOccurs <= 1 ? "ToN" : "ToM";
+ break;
+ }
+ }
+ } else {
+ imageName += "NToM";
+ }
+
+ return EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/multiplicity/" + imageName + ".gif");
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected String getLabelText() {
+ String text = null;
+ if (getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()) + getETypeString();
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ private String getETypeString() {
+ EClassifier eType = null;
+ if (((View) getModel()).getElement() instanceof EAttribute) {
+ eType = ((EAttribute) ((View) getModel()).getElement()).getEType();
+ }
+ if (eType != null) {
+ return " : " + eType.getName();
+ }
+ return " : null";
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EAttribute_2001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ Object notifier = event.getNotifier();
+
+ // To handle refresh on EType or Bounds of EAttribute
+ if (notifier == resolveSemanticElement()) {
+ switch (event.getFeatureID(EAttribute.class)) {
+ case EcorePackage.EATTRIBUTE__LOWER_BOUND:
+ case EcorePackage.EATTRIBUTE__UPPER_BOUND:
+ case EcorePackage.ETYPED_ELEMENT__ETYPE:
+ refreshLabel();
+ break;
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClass2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClass2EditPart.java
new file mode 100644
index 0000000..b0547d2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClass2EditPart.java
@@ -0,0 +1,315 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClass2ItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClass2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2003;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public EClass2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == EcoreElementTypes.EAttribute_2001) {
+ EditPart compartmentEditPart = getChildBySemanticHint(EcoreVisualIDRegistry.getType(EClassAttributes2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == EcoreElementTypes.EOperation_2002) {
+ EditPart compartmentEditPart = getChildBySemanticHint(EcoreVisualIDRegistry.getType(EClassOperations2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EClass2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ // 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);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+
+ ConstrainedToolbarLayoutEditPolicy lep = new ConstrainedToolbarLayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof ITextAwareEditPart) {
+ return new EcoreTextSelectionEditPolicy();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassFigure figure = new ClassFigure();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public ClassFigure getPrimaryShape() {
+ return (ClassFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EClassName2EditPart) {
+ ((EClassName2EditPart) childEditPart).setLabel(getPrimaryShape().getFigureClassNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects
+ * layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(EcoreVisualIDRegistry.getType(EClassName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class ClassFigure extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureClassNameLabel;
+
+ /**
+ * @generated
+ */
+ public ClassFigure() {
+
+ ToolbarLayout layoutThis = new ToolbarLayout();
+ layoutThis.setStretchMinorAxis(true);
+ layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+
+ layoutThis.setSpacing(0);
+ layoutThis.setVertical(true);
+
+ this.setLayoutManager(layoutThis);
+
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(30)));
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fFigureClassNameLabel = new WrappingLabel();
+ fFigureClassNameLabel.setAlignment(PositionConstants.TOP);
+ fFigureClassNameLabel.setText("<..>");
+
+ this.add(fFigureClassNameLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureClassNameLabel() {
+ return fFigureClassNameLabel;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassAttributes2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassAttributes2EditPart.java
new file mode 100644
index 0000000..3c3fd66
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassAttributes2EditPart.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassAttributes2CanonicalEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassAttributes2ItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassAttributes2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5004;
+
+ /**
+ * @generated
+ */
+ public EClassAttributes2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EClassAttributes2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EClassAttributes2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new EClassAttributes2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ // nothing to do -- parent layout does not accept Double constraints as
+ // ratio
+ // super.setRatio(ratio);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassAttributesEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassAttributesEditPart.java
new file mode 100644
index 0000000..29494a2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassAttributesEditPart.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassAttributesCanonicalEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassAttributesItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassAttributesEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5001;
+
+ /**
+ * @generated
+ */
+ public EClassAttributesEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EClassAttributesEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EClassAttributesItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new EClassAttributesCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ // nothing to do -- parent layout does not accept Double constraints as
+ // ratio
+ // super.setRatio(ratio);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassESuperTypesEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassESuperTypesEditPart.java
new file mode 100644
index 0000000..7d364f0
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassESuperTypesEditPart.java
@@ -0,0 +1,95 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassESuperTypesItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassESuperTypesEditPart extends ConnectionNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3004;
+
+ /**
+ * @generated
+ */
+ public EClassESuperTypesEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EClassESuperTypesItemSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected Connection createConnectionFigure() {
+
+ return new SolidLineWDstClosedArrow();
+ }
+
+ /**
+ * @generated
+ */
+ public class SolidLineWDstClosedArrow extends PolylineConnectionEx {
+
+ /**
+ * @generated
+ */
+ public SolidLineWDstClosedArrow() {
+
+ setTargetDecoration(createTargetDecoration());
+ }
+
+ /**
+ * @generated
+ */
+ private RotatableDecoration createTargetDecoration() {
+ PolygonDecoration df = new PolygonDecoration();
+ df.setBackgroundColor(ColorConstants.white);
+ PointList pl = new PointList();
+ pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
+ pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2));
+ pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2));
+ pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
+ df.setTemplate(pl);
+ df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
+ return df;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassEditPart.java
new file mode 100644
index 0000000..c0a84af
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassEditPart.java
@@ -0,0 +1,328 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 1001;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public EClassEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == EcoreElementTypes.EAttribute_2001) {
+ EditPart compartmentEditPart = getChildBySemanticHint(EcoreVisualIDRegistry.getType(EClassAttributesEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ if (type == EcoreElementTypes.EOperation_2002) {
+ EditPart compartmentEditPart = getChildBySemanticHint(EcoreVisualIDRegistry.getType(EClassOperationsEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EClassItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ // 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);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+
+ ConstrainedToolbarLayoutEditPolicy lep = new ConstrainedToolbarLayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof ITextAwareEditPart) {
+ return new EcoreTextSelectionEditPolicy();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ ClassFigure figure = new ClassFigure();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public ClassFigure getPrimaryShape() {
+ return (ClassFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EClassNameEditPart) {
+ ((EClassNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigureClassNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects
+ * layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(EcoreVisualIDRegistry.getType(EClassNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ if (event.getNotifier() == getModel() && EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
+ handleMajorSemanticChange();
+ } else {
+ super.handleNotificationEvent(event);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public class ClassFigure extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureClassNameLabel;
+
+ /**
+ * @generated
+ */
+ public ClassFigure() {
+
+ ToolbarLayout layoutThis = new ToolbarLayout();
+ layoutThis.setStretchMinorAxis(true);
+ layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+
+ layoutThis.setSpacing(0);
+ layoutThis.setVertical(true);
+
+ this.setLayoutManager(layoutThis);
+
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(30)));
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ fFigureClassNameLabel = new WrappingLabel();
+ fFigureClassNameLabel.setAlignment(PositionConstants.TOP);
+ fFigureClassNameLabel.setText("<..>");
+
+ this.add(fFigureClassNameLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureClassNameLabel() {
+ return fFigureClassNameLabel;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassName2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassName2EditPart.java
new file mode 100644
index 0000000..6fc283c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassName2EditPart.java
@@ -0,0 +1,580 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EClassName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4002;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EClassName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected Image getLabelIcon() {
+ if (((EClass) resolveSemanticElement()).isInterface()) {
+ return EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/Interface.gif");
+ } else {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EClass_2003, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ @Override
+ public void notifyChanged(Notification notification) {
+
+ if (notification.getNotifier() instanceof EClass)
+ switch (notification.getFeatureID(EClass.class)) {
+ case EcorePackage.ECLASS__ABSTRACT:
+ refreshFont();
+ break;
+ case EcorePackage.ECLASS__INTERFACE:
+ refreshLabel();
+ break;
+ }
+ super.notifyChanged(notification);
+ }
+
+ @Override
+ protected void setFont(FontData fontData) {
+ // Enforce the Font Style as italic when the EClass is abstract
+ super.setFont(new FontData(fontData.getName(), fontData.getHeight(), fontData.getStyle() | (((EClass) resolveSemanticElement()).isAbstract() ? SWT.ITALIC : SWT.NONE)));
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassNameEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassNameEditPart.java
new file mode 100644
index 0000000..dd1145e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassNameEditPart.java
@@ -0,0 +1,580 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EClassNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4001;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EClassNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected Image getLabelIcon() {
+ if (resolveSemanticElement() != null && ((EClass) resolveSemanticElement()).isInterface()) {
+ return EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/Interface.gif");
+ } else {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EClass_1001, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+
+ @Override
+ public void notifyChanged(Notification notification) {
+
+ if (notification.getNotifier() instanceof EClass)
+ switch (notification.getFeatureID(EClass.class)) {
+ case EcorePackage.ECLASS__ABSTRACT:
+ refreshFont();
+ break;
+ case EcorePackage.ECLASS__INTERFACE:
+ refreshLabel();
+ break;
+ }
+ super.notifyChanged(notification);
+ }
+
+ @Override
+ protected void setFont(FontData fontData) {
+ // Enforce the Font Style as italic when the EClass is abstract
+ super.setFont(new FontData(fontData.getName(), fontData.getHeight(), fontData.getStyle() | (((EClass) resolveSemanticElement()).isAbstract() ? SWT.ITALIC : SWT.NONE)));
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassOperations2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassOperations2EditPart.java
new file mode 100644
index 0000000..373abd8
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassOperations2EditPart.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassOperations2CanonicalEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassOperations2ItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassOperations2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5005;
+
+ /**
+ * @generated
+ */
+ public EClassOperations2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EClassOperations2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EClassOperations2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new EClassOperations2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ // nothing to do -- parent layout does not accept Double constraints as
+ // ratio
+ // super.setRatio(ratio);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassOperationsEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassOperationsEditPart.java
new file mode 100644
index 0000000..b4252cc
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EClassOperationsEditPart.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassOperationsCanonicalEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EClassOperationsItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassOperationsEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5002;
+
+ /**
+ * @generated
+ */
+ public EClassOperationsEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EClassOperationsEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EClassOperationsItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new EClassOperationsCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ // nothing to do -- parent layout does not accept Double constraints as
+ // ratio
+ // super.setRatio(ratio);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataType2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataType2EditPart.java
new file mode 100644
index 0000000..7d61095
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataType2EditPart.java
@@ -0,0 +1,335 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EDataType2ItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EDataType2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2004;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public EDataType2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EDataType2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ // 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);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+
+ ConstrainedToolbarLayoutEditPolicy lep = new ConstrainedToolbarLayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof ITextAwareEditPart) {
+ return new EcoreTextSelectionEditPolicy();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ DataTypeFigure figure = new DataTypeFigure();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public DataTypeFigure getPrimaryShape() {
+ return (DataTypeFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EDataTypeName2EditPart) {
+ ((EDataTypeName2EditPart) childEditPart).setLabel(getPrimaryShape().getFigureDataTypeNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof EDataTypeInstanceClass2EditPart) {
+ ((EDataTypeInstanceClass2EditPart) childEditPart).setLabel(getPrimaryShape().getFigureDataTypeJavaLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects
+ * layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(EcoreVisualIDRegistry.getType(EDataTypeName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class DataTypeFigure extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureDataTypeNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureDataTypeJavaLabel;
+
+ private WrappingLabel dataTypeFixedNameLabel0;
+
+ /**
+ * @generated
+ */
+ public DataTypeFigure() {
+
+ ToolbarLayout layoutThis = new ToolbarLayout();
+ layoutThis.setStretchMinorAxis(true);
+ layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+
+ layoutThis.setSpacing(1);
+ layoutThis.setVertical(true);
+
+ this.setLayoutManager(layoutThis);
+
+ this.setOutlineXOR(true);
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(30)));
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ dataTypeFixedNameLabel0 = new WrappingLabel();
+ dataTypeFixedNameLabel0.setAlignment(PositionConstants.TOP);
+ dataTypeFixedNameLabel0.setText("<<datatype>>");
+
+ this.add(dataTypeFixedNameLabel0);
+
+ fFigureDataTypeNameLabel = new WrappingLabel();
+ fFigureDataTypeNameLabel.setAlignment(PositionConstants.TOP);
+ fFigureDataTypeNameLabel.setText("<..>");
+
+ this.add(fFigureDataTypeNameLabel);
+
+ fFigureDataTypeJavaLabel = new WrappingLabel();
+ fFigureDataTypeJavaLabel.setAlignment(PositionConstants.TOP);
+ fFigureDataTypeJavaLabel.setText("");
+
+ this.add(fFigureDataTypeJavaLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureDataTypeNameLabel() {
+ return fFigureDataTypeNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureDataTypeJavaLabel() {
+ return fFigureDataTypeJavaLabel;
+ }
+
+ @Override
+ protected void outlineShape(Graphics graphics) {
+ Rectangle r = getBounds();
+ int x = r.x + lineWidth / 2;
+ int y = r.y + lineWidth / 2;
+ int w = r.width - Math.max(1, lineWidth);
+ int h = r.height - Math.max(1, lineWidth);
+ int labelHeight = getFigureDataTypeNameLabel().getBounds().height + dataTypeFixedNameLabel0.getBounds().height + ((ToolbarLayout) getLayoutManager()).getSpacing();
+ Point point1 = new Point(x, y + labelHeight);
+ Point point2 = new Point(x + w, y + labelHeight);
+ graphics.drawLine(point1, point2);
+ graphics.drawRectangle(x, y, w, h);
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeEditPart.java
new file mode 100644
index 0000000..059c750
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeEditPart.java
@@ -0,0 +1,348 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EDataTypeItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EDataTypeEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 1004;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public EDataTypeEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EDataTypeItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ // 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);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+
+ ConstrainedToolbarLayoutEditPolicy lep = new ConstrainedToolbarLayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof ITextAwareEditPart) {
+ return new EcoreTextSelectionEditPolicy();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ DataTypeFigure figure = new DataTypeFigure();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public DataTypeFigure getPrimaryShape() {
+ return (DataTypeFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EDataTypeNameEditPart) {
+ ((EDataTypeNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigureDataTypeNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof EDataTypeInstanceClassEditPart) {
+ ((EDataTypeInstanceClassEditPart) childEditPart).setLabel(getPrimaryShape().getFigureDataTypeJavaLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects
+ * layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(EcoreVisualIDRegistry.getType(EDataTypeNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ if (event.getNotifier() == getModel() && EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
+ handleMajorSemanticChange();
+ } else {
+ super.handleNotificationEvent(event);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public class DataTypeFigure extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureDataTypeNameLabel;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureDataTypeJavaLabel;
+
+ private WrappingLabel dataTypeFixedNameLabel0;
+
+ /**
+ * @generated
+ */
+ public DataTypeFigure() {
+
+ ToolbarLayout layoutThis = new ToolbarLayout();
+ layoutThis.setStretchMinorAxis(true);
+ layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+
+ layoutThis.setSpacing(1);
+ layoutThis.setVertical(true);
+
+ this.setLayoutManager(layoutThis);
+
+ this.setOutlineXOR(true);
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(30)));
+ createContents();
+ }
+
+ /**
+ * @generated NOT
+ */
+ private void createContents() {
+
+ dataTypeFixedNameLabel0 = new WrappingLabel();
+ dataTypeFixedNameLabel0.setAlignment(PositionConstants.TOP);
+ dataTypeFixedNameLabel0.setText("<<datatype>>");
+
+ this.add(dataTypeFixedNameLabel0);
+
+ fFigureDataTypeNameLabel = new WrappingLabel();
+ fFigureDataTypeNameLabel.setAlignment(PositionConstants.TOP);
+ fFigureDataTypeNameLabel.setText("<..>");
+
+ this.add(fFigureDataTypeNameLabel);
+
+ fFigureDataTypeJavaLabel = new WrappingLabel();
+ fFigureDataTypeJavaLabel.setAlignment(PositionConstants.TOP);
+ fFigureDataTypeJavaLabel.setText("");
+
+ this.add(fFigureDataTypeJavaLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureDataTypeNameLabel() {
+ return fFigureDataTypeNameLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureDataTypeJavaLabel() {
+ return fFigureDataTypeJavaLabel;
+ }
+
+ @Override
+ protected void outlineShape(Graphics graphics) {
+ Rectangle r = getBounds();
+ int x = r.x + lineWidth / 2;
+ int y = r.y + lineWidth / 2;
+ int w = r.width - Math.max(1, lineWidth);
+ int h = r.height - Math.max(1, lineWidth);
+ int labelHeight = getFigureDataTypeNameLabel().getBounds().height + dataTypeFixedNameLabel0.getBounds().height + ((ToolbarLayout) getLayoutManager()).getSpacing();
+ Point point1 = new Point(x, y + labelHeight);
+ Point point2 = new Point(x + w, y + labelHeight);
+ graphics.drawLine(point1, point2);
+ graphics.drawRectangle(x, y, w, h);
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeInstanceClass2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeInstanceClass2EditPart.java
new file mode 100644
index 0000000..a29768d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeInstanceClass2EditPart.java
@@ -0,0 +1,559 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EDataTypeInstanceClass2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4004;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EDataTypeInstanceClass2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected String getLabelText() {
+ String text = null;
+ if (getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()) + getInstanceClassName();
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ private String getInstanceClassName() {
+ String instanceClassName = null;
+ if (((View) getModel()).getElement() instanceof EDataType) {
+ instanceClassName = ((EDataType) ((View) getModel()).getElement()).getInstanceClassName();
+ }
+ if ((instanceClassName == null) || (instanceClassName.length() == 0)) {
+ return "null";
+ }
+ return "";
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EDataType_2004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeInstanceClassEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeInstanceClassEditPart.java
new file mode 100644
index 0000000..fd12070
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeInstanceClassEditPart.java
@@ -0,0 +1,559 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EDataTypeInstanceClassEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4009;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EDataTypeInstanceClassEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected String getLabelText() {
+ String text = null;
+ if (getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()) + getInstanceClassName();
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ private String getInstanceClassName() {
+ String instanceClassName = null;
+ if (((View) getModel()).getElement() instanceof EDataType) {
+ instanceClassName = ((EDataType) ((View) getModel()).getElement()).getInstanceClassName();
+ }
+ if ((instanceClassName == null) || (instanceClassName.length() == 0)) {
+ return "null";
+ }
+ return "";
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EDataType_1004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeName2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeName2EditPart.java
new file mode 100644
index 0000000..0826d65
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeName2EditPart.java
@@ -0,0 +1,552 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EDataTypeName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4003;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EDataTypeName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EDataType_2004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeNameEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeNameEditPart.java
new file mode 100644
index 0000000..8451998
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EDataTypeNameEditPart.java
@@ -0,0 +1,552 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EDataTypeNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4008;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EDataTypeNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EDataType_1004, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnum2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnum2EditPart.java
new file mode 100644
index 0000000..4838576
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnum2EditPart.java
@@ -0,0 +1,317 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EEnum2ItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnum2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2005;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public EEnum2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == EcoreElementTypes.EEnumLiteral_2006) {
+ EditPart compartmentEditPart = getChildBySemanticHint(EcoreVisualIDRegistry.getType(EEnumLiteralsEditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EEnum2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ // 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);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+
+ ConstrainedToolbarLayoutEditPolicy lep = new ConstrainedToolbarLayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof ITextAwareEditPart) {
+ return new EcoreTextSelectionEditPolicy();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ EnumerationFigure figure = new EnumerationFigure();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public EnumerationFigure getPrimaryShape() {
+ return (EnumerationFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EEnumName2EditPart) {
+ ((EEnumName2EditPart) childEditPart).setLabel(getPrimaryShape().getFigureEnumerationNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects
+ * layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(EcoreVisualIDRegistry.getType(EEnumName2EditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ public class EnumerationFigure extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureEnumerationNameLabel;
+
+ /**
+ * @generated
+ */
+ public EnumerationFigure() {
+
+ ToolbarLayout layoutThis = new ToolbarLayout();
+ layoutThis.setStretchMinorAxis(true);
+ layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+
+ layoutThis.setSpacing(0);
+ layoutThis.setVertical(true);
+
+ this.setLayoutManager(layoutThis);
+
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(30)));
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ WrappingLabel enumerationFixedNameLabel0 = new WrappingLabel();
+ enumerationFixedNameLabel0.setAlignment(PositionConstants.TOP);
+ enumerationFixedNameLabel0.setText("<<enumeration>>");
+
+ this.add(enumerationFixedNameLabel0);
+
+ fFigureEnumerationNameLabel = new WrappingLabel();
+ fFigureEnumerationNameLabel.setAlignment(PositionConstants.TOP);
+ fFigureEnumerationNameLabel.setText("<..>");
+
+ this.add(fFigureEnumerationNameLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureEnumerationNameLabel() {
+ return fFigureEnumerationNameLabel;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumEditPart.java
new file mode 100644
index 0000000..0f422ab
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumEditPart.java
@@ -0,0 +1,330 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EEnumItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewAndElementRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumEditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 1005;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public EEnumEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy() {
+
+ public Command getCommand(Request request) {
+ if (understandsRequest(request)) {
+ if (request instanceof CreateViewAndElementRequest) {
+ CreateElementRequestAdapter adapter = ((CreateViewAndElementRequest) request).getViewAndElementDescriptor().getCreateElementRequestAdapter();
+ IElementType type = (IElementType) adapter.getAdapter(IElementType.class);
+ if (type == EcoreElementTypes.EEnumLiteral_2006) {
+ EditPart compartmentEditPart = getChildBySemanticHint(EcoreVisualIDRegistry.getType(EEnumLiterals2EditPart.VISUAL_ID));
+ return compartmentEditPart == null ? null : compartmentEditPart.getCommand(request);
+ }
+ }
+ return super.getCommand(request);
+ }
+ return null;
+ }
+ });
+
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EEnumItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ // 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);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+
+ ConstrainedToolbarLayoutEditPolicy lep = new ConstrainedToolbarLayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof ITextAwareEditPart) {
+ return new EcoreTextSelectionEditPolicy();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ EnumerationFigure figure = new EnumerationFigure();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public EnumerationFigure getPrimaryShape() {
+ return (EnumerationFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EEnumNameEditPart) {
+ ((EEnumNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigureEnumerationNameLabel());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects
+ * layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(EcoreVisualIDRegistry.getType(EEnumNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ if (event.getNotifier() == getModel() && EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
+ handleMajorSemanticChange();
+ } else {
+ super.handleNotificationEvent(event);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public class EnumerationFigure extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigureEnumerationNameLabel;
+
+ /**
+ * @generated
+ */
+ public EnumerationFigure() {
+
+ ToolbarLayout layoutThis = new ToolbarLayout();
+ layoutThis.setStretchMinorAxis(true);
+ layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+
+ layoutThis.setSpacing(0);
+ layoutThis.setVertical(true);
+
+ this.setLayoutManager(layoutThis);
+
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(30)));
+ createContents();
+ }
+
+ /**
+ * @generated
+ */
+ private void createContents() {
+
+ WrappingLabel enumerationFixedNameLabel0 = new WrappingLabel();
+ enumerationFixedNameLabel0.setAlignment(PositionConstants.TOP);
+ enumerationFixedNameLabel0.setText("<<enumeration>>");
+
+ this.add(enumerationFixedNameLabel0);
+
+ fFigureEnumerationNameLabel = new WrappingLabel();
+ fFigureEnumerationNameLabel.setAlignment(PositionConstants.TOP);
+ fFigureEnumerationNameLabel.setText("<..>");
+
+ this.add(fFigureEnumerationNameLabel);
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigureEnumerationNameLabel() {
+ return fFigureEnumerationNameLabel;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiteralEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiteralEditPart.java
new file mode 100644
index 0000000..987c2a0
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiteralEditPart.java
@@ -0,0 +1,559 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EEnumLiteralItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextNonResizableEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EEnumLiteralEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2006;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EEnumLiteralEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EEnumLiteralItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new EcoreTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EEnumLiteral_2006, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiterals2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiterals2EditPart.java
new file mode 100644
index 0000000..a07e177
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiterals2EditPart.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EEnumLiterals2CanonicalEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EEnumLiterals2ItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumLiterals2EditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5008;
+
+ /**
+ * @generated
+ */
+ public EEnumLiterals2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EEnumLiterals2EditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EEnumLiterals2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new EEnumLiterals2CanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ // nothing to do -- parent layout does not accept Double constraints as
+ // ratio
+ // super.setRatio(ratio);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiteralsEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiteralsEditPart.java
new file mode 100644
index 0000000..a99d74f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumLiteralsEditPart.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EEnumLiteralsCanonicalEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EEnumLiteralsItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumLiteralsEditPart extends ListCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5006;
+
+ /**
+ * @generated
+ */
+ public EEnumLiteralsEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean hasModelChildrenChanged(Notification evt) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EEnumLiteralsEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EEnumLiteralsItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new EEnumLiteralsCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ // nothing to do -- parent layout does not accept Double constraints as
+ // ratio
+ // super.setRatio(ratio);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumName2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumName2EditPart.java
new file mode 100644
index 0000000..703b266
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumName2EditPart.java
@@ -0,0 +1,552 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EEnumName2EditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4005;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EEnumName2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EEnum_2005, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumNameEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumNameEditPart.java
new file mode 100644
index 0000000..6c1821b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EEnumNameEditPart.java
@@ -0,0 +1,552 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EEnumNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4010;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EEnumNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EEnum_1005, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EOperationEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EOperationEditPart.java
new file mode 100644
index 0000000..088feab
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EOperationEditPart.java
@@ -0,0 +1,776 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EParameter;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EOperationItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextNonResizableEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.resource.StringConverter;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EOperationEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2002;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EOperationEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EOperationItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new EcoreTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * TODO see whether it is possible to directly use the Label of the
+ * EOperationItemProvider class
+ *
+ * @generated NOT
+ */
+ protected String getLabelText() {
+ String text = null;
+ if (getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(getParserElement()), getParserOptions().intValue()) + getSuffixText();
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ private String getSuffixText() {
+ String text = "";
+ text += "(";
+ text += getParametersText();
+ text += ")";
+ if (((EOperation) resolveSemanticElement()).getEType() != null) {
+ text += " : " + ((EOperation) resolveSemanticElement()).getEType().getName();
+ }
+ text += getExceptionsText();
+ return text;
+ }
+
+ private String getParametersText() {
+ StringBuffer text = new StringBuffer();
+ boolean first = true;
+ for (EParameter param : ((EOperation) resolveSemanticElement()).getEParameters()) {
+ if (first) {
+ first = false;
+ } else {
+ text.append(",");
+ }
+
+ EClassifier eType = param.getEType();
+ if (eType == null) {
+ text.append("null");
+ } else {
+ text.append(param.getEType().getName());
+ }
+ }
+
+ return text.toString();
+ }
+
+ private String getExceptionsText() {
+ StringBuffer text = new StringBuffer();
+ boolean first = true;
+ for (EClassifier ex : ((EOperation) resolveSemanticElement()).getEExceptions()) {
+ if (first) {
+ text.append(" throws ");
+ first = false;
+ } else {
+ text.append(", ");
+ }
+
+ text.append(ex.getName());
+ }
+
+ return text.toString();
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EOperation_2002, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+
+ // Listen to the EParameters and other model properties used to update
+ // the operation text
+ Object notifier = event.getNotifier();
+ Object newObject = event.getNewValue();
+ Object oldObject = event.getOldValue();
+
+ if (notifier instanceof EOperation) {
+ if (notifier == resolveSemanticElement()) {
+ switch (event.getFeatureID(EOperation.class)) {
+ case EcorePackage.EOPERATION__EEXCEPTIONS:
+ case EcorePackage.EOPERATION__EPARAMETERS:
+ updateModelListening(oldObject, newObject);
+ break;
+ default:
+ break;
+ }
+ super.handleNotificationEvent(event);
+ } else {
+ refreshLabel();
+ }
+ } else if (notifier instanceof EParameter) {
+ switch (event.getFeatureID(EParameter.class)) {
+ case EcorePackage.EPARAMETER__ETYPE:
+ updateModelListening(oldObject, newObject);
+ break;
+ default:
+ break;
+ }
+ refreshLabel();
+ } else if (notifier instanceof EClassifier) {
+ switch (event.getFeatureID(EClassifier.class)) {
+ case EcorePackage.ECLASSIFIER__NAME:
+ refreshLabel();
+ break;
+ default:
+ break;
+ }
+ }
+
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * This method updates the listening on added or removed objects
+ *
+ * @param oldValue
+ * the old Object
+ * @param newValue
+ * the new Object
+ */
+ protected void updateModelListening(Object oldValue, Object newValue) {
+ if (oldValue != newValue) {
+ if (oldValue != null && oldValue instanceof EObject) {
+ // stop listening the removed object
+ removeListenerFilter(StringConverter.asString(oldValue.hashCode()));
+ }
+ if (newValue != null && newValue instanceof EObject) {
+ // Listen the newly created object
+ addListenerFilter(StringConverter.asString(newValue.hashCode()), this, (EObject) newValue);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#activate()
+ */
+ public void activate() {
+ super.activate();
+ EObject model = resolveSemanticElement();
+ if (model instanceof EOperation) {
+ listenParameters((EOperation) resolveSemanticElement());
+ listenExceptions((EOperation) resolveSemanticElement());
+ }
+ }
+
+ /**
+ * @see org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart#deactivate()
+ */
+ public void deactivate() {
+ EObject model = resolveSemanticElement();
+ if (model instanceof EOperation) {
+ unlistenExceptions((EOperation) resolveSemanticElement());
+ unlistenParameters((EOperation) resolveSemanticElement());
+ }
+ super.deactivate();
+ }
+
+ /**
+ * Listen to all the parameters of the operation
+ *
+ * @param operation
+ * the model object
+ */
+ private void listenParameters(EOperation operation) {
+ for (EParameter param : operation.getEParameters()) {
+ addListenerFilter(StringConverter.asString(param.hashCode()), this, param);
+ listenType(param);
+ }
+ }
+
+ /**
+ * Stop listening to all the parameters of the operation
+ *
+ * @param operation
+ * the model object
+ */
+ private void unlistenParameters(EOperation operation) {
+ for (EParameter param : operation.getEParameters()) {
+ unlistenType(param);
+ removeListenerFilter(StringConverter.asString(param.hashCode()));
+ }
+ }
+
+ /**
+ * Listen to the type of the parameter
+ *
+ * @param param
+ * the model object
+ */
+ private void listenType(EParameter param) {
+ if (param.getEType() != null) {
+ addListenerFilter(StringConverter.asString(param.getEType().hashCode()), this, param, EcorePackage.eINSTANCE.getETypedElement_EType());
+ }
+ }
+
+ /**
+ * Stop listening to the type of the parameter
+ *
+ * @param param
+ * the model object
+ */
+ private void unlistenType(EParameter param) {
+ if (param.getEType() != null) {
+ removeListenerFilter(StringConverter.asString(param.getEType().hashCode()));
+ }
+ }
+
+ /**
+ * Listen to all the exceptions of the operation
+ *
+ * @param operation
+ * the model object
+ */
+ private void listenExceptions(EOperation operation) {
+ for (EClassifier ex : operation.getEExceptions()) {
+ addListenerFilter(StringConverter.asString(ex.hashCode()), this, ex);
+ }
+ }
+
+ /**
+ * Stop listening to all the exceptions of the operation
+ *
+ * @param operation
+ * the model object
+ */
+ private void unlistenExceptions(EOperation operation) {
+ for (EClassifier ex : operation.getEExceptions()) {
+ removeListenerFilter(StringConverter.asString(ex.hashCode()));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackage2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackage2EditPart.java
new file mode 100644
index 0000000..e64cbc1
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackage2EditPart.java
@@ -0,0 +1,374 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.StackLayout;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.figures.PackageLabelRectangle;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EPackage2ItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.OpenDiagramEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ConstrainedToolbarLayoutEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.ConstrainedToolbarLayout;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.gef.ui.figures.DefaultSizeNodeFigure;
+import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackage2EditPart extends ShapeNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 1002;
+
+ /**
+ * @generated
+ */
+ protected IFigure contentPane;
+
+ /**
+ * @generated
+ */
+ protected IFigure primaryShape;
+
+ /**
+ * @generated
+ */
+ public EPackage2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+
+ super.createDefaultEditPolicies();
+ // // To manage delete from diagram when there is an associated diagram
+ // with the package
+ // installEditPolicy(EditPolicy.COMPONENT_ROLE,
+ // new PackageComponentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EPackage2ItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, createLayoutEditPolicy());
+ installEditPolicy(EditPolicyRoles.OPEN_ROLE, new OpenDiagramEditPolicy());
+ // 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);
+ }
+
+ /**
+ * @generated
+ */
+ protected LayoutEditPolicy createLayoutEditPolicy() {
+
+ ConstrainedToolbarLayoutEditPolicy lep = new ConstrainedToolbarLayoutEditPolicy() {
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ if (child.getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE) == null) {
+ if (child instanceof ITextAwareEditPart) {
+ return new EcoreTextSelectionEditPolicy();
+ }
+ }
+ return super.createChildEditPolicy(child);
+ }
+ };
+ return lep;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createNodeShape() {
+ PackageFigure figure = new PackageFigure();
+ return primaryShape = figure;
+ }
+
+ /**
+ * @generated
+ */
+ public PackageFigure getPrimaryShape() {
+ return (PackageFigure) primaryShape;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ if (childEditPart instanceof EPackageNameEditPart) {
+ ((EPackageNameEditPart) childEditPart).setLabel(getPrimaryShape().getFigurePackageNameLabel());
+ return true;
+ }
+ if (childEditPart instanceof EPackageContentsEditPart) {
+ IFigure pane = getPrimaryShape().getFigurePackageBodyRectangle();
+ setupContentPane(pane); // FIXME each comparment should handle his
+ // content pane in his own way
+ pane.add(((EPackageContentsEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean removeFixedChild(EditPart childEditPart) {
+
+ if (childEditPart instanceof EPackageContentsEditPart) {
+ IFigure pane = getPrimaryShape().getFigurePackageBodyRectangle();
+ setupContentPane(pane); // FIXME each comparment should handle his
+ // content pane in his own way
+ pane.remove(((EPackageContentsEditPart) childEditPart).getFigure());
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeChildVisual(EditPart childEditPart) {
+ if (removeFixedChild(childEditPart)) {
+ return;
+ }
+ super.removeChildVisual(childEditPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure getContentPaneFor(IGraphicalEditPart editPart) {
+
+ if (editPart instanceof EPackageContentsEditPart) {
+ return getPrimaryShape().getFigurePackageBodyRectangle();
+ }
+ return super.getContentPaneFor(editPart);
+ }
+
+ /**
+ * @generated
+ */
+ protected NodeFigure createNodePlate() {
+ DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(getMapMode().DPtoLP(40), getMapMode().DPtoLP(40));
+ return result;
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected NodeFigure createNodeFigure() {
+ NodeFigure figure = createNodePlate();
+ figure.setLayoutManager(new StackLayout());
+ IFigure shape = createNodeShape();
+ figure.add(shape);
+ contentPane = setupContentPane(shape);
+ return figure;
+ }
+
+ /**
+ * Default implementation treats passed figure as content pane. Respects
+ * layout one may have set for generated figure.
+ *
+ * @param nodeShape
+ * instance of generated figure class
+ * @generated
+ */
+ protected IFigure setupContentPane(IFigure nodeShape) {
+ if (nodeShape.getLayoutManager() == null) {
+ ConstrainedToolbarLayout layout = new ConstrainedToolbarLayout();
+ layout.setSpacing(getMapMode().DPtoLP(5));
+ nodeShape.setLayoutManager(layout);
+ }
+ return nodeShape; // use nodeShape itself as contentPane
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure getContentPane() {
+ if (contentPane != null) {
+ return contentPane;
+ }
+ return super.getContentPane();
+ }
+
+ /**
+ * @generated
+ */
+ public EditPart getPrimaryChildEditPart() {
+ return getChildBySemanticHint(EcoreVisualIDRegistry.getType(EPackageNameEditPart.VISUAL_ID));
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ if (event.getNotifier() == getModel() && EcorePackage.eINSTANCE.getEModelElement_EAnnotations().equals(event.getFeature())) {
+ handleMajorSemanticChange();
+ } else {
+ super.handleNotificationEvent(event);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public class PackageFigure extends RectangleFigure {
+
+ /**
+ * @generated
+ */
+ private RectangleFigure fFigurePackageBodyRectangle;
+
+ /**
+ * @generated
+ */
+ private WrappingLabel fFigurePackageNameLabel;
+
+ private PackageLabelRectangle packageLabelRectangle0;
+
+ /**
+ * @generated
+ */
+ public PackageFigure() {
+
+ ToolbarLayout layoutThis = new ToolbarLayout();
+ layoutThis.setStretchMinorAxis(true);
+ layoutThis.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+
+ layoutThis.setSpacing(0);
+ layoutThis.setVertical(true);
+
+ this.setLayoutManager(layoutThis);
+
+ this.setFill(false);
+ this.setOutline(false);
+ this.setLineWidth(2);
+ this.setMinimumSize(new Dimension(getMapMode().DPtoLP(100), getMapMode().DPtoLP(100)));
+ createContents();
+ }
+
+ /**
+ * @generated NOT
+ */
+ private void createContents() {
+
+ packageLabelRectangle0 = new PackageLabelRectangle();
+ packageLabelRectangle0.setLineWidth(2);
+
+ packageLabelRectangle0.setBorder(new MarginBorder(getMapMode().DPtoLP(5), getMapMode().DPtoLP(5), getMapMode().DPtoLP(5), getMapMode().DPtoLP(5)));
+
+ this.add(packageLabelRectangle0);
+
+ ToolbarLayout layoutPackageLabelRectangle0 = new ToolbarLayout();
+ layoutPackageLabelRectangle0.setStretchMinorAxis(false);
+ layoutPackageLabelRectangle0.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT
+
+ );
+
+ layoutPackageLabelRectangle0.setSpacing(5);
+ layoutPackageLabelRectangle0.setVertical(false);
+
+ packageLabelRectangle0.setLayoutManager(layoutPackageLabelRectangle0);
+
+ WrappingLabel packageNameLabel1 = new WrappingLabel();
+ packageNameLabel1.setText("<..>");
+
+ packageLabelRectangle0.add(packageNameLabel1);
+ fFigurePackageNameLabel = packageNameLabel1;
+
+ RectangleFigure packageBodyRectangle0 = new RectangleFigure();
+ packageBodyRectangle0.setLineWidth(2);
+
+ this.add(packageBodyRectangle0);
+ fFigurePackageBodyRectangle = packageBodyRectangle0;
+
+ }
+
+ /**
+ * @generated
+ */
+ private boolean myUseLocalCoordinates = false;
+
+ /**
+ * @generated
+ */
+ protected boolean useLocalCoordinates() {
+ return myUseLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setUseLocalCoordinates(boolean useLocalCoordinates) {
+ myUseLocalCoordinates = useLocalCoordinates;
+ }
+
+ /**
+ * @generated
+ */
+ public RectangleFigure getFigurePackageBodyRectangle() {
+ return fFigurePackageBodyRectangle;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getFigurePackageNameLabel() {
+ return fFigurePackageNameLabel;
+ }
+
+ @Override
+ public void setBounds(Rectangle rect) {
+ int preferenceHeight = rect.height - packageLabelRectangle0.getBounds().height - lineWidth / 2;
+ if (preferenceHeight < 0) {
+ preferenceHeight = 0;
+ }
+ getFigurePackageBodyRectangle().setPreferredSize(rect.width, preferenceHeight);
+ super.setBounds(rect);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageContentsEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageContentsEditPart.java
new file mode 100644
index 0000000..dd4b0ef
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageContentsEditPart.java
@@ -0,0 +1,83 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EPackageContentsItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeCompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CreationEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.DragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ResizableCompartmentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.figures.ResizableCompartmentFigure;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackageContentsEditPart extends ShapeCompartmentEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 5003;
+
+ /**
+ * @generated
+ */
+ public EPackageContentsEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public String getCompartmentName() {
+ return Messages.EPackageContentsEditPart_title;
+ }
+
+ /**
+ * @generated
+ */
+ public IFigure createFigure() {
+ ResizableCompartmentFigure result = (ResizableCompartmentFigure) super.createFigure();
+ result.setTitleVisibility(false);
+ return result;
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ResizableCompartmentEditPolicy());
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EPackageContentsItemSemanticEditPolicy());
+ installEditPolicy(EditPolicyRoles.CREATION_ROLE, new CreationEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new DragDropEditPolicy());
+ // FIXME: LB to find out if this stuff is needed or not
+ // installEditPolicy(EditPolicyRoles.CANONICAL_ROLE,
+ // new EPackageContentsCanonicalEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected void setRatio(Double ratio) {
+ // nothing to do -- parent layout does not accept Double constraints as
+ // ratio
+ // super.setRatio(ratio);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageEditPart.java
new file mode 100644
index 0000000..810e733
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageEditPart.java
@@ -0,0 +1,56 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EPackageItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.PackageDiagramDragDropEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackageEditPart extends DiagramEditPart {
+
+ /**
+ * @generated
+ */
+ public final static String MODEL_ID = "Ecore"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 79;
+
+ /**
+ * @generated
+ */
+ public EPackageEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EPackageItemSemanticEditPolicy());
+ // installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new
+ // EPackageCanonicalEditPolicy());
+ installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new PackageDiagramDragDropEditPolicy());
+
+ removeEditPolicy(org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles.POPUPBAR_ROLE);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageNameEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageNameEditPart.java
new file mode 100644
index 0000000..881518b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EPackageNameEditPart.java
@@ -0,0 +1,552 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.gef.handles.NonResizableHandleKit;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EPackageNameEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4006;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EPackageNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new NonResizableEditPolicy() {
+
+ protected List createSelectionHandles() {
+ List handles = new ArrayList();
+ NonResizableHandleKit.addMoveHandle((GraphicalEditPart) getHost(), handles);
+ return handles;
+ }
+
+ public Command getCommand(Request request) {
+ return null;
+ }
+
+ public boolean understandsRequest(Request request) {
+ return false;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(WrappingLabel figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EPackage_1002, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ // Parent should assign one using setLabel() method
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReference2EditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReference2EditPart.java
new file mode 100644
index 0000000..d5adf6c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReference2EditPart.java
@@ -0,0 +1,101 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EReference2ItemSemanticEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EReference2EditPart extends ConnectionNodeEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3003;
+
+ /**
+ * @generated
+ */
+ public EReference2EditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EReference2ItemSemanticEditPolicy());
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected Connection createConnectionFigure() {
+ return new SolidLineWDstClosedArrow();
+ }
+
+ /**
+ * @generated
+ */
+ public SolidLineWDstClosedArrow getPrimaryShape() {
+ return (SolidLineWDstClosedArrow) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class SolidLineWDstClosedArrow extends PolylineConnectionEx {
+
+ /**
+ * @generated
+ */
+ public SolidLineWDstClosedArrow() {
+
+ setTargetDecoration(createTargetDecoration());
+ }
+
+ /**
+ * @generated
+ */
+ private RotatableDecoration createTargetDecoration() {
+ PolygonDecoration df = new PolygonDecoration();
+ df.setBackgroundColor(ColorConstants.white);
+ PointList pl = new PointList();
+ pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
+ pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(2));
+ pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(-2));
+ pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
+ df.setTemplate(pl);
+ df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
+ return df;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceEditPart.java
new file mode 100644
index 0000000..3269948
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceEditPart.java
@@ -0,0 +1,165 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.Connection;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EReferenceItemSemanticEditPolicy;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionNodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.PolylineConnectionEx;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EReferenceEditPart extends ConnectionNodeEditPart {
+
+ @Override
+ protected void handleNotificationEvent(Notification notification) {
+ if (notification.getNotifier() instanceof EReference) {
+ switch (notification.getFeatureID(EReference.class)) {
+ case EcorePackage.EREFERENCE__CONTAINMENT:
+ refreshSourceDecoration();
+ break;
+ }
+ }
+ super.handleNotificationEvent(notification);
+ }
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 3002;
+
+ /**
+ * @generated
+ */
+ public EReferenceEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EReferenceItemSemanticEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean addFixedChild(EditPart childEditPart) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addChildVisual(EditPart childEditPart, int index) {
+ if (addFixedChild(childEditPart)) {
+ return;
+ }
+ super.addChildVisual(childEditPart, -1);
+ }
+
+ /**
+ * Creates figure for this edit part.
+ *
+ * Body of this method does not depend on settings in generation model so
+ * you may safely remove <i>generated</i> tag and modify it.
+ *
+ * @generated
+ */
+ protected Connection createConnectionFigure() {
+ return new SolidLineWDstArrow();
+ }
+
+ /**
+ * @generated
+ */
+ public SolidLineWDstArrow getPrimaryShape() {
+ return (SolidLineWDstArrow) getFigure();
+ }
+
+ /**
+ * @generated
+ */
+ public class SolidLineWDstArrow extends PolylineConnectionEx {
+
+ /**
+ * @generated NOT
+ */
+ public SolidLineWDstArrow() {
+ setTargetDecoration(createTargetDecoration());
+ }
+
+ public void displaySourceDecoration(boolean display) {
+ if (display == true) {
+ setSourceDecoration(createSourceDecoration());
+ } else {
+ if (getSourceDecoration() != null) {
+ setSourceDecoration(null);
+ }
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private RotatableDecoration createTargetDecoration() {
+ PolylineDecoration df = new PolylineDecoration();
+ PointList pl = new PointList();
+ pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(1));
+ pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
+ pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(-1));
+ df.setTemplate(pl);
+ df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
+ return df;
+ }
+
+ private RotatableDecoration createSourceDecoration() {
+ PolygonDecoration df = new PolygonDecoration();
+ PointList pl = new PointList();
+ pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(1));
+ pl.addPoint(getMapMode().DPtoLP(0), getMapMode().DPtoLP(0));
+ pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(-1));
+ pl.addPoint(getMapMode().DPtoLP(-2), getMapMode().DPtoLP(0));
+ pl.addPoint(getMapMode().DPtoLP(-1), getMapMode().DPtoLP(1));
+ df.setTemplate(pl);
+ df.setScale(getMapMode().DPtoLP(7), getMapMode().DPtoLP(3));
+ return df;
+ }
+
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshSourceDecoration();
+ }
+
+ protected void refreshSourceDecoration() {
+ ((SolidLineWDstArrow) getFigure()).displaySourceDecoration(((EReference) resolveSemanticElement()).isContainment());
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceLowerBoundUpperBoundEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceLowerBoundUpperBoundEditPart.java
new file mode 100644
index 0000000..3afe6b3
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceLowerBoundUpperBoundEditPart.java
@@ -0,0 +1,536 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EReferenceLowerBoundUpperBoundEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4012;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(EcoreVisualIDRegistry.getType(org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceLowerBoundUpperBoundEditPart.VISUAL_ID), new Point(10, 10));
+ }
+
+ /**
+ * @generated
+ */
+ public EReferenceLowerBoundUpperBoundEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.SOURCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EReference_3002, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceNameEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceNameEditPart.java
new file mode 100644
index 0000000..90a8106
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EReferenceNameEditPart.java
@@ -0,0 +1,535 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.ConnectionLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.LabelEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EReferenceNameEditPart extends LabelEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 4011;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ static {
+ registerSnapBackPosition(EcoreVisualIDRegistry.getType(org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceNameEditPart.VISUAL_ID), new Point(-10, -10));
+ }
+
+ /**
+ * @generated
+ */
+ public EReferenceNameEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ public int getKeyPoint() {
+ return ConnectionLocator.SOURCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EReference_3002, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EStringToStringMapEntryEditPart.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EStringToStringMapEntryEditPart.java
new file mode 100644
index 0000000..704983d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EStringToStringMapEntryEditPart.java
@@ -0,0 +1,559 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EStringToStringMapEntryItemSemanticEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextNonResizableEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EcoreTextSelectionEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.emf.transaction.RunnableWithResult;
+import org.eclipse.gef.AccessibleEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.gef.requests.SelectionRequest;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.EditPolicyRoles;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.LabelDirectEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.ListItemComponentEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.l10n.DiagramColorRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.TextDirectEditManager;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ISemanticParser;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EStringToStringMapEntryEditPart extends CompartmentEditPart implements ITextAwareEditPart {
+
+ /**
+ * @generated
+ */
+ public static final int VISUAL_ID = 2007;
+
+ /**
+ * @generated
+ */
+ private DirectEditManager manager;
+
+ /**
+ * @generated
+ */
+ private IParser parser;
+
+ /**
+ * @generated
+ */
+ private List parserElements;
+
+ /**
+ * @generated
+ */
+ private String defaultText;
+
+ /**
+ * @generated
+ */
+ public EStringToStringMapEntryEditPart(View view) {
+ super(view);
+ }
+
+ /**
+ * @generated
+ */
+ public DragTracker getDragTracker(Request request) {
+ if (request instanceof SelectionRequest && ((SelectionRequest) request).getLastButtonPressed() == 3) {
+ return null;
+ }
+ return new DragEditPartsTrackerEx(this);
+ }
+
+ /**
+ * @generated
+ */
+ protected void createDefaultEditPolicies() {
+ super.createDefaultEditPolicies();
+ installEditPolicy(EditPolicyRoles.SEMANTIC_ROLE, new EStringToStringMapEntryItemSemanticEditPolicy());
+ installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new EcoreTextNonResizableEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ListItemComponentEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelTextHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getText();
+ } else {
+ return ((Label) figure).getText();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelTextHelper(IFigure figure, String text) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setText(text);
+ } else {
+ ((Label) figure).setText(text);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIconHelper(IFigure figure) {
+ if (figure instanceof WrappingLabel) {
+ return ((WrappingLabel) figure).getIcon();
+ } else {
+ return ((Label) figure).getIcon();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setLabelIconHelper(IFigure figure, Image icon) {
+ if (figure instanceof WrappingLabel) {
+ ((WrappingLabel) figure).setIcon(icon);
+ } else {
+ ((Label) figure).setIcon(icon);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabel(IFigure figure) {
+ unregisterVisuals();
+ setFigure(figure);
+ defaultText = getLabelTextHelper(figure);
+ registerVisuals();
+ refreshVisuals();
+ }
+
+ /**
+ * @generated
+ */
+ protected List getModelChildren() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public IGraphicalEditPart getChildBySemanticHint(String semanticHint) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getParserElement() {
+ return resolveSemanticElement();
+ }
+
+ /**
+ * @generated
+ */
+ protected Image getLabelIcon() {
+ EObject parserElement = getParserElement();
+ if (parserElement == null) {
+ return null;
+ }
+ return EcoreElementTypes.getImage(parserElement.eClass());
+ }
+
+ /**
+ * @generated
+ */
+ protected String getLabelText() {
+ String text = null;
+ EObject parserElement = getParserElement();
+ if (parserElement != null && getParser() != null) {
+ text = getParser().getPrintString(new EObjectAdapter(parserElement), getParserOptions().intValue());
+ }
+ if (text == null || text.length() == 0) {
+ text = defaultText;
+ }
+ return text;
+ }
+
+ /**
+ * @generated
+ */
+ public void setLabelText(String text) {
+ setLabelTextHelper(getFigure(), text);
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditText() {
+ if (getParserElement() == null || getParser() == null) {
+ return ""; //$NON-NLS-1$
+ }
+ return getParser().getEditString(new EObjectAdapter(getParserElement()), getParserOptions().intValue());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isEditable() {
+ return getParser() != null;
+ }
+
+ /**
+ * @generated
+ */
+ public ICellEditorValidator getEditTextValidator() {
+ return new ICellEditorValidator() {
+
+ public String isValid(final Object value) {
+ if (value instanceof String) {
+ final EObject element = getParserElement();
+ final IParser parser = getParser();
+ try {
+ IParserEditStatus valid = (IParserEditStatus) getEditingDomain().runExclusive(new RunnableWithResult.Impl() {
+
+ public void run() {
+ setResult(parser.isValidEditString(new EObjectAdapter(element), (String) value));
+ }
+ });
+ return valid.getCode() == ParserEditStatus.EDITABLE ? null : valid.getMessage();
+ } catch (InterruptedException ie) {
+ ie.printStackTrace();
+ }
+ }
+
+ // shouldn't get here
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor() {
+ if (getParserElement() == null || getParser() == null) {
+ return null;
+ }
+ return getParser().getCompletionProcessor(new EObjectAdapter(getParserElement()));
+ }
+
+ /**
+ * @generated
+ */
+ public ParserOptions getParserOptions() {
+ return ParserOptions.NONE;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser() {
+ if (parser == null) {
+ String parserHint = ((View) getModel()).getType();
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EStringToStringMapEntry_2007, getParserElement(), parserHint);
+ parser = ParserService.getInstance().getParser(hintAdapter);
+ }
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected DirectEditManager getManager() {
+ if (manager == null) {
+ setManager(new TextDirectEditManager(this, TextDirectEditManager.getTextCellEditorClass(this), EcoreEditPartFactory.getTextCellEditorLocator(this)));
+ }
+ return manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setManager(DirectEditManager manager) {
+ this.manager = manager;
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit() {
+ getManager().show();
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEdit(Point eventLocation) {
+ if (getManager().getClass() == TextDirectEditManager.class) {
+ ((TextDirectEditManager) getManager()).show(eventLocation.getSWTPoint());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void performDirectEdit(char initialCharacter) {
+ if (getManager() instanceof TextDirectEditManager) {
+ ((TextDirectEditManager) getManager()).show(initialCharacter);
+ } else {
+ performDirectEdit();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void performDirectEditRequest(Request request) {
+ final Request theRequest = request;
+ try {
+ getEditingDomain().runExclusive(new Runnable() {
+
+ public void run() {
+ if (isActive() && isEditable()) {
+ if (theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR) instanceof Character) {
+ Character initialChar = (Character) theRequest.getExtendedData().get(RequestConstants.REQ_DIRECTEDIT_EXTENDEDDATA_INITIAL_CHAR);
+ performDirectEdit(initialChar.charValue());
+ } else if ((theRequest instanceof DirectEditRequest) && (getEditText().equals(getLabelText()))) {
+ DirectEditRequest editRequest = (DirectEditRequest) theRequest;
+ performDirectEdit(editRequest.getLocation());
+ } else {
+ performDirectEdit();
+ }
+ }
+ }
+ });
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ refreshLabel();
+ refreshFont();
+ refreshFontColor();
+ refreshUnderline();
+ refreshStrikeThrough();
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshLabel() {
+ setLabelTextHelper(getFigure(), getLabelText());
+ setLabelIconHelper(getFigure(), getLabelIcon());
+ Object pdEditPolicy = getEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE);
+ if (pdEditPolicy instanceof EcoreTextSelectionEditPolicy) {
+ ((EcoreTextSelectionEditPolicy) pdEditPolicy).refreshFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshUnderline() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextUnderline(style.isUnderline());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshStrikeThrough() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null && getFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getFigure()).setTextStrikeThrough(style.isStrikeThrough());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFont() {
+ FontStyle style = (FontStyle) getFontStyleOwnerView().getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ if (style != null) {
+ FontData fontData = new FontData(style.getFontName(), style.getFontHeight(), (style.isBold() ? SWT.BOLD : SWT.NORMAL) | (style.isItalic() ? SWT.ITALIC : SWT.NORMAL));
+ setFont(fontData);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFontColor(Color color) {
+ getFigure().setForegroundColor(color);
+ }
+
+ /**
+ * @generated
+ */
+ protected void addSemanticListeners() {
+ if (getParser() instanceof ISemanticParser) {
+ EObject element = resolveSemanticElement();
+ parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
+ for (int i = 0; i < parserElements.size(); i++) {
+ addListenerFilter("SemanticModel" + i, this, (EObject) parserElements.get(i)); //$NON-NLS-1$
+ }
+ } else {
+ super.addSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeSemanticListeners() {
+ if (parserElements != null) {
+ for (int i = 0; i < parserElements.size(); i++) {
+ removeListenerFilter("SemanticModel" + i); //$NON-NLS-1$
+ }
+ } else {
+ super.removeSemanticListeners();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected AccessibleEditPart getAccessibleEditPart() {
+ if (accessibleEP == null) {
+ accessibleEP = new AccessibleGraphicalEditPart() {
+
+ public void getName(AccessibleEvent e) {
+ e.result = getLabelTextHelper(getFigure());
+ }
+ };
+ }
+ return accessibleEP;
+ }
+
+ /**
+ * @generated
+ */
+ private View getFontStyleOwnerView() {
+ return getPrimaryView();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addNotationalListeners() {
+ super.addNotationalListeners();
+ addListenerFilter("PrimaryView", this, getPrimaryView()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void removeNotationalListeners() {
+ super.removeNotationalListeners();
+ removeListenerFilter("PrimaryView"); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleNotificationEvent(Notification event) {
+ Object feature = event.getFeature();
+ if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
+ Integer c = (Integer) event.getNewValue();
+ setFontColor(DiagramColorRegistry.getInstance().getColor(c));
+ } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
+ refreshUnderline();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
+ refreshStrikeThrough();
+ } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
+ || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature) || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
+ refreshFont();
+ } else {
+ if (getParser() != null && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
+ refreshLabel();
+ }
+ if (getParser() instanceof ISemanticParser) {
+ ISemanticParser modelParser = (ISemanticParser) getParser();
+ if (modelParser.areSemanticElementsAffected(null, event)) {
+ removeSemanticListeners();
+ if (resolveSemanticElement() != null) {
+ addSemanticListeners();
+ }
+ refreshLabel();
+ }
+ }
+ }
+ super.handleNotificationEvent(event);
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigure() {
+ IFigure label = createFigurePrim();
+ defaultText = getLabelTextHelper(label);
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFigurePrim() {
+ return new WrappingLabel();
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EcoreEditPartFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EcoreEditPartFactory.java
new file mode 100644
index 0000000..8fa9350
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/parts/EcoreEditPartFactory.java
@@ -0,0 +1,256 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.parts;
+
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * @generated
+ */
+public class EcoreEditPartFactory implements EditPartFactory {
+
+ /**
+ * @generated
+ */
+ public EditPart createEditPart(EditPart context, Object model) {
+ if (model instanceof View) {
+ View view = (View) model;
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
+
+ case EPackageEditPart.VISUAL_ID:
+ return new EPackageEditPart(view);
+
+ case EClassEditPart.VISUAL_ID:
+ return new EClassEditPart(view);
+
+ case EClassNameEditPart.VISUAL_ID:
+ return new EClassNameEditPart(view);
+
+ case EPackage2EditPart.VISUAL_ID:
+ return new EPackage2EditPart(view);
+
+ case EPackageNameEditPart.VISUAL_ID:
+ return new EPackageNameEditPart(view);
+
+ case EAnnotationEditPart.VISUAL_ID:
+ return new EAnnotationEditPart(view);
+
+ case EAnnotationSourceEditPart.VISUAL_ID:
+ return new EAnnotationSourceEditPart(view);
+
+ case EDataTypeEditPart.VISUAL_ID:
+ return new EDataTypeEditPart(view);
+
+ case EDataTypeNameEditPart.VISUAL_ID:
+ return new EDataTypeNameEditPart(view);
+
+ case EDataTypeInstanceClassEditPart.VISUAL_ID:
+ return new EDataTypeInstanceClassEditPart(view);
+
+ case EEnumEditPart.VISUAL_ID:
+ return new EEnumEditPart(view);
+
+ case EEnumNameEditPart.VISUAL_ID:
+ return new EEnumNameEditPart(view);
+
+ case EAttributeEditPart.VISUAL_ID:
+ return new EAttributeEditPart(view);
+
+ case EOperationEditPart.VISUAL_ID:
+ return new EOperationEditPart(view);
+
+ case EClass2EditPart.VISUAL_ID:
+ return new EClass2EditPart(view);
+
+ case EClassName2EditPart.VISUAL_ID:
+ return new EClassName2EditPart(view);
+
+ case EDataType2EditPart.VISUAL_ID:
+ return new EDataType2EditPart(view);
+
+ case EDataTypeName2EditPart.VISUAL_ID:
+ return new EDataTypeName2EditPart(view);
+
+ case EDataTypeInstanceClass2EditPart.VISUAL_ID:
+ return new EDataTypeInstanceClass2EditPart(view);
+
+ case EEnum2EditPart.VISUAL_ID:
+ return new EEnum2EditPart(view);
+
+ case EEnumName2EditPart.VISUAL_ID:
+ return new EEnumName2EditPart(view);
+
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return new EEnumLiteralEditPart(view);
+
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ return new EStringToStringMapEntryEditPart(view);
+
+ case EClassAttributesEditPart.VISUAL_ID:
+ return new EClassAttributesEditPart(view);
+
+ case EClassOperationsEditPart.VISUAL_ID:
+ return new EClassOperationsEditPart(view);
+
+ case EPackageContentsEditPart.VISUAL_ID:
+ return new EPackageContentsEditPart(view);
+
+ case EClassAttributes2EditPart.VISUAL_ID:
+ return new EClassAttributes2EditPart(view);
+
+ case EClassOperations2EditPart.VISUAL_ID:
+ return new EClassOperations2EditPart(view);
+
+ case EEnumLiteralsEditPart.VISUAL_ID:
+ return new EEnumLiteralsEditPart(view);
+
+ case EAnnotationDetailsEditPart.VISUAL_ID:
+ return new EAnnotationDetailsEditPart(view);
+
+ case EEnumLiterals2EditPart.VISUAL_ID:
+ return new EEnumLiterals2EditPart(view);
+
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return new EAnnotationReferencesEditPart(view);
+
+ case EReferenceEditPart.VISUAL_ID:
+ return new EReferenceEditPart(view);
+
+ case EReferenceNameEditPart.VISUAL_ID:
+ return new EReferenceNameEditPart(view);
+
+ case EReferenceLowerBoundUpperBoundEditPart.VISUAL_ID:
+ return new EReferenceLowerBoundUpperBoundEditPart(view);
+
+ case EReference2EditPart.VISUAL_ID:
+ return new EReference2EditPart(view);
+ }
+ }
+ return createUnrecognizedEditPart(context, model);
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart createUnrecognizedEditPart(EditPart context, Object model) {
+ // Handle creation of unrecognized child node EditParts here
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
+ if (source.getFigure() instanceof WrappingLabel)
+ return new TextCellEditorLocator((WrappingLabel) source.getFigure());
+ else {
+ return new LabelCellEditorLocator((Label) source.getFigure());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ static private class TextCellEditorLocator implements CellEditorLocator {
+
+ /**
+ * @generated
+ */
+ private WrappingLabel wrappingLabel;
+
+ /**
+ * @generated
+ */
+ public TextCellEditorLocator(WrappingLabel wrappingLabel) {
+ this.wrappingLabel = wrappingLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public WrappingLabel getWrapLabel() {
+ return wrappingLabel;
+ }
+
+ /**
+ * @generated
+ */
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text) celleditor.getControl();
+ Rectangle rect = getWrapLabel().getTextBounds().getCopy();
+ getWrapLabel().translateToAbsolute(rect);
+ if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
+ rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
+ } else {
+ int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
+ }
+ if (!rect.equals(new Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private static class LabelCellEditorLocator implements CellEditorLocator {
+
+ /**
+ * @generated
+ */
+ private Label label;
+
+ /**
+ * @generated
+ */
+ public LabelCellEditorLocator(Label label) {
+ this.label = label;
+ }
+
+ /**
+ * @generated
+ */
+ public Label getLabel() {
+ return label;
+ }
+
+ /**
+ * @generated
+ */
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text) celleditor.getControl();
+ Rectangle rect = getLabel().getTextBounds().getCopy();
+ getLabel().translateToAbsolute(rect);
+ int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
+ if (!rect.equals(new Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationDetailsCanonicalEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationDetailsCanonicalEditPolicy.java
new file mode 100644
index 0000000..36d55a3
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationDetailsCanonicalEditPolicy.java
@@ -0,0 +1,82 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdater;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreNodeDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAnnotationDetailsCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = EcoreDiagramUpdater.getEAnnotationDetails_5007SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((EcoreNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = EcoreVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ return !semanticChildren.contains(view.getElement()) || visualID != EcoreVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEAnnotation_Details());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationDetailsItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationDetailsItemSemanticEditPolicy.java
new file mode 100644
index 0000000..b77f3f5
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationDetailsItemSemanticEditPolicy.java
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EStringToStringMapEntryCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class EAnnotationDetailsItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (EcoreElementTypes.EStringToStringMapEntry_2007 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEAnnotation_Details());
+ }
+ return getGEFWrapper(new EStringToStringMapEntryCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationItemSemanticEditPolicy.java
new file mode 100644
index 0000000..25503f3
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationItemSemanticEditPolicy.java
@@ -0,0 +1,122 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationDetailsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAnnotationItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (EcoreVisualIDRegistry.getVisualID(node)) {
+ case EAnnotationDetailsEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationReferencesItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationReferencesItemSemanticEditPolicy.java
new file mode 100644
index 0000000..7eed2ce
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAnnotationReferencesItemSemanticEditPolicy.java
@@ -0,0 +1,30 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+
+/**
+ * @generated
+ */
+public class EAnnotationReferencesItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return getGEFWrapper(new DestroyReferenceCommand(req));
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAttributeItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAttributeItemSemanticEditPolicy.java
new file mode 100644
index 0000000..d01f694
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EAttributeItemSemanticEditPolicy.java
@@ -0,0 +1,83 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EAttributeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClass2ItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClass2ItemSemanticEditPolicy.java
new file mode 100644
index 0000000..50dc4a6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClass2ItemSemanticEditPolicy.java
@@ -0,0 +1,165 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReference2CreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReference2ReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributes2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperations2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReference2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClass2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (EcoreVisualIDRegistry.getVisualID(node)) {
+ case EClassAttributes2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
+ case EAttributeEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case EClassOperations2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
+ case EOperationEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return getGEFWrapper(new EReferenceCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EClassESuperTypes_3003 == req.getElementType()) {
+ return getGEFWrapper(new EReference2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return getGEFWrapper(new EReferenceCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EClassESuperTypes_3003 == req.getElementType()) {
+ return getGEFWrapper(new EReference2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EReferenceEditPart.VISUAL_ID:
+ return getGEFWrapper(new EReferenceReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ case EReference2EditPart.VISUAL_ID:
+ return getGEFWrapper(new EReference2ReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributes2CanonicalEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributes2CanonicalEditPolicy.java
new file mode 100644
index 0000000..7d708a2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributes2CanonicalEditPolicy.java
@@ -0,0 +1,82 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdater;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreNodeDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassAttributes2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = EcoreDiagramUpdater.getEClassAttributes_5004SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((EcoreNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = EcoreVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EAttributeEditPart.VISUAL_ID:
+ return !semanticChildren.contains(view.getElement()) || visualID != EcoreVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEClass_EAttributes());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributes2ItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributes2ItemSemanticEditPolicy.java
new file mode 100644
index 0000000..723d980
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributes2ItemSemanticEditPolicy.java
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAttributeCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class EClassAttributes2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (EcoreElementTypes.EAttribute_2001 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
+ }
+ return getGEFWrapper(new EAttributeCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributesCanonicalEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributesCanonicalEditPolicy.java
new file mode 100644
index 0000000..7438e6a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributesCanonicalEditPolicy.java
@@ -0,0 +1,82 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdater;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreNodeDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassAttributesCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = EcoreDiagramUpdater.getEClassAttributes_5001SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((EcoreNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = EcoreVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EAttributeEditPart.VISUAL_ID:
+ return !semanticChildren.contains(view.getElement()) || visualID != EcoreVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEClass_EAttributes());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributesItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributesItemSemanticEditPolicy.java
new file mode 100644
index 0000000..67df4e7
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassAttributesItemSemanticEditPolicy.java
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAttributeCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class EClassAttributesItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (EcoreElementTypes.EAttribute_2001 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EStructuralFeatures());
+ }
+ return getGEFWrapper(new EAttributeCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassESuperTypesItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassESuperTypesItemSemanticEditPolicy.java
new file mode 100644
index 0000000..518fc80
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassESuperTypesItemSemanticEditPolicy.java
@@ -0,0 +1,31 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+
+/**
+ * @generated
+ */
+public class EClassESuperTypesItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return getGEFWrapper(new DestroyReferenceCommand(req));
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassItemSemanticEditPolicy.java
new file mode 100644
index 0000000..d5ef15c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassItemSemanticEditPolicy.java
@@ -0,0 +1,169 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReference2CreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReference2ReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperationsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReference2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (EcoreVisualIDRegistry.getVisualID(node)) {
+ case EClassAttributesEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
+ case EAttributeEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ case EClassOperationsEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
+ case EOperationEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return getGEFWrapper(new EReferenceCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EClassESuperTypes_3003 == req.getElementType()) {
+ return getGEFWrapper(new EReference2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return getGEFWrapper(new EReferenceCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EClassESuperTypes_3003 == req.getElementType()) {
+ return getGEFWrapper(new EReference2CreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EReferenceEditPart.VISUAL_ID:
+ return getGEFWrapper(new EReferenceReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ case EReference2EditPart.VISUAL_ID:
+ return getGEFWrapper(new EReference2ReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperations2CanonicalEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperations2CanonicalEditPolicy.java
new file mode 100644
index 0000000..83d4e65
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperations2CanonicalEditPolicy.java
@@ -0,0 +1,82 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdater;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreNodeDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassOperations2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = EcoreDiagramUpdater.getEClassOperations_5005SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((EcoreNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = EcoreVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EOperationEditPart.VISUAL_ID:
+ return !semanticChildren.contains(view.getElement()) || visualID != EcoreVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEClass_EOperations());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperations2ItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperations2ItemSemanticEditPolicy.java
new file mode 100644
index 0000000..c13aba5
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperations2ItemSemanticEditPolicy.java
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EOperationCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class EClassOperations2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (EcoreElementTypes.EOperation_2002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EOperations());
+ }
+ return getGEFWrapper(new EOperationCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperationsCanonicalEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperationsCanonicalEditPolicy.java
new file mode 100644
index 0000000..44af57d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperationsCanonicalEditPolicy.java
@@ -0,0 +1,82 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdater;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreNodeDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassOperationsCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = EcoreDiagramUpdater.getEClassOperations_5002SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((EcoreNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = EcoreVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EOperationEditPart.VISUAL_ID:
+ return !semanticChildren.contains(view.getElement()) || visualID != EcoreVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEClass_EOperations());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperationsItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperationsItemSemanticEditPolicy.java
new file mode 100644
index 0000000..cfc21ac
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EClassOperationsItemSemanticEditPolicy.java
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EOperationCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class EClassOperationsItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (EcoreElementTypes.EOperation_2002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEClass_EOperations());
+ }
+ return getGEFWrapper(new EOperationCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EDataType2ItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EDataType2ItemSemanticEditPolicy.java
new file mode 100644
index 0000000..81b729f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EDataType2ItemSemanticEditPolicy.java
@@ -0,0 +1,107 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EDataType2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return getGEFWrapper(new EReferenceCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EReferenceEditPart.VISUAL_ID:
+ return getGEFWrapper(new EReferenceReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EDataTypeItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EDataTypeItemSemanticEditPolicy.java
new file mode 100644
index 0000000..d235805
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EDataTypeItemSemanticEditPolicy.java
@@ -0,0 +1,112 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EDataTypeItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return getGEFWrapper(new EReferenceCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EReferenceEditPart.VISUAL_ID:
+ return getGEFWrapper(new EReferenceReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnum2ItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnum2ItemSemanticEditPolicy.java
new file mode 100644
index 0000000..18cfd6d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnum2ItemSemanticEditPolicy.java
@@ -0,0 +1,142 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnum2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (EcoreVisualIDRegistry.getVisualID(node)) {
+ case EEnumLiteralsEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
+ case EEnumLiteralEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return getGEFWrapper(new EReferenceCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EReferenceEditPart.VISUAL_ID:
+ return getGEFWrapper(new EReferenceReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumItemSemanticEditPolicy.java
new file mode 100644
index 0000000..5c896b5
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumItemSemanticEditPolicy.java
@@ -0,0 +1,146 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EReferenceReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiterals2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (EcoreVisualIDRegistry.getVisualID(node)) {
+ case EEnumLiterals2EditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
+ case EEnumLiteralEditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ if (EcoreElementTypes.EReference_3002 == req.getElementType()) {
+ return getGEFWrapper(new EReferenceCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EClass based link. New link target or source
+ * should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EReferenceEditPart.VISUAL_ID:
+ return getGEFWrapper(new EReferenceReorientCommand(req));
+ }
+ return super.getReorientRelationshipCommand(req);
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralItemSemanticEditPolicy.java
new file mode 100644
index 0000000..fd0e800
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralItemSemanticEditPolicy.java
@@ -0,0 +1,83 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EEnumLiteralItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiterals2CanonicalEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiterals2CanonicalEditPolicy.java
new file mode 100644
index 0000000..4054e01
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiterals2CanonicalEditPolicy.java
@@ -0,0 +1,82 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdater;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreNodeDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumLiterals2CanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = EcoreDiagramUpdater.getEEnumLiterals_5008SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((EcoreNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = EcoreVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return !semanticChildren.contains(view.getElement()) || visualID != EcoreVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEEnum_ELiterals());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiterals2ItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiterals2ItemSemanticEditPolicy.java
new file mode 100644
index 0000000..a876cf6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiterals2ItemSemanticEditPolicy.java
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EEnumLiteralCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class EEnumLiterals2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (EcoreElementTypes.EEnumLiteral_2006 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEEnum_ELiterals());
+ }
+ return getGEFWrapper(new EEnumLiteralCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralsCanonicalEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralsCanonicalEditPolicy.java
new file mode 100644
index 0000000..0a4fa6d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralsCanonicalEditPolicy.java
@@ -0,0 +1,82 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdater;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreNodeDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumLiteralsCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = EcoreDiagramUpdater.getEEnumLiterals_5006SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((EcoreNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = EcoreVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return !semanticChildren.contains(view.getElement()) || visualID != EcoreVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEEnum_ELiterals());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralsItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralsItemSemanticEditPolicy.java
new file mode 100644
index 0000000..f2854a3
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EEnumLiteralsItemSemanticEditPolicy.java
@@ -0,0 +1,38 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EEnumLiteralCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class EEnumLiteralsItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (EcoreElementTypes.EEnumLiteral_2006 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEEnum_ELiterals());
+ }
+ return getGEFWrapper(new EEnumLiteralCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EOperationItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EOperationItemSemanticEditPolicy.java
new file mode 100644
index 0000000..6cc3865
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EOperationItemSemanticEditPolicy.java
@@ -0,0 +1,83 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EOperationItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackage2ItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackage2ItemSemanticEditPolicy.java
new file mode 100644
index 0000000..09a9356
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackage2ItemSemanticEditPolicy.java
@@ -0,0 +1,137 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.RemoveDiagramCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageContentsEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.notation.MultiDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackage2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated NOT
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyChildNodesCommand(cc);
+ addDestroyShortcutsCommand(cc);
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ req.setElementToDestroy(view);
+ }
+ MultiDiagramLinkStyle style = (MultiDiagramLinkStyle) view.getStyle(NotationPackage.eINSTANCE.getMultiDiagramLinkStyle());
+ if (style != null) {
+ cc.add(getGEFWrapper(new RemoveDiagramCommand(style)));
+ }
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyChildNodesCommand(CompoundCommand cmd) {
+ View view = (View) getHost().getModel();
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return;
+ }
+ for (Iterator it = view.getChildren().iterator(); it.hasNext();) {
+ Node node = (Node) it.next();
+ switch (EcoreVisualIDRegistry.getVisualID(node)) {
+ case EPackageContentsEditPart.VISUAL_ID:
+ for (Iterator cit = node.getChildren().iterator(); cit.hasNext();) {
+ Node cnode = (Node) cit.next();
+ switch (EcoreVisualIDRegistry.getVisualID(cnode)) {
+ case EClass2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case EDataType2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ case EEnum2EditPart.VISUAL_ID:
+ cmd.add(getDestroyElementCommand(cnode));
+ break;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageCanonicalEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageCanonicalEditPolicy.java
new file mode 100644
index 0000000..1f2dc81
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageCanonicalEditPolicy.java
@@ -0,0 +1,339 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackage2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdater;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreLinkDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreNodeDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.DeferredLayoutCommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.RequestConstants;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackageCanonicalEditPolicy extends CanonicalConnectionEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = EcoreDiagramUpdater.getEPackage_79SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((EcoreNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean shouldDeleteView(View view) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ if (view.getEAnnotation("Shortcut") != null) {//$NON-NLS-1$
+ return EcoreDiagramUpdater.isShortcutOrphaned(view);
+ }
+ int visualID = EcoreVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EClassEditPart.VISUAL_ID:
+ case EPackage2EditPart.VISUAL_ID:
+ case EAnnotationEditPart.VISUAL_ID:
+ case EDataTypeEditPart.VISUAL_ID:
+ case EEnumEditPart.VISUAL_ID:
+ return !semanticChildren.contains(view.getElement()) || visualID != EcoreVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEPackage_ESubpackages());
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+ /**
+ * @generated
+ */
+ protected List getSemanticConnectionsList() {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getSourceElement(EObject relationship) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getTargetElement(EObject relationship) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean shouldIncludeConnection(Edge connector, Collection children) {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSemantic() {
+ List createdViews = new LinkedList();
+ createdViews.addAll(refreshSemanticChildren());
+ List createdConnectionViews = new LinkedList();
+ createdConnectionViews.addAll(refreshSemanticConnections());
+ createdConnectionViews.addAll(refreshConnections());
+
+ if (createdViews.size() > 1) {
+ // perform a layout of the container
+ DeferredLayoutCommand layoutCmd = new DeferredLayoutCommand(host().getEditingDomain(), createdViews, host());
+ executeCommand(new ICommandProxy(layoutCmd));
+ }
+
+ createdViews.addAll(createdConnectionViews);
+ makeViewsImmutable(createdViews);
+ }
+
+ /**
+ * @generated
+ */
+ private Diagram getDiagram() {
+ return ((View) getHost().getModel()).getDiagram();
+ }
+
+ /**
+ * @generated
+ */
+ private Collection refreshConnections() {
+ Map domain2NotationMap = new HashMap();
+ Collection linkDescriptors = collectAllLinks(getDiagram(), domain2NotationMap);
+ Collection existingLinks = new LinkedList(getDiagram().getEdges());
+ for (Iterator linksIterator = existingLinks.iterator(); linksIterator.hasNext();) {
+ Edge nextDiagramLink = (Edge) linksIterator.next();
+ EObject diagramLinkObject = nextDiagramLink.getElement();
+ EObject diagramLinkSrc = nextDiagramLink.getSource().getElement();
+ EObject diagramLinkDst = nextDiagramLink.getTarget().getElement();
+ int diagramLinkVisualID = EcoreVisualIDRegistry.getVisualID(nextDiagramLink);
+ for (Iterator LinkDescriptorsIterator = linkDescriptors.iterator(); LinkDescriptorsIterator.hasNext();) {
+ EcoreLinkDescriptor nextLinkDescriptor = (EcoreLinkDescriptor) 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);
+ }
+
+ /**
+ * @generated
+ */
+ private Collection collectAllLinks(View view, Map domain2NotationMap) {
+ if (!EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(view))) {
+ return Collections.EMPTY_LIST;
+ }
+ Collection result = new LinkedList();
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
+ case EPackageEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEPackage_79ContainedLinks(view));
+ break;
+ }
+ case EClassEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEClass_1001ContainedLinks(view));
+ break;
+ }
+ case EPackage2EditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEPackage_1002ContainedLinks(view));
+ break;
+ }
+ case EAnnotationEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEAnnotation_1003ContainedLinks(view));
+ break;
+ }
+ case EDataTypeEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEDataType_1004ContainedLinks(view));
+ break;
+ }
+ case EEnumEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEEnum_1005ContainedLinks(view));
+ break;
+ }
+ case EAttributeEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEAttribute_2001ContainedLinks(view));
+ break;
+ }
+ case EOperationEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEOperation_2002ContainedLinks(view));
+ break;
+ }
+ case EClass2EditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEClass_2003ContainedLinks(view));
+ break;
+ }
+ case EDataType2EditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEDataType_2004ContainedLinks(view));
+ break;
+ }
+ case EEnum2EditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEEnum_2005ContainedLinks(view));
+ break;
+ }
+ case EEnumLiteralEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEEnumLiteral_2006ContainedLinks(view));
+ break;
+ }
+ case EStringToStringMapEntryEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEStringToStringMapEntry_2007ContainedLinks(view));
+ break;
+ }
+ case EReferenceEditPart.VISUAL_ID: {
+ domain2NotationMap.put(view.getElement(), view);
+ result.addAll(EcoreDiagramUpdater.getEReference_3002ContainedLinks(view));
+ break;
+ }
+ }
+ for (Iterator children = view.getChildren().iterator(); children.hasNext();) {
+ result.addAll(collectAllLinks((View) children.next(), domain2NotationMap));
+ }
+ for (Iterator edges = view.getSourceEdges().iterator(); edges.hasNext();) {
+ result.addAll(collectAllLinks((View) edges.next(), domain2NotationMap));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection createConnections(Collection linkDescriptors, Map domain2NotationMap) {
+ List adapters = new LinkedList();
+ for (Iterator linkDescriptorsIterator = linkDescriptors.iterator(); linkDescriptorsIterator.hasNext();) {
+ final EcoreLinkDescriptor nextLinkDescriptor = (EcoreLinkDescriptor) linkDescriptorsIterator.next();
+ EditPart sourceEditPart = getEditPart(nextLinkDescriptor.getSource(), domain2NotationMap);
+ EditPart targetEditPart = getEditPart(nextLinkDescriptor.getDestination(), domain2NotationMap);
+ if (sourceEditPart == null || targetEditPart == null) {
+ continue;
+ }
+ CreateConnectionViewRequest.ConnectionViewDescriptor descriptor = new CreateConnectionViewRequest.ConnectionViewDescriptor(nextLinkDescriptor.getSemanticAdapter(), null, ViewUtil.APPEND,
+ false, ((IGraphicalEditPart) getHost()).getDiagramPreferencesHint());
+ CreateConnectionViewRequest ccr = new CreateConnectionViewRequest(descriptor);
+ ccr.setType(RequestConstants.REQ_CONNECTION_START);
+ ccr.setSourceEditPart(sourceEditPart);
+ sourceEditPart.getCommand(ccr);
+ ccr.setTargetEditPart(targetEditPart);
+ ccr.setType(RequestConstants.REQ_CONNECTION_END);
+ Command cmd = targetEditPart.getCommand(ccr);
+ if (cmd != null && cmd.canExecute()) {
+ executeCommand(cmd);
+ IAdaptable viewAdapter = (IAdaptable) ccr.getNewObject();
+ if (viewAdapter != null) {
+ adapters.add(viewAdapter);
+ }
+ }
+ }
+ return adapters;
+ }
+
+ /**
+ * @generated
+ */
+ private EditPart getEditPart(EObject domainModelElement, Map domain2NotationMap) {
+ View view = (View) domain2NotationMap.get(domainModelElement);
+ if (view != null) {
+ return (EditPart) getHost().getViewer().getEditPartRegistry().get(view);
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageContentsCanonicalEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageContentsCanonicalEditPolicy.java
new file mode 100644
index 0000000..db1d817
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageContentsCanonicalEditPolicy.java
@@ -0,0 +1,86 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramUpdater;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreNodeDescriptor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackageContentsCanonicalEditPolicy extends CanonicalEditPolicy {
+
+ /**
+ * @generated
+ */
+ Set myFeaturesToSynchronize;
+
+ /**
+ * @generated
+ */
+ protected List getSemanticChildrenList() {
+ View viewObject = (View) getHost().getModel();
+ List result = new LinkedList();
+ for (Iterator it = EcoreDiagramUpdater.getEPackageContents_5003SemanticChildren(viewObject).iterator(); it.hasNext();) {
+ result.add(((EcoreNodeDescriptor) it.next()).getModelElement());
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isOrphaned(Collection semanticChildren, final View view) {
+ int visualID = EcoreVisualIDRegistry.getVisualID(view);
+ switch (visualID) {
+ case EClass2EditPart.VISUAL_ID:
+ case EDataType2EditPart.VISUAL_ID:
+ case EEnum2EditPart.VISUAL_ID:
+ return !semanticChildren.contains(view.getElement()) || visualID != EcoreVisualIDRegistry.getNodeVisualID((View) getHost().getModel(), view.getElement());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getDefaultFactoryHint() {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Set getFeaturesToSynchronize() {
+ if (myFeaturesToSynchronize == null) {
+ myFeaturesToSynchronize = new HashSet();
+ myFeaturesToSynchronize.add(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
+ }
+ return myFeaturesToSynchronize;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageContentsItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageContentsItemSemanticEditPolicy.java
new file mode 100644
index 0000000..42ce7ab
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageContentsItemSemanticEditPolicy.java
@@ -0,0 +1,52 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EClass2CreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EDataType2CreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EEnum2CreateCommand;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+
+/**
+ * @generated
+ */
+public class EPackageContentsItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (EcoreElementTypes.EClass_2003 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
+ }
+ return getGEFWrapper(new EClass2CreateCommand(req));
+ }
+ if (EcoreElementTypes.EDataType_2004 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
+ }
+ return getGEFWrapper(new EDataType2CreateCommand(req));
+ }
+ if (EcoreElementTypes.EEnum_2005 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
+ }
+ return getGEFWrapper(new EEnum2CreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageItemSemanticEditPolicy.java
new file mode 100644
index 0000000..fb229ba
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EPackageItemSemanticEditPolicy.java
@@ -0,0 +1,91 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EClassCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EDataTypeCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EEnumCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EPackageCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.commands.core.commands.DuplicateEObjectsCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+
+/**
+ * @generated
+ */
+public class EPackageItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ if (EcoreElementTypes.EClass_1001 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
+ }
+ return getGEFWrapper(new EClassCreateCommand(req));
+ }
+ if (EcoreElementTypes.EPackage_1002 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_ESubpackages());
+ }
+ return getGEFWrapper(new EPackageCreateCommand(req));
+ }
+ if (EcoreElementTypes.EAnnotation_1003 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEModelElement_EAnnotations());
+ }
+ return getGEFWrapper(new EAnnotationCreateCommand(req));
+ }
+ if (EcoreElementTypes.EDataType_1004 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
+ }
+ return getGEFWrapper(new EDataTypeCreateCommand(req));
+ }
+ if (EcoreElementTypes.EEnum_1005 == req.getElementType()) {
+ if (req.getContainmentFeature() == null) {
+ req.setContainmentFeature(EcorePackage.eINSTANCE.getEPackage_EClassifiers());
+ }
+ return getGEFWrapper(new EEnumCreateCommand(req));
+ }
+ return super.getCreateCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ return getGEFWrapper(new DuplicateAnythingCommand(editingDomain, req));
+ }
+
+ /**
+ * @generated
+ */
+ private static class DuplicateAnythingCommand extends DuplicateEObjectsCommand {
+
+ /**
+ * @generated
+ */
+ public DuplicateAnythingCommand(TransactionalEditingDomain editingDomain, DuplicateElementsRequest req) {
+ super(editingDomain, req.getLabel(), req.getElementsToBeDuplicated(), req.getAllDuplicatedElementsMap());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EReference2ItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EReference2ItemSemanticEditPolicy.java
new file mode 100644
index 0000000..34f5e17
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EReference2ItemSemanticEditPolicy.java
@@ -0,0 +1,31 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyReferenceCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+
+/**
+ * @generated
+ */
+public class EReference2ItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return getGEFWrapper(new DestroyReferenceCommand(req));
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EReferenceItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EReferenceItemSemanticEditPolicy.java
new file mode 100644
index 0000000..8a77d6e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EReferenceItemSemanticEditPolicy.java
@@ -0,0 +1,79 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesCreateCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EAnnotationReferencesReorientCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+
+/**
+ * @generated
+ */
+public class EReferenceItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return getGEFWrapper(new DestroyElementCommand(req));
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ Command command = req.getTarget() == null ? getStartCreateRelationshipCommand(req) : getCompleteCreateRelationshipCommand(req);
+ return command != null ? command : super.getCreateRelationshipCommand(req);
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getStartCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return null;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCompleteCreateRelationshipCommand(CreateRelationshipRequest req) {
+ if (EcoreElementTypes.EAnnotationReferences_3001 == req.getElementType()) {
+ return getGEFWrapper(new EAnnotationReferencesCreateCommand(req, req.getSource(), req.getTarget()));
+ }
+ return null;
+ }
+
+ /**
+ * Returns command to reorient EReference based link. New link target or
+ * source should be the domain model element associated with this node.
+ *
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ switch (getVisualID(req)) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getGEFWrapper(new EAnnotationReferencesReorientCommand(req));
+ }
+ return super.getReorientReferenceRelationshipCommand(req);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java
new file mode 100644
index 0000000..847dcc4
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EStringToStringMapEntryItemSemanticEditPolicy.java
@@ -0,0 +1,35 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.DestroyElementCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+
+/**
+ * @generated
+ */
+public class EStringToStringMapEntryItemSemanticEditPolicy extends EcoreBaseItemSemanticEditPolicy {
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ CompoundCommand cc = getDestroyEdgesCommand();
+ addDestroyShortcutsCommand(cc);
+ cc.add(getGEFWrapper(new DestroyElementCommand(req)));
+ return cc.unwrap();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreBaseItemSemanticEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreBaseItemSemanticEditPolicy.java
new file mode 100644
index 0000000..cc968b0
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreBaseItemSemanticEditPolicy.java
@@ -0,0 +1,454 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.helpers.EcoreBaseEditHelper;
+import org.eclipse.emf.ecoretools.diagram.expressions.EcoreAbstractExpression;
+import org.eclipse.emf.ecoretools.diagram.expressions.EcoreOCLFactory;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.core.commands.DeleteCommand;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.SemanticEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IEditHelperContext;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ConfigureRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DuplicateElementsRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.GetEditContextRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.MoveRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreBaseItemSemanticEditPolicy extends SemanticEditPolicy {
+
+ /**
+ * Extended request data key to hold editpart visual id.
+ *
+ * @generated
+ */
+ public static final String VISUAL_ID_KEY = "visual_id"; //$NON-NLS-1$
+
+ /**
+ * Extended request data key to hold editpart visual id. Add visual id of
+ * edited editpart to extended data of the request so command switch can
+ * decide what kind of diagram element is being edited. It is done in those
+ * cases when it's not possible to deduce diagram element kind from domain
+ * element.
+ *
+ * @generated
+ */
+ public Command getCommand(Request request) {
+ if (request instanceof ReconnectRequest) {
+ Object view = ((ReconnectRequest) request).getConnectionEditPart().getModel();
+ if (view instanceof View) {
+ Integer id = new Integer(EcoreVisualIDRegistry.getVisualID((View) view));
+ request.getExtendedData().put(VISUAL_ID_KEY, id);
+ }
+ }
+ return super.getCommand(request);
+ }
+
+ /**
+ * Returns visual id from request parameters.
+ *
+ * @generated
+ */
+ protected int getVisualID(IEditCommandRequest request) {
+ Object id = request.getParameter(VISUAL_ID_KEY);
+ return id instanceof Integer ? ((Integer) id).intValue() : -1;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSemanticCommand(IEditCommandRequest request) {
+ IEditCommandRequest completedRequest = completeRequest(request);
+ Object editHelperContext = completedRequest.getEditHelperContext();
+ if (editHelperContext instanceof View || (editHelperContext instanceof IEditHelperContext && ((IEditHelperContext) editHelperContext).getEObject() instanceof View)) {
+ // no semantic commands are provided for pure design elements
+ return null;
+ }
+ if (editHelperContext == null) {
+ editHelperContext = ViewUtil.resolveSemanticElement((View) getHost().getModel());
+ }
+ IElementType elementType = ElementTypeRegistry.getInstance().getElementType(editHelperContext);
+ if (elementType == ElementTypeRegistry.getInstance().getType("org.eclipse.gmf.runtime.emf.type.core.default")) { //$NON-NLS-1$
+ elementType = null;
+ }
+ Command semanticCommand = getSemanticCommandSwitch(completedRequest);
+ if (semanticCommand != null) {
+ ICommand command = semanticCommand instanceof ICommandProxy ? ((ICommandProxy) semanticCommand).getICommand() : new CommandProxy(semanticCommand);
+ completedRequest.setParameter(EcoreBaseEditHelper.EDIT_POLICY_COMMAND, command);
+ }
+ if (elementType != null) {
+ ICommand command = elementType.getEditCommand(completedRequest);
+ if (command != null) {
+ if (!(command instanceof CompositeTransactionalCommand)) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ command = new CompositeTransactionalCommand(editingDomain, null).compose(command);
+ }
+ semanticCommand = new ICommandProxy(command);
+ }
+ }
+ boolean shouldProceed = true;
+ if (completedRequest instanceof DestroyRequest) {
+ shouldProceed = shouldProceed((DestroyRequest) completedRequest);
+ }
+ if (shouldProceed) {
+ if (completedRequest instanceof DestroyRequest) {
+ TransactionalEditingDomain editingDomain = ((IGraphicalEditPart) getHost()).getEditingDomain();
+ Command deleteViewCommand = new ICommandProxy(new DeleteCommand(editingDomain, (View) getHost().getModel()));
+ semanticCommand = semanticCommand == null ? deleteViewCommand : semanticCommand.chain(deleteViewCommand);
+ }
+ return semanticCommand;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSemanticCommandSwitch(IEditCommandRequest req) {
+ if (req instanceof CreateRelationshipRequest) {
+ return getCreateRelationshipCommand((CreateRelationshipRequest) req);
+ } else if (req instanceof CreateElementRequest) {
+ return getCreateCommand((CreateElementRequest) req);
+ } else if (req instanceof ConfigureRequest) {
+ return getConfigureCommand((ConfigureRequest) req);
+ } else if (req instanceof DestroyElementRequest) {
+ return getDestroyElementCommand((DestroyElementRequest) req);
+ } else if (req instanceof DestroyReferenceRequest) {
+ return getDestroyReferenceCommand((DestroyReferenceRequest) req);
+ } else if (req instanceof DuplicateElementsRequest) {
+ return getDuplicateCommand((DuplicateElementsRequest) req);
+ } else if (req instanceof GetEditContextRequest) {
+ return getEditContextCommand((GetEditContextRequest) req);
+ } else if (req instanceof MoveRequest) {
+ return getMoveCommand((MoveRequest) req);
+ } else if (req instanceof ReorientReferenceRelationshipRequest) {
+ return getReorientReferenceRelationshipCommand((ReorientReferenceRelationshipRequest) req);
+ } else if (req instanceof ReorientRelationshipRequest) {
+ return getReorientRelationshipCommand((ReorientRelationshipRequest) req);
+ } else if (req instanceof SetRequest) {
+ return getSetCommand((SetRequest) req);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getConfigureCommand(ConfigureRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getCreateCommand(CreateElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getSetCommand(SetRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getEditContextCommand(GetEditContextRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyElementCommand(DestroyElementRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getDuplicateCommand(DuplicateElementsRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getMoveCommand(MoveRequest req) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientReferenceRelationshipCommand(ReorientReferenceRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected Command getReorientRelationshipCommand(ReorientRelationshipRequest req) {
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ protected final Command getGEFWrapper(ICommand cmd) {
+ return new ICommandProxy(cmd);
+ }
+
+ /**
+ * @deprecated use getGEFWrapper() instead
+ * @generated
+ */
+ protected final Command getMSLWrapper(ICommand cmd) {
+ // XXX deprecated: use getGEFWrapper() instead
+ return getGEFWrapper(cmd);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject getSemanticElement() {
+ return ViewUtil.resolveSemanticElement((View) getHost().getModel());
+ }
+
+ /**
+ * Returns editing domain from the host edit part.
+ *
+ * @generated
+ */
+ protected TransactionalEditingDomain getEditingDomain() {
+ return ((IGraphicalEditPart) getHost()).getEditingDomain();
+ }
+
+ /**
+ * Creates command to destroy the link.
+ *
+ * @generated
+ */
+ protected Command getDestroyElementCommand(View view) {
+ EditPart editPart = (EditPart) getHost().getViewer().getEditPartRegistry().get(view);
+ DestroyElementRequest request = new DestroyElementRequest(getEditingDomain(), false);
+ return editPart.getCommand(new EditCommandRequestWrapper(request, Collections.EMPTY_MAP));
+ }
+
+ /**
+ * Creates commands to destroy all host incoming and outgoing links.
+ *
+ * @generated
+ */
+ protected CompoundCommand getDestroyEdgesCommand() {
+ CompoundCommand cmd = new CompoundCommand();
+ View view = (View) getHost().getModel();
+ for (Iterator it = view.getSourceEdges().iterator(); it.hasNext();) {
+ cmd.add(getDestroyElementCommand((Edge) it.next()));
+ }
+ for (Iterator it = view.getTargetEdges().iterator(); it.hasNext();) {
+ cmd.add(getDestroyElementCommand((Edge) it.next()));
+ }
+ return cmd;
+ }
+
+ /**
+ * @generated
+ */
+ protected void addDestroyShortcutsCommand(CompoundCommand command) {
+ View view = (View) getHost().getModel();
+ if (view.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ return;
+ }
+ for (Iterator it = view.getDiagram().getChildren().iterator(); it.hasNext();) {
+ View nextView = (View) it.next();
+ if (nextView.getEAnnotation("Shortcut") == null || !nextView.isSetElement() || nextView.getElement() != view.getElement()) { //$NON-NLS-1$
+ continue;
+ }
+ command.add(getDestroyElementCommand(nextView));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static class LinkConstraints {
+
+ /**
+ * @generated
+ */
+ private static final String OPPOSITE_END_VAR = "oppositeEnd"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private static final EcoreAbstractExpression EReference_3002_TargetExpression;
+
+ /**
+ * @generated
+ */
+ static {
+ Map env = new HashMap(3);
+ env.put(OPPOSITE_END_VAR, EcorePackage.eINSTANCE.getEClass());
+ EReference_3002_TargetExpression = EcoreOCLFactory.getExpression("self.oclIsKindOf(ecore::EClass)", EcorePackage.eINSTANCE.getEClassifier(), env); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private static final EcoreAbstractExpression EClassESuperTypes_3003_TargetExpression;
+
+ /**
+ * @generated
+ */
+ static {
+ Map env = new HashMap(3);
+ env.put(OPPOSITE_END_VAR, EcorePackage.eINSTANCE.getEClass());
+ EClassESuperTypes_3003_TargetExpression = EcoreOCLFactory.getExpression(
+ "self <> oppositeEnd and not oppositeEnd.eSuperTypes->includes(self) and not self.eAllSuperTypes->includes(oppositeEnd)", EcorePackage.eINSTANCE.getEClass(), env); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateEAnnotationReferences_3001(EAnnotation source, EObject target) {
+ if (source != null) {
+ if (source.getReferences().contains(target)) {
+ return false;
+ }
+ }
+ return canExistEAnnotationReferences_3001(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateEReference_3002(EClass source, EClassifier target) {
+ return canExistEReference_3002(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateEClassESuperTypes_3003(EClass source, EClass target) {
+ if (source != null) {
+ if (source.getESuperTypes().contains(target)) {
+ return false;
+ }
+ }
+ return canExistEClassESuperTypes_3003(source, target);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistEAnnotationReferences_3001(EAnnotation source, EObject target) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistEReference_3002(EClass source, EClassifier target) {
+ if (!evaluate(EReference_3002_TargetExpression, target, source, true)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canExistEClassESuperTypes_3003(EClass source, EClass target) {
+ if (!evaluate(EClassESuperTypes_3003_TargetExpression, target, source, true)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean evaluate(EcoreAbstractExpression constraint, Object sourceEnd, Object oppositeEnd, boolean clearEnv) {
+ if (sourceEnd == null) {
+ return true;
+ }
+ Map evalEnv = Collections.singletonMap(OPPOSITE_END_VAR, oppositeEnd);
+ try {
+ Object val = constraint.evaluate(sourceEnd, evalEnv);
+ return (val instanceof Boolean) ? ((Boolean) val).booleanValue() : false;
+ } catch (Exception e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Link constraint evaluation error", e); //$NON-NLS-1$
+ return false;
+ }
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreTextNonResizableEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreTextNonResizableEditPolicy.java
new file mode 100644
index 0000000..e954b75
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreTextNonResizableEditPolicy.java
@@ -0,0 +1,212 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.handles.MoveHandle;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.NonResizableEditPolicyEx;
+import org.eclipse.gmf.runtime.diagram.ui.tools.DragEditPartsTrackerEx;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+/**
+ * @generated
+ */
+public class EcoreTextNonResizableEditPolicy extends NonResizableEditPolicyEx {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (selectionFeedbackFigure != null) {
+ if (selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+
+ /**
+ * @generated
+ */
+ protected List createSelectionHandles() {
+ MoveHandle moveHandle = new MoveHandle((GraphicalEditPart) getHost());
+ moveHandle.setBorder(null);
+ moveHandle.setDragTracker(new DragEditPartsTrackerEx(getHost()));
+ return Collections.singletonList(moveHandle);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreTextSelectionEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreTextSelectionEditPolicy.java
new file mode 100644
index 0000000..2463184
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/EcoreTextSelectionEditPolicy.java
@@ -0,0 +1,196 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.RectangleFigure;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.editpolicies.SelectionEditPolicy;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+/**
+ * @generated
+ */
+public class EcoreTextSelectionEditPolicy extends SelectionEditPolicy {
+
+ /**
+ * @generated
+ */
+ private IFigure selectionFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ private IFigure focusFeedbackFigure;
+
+ /**
+ * @generated
+ */
+ protected void showPrimarySelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ showSelection();
+ showFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(true);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ hideSelection();
+ addFeedback(selectionFeedbackFigure = createSelectionFeedbackFigure());
+ refreshSelectionFeedback();
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideSelection() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setSelected(false);
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (selectionFeedbackFigure != null) {
+ removeFeedback(selectionFeedbackFigure);
+ selectionFeedbackFigure = null;
+ }
+ hideFocus();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void showFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(true);
+ } else {
+ hideFocus();
+ addFeedback(focusFeedbackFigure = createFocusFeedbackFigure());
+ refreshFocusFeedback();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void hideFocus() {
+ if (getHostFigure() instanceof WrappingLabel) {
+ ((WrappingLabel) getHostFigure()).setFocus(false);
+ } else {
+ if (focusFeedbackFigure != null) {
+ removeFeedback(focusFeedbackFigure);
+ focusFeedbackFigure = null;
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Rectangle getFeedbackBounds() {
+ Rectangle bounds;
+ if (getHostFigure() instanceof Label) {
+ bounds = ((Label) getHostFigure()).getTextBounds();
+ bounds.intersect(getHostFigure().getBounds());
+ } else {
+ bounds = getHostFigure().getBounds().getCopy();
+ }
+ getHostFigure().getParent().translateToAbsolute(bounds);
+ getFeedbackLayer().translateToRelative(bounds);
+ return bounds;
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createSelectionFeedbackFigure() {
+ if (getHostFigure() instanceof Label) {
+ Label feedbackFigure = new Label();
+ feedbackFigure.setOpaque(true);
+ feedbackFigure.setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ feedbackFigure.setForegroundColor(ColorConstants.menuForegroundSelected);
+ return feedbackFigure;
+ } else {
+ RectangleFigure feedbackFigure = new RectangleFigure();
+ feedbackFigure.setFill(false);
+ return feedbackFigure;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IFigure createFocusFeedbackFigure() {
+ return new Figure() {
+
+ protected void paintFigure(Graphics graphics) {
+ graphics.drawFocus(getBounds().getResized(-1, -1));
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateLabel(Label target) {
+ Label source = (Label) getHostFigure();
+ target.setText(source.getText());
+ target.setTextAlignment(source.getTextAlignment());
+ target.setFont(source.getFont());
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshSelectionFeedback() {
+ if (selectionFeedbackFigure != null) {
+ if (selectionFeedbackFigure instanceof Label) {
+ updateLabel((Label) selectionFeedbackFigure);
+ selectionFeedbackFigure.setBounds(getFeedbackBounds());
+ } else {
+ selectionFeedbackFigure.setBounds(getFeedbackBounds().expand(5, 5));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void refreshFocusFeedback() {
+ if (focusFeedbackFigure != null) {
+ focusFeedbackFigure.setBounds(getFeedbackBounds());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void refreshFeedback() {
+ refreshSelectionFeedback();
+ refreshFocusFeedback();
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/OpenDiagramEditPolicy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/OpenDiagramEditPolicy.java
new file mode 100644
index 0000000..aa40a9e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/edit/policies/OpenDiagramEditPolicy.java
@@ -0,0 +1,430 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.edit.policies;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorUtil;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.commands.ICommandProxy;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.OpenEditPolicy;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.MultiDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.Style;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * @generated NOT
+ */
+public class OpenDiagramEditPolicy extends OpenEditPolicy {
+
+ @Override
+ protected Command getOpenCommand(Request request) {
+ EditPart targetEditPart = getTargetEditPart(request);
+ if (false == targetEditPart.getModel() instanceof View) {
+ return null;
+ }
+ View view = (View) targetEditPart.getModel();
+ Style link = view.getStyle(NotationPackage.eINSTANCE.getMultiDiagramLinkStyle());
+ if (false == link instanceof MultiDiagramLinkStyle) {
+ return null;
+ }
+ return new ICommandProxy(new OpenDiagramCommand((MultiDiagramLinkStyle) link));
+ }
+
+ private static class OpenDiagramCommand extends AbstractTransactionalCommand {
+
+ private MultiDiagramLinkStyle multiDiagramFacet;
+
+ OpenDiagramCommand(MultiDiagramLinkStyle multiDiagramLinkStyle) {
+ // editing domain is taken for original diagram,
+ // if we open diagram from another file, we should use another
+ // editing domain
+ super(TransactionUtil.getEditingDomain(multiDiagramLinkStyle), "Open Diagram", null);
+ multiDiagramFacet = multiDiagramLinkStyle;
+ }
+
+ private static final int DELETE = 1010;
+
+ private static final int CREATE = 1020;
+
+ private class ChooseDiagramToOpenDialog extends Dialog {
+
+ private static final int DELETE_ID = IDialogConstants.CLIENT_ID + 1010;
+
+ private static final int CREATE_ID = IDialogConstants.CLIENT_ID + 1020;
+
+ private static final String DELETE_LABEL = "Delete";
+
+ private static final String CREATE_LABEL = "Create";
+
+ private TreeViewer myTreeViewer;
+
+ private MultiDiagramLinkStyle multiDiagramFacet;
+
+ private Diagram selectedDiagram;
+
+ public ChooseDiagramToOpenDialog(Shell parentShell, MultiDiagramLinkStyle multiDiagramFacet) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ this.multiDiagramFacet = multiDiagramFacet;
+
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ getShell().setText("Manages diagrams");
+ createDiagramTreeBrowser(composite);
+ return composite;
+ }
+
+ @Override
+ protected Control createButtonBar(Composite parent) {
+ Control buttonBar = super.createButtonBar(parent);
+ getButton(IDialogConstants.OK_ID).setText("Open");
+ getButton(IDialogConstants.OK_ID).setToolTipText("Open selected diagram");
+ getButton(CREATE_ID).setToolTipText("Create a new diagram an open it");
+ getButton(DELETE_ID).setToolTipText("Delete selected diagram");
+ getButton(IDialogConstants.CANCEL_ID).setToolTipText("Close the dialog");
+ return buttonBar;
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, CREATE_ID, CREATE_LABEL, false);
+ createButton(parent, DELETE_ID, DELETE_LABEL, false);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
+ }
+
+ private void createDiagramTreeBrowser(Composite composite) {
+ myTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ myTreeViewer.getTree().setLayoutData(layoutData);
+ myTreeViewer.setContentProvider(new DiagramsTreeContentProvider());
+ myTreeViewer.setLabelProvider(new DiagramsTreeLabelProvider());
+ myTreeViewer.setInput(multiDiagramFacet);
+ myTreeViewer.addSelectionChangedListener(new OkButtonListener());
+ }
+
+ private class DiagramsTreeContentProvider implements ITreeContentProvider {
+
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof MultiDiagramLinkStyle) {
+ return ((MultiDiagramLinkStyle) parentElement).getDiagramLinks().toArray();
+ }
+ return Collections.EMPTY_LIST.toArray();
+ }
+
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ if (element instanceof MultiDiagramLinkStyle) {
+ return ((MultiDiagramLinkStyle) element).getDiagramLinks().isEmpty();
+ }
+ return false;
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+
+ private class DiagramsTreeLabelProvider implements ILabelProvider {
+
+ private WorkbenchLabelProvider myWorkbenchLabelProvider = new WorkbenchLabelProvider();
+
+ private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+
+ public Image getImage(Object element) {
+ return EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/EPackage.gif");
+ }
+
+ public String getText(Object element) {
+ return ((Diagram) element).getName();
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.addListener(listener);
+ myAdapterFactoryLabelProvider.addListener(listener);
+ }
+
+ public void dispose() {
+ myWorkbenchLabelProvider.dispose();
+ myAdapterFactoryLabelProvider.dispose();
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.removeListener(listener);
+ myAdapterFactoryLabelProvider.removeListener(listener);
+ }
+ }
+
+ private class OkButtonListener implements ISelectionChangedListener {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (event.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof Diagram) {
+ selectedDiagram = (Diagram) selectedElement;
+ return;
+ }
+ }
+ }
+ selectedDiagram = null;
+ }
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ switch (buttonId) {
+ case IDialogConstants.OK_ID:
+ okPressed();
+ break;
+ case CREATE_ID:
+ setReturnCode(CREATE);
+ close();
+ break;
+ case DELETE_ID:
+ setReturnCode(DELETE);
+ close();
+ break;
+ case IDialogConstants.CANCEL_ID:
+ cancelPressed();
+ break;
+ default:
+ break;
+ }
+ }
+
+ public MultiDiagramLinkStyle getMultiDiagramFacet() {
+ return multiDiagramFacet;
+ }
+
+ public Diagram getSelectedDiagram() {
+ return selectedDiagram;
+ }
+ }
+
+ // FIXME canExecute if !(readOnly && getDiagramToOpen == null), i.e.
+ // open works on ro diagrams only when there's associated diagram
+ // already
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ // Open dialog
+ final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite().getShell();
+ ChooseDiagramToOpenDialog dialog = new ChooseDiagramToOpenDialog(shell, multiDiagramFacet);
+ switch (dialog.open()) {
+ // Cancel pressed
+ case Window.CANCEL: {
+ // nothing to do
+ break;
+ }
+ // OK pressed
+ case Window.OK: {
+ okPressed(dialog.getSelectedDiagram());
+ break;
+ }
+ // Create pressed
+ case CREATE: {
+ createPressed();
+ break;
+ }
+ // Delete pressed
+ case DELETE: {
+ deletePressed(dialog.getSelectedDiagram());
+ break;
+ }
+ // Things gone bad ...
+ default: {
+ return CommandResult.newErrorCommandResult("Diagram operation failed !");
+ }
+ }
+ return CommandResult.newOKCommandResult();
+ }
+
+ private void okPressed(Diagram diagram) {
+ openEditor(diagram);
+ }
+
+ private IEditorInput getEditorInput(Diagram diagram) {
+ URI parentUri = diagram.eResource().getURI();
+ URI uri = parentUri.appendFragment(diagram.eResource().getURIFragment(diagram));
+ return new URIEditorInput(uri);
+ }
+
+ private void openEditor(Diagram diagram) {
+ if (diagram != null) {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ try {
+ page.openEditor(getEditorInput(diagram), getEditorID());
+ } catch (PartInitException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Can't open Ecore Diagram Editor !");
+ }
+ }
+ }
+
+ private void createPressed() {
+ try {
+ openEditor(intializeNewDiagram());
+ } catch (ExecutionException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Can't open Ecore Diagram Editor !");
+ }
+ }
+
+ protected void deletePressed(Diagram diagram) {
+ if (diagram != null) { // Close associated diagram
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IEditorPart editor = page.findEditor(getEditorInput(diagram));
+ if (editor != null) {
+ page.closeEditor(editor, true);
+ }
+ assert multiDiagramFacet.eResource() != null;
+ multiDiagramFacet.eResource().getContents().remove(diagram);
+ multiDiagramFacet.getDiagramLinks().remove(diagram);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Diagram intializeNewDiagram() throws ExecutionException {
+ Diagram d = ViewService.createDiagram(getDiagramDomainElement(), getDiagramKind(), getPreferencesHint());
+ if (d == null) {
+ throw new ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind");
+ }
+ setDefaultNameForDiagram(d);
+ multiDiagramFacet.getDiagramLinks().add(d);
+ assert multiDiagramFacet.eResource() != null;
+ multiDiagramFacet.eResource().getContents().add(d);
+ try {
+ new WorkspaceModifyOperation() {
+
+ protected void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException {
+ try {
+ for (Iterator it = multiDiagramFacet.eResource().getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ if (nextResource.isLoaded() && !getEditingDomain().isReadOnly(nextResource)) {
+ nextResource.save(EcoreDiagramEditorUtil.getSaveOptions());
+ }
+ }
+ } catch (IOException ex) {
+ throw new InvocationTargetException(ex, "Save operation failed");
+ }
+ }
+ }.run(null);
+ } catch (InvocationTargetException e) {
+ throw new ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
+ } catch (InterruptedException e) {
+ throw new ExecutionException("Can't create diagram of '" + getDiagramKind() + "' kind", e);
+ }
+ return d;
+ }
+
+ protected EObject getDiagramDomainElement() {
+ // use same element as associated with EP
+ return ((View) multiDiagramFacet.eContainer()).getElement();
+ }
+
+ protected PreferencesHint getPreferencesHint() {
+ // XXX prefhint from target diagram's editor?
+ return EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+ protected String getDiagramKind() {
+ return EPackageEditPart.MODEL_ID;
+ }
+
+ protected String getEditorID() {
+ return EcoreDiagramEditor.ID;
+ }
+
+ protected void setDefaultNameForDiagram(Diagram elementToConfigure) {
+ EPackage pseudoContainer = (EPackage) elementToConfigure.getElement();
+ String baseString = pseudoContainer.getName() + "_Diagram";
+ int count = 0;
+ for (Iterator it = multiDiagramFacet.getDiagramLinks().iterator(); it.hasNext();) {
+ Diagram diagram = (Diagram) it.next();
+ if (diagram.getName().equals(baseString + count)) {
+ count++;
+ }
+ }
+ elementToConfigure.setName(baseString + count);
+ }
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/expressions/EcoreAbstractExpression.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/expressions/EcoreAbstractExpression.java
new file mode 100644
index 0000000..d184d9c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/expressions/EcoreAbstractExpression.java
@@ -0,0 +1,222 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.expressions;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public abstract class EcoreAbstractExpression {
+
+ /**
+ * @generated
+ */
+ private static final boolean DISABLED_NO_IMPL_EXCEPTION_LOG = Boolean.valueOf(
+ Platform.getDebugOption(EcoreDiagramEditorPlugin.getInstance().getBundle().getSymbolicName() + "/debug/disableNoExprImplExceptionLog")).booleanValue();
+
+ /**
+ * @generated
+ */
+ private final String body;
+
+ /**
+ * @generated
+ */
+ private final EClassifier context;
+
+ /**
+ * @generated
+ */
+ private IStatus status = Status.OK_STATUS;
+
+ /**
+ * @generated
+ */
+ protected EcoreAbstractExpression(EClassifier context) {
+ this(null, context);
+ }
+
+ /**
+ * @generated
+ */
+ protected EcoreAbstractExpression(String body, EClassifier context) {
+ this.body = body;
+ this.context = context;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setStatus(int severity, String message, Throwable throwable) {
+ String pluginID = EcoreDiagramEditorPlugin.ID;
+ this.status = new Status(severity, pluginID, -1, (message != null) ? message : "", throwable); //$NON-NLS-1$
+ if (!this.status.isOK()) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Expression problem: " + message + " body: " + body, throwable); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected abstract Object doEvaluate(Object context, Map env);
+
+ /**
+ * @generated
+ */
+ public Object evaluate(Object context) {
+ return evaluate(context, Collections.EMPTY_MAP);
+ }
+
+ /**
+ * @generated
+ */
+ public Object evaluate(Object context, Map env) {
+ if (context().isInstance(context)) {
+ try {
+ return doEvaluate(context, env);
+ } catch (Exception e) {
+ if (DISABLED_NO_IMPL_EXCEPTION_LOG && e instanceof NoImplException) {
+ return null;
+ }
+ EcoreDiagramEditorPlugin.getInstance().logError("Expression evaluation failure: " + body, e);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IStatus getStatus() {
+ return status;
+ }
+
+ /**
+ * @generated
+ */
+ public String body() {
+ return body;
+ }
+
+ /**
+ * @generated
+ */
+ public EClassifier context() {
+ return context;
+ }
+
+ /**
+ * @generated
+ */
+ public void assignTo(EStructuralFeature feature, EObject target) {
+ Object value = evaluate(target);
+ value = (value != null) ? performCast(value, feature) : null;
+ if (feature.isMany()) {
+ Collection destCollection = (Collection) target.eGet(feature);
+ destCollection.clear();
+ if (value instanceof Collection) {
+ Collection valueCollection = (Collection) value;
+ for (Iterator it = valueCollection.iterator(); it.hasNext();) {
+ destCollection.add(performCast(it.next(), feature));
+ }
+ } else {
+ destCollection.add(value);
+ }
+ return;
+ }
+ target.eSet(feature, value);
+ }
+
+ /**
+ * @generated
+ */
+ protected Object performCast(Object value, ETypedElement targetType) {
+ if (targetType.getEType() == null || targetType.getEType().getInstanceClass() == null) {
+ return value;
+ }
+ Class targetClass = targetType.getEType().getInstanceClass();
+ if (value != null && value instanceof Number) {
+ Number num = (Number) value;
+ Class valClass = value.getClass();
+ Class targetWrapperClass = targetClass;
+ if (targetClass.isPrimitive()) {
+ targetWrapperClass = 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(BigInteger.class))
+ return 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(BigDecimal.class))
+ return new BigDecimal(num.doubleValue());
+ }
+ }
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ public static final EcoreAbstractExpression createNullExpression(EClassifier context) {
+ return new EcoreAbstractExpression(context) {
+
+ protected Object doEvaluate(Object context, Map env) {
+ // TODO - log entry about not provider available for this
+ // expression
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public static class NoImplException extends RuntimeException {
+
+ /**
+ * @generated
+ */
+ public NoImplException(String message) {
+ super(message);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/expressions/EcoreOCLFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/expressions/EcoreOCLFactory.java
new file mode 100644
index 0000000..9fc00ec
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/expressions/EcoreOCLFactory.java
@@ -0,0 +1,196 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.expressions;
+
+import java.lang.ref.WeakReference;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.ETypedElement;
+import org.eclipse.ocl.Environment;
+import org.eclipse.ocl.EvaluationEnvironment;
+import org.eclipse.ocl.ParserException;
+import org.eclipse.ocl.Query;
+import org.eclipse.ocl.ecore.EcoreFactory;
+import org.eclipse.ocl.expressions.OCLExpression;
+import org.eclipse.ocl.expressions.OperationCallExp;
+import org.eclipse.ocl.expressions.Variable;
+import org.eclipse.ocl.helper.OCLHelper;
+import org.eclipse.ocl.utilities.AbstractVisitor;
+import org.eclipse.ocl.utilities.PredefinedType;
+
+/**
+ * @generated
+ */
+public class EcoreOCLFactory {
+
+ /**
+ * @generated
+ */
+ private EcoreOCLFactory() {
+ }
+
+ /**
+ * @generated
+ */
+ public static EcoreAbstractExpression getExpression(String body, EClassifier context, Map environment) {
+ return new Expression(body, context, environment);
+ }
+
+ /**
+ * @generated
+ */
+ public static EcoreAbstractExpression getExpression(String body, EClassifier context) {
+ return getExpression(body, context, Collections.EMPTY_MAP);
+ }
+
+ /**
+ * @generated
+ */
+ private static class Expression extends EcoreAbstractExpression {
+
+ /**
+ * @generated
+ */
+ private WeakReference queryRef;
+
+ /**
+ * @generated
+ */
+ private final org.eclipse.ocl.ecore.OCL oclInstance;
+
+ /**
+ * @generated
+ */
+ public Expression(String body, EClassifier context, Map environment) {
+ super(body, context);
+ oclInstance = org.eclipse.ocl.ecore.OCL.newInstance();
+ initCustomEnv(oclInstance.getEnvironment(), environment);
+ }
+
+ /**
+ * @generated
+ */
+ protected Query getQuery() {
+ Query oclQuery = null;
+ if (this.queryRef != null) {
+ oclQuery = (Query) this.queryRef.get();
+ }
+ if (oclQuery == null) {
+ OCLHelper oclHelper = oclInstance.createOCLHelper();
+ oclHelper.setContext(context());
+ try {
+ OCLExpression oclExpression = oclHelper.createQuery(body());
+ oclQuery = oclInstance.createQuery(oclExpression);
+ this.queryRef = new WeakReference(oclQuery);
+ setStatus(IStatus.OK, null, null);
+ } catch (ParserException e) {
+ setStatus(IStatus.ERROR, e.getMessage(), e);
+ }
+ }
+ return oclQuery;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object doEvaluate(Object context, Map env) {
+ Query oclQuery = getQuery();
+ if (oclQuery == null) {
+ return null;
+ }
+ EvaluationEnvironment evalEnv = oclQuery.getEvaluationEnvironment();
+ // init environment
+ for (Iterator it = env.entrySet().iterator(); it.hasNext();) {
+ Map.Entry nextEntry = (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();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected Object performCast(Object value, ETypedElement targetType) {
+ if (targetType.getEType() instanceof EEnum) {
+ if (value instanceof EEnumLiteral) {
+ EEnumLiteral literal = (EEnumLiteral) value;
+ return (literal.getInstance() != null) ? literal.getInstance() : literal;
+ }
+ }
+ return super.performCast(value, targetType);
+ }
+
+ /**
+ * @generated
+ */
+ private void initExtentMap(Object context) {
+ if (!getStatus().isOK() || context == null) {
+ return;
+ }
+ final Query queryToInit = getQuery();
+ final Object extentContext = context;
+ queryToInit.getExtentMap().clear();
+ if (queryToInit.queryText() != null && queryToInit.queryText().indexOf(PredefinedType.ALL_INSTANCES_NAME) >= 0) {
+ AbstractVisitor visitior = new AbstractVisitor() {
+
+ private boolean usesAllInstances = false;
+
+ public Object visitOperationCallExp(OperationCallExp oc) {
+ if (!usesAllInstances) {
+ usesAllInstances = PredefinedType.ALL_INSTANCES == oc.getOperationCode();
+ if (usesAllInstances) {
+ queryToInit.getExtentMap().putAll(oclInstance.getEvaluationEnvironment().createExtentMap(extentContext));
+ }
+ }
+ return super.visitOperationCallExp(oc);
+ }
+ };
+ queryToInit.getExpression().accept(visitior);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void initCustomEnv(Environment ecoreEnv, Map environment) {
+ for (Iterator it = environment.keySet().iterator(); it.hasNext();) {
+ String varName = (String) it.next();
+ EClassifier varType = (EClassifier) environment.get(varName);
+ ecoreEnv.addElement(varName, createVar(ecoreEnv, varName, varType), false);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static Variable createVar(Environment ecoreEnv, String name, EClassifier type) {
+ Variable var = EcoreFactory.eINSTANCE.createVariable();
+ var.setName(name);
+ var.setType(ecoreEnv.getUMLReflection().getOCLType(type));
+ return var;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreAbstractNavigatorItem.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreAbstractNavigatorItem.java
new file mode 100644
index 0000000..75f4607
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreAbstractNavigatorItem.java
@@ -0,0 +1,70 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
+
+/**
+ * @generated
+ */
+public abstract class EcoreAbstractNavigatorItem extends PlatformObject {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { ITabbedPropertySheetPageContributor.class };
+ final ITabbedPropertySheetPageContributor propertySheetPageContributor = new ITabbedPropertySheetPageContributor() {
+
+ public String getContributorId() {
+ return "org.eclipse.emf.ecoretools.diagram"; //$NON-NLS-1$
+ }
+ };
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.emf.ecoretools.diagram.navigator.EcoreAbstractNavigatorItem && adapterType == ITabbedPropertySheetPageContributor.class) {
+ return propertySheetPageContributor;
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, org.eclipse.emf.ecoretools.diagram.navigator.EcoreAbstractNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private Object myParent;
+
+ /**
+ * @generated
+ */
+ protected EcoreAbstractNavigatorItem(Object parent) {
+ myParent = parent;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent() {
+ return myParent;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorContentProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorContentProvider.java
new file mode 100644
index 0000000..4dd43c1
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorContentProvider.java
@@ -0,0 +1,229 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @generated
+ */
+public class EcoreDomainNavigatorContentProvider implements ICommonContentProvider {
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryContentProvider myAdapterFctoryContentProvier;
+
+ /**
+ * @generated
+ */
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * @generated
+ */
+ private Viewer myViewer;
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryEditingDomain myEditingDomain;
+
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer myWorkspaceSynchronizer;
+
+ /**
+ * @generated
+ */
+ private Runnable myViewerRefreshRunnable;
+
+ /**
+ * @generated
+ */
+ public EcoreDomainNavigatorContentProvider() {
+ myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
+ myEditingDomain.setResourceToReadOnlyMap(new 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 WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
+
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final Resource resource) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceDeleted(Resource resource) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceMoved(Resource resource, final URI newURI) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkspaceSynchronizer.dispose();
+ myWorkspaceSynchronizer = null;
+ myViewerRefreshRunnable = null;
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource resource = (Resource) it.next();
+ resource.unload();
+ }
+ ((TransactionalEditingDomain) myEditingDomain).dispose();
+ myEditingDomain = null;
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ myViewer = viewer;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IFile) {
+ IFile file = (IFile) parentElement;
+ URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
+ return wrapEObjects(myAdapterFctoryContentProvier.getChildren(resource), parentElement);
+ }
+
+ if (parentElement instanceof EcoreDomainNavigatorItem) {
+ return wrapEObjects(myAdapterFctoryContentProvier.getChildren(((EcoreDomainNavigatorItem) parentElement).getEObject()), parentElement);
+ }
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] wrapEObjects(Object[] objects, Object parentElement) {
+ Collection result = new ArrayList();
+ for (int i = 0; i < objects.length; i++) {
+ if (objects[i] instanceof EObject) {
+ result.add(new EcoreDomainNavigatorItem((EObject) objects[i], parentElement, myAdapterFctoryContentProvier));
+ }
+ }
+ return result.toArray();
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(Object element) {
+ if (element instanceof EcoreAbstractNavigatorItem) {
+ EcoreAbstractNavigatorItem abstractNavigatorItem = (EcoreAbstractNavigatorItem) element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(Object element) {
+ return element instanceof IFile || getChildren(element).length > 0;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorItem.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorItem.java
new file mode 100644
index 0000000..36d387b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorItem.java
@@ -0,0 +1,118 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+/**
+ * @generated
+ */
+public class EcoreDomainNavigatorItem extends PlatformObject {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { EObject.class, IPropertySource.class };
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.emf.ecoretools.diagram.navigator.EcoreDomainNavigatorItem) {
+ org.eclipse.emf.ecoretools.diagram.navigator.EcoreDomainNavigatorItem domainNavigatorItem = (org.eclipse.emf.ecoretools.diagram.navigator.EcoreDomainNavigatorItem) adaptableObject;
+ EObject eObject = domainNavigatorItem.getEObject();
+ if (adapterType == EObject.class) {
+ return eObject;
+ }
+ if (adapterType == IPropertySource.class) {
+ return domainNavigatorItem.getPropertySourceProvider().getPropertySource(eObject);
+ }
+ }
+
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, org.eclipse.emf.ecoretools.diagram.navigator.EcoreDomainNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private Object myParent;
+
+ /**
+ * @generated
+ */
+ private EObject myEObject;
+
+ /**
+ * @generated
+ */
+ private IPropertySourceProvider myPropertySourceProvider;
+
+ /**
+ * @generated
+ */
+ public EcoreDomainNavigatorItem(EObject eObject, Object parent, IPropertySourceProvider propertySourceProvider) {
+ myParent = parent;
+ myEObject = eObject;
+ myPropertySourceProvider = propertySourceProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent() {
+ return myParent;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getEObject() {
+ return myEObject;
+ }
+
+ /**
+ * @generated
+ */
+ public IPropertySourceProvider getPropertySourceProvider() {
+ return myPropertySourceProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof org.eclipse.emf.ecoretools.diagram.navigator.EcoreDomainNavigatorItem) {
+ return EcoreUtil.getURI(getEObject()).equals(EcoreUtil.getURI(((org.eclipse.emf.ecoretools.diagram.navigator.EcoreDomainNavigatorItem) obj).getEObject()));
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ public int hashCode() {
+ return EcoreUtil.getURI(getEObject()).hashCode();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorLabelProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorLabelProvider.java
new file mode 100644
index 0000000..f5ca24a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreDomainNavigatorLabelProvider.java
@@ -0,0 +1,106 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @generated
+ */
+public class EcoreDomainNavigatorLabelProvider implements ICommonLabelProvider {
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ if (element instanceof EcoreDomainNavigatorItem) {
+ return myAdapterFactoryLabelProvider.getImage(((EcoreDomainNavigatorItem) element).getEObject());
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ if (element instanceof EcoreDomainNavigatorItem) {
+ return myAdapterFactoryLabelProvider.getText(((EcoreDomainNavigatorItem) element).getEObject());
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public void addListener(ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.addListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myAdapterFactoryLabelProvider.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+ }
+
+ /**
+ * @generated
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ myAdapterFactoryLabelProvider.removeListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public String getDescription(Object anElement) {
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorActionProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorActionProvider.java
new file mode 100644
index 0000000..cddff82
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorActionProvider.java
@@ -0,0 +1,181 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.navigator.CommonActionProvider;
+import org.eclipse.ui.navigator.ICommonActionConstants;
+import org.eclipse.ui.navigator.ICommonActionExtensionSite;
+import org.eclipse.ui.navigator.ICommonViewerWorkbenchSite;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class EcoreNavigatorActionProvider extends CommonActionProvider {
+
+ /**
+ * @generated
+ */
+ private boolean myContribute;
+
+ /**
+ * @generated
+ */
+ private OpenDiagramAction myOpenDiagramAction;
+
+ /**
+ * @generated
+ */
+ public void init(ICommonActionExtensionSite aSite) {
+ super.init(aSite);
+ if (aSite.getViewSite() instanceof ICommonViewerWorkbenchSite) {
+ myContribute = true;
+ makeActions((ICommonViewerWorkbenchSite) aSite.getViewSite());
+ } else {
+ myContribute = false;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void makeActions(ICommonViewerWorkbenchSite viewerSite) {
+ myOpenDiagramAction = new OpenDiagramAction(viewerSite);
+ }
+
+ /**
+ * @generated
+ */
+ public void fillActionBars(IActionBars actionBars) {
+ if (!myContribute) {
+ return;
+ }
+ IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
+ myOpenDiagramAction.selectionChanged(selection);
+ if (myOpenDiagramAction.isEnabled()) {
+ actionBars.setGlobalActionHandler(ICommonActionConstants.OPEN, myOpenDiagramAction);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void fillContextMenu(IMenuManager menu) {
+ }
+
+ /**
+ * @generated
+ */
+ private class OpenDiagramAction extends Action {
+
+ /**
+ * @generated
+ */
+ private Diagram myDiagram;
+
+ /**
+ * @generated
+ */
+ private ICommonViewerWorkbenchSite myViewerSite;
+
+ /**
+ * @generated
+ */
+ public OpenDiagramAction(ICommonViewerWorkbenchSite viewerSite) {
+ super(Messages.NavigatorActionProvider_OpenDiagramActionName);
+ myViewerSite = viewerSite;
+ }
+
+ /**
+ * @generated
+ */
+ public final void selectionChanged(IStructuredSelection selection) {
+ myDiagram = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof EcoreNavigatorItem) {
+ selectedElement = ((EcoreNavigatorItem) selectedElement).getView();
+ } else if (selectedElement instanceof IAdaptable) {
+ selectedElement = ((IAdaptable) selectedElement).getAdapter(View.class);
+ }
+ if (selectedElement instanceof Diagram) {
+ Diagram diagram = (Diagram) selectedElement;
+ if (EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(diagram))) {
+ myDiagram = diagram;
+ }
+ }
+ }
+ setEnabled(myDiagram != null);
+ }
+
+ /**
+ * @generated
+ */
+ public void run() {
+ if (myDiagram == null || myDiagram.eResource() == null) {
+ return;
+ }
+
+ IEditorInput editorInput = getEditorInput();
+ IWorkbenchPage page = myViewerSite.getPage();
+ try {
+ page.openEditor(editorInput, EcoreDiagramEditor.ID);
+ } catch (PartInitException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Exception while openning diagram", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private IEditorInput getEditorInput() {
+ for (Iterator it = myDiagram.eResource().getContents().iterator(); it.hasNext();) {
+ EObject nextEObject = (EObject) it.next();
+ if (nextEObject == myDiagram) {
+ return new FileEditorInput(WorkspaceSynchronizer.getFile(myDiagram.eResource()));
+ }
+ if (nextEObject instanceof Diagram) {
+ break;
+ }
+ }
+ URI uri = EcoreUtil.getURI(myDiagram);
+ String editorName = uri.lastSegment() + "#" + myDiagram.eResource().getContents().indexOf(myDiagram); //$NON-NLS-1$
+ IEditorInput editorInput = new URIEditorInput(uri, editorName);
+ return editorInput;
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorContentProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorContentProvider.java
new file mode 100644
index 0000000..554dbe8
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorContentProvider.java
@@ -0,0 +1,703 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationDetailsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributes2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperations2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperationsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiterals2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackage2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageContentsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReference2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonContentProvider;
+
+/**
+ * @generated
+ */
+public class EcoreNavigatorContentProvider implements ICommonContentProvider {
+
+ /**
+ * @generated
+ */
+ private static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * @generated
+ */
+ private Viewer myViewer;
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryEditingDomain myEditingDomain;
+
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer myWorkspaceSynchronizer;
+
+ /**
+ * @generated
+ */
+ private Runnable myViewerRefreshRunnable;
+
+ /**
+ * @generated
+ */
+ public EcoreNavigatorContentProvider() {
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
+ myEditingDomain.setResourceToReadOnlyMap(new 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 WorkspaceSynchronizer(editingDomain, new WorkspaceSynchronizer.Delegate() {
+
+ public void dispose() {
+ }
+
+ public boolean handleResourceChanged(final Resource resource) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceDeleted(Resource resource) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+
+ public boolean handleResourceMoved(Resource resource, final URI newURI) {
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ nextResource.unload();
+ }
+ if (myViewer != null) {
+ myViewer.getControl().getDisplay().asyncExec(myViewerRefreshRunnable);
+ }
+ return true;
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkspaceSynchronizer.dispose();
+ myWorkspaceSynchronizer = null;
+ myViewerRefreshRunnable = null;
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource resource = (Resource) it.next();
+ resource.unload();
+ }
+ ((TransactionalEditingDomain) myEditingDomain).dispose();
+ myEditingDomain = null;
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ myViewer = viewer;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof IFile) {
+ IFile file = (IFile) parentElement;
+ URI fileURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ Resource resource = myEditingDomain.getResourceSet().getResource(fileURI, true);
+ Collection result = new ArrayList();
+ result.addAll(createNavigatorItems(selectViewsByType(resource.getContents(), EPackageEditPart.MODEL_ID), file, false));
+ return result.toArray();
+ }
+
+ if (parentElement instanceof EcoreNavigatorGroup) {
+ EcoreNavigatorGroup group = (EcoreNavigatorGroup) parentElement;
+ return group.getChildren();
+ }
+
+ if (parentElement instanceof EcoreNavigatorItem) {
+ EcoreNavigatorItem navigatorItem = (EcoreNavigatorItem) parentElement;
+ if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
+ return EMPTY_ARRAY;
+ }
+ return getViewChildren(navigatorItem.getView(), parentElement);
+ }
+
+ /*
+ * 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 IAdaptable) {
+ View view = (View) ((IAdaptable) parentElement).getAdapter(View.class);
+ if (view != null) {
+ return getViewChildren(view, parentElement);
+ }
+ }
+
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ private Object[] getViewChildren(View view, Object parentElement) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
+
+ case EPackageEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ result.addAll(getForeignShortcuts((Diagram) view, parentElement));
+ EcoreNavigatorGroup links = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EPackage_79_links, "icons/linksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), EClassEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), EPackage2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), EAnnotationEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), EDataTypeEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), EEnumEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), EReferenceEditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ connectedViews = getDiagramLinksByType(Collections.singleton(view), EReference2EditPart.VISUAL_ID);
+ links.addChildren(createNavigatorItems(connectedViews, links, false));
+ if (!links.isEmpty()) {
+ result.add(links);
+ }
+ return result.toArray();
+ }
+
+ case EClassEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EClass_1001_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ EcoreNavigatorGroup outgoinglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EClass_1001_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), EClassAttributesEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EAttributeEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), EClassOperationsEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EOperationEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EReferenceEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), EReferenceEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EReference2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), EReference2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case EPackage2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EPackage_1002_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), EPackageContentsEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EClass2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), EPackageContentsEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EDataType2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), EPackageContentsEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EEnum2EditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ return result.toArray();
+ }
+
+ case EAnnotationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EAnnotation_1003_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ EcoreNavigatorGroup outgoinglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EAnnotation_1003_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), EAnnotationDetailsEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EStringToStringMapEntryEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case EDataTypeEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EDataType_1004_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EReferenceEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ return result.toArray();
+ }
+
+ case EEnumEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EEnum_1005_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), EEnumLiterals2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EEnumLiteralEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EReferenceEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ return result.toArray();
+ }
+
+ case EAttributeEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EAttribute_2001_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ return result.toArray();
+ }
+
+ case EOperationEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EOperation_2002_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ return result.toArray();
+ }
+
+ case EClass2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EClass_2003_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ EcoreNavigatorGroup outgoinglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EClass_2003_outgoinglinks, "icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), EClassAttributes2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EAttributeEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getChildrenByType(Collections.singleton(view), EClassOperations2EditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EOperationEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EReferenceEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), EReferenceEditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EReference2EditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getOutgoingLinksByType(Collections.singleton(view), EReference2EditPart.VISUAL_ID);
+ outgoinglinks.addChildren(createNavigatorItems(connectedViews, outgoinglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ if (!outgoinglinks.isEmpty()) {
+ result.add(outgoinglinks);
+ }
+ return result.toArray();
+ }
+
+ case EDataType2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EDataType_2004_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EReferenceEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ return result.toArray();
+ }
+
+ case EEnum2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EEnum_2005_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getChildrenByType(Collections.singleton(view), EEnumLiteralsEditPart.VISUAL_ID);
+ connectedViews = getChildrenByType(connectedViews, EEnumLiteralEditPart.VISUAL_ID);
+ result.addAll(createNavigatorItems(connectedViews, parentElement, false));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ connectedViews = getIncomingLinksByType(Collections.singleton(view), EReferenceEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ return result.toArray();
+ }
+
+ case EEnumLiteralEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup incominglinks = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EEnumLiteral_2006_incominglinks, "icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getIncomingLinksByType(Collections.singleton(view), EAnnotationReferencesEditPart.VISUAL_ID);
+ incominglinks.addChildren(createNavigatorItems(connectedViews, incominglinks, true));
+ if (!incominglinks.isEmpty()) {
+ result.add(incominglinks);
+ }
+ return result.toArray();
+ }
+
+ case EAnnotationReferencesEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup target = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EAnnotationReferences_3001_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ EcoreNavigatorGroup source = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EAnnotationReferences_3001_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), EClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EPackage2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EAnnotationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EDataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EEnumEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EAttributeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EOperationEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EClass2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EDataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EEnum2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EEnumLiteralEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EAnnotationEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case EReferenceEditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup target = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EReference_3002_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ EcoreNavigatorGroup source = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EReference_3002_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), EClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EDataTypeEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EEnumEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EClass2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EDataType2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EEnum2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EClass2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+
+ case EReference2EditPart.VISUAL_ID: {
+ Collection result = new ArrayList();
+ EcoreNavigatorGroup target = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EClassESuperTypes_3003_target, "icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ EcoreNavigatorGroup source = new EcoreNavigatorGroup(Messages.NavigatorGroupName_EClassESuperTypes_3003_source, "icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
+ Collection connectedViews = getLinksTargetByType(Collections.singleton(view), EClassEditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksTargetByType(Collections.singleton(view), EClass2EditPart.VISUAL_ID);
+ target.addChildren(createNavigatorItems(connectedViews, target, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EClassEditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ connectedViews = getLinksSourceByType(Collections.singleton(view), EClass2EditPart.VISUAL_ID);
+ source.addChildren(createNavigatorItems(connectedViews, source, true));
+ if (!target.isEmpty()) {
+ result.add(target);
+ }
+ if (!source.isEmpty()) {
+ result.add(source);
+ }
+ return result.toArray();
+ }
+ }
+ return EMPTY_ARRAY;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getLinksSourceByType(Collection edges, int visualID) {
+ Collection result = new ArrayList();
+ String type = EcoreVisualIDRegistry.getType(visualID);
+ for (Iterator it = edges.iterator(); it.hasNext();) {
+ Edge nextEdge = (Edge) it.next();
+ View nextEdgeSource = nextEdge.getSource();
+ if (type.equals(nextEdgeSource.getType()) && isOwnView(nextEdgeSource)) {
+ result.add(nextEdgeSource);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getLinksTargetByType(Collection edges, int visualID) {
+ Collection result = new ArrayList();
+ String type = EcoreVisualIDRegistry.getType(visualID);
+ for (Iterator it = edges.iterator(); it.hasNext();) {
+ Edge nextEdge = (Edge) it.next();
+ View nextEdgeTarget = nextEdge.getTarget();
+ if (type.equals(nextEdgeTarget.getType()) && isOwnView(nextEdgeTarget)) {
+ result.add(nextEdgeTarget);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getOutgoingLinksByType(Collection nodes, int visualID) {
+ Collection result = new ArrayList();
+ String type = EcoreVisualIDRegistry.getType(visualID);
+ for (Iterator it = nodes.iterator(); it.hasNext();) {
+ View nextNode = (View) it.next();
+ result.addAll(selectViewsByType(nextNode.getSourceEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getIncomingLinksByType(Collection nodes, int visualID) {
+ Collection result = new ArrayList();
+ String type = EcoreVisualIDRegistry.getType(visualID);
+ for (Iterator it = nodes.iterator(); it.hasNext();) {
+ View nextNode = (View) it.next();
+ result.addAll(selectViewsByType(nextNode.getTargetEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getChildrenByType(Collection nodes, int visualID) {
+ Collection result = new ArrayList();
+ String type = EcoreVisualIDRegistry.getType(visualID);
+ for (Iterator it = nodes.iterator(); it.hasNext();) {
+ View nextNode = (View) it.next();
+ result.addAll(selectViewsByType(nextNode.getChildren(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getDiagramLinksByType(Collection diagrams, int visualID) {
+ Collection result = new ArrayList();
+ String type = EcoreVisualIDRegistry.getType(visualID);
+ for (Iterator it = diagrams.iterator(); it.hasNext();) {
+ Diagram nextDiagram = (Diagram) it.next();
+ result.addAll(selectViewsByType(nextDiagram.getEdges(), type));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection selectViewsByType(Collection views, String type) {
+ Collection result = new ArrayList();
+ for (Iterator it = views.iterator(); it.hasNext();) {
+ View nextView = (View) it.next();
+ if (type.equals(nextView.getType()) && isOwnView(nextView)) {
+ result.add(nextView);
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isOwnView(View view) {
+ return EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(view));
+ }
+
+ /**
+ * @generated
+ */
+ private Collection createNavigatorItems(Collection views, Object parent, boolean isLeafs) {
+ Collection result = new ArrayList();
+ for (Iterator it = views.iterator(); it.hasNext();) {
+ result.add(new EcoreNavigatorItem((View) it.next(), parent, isLeafs));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private Collection getForeignShortcuts(Diagram diagram, Object parent) {
+ Collection result = new ArrayList();
+ for (Iterator it = diagram.getChildren().iterator(); it.hasNext();) {
+ View nextView = (View) it.next();
+ if (!isOwnView(nextView) && nextView.getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ result.add(nextView);
+ }
+ }
+ return createNavigatorItems(result, parent, false);
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(Object element) {
+ if (element instanceof EcoreAbstractNavigatorItem) {
+ EcoreAbstractNavigatorItem abstractNavigatorItem = (EcoreAbstractNavigatorItem) element;
+ return abstractNavigatorItem.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(Object element) {
+ return element instanceof IFile || getChildren(element).length > 0;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorGroup.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorGroup.java
new file mode 100644
index 0000000..e1d0b3e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorGroup.java
@@ -0,0 +1,109 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+/**
+ * @generated
+ */
+public class EcoreNavigatorGroup extends EcoreAbstractNavigatorItem {
+
+ /**
+ * @generated
+ */
+ private String myGroupName;
+
+ /**
+ * @generated
+ */
+ private String myIcon;
+
+ /**
+ * @generated
+ */
+ private Collection myChildren = new LinkedList();
+
+ /**
+ * @generated
+ */
+ EcoreNavigatorGroup(String groupName, String icon, Object parent) {
+ super(parent);
+ myGroupName = groupName;
+ myIcon = icon;
+ }
+
+ /**
+ * @generated
+ */
+ public String getGroupName() {
+ return myGroupName;
+ }
+
+ /**
+ * @generated
+ */
+ public String getIcon() {
+ return myIcon;
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren() {
+ return myChildren.toArray();
+ }
+
+ /**
+ * @generated
+ */
+ public void addChildren(Collection children) {
+ myChildren.addAll(children);
+ }
+
+ /**
+ * @generated
+ */
+ public void addChild(Object child) {
+ myChildren.add(child);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isEmpty() {
+ return myChildren.size() == 0;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorGroup) {
+ org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorGroup anotherGroup = (org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorGroup) obj;
+ if (getGroupName().equals(anotherGroup.getGroupName())) {
+ return getParent().equals(anotherGroup.getParent());
+ }
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ public int hashCode() {
+ return getGroupName().hashCode();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorItem.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorItem.java
new file mode 100644
index 0000000..c8a5355
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorItem.java
@@ -0,0 +1,96 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreNavigatorItem extends EcoreAbstractNavigatorItem {
+
+ /**
+ * @generated
+ */
+ static {
+ final Class[] supportedTypes = new Class[] { View.class, EObject.class };
+ Platform.getAdapterManager().registerAdapters(new IAdapterFactory() {
+
+ public Object getAdapter(Object adaptableObject, Class adapterType) {
+ if (adaptableObject instanceof org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorItem && (adapterType == View.class || adapterType == EObject.class)) {
+ return ((org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorItem) adaptableObject).getView();
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return supportedTypes;
+ }
+ }, org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorItem.class);
+ }
+
+ /**
+ * @generated
+ */
+ private View myView;
+
+ /**
+ * @generated
+ */
+ private boolean myLeaf = false;
+
+ /**
+ * @generated
+ */
+ public EcoreNavigatorItem(View view, Object parent, boolean isLeaf) {
+ super(parent);
+ myView = view;
+ myLeaf = isLeaf;
+ }
+
+ /**
+ * @generated
+ */
+ public View getView() {
+ return myView;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLeaf() {
+ return myLeaf;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorItem) {
+ return EcoreUtil.getURI(getView()).equals(EcoreUtil.getURI(((org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorItem) obj).getView()));
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * @generated
+ */
+ public int hashCode() {
+ return EcoreUtil.getURI(getView()).hashCode();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorLabelProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorLabelProvider.java
new file mode 100644
index 0000000..5c9f1eb
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorLabelProvider.java
@@ -0,0 +1,536 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationSourceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackage2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReference2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreParserProvider;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserOptions;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserService;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.viewers.ITreePathLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.ViewerLabel;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.navigator.ICommonContentExtensionSite;
+import org.eclipse.ui.navigator.ICommonLabelProvider;
+
+/**
+ * @generated
+ */
+public class EcoreNavigatorLabelProvider extends LabelProvider implements ICommonLabelProvider, ITreePathLabelProvider {
+
+ /**
+ * @generated
+ */
+ static {
+ EcoreDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?UnknownElement", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
+ EcoreDiagramEditorPlugin.getInstance().getImageRegistry().put("Navigator?ImageNotFound", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public void updateLabel(ViewerLabel label, TreePath elementPath) {
+ Object element = elementPath.getLastSegment();
+ if (element instanceof EcoreNavigatorItem && !isOwnView(((EcoreNavigatorItem) element).getView())) {
+ return;
+ }
+ label.setText(getText(element));
+ label.setImage(getImage(element));
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ if (element instanceof EcoreNavigatorGroup) {
+ EcoreNavigatorGroup group = (EcoreNavigatorGroup) element;
+ return EcoreDiagramEditorPlugin.getInstance().getBundledImage(group.getIcon());
+ }
+
+ if (element instanceof EcoreNavigatorItem) {
+ EcoreNavigatorItem navigatorItem = (EcoreNavigatorItem) element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return super.getImage(element);
+ }
+ return getImage(navigatorItem.getView());
+ }
+
+ // Due to plugin.xml content will be called only for "own" views
+ if (element instanceof IAdaptable) {
+ View view = (View) ((IAdaptable) element).getAdapter(View.class);
+ if (view != null && isOwnView(view)) {
+ return getImage(view);
+ }
+ }
+
+ return super.getImage(element);
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(View view) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
+ case EPackageEditPart.VISUAL_ID:
+ return getImage("Navigator?Diagram?http://www.eclipse.org/emf/2002/Ecore?EPackage", EcoreElementTypes.EPackage_79); //$NON-NLS-1$
+ case EClassEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/emf/2002/Ecore?EClass", EcoreElementTypes.EClass_1001); //$NON-NLS-1$
+ case EPackage2EditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/emf/2002/Ecore?EPackage", EcoreElementTypes.EPackage_1002); //$NON-NLS-1$
+ case EAnnotationEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/emf/2002/Ecore?EAnnotation", EcoreElementTypes.EAnnotation_1003); //$NON-NLS-1$
+ case EDataTypeEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/emf/2002/Ecore?EDataType", EcoreElementTypes.EDataType_1004); //$NON-NLS-1$
+ case EEnumEditPart.VISUAL_ID:
+ return getImage("Navigator?TopLevelNode?http://www.eclipse.org/emf/2002/Ecore?EEnum", EcoreElementTypes.EEnum_1005); //$NON-NLS-1$
+ case EAttributeEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/emf/2002/Ecore?EAttribute", EcoreElementTypes.EAttribute_2001); //$NON-NLS-1$
+ case EOperationEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/emf/2002/Ecore?EOperation", EcoreElementTypes.EOperation_2002); //$NON-NLS-1$
+ case EClass2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/emf/2002/Ecore?EClass", EcoreElementTypes.EClass_2003); //$NON-NLS-1$
+ case EDataType2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/emf/2002/Ecore?EDataType", EcoreElementTypes.EDataType_2004); //$NON-NLS-1$
+ case EEnum2EditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/emf/2002/Ecore?EEnum", EcoreElementTypes.EEnum_2005); //$NON-NLS-1$
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/emf/2002/Ecore?EEnumLiteral", EcoreElementTypes.EEnumLiteral_2006); //$NON-NLS-1$
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ return getImage("Navigator?Node?http://www.eclipse.org/emf/2002/Ecore?EStringToStringMapEntry", EcoreElementTypes.EStringToStringMapEntry_2007); //$NON-NLS-1$
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/emf/2002/Ecore?EAnnotation?references", EcoreElementTypes.EAnnotationReferences_3001); //$NON-NLS-1$
+ case EReferenceEditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/emf/2002/Ecore?EReference", EcoreElementTypes.EReference_3002); //$NON-NLS-1$
+ case EReference2EditPart.VISUAL_ID:
+ return getImage("Navigator?Link?http://www.eclipse.org/emf/2002/Ecore?EClass?eSuperTypes", EcoreElementTypes.EClassESuperTypes_3003); //$NON-NLS-1$
+ }
+ return getImage("Navigator?UnknownElement", null); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private Image getImage(String key, IElementType elementType) {
+ ImageRegistry imageRegistry = EcoreDiagramEditorPlugin.getInstance().getImageRegistry();
+ Image image = imageRegistry.get(key);
+ if (image == null && elementType != null && EcoreElementTypes.isKnownElementType(elementType)) {
+ image = EcoreElementTypes.getImage(elementType);
+ imageRegistry.put(key, image);
+ }
+
+ if (image == null) {
+ image = imageRegistry.get("Navigator?ImageNotFound"); //$NON-NLS-1$
+ imageRegistry.put(key, image);
+ }
+ return image;
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ if (element instanceof EcoreNavigatorGroup) {
+ EcoreNavigatorGroup group = (EcoreNavigatorGroup) element;
+ return group.getGroupName();
+ }
+
+ if (element instanceof EcoreNavigatorItem) {
+ EcoreNavigatorItem navigatorItem = (EcoreNavigatorItem) element;
+ if (!isOwnView(navigatorItem.getView())) {
+ return null;
+ }
+ return getText(navigatorItem.getView());
+ }
+
+ // Due to plugin.xml content will be called only for "own" views
+ if (element instanceof IAdaptable) {
+ View view = (View) ((IAdaptable) element).getAdapter(View.class);
+ if (view != null && isOwnView(view)) {
+ return getText(view);
+ }
+ }
+
+ return super.getText(element);
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(View view) {
+ if (view.getElement() != null && view.getElement().eIsProxy()) {
+ return getUnresolvedDomainElementProxyText(view);
+ }
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
+ case EPackageEditPart.VISUAL_ID:
+ return getEPackage_79Text(view);
+ case EClassEditPart.VISUAL_ID:
+ return getEClass_1001Text(view);
+ case EPackage2EditPart.VISUAL_ID:
+ return getEPackage_1002Text(view);
+ case EAnnotationEditPart.VISUAL_ID:
+ return getEAnnotation_1003Text(view);
+ case EDataTypeEditPart.VISUAL_ID:
+ return getEDataType_1004Text(view);
+ case EEnumEditPart.VISUAL_ID:
+ return getEEnum_1005Text(view);
+ case EAttributeEditPart.VISUAL_ID:
+ return getEAttribute_2001Text(view);
+ case EOperationEditPart.VISUAL_ID:
+ return getEOperation_2002Text(view);
+ case EClass2EditPart.VISUAL_ID:
+ return getEClass_2003Text(view);
+ case EDataType2EditPart.VISUAL_ID:
+ return getEDataType_2004Text(view);
+ case EEnum2EditPart.VISUAL_ID:
+ return getEEnum_2005Text(view);
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return getEEnumLiteral_2006Text(view);
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ return getEStringToStringMapEntry_2007Text(view);
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return getEAnnotationReferences_3001Text(view);
+ case EReferenceEditPart.VISUAL_ID:
+ return getEReference_3002Text(view);
+ case EReference2EditPart.VISUAL_ID:
+ return getEClassESuperTypes_3003Text(view);
+ }
+ return getUnknownElementText(view);
+ }
+
+ /**
+ * @generated
+ */
+ private String getEClass_1001Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EClass_1001, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EClassNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 4001); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEPackage_1002Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EPackage_1002, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EPackageNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 4006); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEAnnotation_1003Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EAnnotation_1003, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EAnnotationSourceEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 4007); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEDataType_1004Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EDataType_1004, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EDataTypeNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 4008); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEEnum_1005Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EEnum_1005, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EEnumNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 4010); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEAttribute_2001Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EAttribute_2001, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EAttributeEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 2001); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getEOperation_2002Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EOperation_2002, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EOperationEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 2002); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getEClass_2003Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EClass_2003, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EClassName2EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 4002); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEDataType_2004Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EDataType_2004, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EDataTypeName2EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 4003); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEEnum_2005Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EEnum_2005, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EEnumName2EditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 4005); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEEnumLiteral_2006Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EEnumLiteral_2006, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EEnumLiteralEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 2006); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getEStringToStringMapEntry_2007Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EStringToStringMapEntry_2007, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EStringToStringMapEntryEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 2007); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getEPackage_79Text(View view) {
+ EPackage domainModelElement = (EPackage) view.getElement();
+ if (domainModelElement != null) {
+ return domainModelElement.getName();
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("No domain element for view with visualID = " + 79); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private String getEAnnotationReferences_3001Text(View view) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private String getEReference_3002Text(View view) {
+ IAdaptable hintAdapter = new EcoreParserProvider.HintAdapter(EcoreElementTypes.EReference_3002, (view.getElement() != null ? view.getElement() : view), EcoreVisualIDRegistry
+ .getType(EReferenceNameEditPart.VISUAL_ID));
+ IParser parser = ParserService.getInstance().getParser(hintAdapter);
+
+ if (parser != null) {
+ return parser.getPrintString(hintAdapter, ParserOptions.NONE.intValue());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Parser was not found for label " + 4011); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private String getEClassESuperTypes_3003Text(View view) {
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private String getUnknownElementText(View view) {
+ return "<UnknownElement Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * @generated
+ */
+ private String getUnresolvedDomainElementProxyText(View view) {
+ return "<Unresolved domain element Visual_ID = " + view.getType() + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * @generated
+ */
+ public void init(ICommonContentExtensionSite aConfig) {
+ }
+
+ /**
+ * @generated
+ */
+ public void restoreState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public void saveState(IMemento aMemento) {
+ }
+
+ /**
+ * @generated
+ */
+ public String getDescription(Object anElement) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isOwnView(View view) {
+ return EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(view));
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorLinkHelper.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorLinkHelper.java
new file mode 100644
index 0000000..02dd02b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorLinkHelper.java
@@ -0,0 +1,130 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.navigator.ILinkHelper;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class EcoreNavigatorLinkHelper implements ILinkHelper {
+
+ /**
+ * @generated
+ */
+ private static IEditorInput getEditorInput(Diagram diagram) {
+ Resource diagramResource = diagram.eResource();
+ for (Iterator it = diagramResource.getContents().iterator(); it.hasNext();) {
+ EObject nextEObject = (EObject) it.next();
+ if (nextEObject == diagram) {
+ return new FileEditorInput(WorkspaceSynchronizer.getFile(diagramResource));
+ }
+ if (nextEObject instanceof Diagram) {
+ break;
+ }
+ }
+ URI uri = EcoreUtil.getURI(diagram);
+ String editorName = uri.lastSegment() + "#" + diagram.eResource().getContents().indexOf(diagram); //$NON-NLS-1$
+ IEditorInput editorInput = new URIEditorInput(uri, editorName);
+ return editorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public IStructuredSelection findSelection(IEditorInput anInput) {
+ IDiagramDocument document = EcoreDiagramEditorPlugin.getInstance().getDocumentProvider().getDiagramDocument(anInput);
+ if (document == null) {
+ return StructuredSelection.EMPTY;
+ }
+ Diagram diagram = document.getDiagram();
+ IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
+ if (file != null) {
+ EcoreNavigatorItem item = new EcoreNavigatorItem(diagram, file, false);
+ return new StructuredSelection(item);
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * @generated
+ */
+ public void activateEditor(IWorkbenchPage aPage, IStructuredSelection aSelection) {
+ if (aSelection == null || aSelection.isEmpty()) {
+ return;
+ }
+ if (false == aSelection.getFirstElement() instanceof EcoreAbstractNavigatorItem) {
+ return;
+ }
+
+ EcoreAbstractNavigatorItem abstractNavigatorItem = (EcoreAbstractNavigatorItem) aSelection.getFirstElement();
+ View navigatorView = null;
+ if (abstractNavigatorItem instanceof EcoreNavigatorItem) {
+ navigatorView = ((EcoreNavigatorItem) abstractNavigatorItem).getView();
+ } else if (abstractNavigatorItem instanceof EcoreNavigatorGroup) {
+ EcoreNavigatorGroup navigatorGroup = (EcoreNavigatorGroup) abstractNavigatorItem;
+ if (navigatorGroup.getParent() instanceof EcoreNavigatorItem) {
+ navigatorView = ((EcoreNavigatorItem) navigatorGroup.getParent()).getView();
+ } else if (navigatorGroup.getParent() instanceof IAdaptable) {
+ navigatorView = (View) ((IAdaptable) navigatorGroup.getParent()).getAdapter(View.class);
+ }
+ }
+ if (navigatorView == null) {
+ return;
+ }
+ IEditorInput editorInput = getEditorInput(navigatorView.getDiagram());
+ IEditorPart editor = aPage.findEditor(editorInput);
+ if (editor == null) {
+ return;
+ }
+ aPage.bringToTop(editor);
+ if (editor instanceof DiagramEditor) {
+ DiagramEditor diagramEditor = (DiagramEditor) editor;
+ ResourceSet diagramEditorResourceSet = diagramEditor.getEditingDomain().getResourceSet();
+ EObject selectedView = diagramEditorResourceSet.getEObject(EcoreUtil.getURI(navigatorView), true);
+ if (selectedView == null) {
+ return;
+ }
+ GraphicalViewer graphicalViewer = (GraphicalViewer) diagramEditor.getAdapter(GraphicalViewer.class);
+ EditPart selectedEditPart = (EditPart) graphicalViewer.getEditPartRegistry().get(selectedView);
+ if (selectedEditPart != null) {
+ graphicalViewer.select(selectedEditPart);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorSorter.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorSorter.java
new file mode 100644
index 0000000..3051c9a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/navigator/EcoreNavigatorSorter.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.navigator;
+
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.jface.viewers.ViewerSorter;
+
+/**
+ * @generated
+ */
+public class EcoreNavigatorSorter extends ViewerSorter {
+
+ /**
+ * @generated
+ */
+ private static final int GROUP_CATEGORY = 5010;
+
+ /**
+ * @generated
+ */
+ private static final int SHORTCUTS_CATEGORY = 5009;
+
+ /**
+ * @generated
+ */
+ public int category(Object element) {
+ if (element instanceof EcoreNavigatorItem) {
+ EcoreNavigatorItem item = (EcoreNavigatorItem) element;
+ if (item.getView().getEAnnotation("Shortcut") != null) { //$NON-NLS-1$
+ return SHORTCUTS_CATEGORY;
+ }
+ return EcoreVisualIDRegistry.getVisualID(item.getView());
+ }
+ return GROUP_CATEGORY;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/AbstractParser.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/AbstractParser.java
new file mode 100644
index 0000000..fa1da85
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/AbstractParser.java
@@ -0,0 +1,400 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.parsers;
+
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.core.command.UnexecutableCommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.type.core.commands.SetValueCommand;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @generated
+ */
+public abstract class AbstractParser implements IParser {
+
+ /**
+ * @generated
+ */
+ protected final EAttribute[] features;
+
+ /**
+ * @generated
+ */
+ private String viewPattern;
+
+ /**
+ * @generated
+ */
+ private String editorPattern;
+
+ /**
+ * @generated
+ */
+ private String editPattern;
+
+ /**
+ * @generated
+ */
+ public AbstractParser(EAttribute[] features) {
+ if (features == null || Arrays.asList(features).contains(null)) {
+ throw new IllegalArgumentException();
+ }
+ this.features = features;
+ }
+
+ /**
+ * @generated
+ */
+ public String getViewPattern() {
+ return viewPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setViewPattern(String viewPattern) {
+ this.viewPattern = viewPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditorPattern() {
+ return editorPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditorPattern(String editorPattern) {
+ this.editorPattern = editorPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditPattern() {
+ return editPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditPattern(String editPattern) {
+ this.editPattern = editPattern;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+ if (event instanceof Notification) {
+ return isAffectingFeature(((Notification) event).getFeature());
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isAffectingFeature(Object feature) {
+ for (int i = 0; i < features.length; i++) {
+ if (features[i] == feature) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable element) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object[] getValues(EObject element) {
+ Object[] values = new Object[features.length];
+ for (int i = 0; i < features.length; i++) {
+ values[i] = getValue(element, features[i]);
+ }
+ return values;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object getValue(EObject element, EAttribute feature) {
+ Object value = element.eGet(feature);
+ Class iClass = feature.getEAttributeType().getInstanceClass();
+ if (String.class.equals(iClass)) {
+ if (value == null) {
+ value = ""; //$NON-NLS-1$
+ }
+ }
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getParseCommand(IAdaptable adapter, Object[] values, int flags) {
+ if (values == null || validateNewValues(values).getCode() != IParserEditStatus.EDITABLE) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ EObject element = (EObject) adapter.getAdapter(EObject.class);
+ TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(element);
+ if (editingDomain == null) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ CompositeTransactionalCommand command = new CompositeTransactionalCommand(editingDomain, "Set Values"); //$NON-NLS-1$
+ for (int i = 0; i < values.length; i++) {
+ command.compose(getModificationCommand(element, features[i], values[i]));
+ }
+ return command;
+ }
+
+ /**
+ * @generated
+ */
+ protected ICommand getModificationCommand(EObject element, EAttribute feature, Object value) {
+ value = getValidNewValue(feature, value);
+ if (value instanceof InvalidValue) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ SetRequest request = new SetRequest(element, feature, value);
+ return new SetValueCommand(request);
+ }
+
+ /**
+ * @generated
+ */
+ protected IParserEditStatus validateNewValues(Object[] values) {
+ if (values.length != features.length) {
+ return ParserEditStatus.UNEDITABLE_STATUS;
+ }
+ for (int i = 0; i < values.length; i++) {
+ Object value = getValidNewValue(features[i], values[i]);
+ if (value instanceof InvalidValue) {
+ return new ParserEditStatus(EcoreDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, value.toString());
+ }
+ }
+ return ParserEditStatus.EDITABLE_STATUS;
+ }
+
+ /**
+ * @generated
+ */
+ protected Object getValidNewValue(EAttribute feature, Object value) {
+ EClassifier type = feature.getEType();
+ if (type instanceof 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(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, 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(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, 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(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, 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(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, 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(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, 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(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, 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(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, 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(NLS.bind(Messages.AbstractParser_WrongStringConversionMessage, iClass.getName()));
+ }
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, iClass.getName()));
+ }
+ } else if (type instanceof EEnum) {
+ if (value instanceof String) {
+ EEnumLiteral literal = ((EEnum) type).getEEnumLiteralByLiteral((String) value);
+ if (literal == null) {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnknownLiteralMessage, value));
+ } else {
+ value = literal.getInstance();
+ }
+ } else {
+ value = new InvalidValue(NLS.bind(Messages.AbstractParser_UnexpectedValueTypeMessage, String.class.getName()));
+ }
+ }
+ }
+ return value;
+ }
+
+ /**
+ * @generated
+ */
+ protected class InvalidValue {
+
+ /**
+ * @generated
+ */
+ private String description;
+
+ /**
+ * @generated
+ */
+ public InvalidValue(String description) {
+ this.description = description;
+ }
+
+ /**
+ * @generated
+ */
+ public String toString() {
+ return description;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/CompositeParser.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/CompositeParser.java
new file mode 100644
index 0000000..26d2999
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/CompositeParser.java
@@ -0,0 +1,85 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.parsers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.jface.text.contentassist.IContentAssistProcessor;
+
+/**
+ * @generated
+ */
+public class CompositeParser implements IParser {
+
+ /**
+ * @generated
+ */
+ private final IParser reader;
+
+ /**
+ * @generated
+ */
+ private final IParser writer;
+
+ /**
+ * @generated
+ */
+ public CompositeParser(IParser reader, IParser writer) {
+ this.reader = reader;
+ this.writer = writer;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isAffectingEvent(Object event, int flags) {
+ return reader.isAffectingEvent(event, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public String getPrintString(IAdaptable adapter, int flags) {
+ return reader.getPrintString(adapter, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditString(IAdaptable adapter, int flags) {
+ return reader.getEditString(adapter, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
+ return writer.isValidEditString(adapter, editString);
+ }
+
+ /**
+ * @generated
+ */
+ public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
+ return writer.getParseCommand(adapter, newString, flags);
+ }
+
+ /**
+ * @generated
+ */
+ public IContentAssistProcessor getCompletionProcessor(IAdaptable adapter) {
+ return writer.getCompletionProcessor(adapter);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/MessageFormatParser.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/MessageFormatParser.java
new file mode 100644
index 0000000..425f5fd
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/parsers/MessageFormatParser.java
@@ -0,0 +1,214 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.parsers;
+
+import java.text.FieldPosition;
+import java.text.MessageFormat;
+import java.text.ParsePosition;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserEditStatus;
+import org.eclipse.gmf.runtime.common.ui.services.parser.ParserEditStatus;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @generated
+ */
+public class MessageFormatParser extends AbstractParser {
+
+ /**
+ * @generated
+ */
+ private String defaultPattern;
+
+ /**
+ * @generated
+ */
+ private MessageFormat viewProcessor;
+
+ /**
+ * @generated
+ */
+ private MessageFormat editorProcessor;
+
+ /**
+ * @generated
+ */
+ private MessageFormat editProcessor;
+
+ /**
+ * @generated
+ */
+ public MessageFormatParser(EAttribute[] features) {
+ super(features);
+ }
+
+ /**
+ * @generated
+ */
+ 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;
+ }
+
+ /**
+ * @generated
+ */
+ public String getViewPattern() {
+ String pattern = super.getViewPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ /**
+ * @generated
+ */
+ public void setViewPattern(String viewPattern) {
+ super.setViewPattern(viewPattern);
+ viewProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat createViewProcessor(String viewPattern) {
+ return new MessageFormat(viewPattern);
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getViewProcessor() {
+ if (viewProcessor == null) {
+ viewProcessor = createViewProcessor(getViewPattern());
+ }
+ return viewProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditorPattern() {
+ String pattern = super.getEditorPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditorPattern(String editorPattern) {
+ super.setEditorPattern(editorPattern);
+ editorProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat createEditorProcessor(String editorPattern) {
+ return new MessageFormat(editorPattern);
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditorProcessor() {
+ if (editorProcessor == null) {
+ editorProcessor = createEditorProcessor(getEditorPattern());
+ }
+ return editorProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditPattern() {
+ String pattern = super.getEditPattern();
+ return pattern != null ? pattern : getDefaultPattern();
+ }
+
+ /**
+ * @generated
+ */
+ public void setEditPattern(String editPattern) {
+ super.setEditPattern(editPattern);
+ editProcessor = null;
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat createEditProcessor(String editPattern) {
+ return new MessageFormat(editPattern);
+ }
+
+ /**
+ * @generated
+ */
+ protected MessageFormat getEditProcessor() {
+ if (editProcessor == null) {
+ editProcessor = createEditProcessor(getEditPattern());
+ }
+ return editProcessor;
+ }
+
+ /**
+ * @generated
+ */
+ public String getPrintString(IAdaptable adapter, int flags) {
+ EObject element = (EObject) adapter.getAdapter(EObject.class);
+ return getViewProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
+ }
+
+ /**
+ * @generated
+ */
+ public String getEditString(IAdaptable adapter, int flags) {
+ EObject element = (EObject) adapter.getAdapter(EObject.class);
+ return getEditorProcessor().format(getValues(element), new StringBuffer(), new FieldPosition(0)).toString();
+ }
+
+ /**
+ * @generated
+ */
+ public IParserEditStatus isValidEditString(IAdaptable adapter, String editString) {
+ ParsePosition pos = new ParsePosition(0);
+ Object[] values = getEditProcessor().parse(editString, pos);
+ if (values == null) {
+ return new ParserEditStatus(EcoreDiagramEditorPlugin.ID, IParserEditStatus.UNEDITABLE, NLS.bind(Messages.MessageFormatParser_InvalidInputError, new Integer(pos.getErrorIndex())));
+ }
+ return validateNewValues(values);
+ }
+
+ /**
+ * @generated
+ */
+ public ICommand getParseCommand(IAdaptable adapter, String newString, int flags) {
+ Object[] values = getEditProcessor().parse(newString, new ParsePosition(0));
+ return getParseCommand(adapter, values, flags);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreateShortcutAction.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreateShortcutAction.java
new file mode 100644
index 0000000..7267590
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreateShortcutAction.java
@@ -0,0 +1,111 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.EcoreCreateShortcutDecorationsCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.diagram.ui.commands.CreateCommand;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class EcoreCreateShortcutAction implements IObjectActionDelegate {
+
+ /**
+ * @generated
+ */
+ private EPackageEditPart mySelectedElement;
+
+ /**
+ * @generated
+ */
+ private Shell myShell;
+
+ /**
+ * @generated
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ myShell = targetPart.getSite().getShell();
+ }
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ mySelectedElement = null;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof EPackageEditPart) {
+ mySelectedElement = (EPackageEditPart) structuredSelection.getFirstElement();
+ }
+ }
+ action.setEnabled(isEnabled());
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isEnabled() {
+ return mySelectedElement != null;
+ }
+
+ /**
+ * @generated
+ */
+ public void run(IAction action) {
+ final View view = (View) mySelectedElement.getModel();
+ EcoreElementChooserDialog elementChooser = new EcoreElementChooserDialog(myShell, view);
+ int result = elementChooser.open();
+ if (result != Window.OK) {
+ return;
+ }
+ URI selectedModelElementURI = elementChooser.getSelectedModelElementURI();
+ final EObject selectedElement;
+ try {
+ selectedElement = mySelectedElement.getEditingDomain().getResourceSet().getEObject(selectedModelElementURI, true);
+ } catch (WrappedException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Exception while loading object: " + selectedModelElementURI.toString(), e); //$NON-NLS-1$
+ return;
+ }
+
+ if (selectedElement == null) {
+ return;
+ }
+ CreateViewRequest.ViewDescriptor viewDescriptor = new CreateViewRequest.ViewDescriptor(new EObjectAdapter(selectedElement), Node.class, null, EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ ICommand command = new CreateCommand(mySelectedElement.getEditingDomain(), viewDescriptor, view);
+ command = command.compose(new EcoreCreateShortcutDecorationsCommand(mySelectedElement.getEditingDomain(), view, viewDescriptor));
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
+ } catch (ExecutionException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to create shortcut", e); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreationWizard.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreationWizard.java
new file mode 100644
index 0000000..6c2524f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreationWizard.java
@@ -0,0 +1,156 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+
+/**
+ * @generated
+ */
+public class EcoreCreationWizard extends Wizard implements INewWizard {
+
+ /**
+ * @generated
+ */
+ private IWorkbench workbench;
+
+ /**
+ * @generated
+ */
+ protected IStructuredSelection selection;
+
+ /**
+ * @generated
+ */
+ protected EcoreCreationWizardPage diagramModelFilePage;
+
+ /**
+ * @generated
+ */
+ protected EcoreCreationWizardPage domainModelFilePage;
+
+ /**
+ * @generated
+ */
+ protected Resource diagram;
+
+ /**
+ * @generated
+ */
+ private boolean openNewlyCreatedDiagramEditor = true;
+
+ /**
+ * @generated
+ */
+ public IWorkbench getWorkbench() {
+ return workbench;
+ }
+
+ /**
+ * @generated
+ */
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * @generated
+ */
+ public final Resource getDiagram() {
+ return diagram;
+ }
+
+ /**
+ * @generated
+ */
+ public final boolean isOpenNewlyCreatedDiagramEditor() {
+ return openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ public void setOpenNewlyCreatedDiagramEditor(boolean openNewlyCreatedDiagramEditor) {
+ this.openNewlyCreatedDiagramEditor = openNewlyCreatedDiagramEditor;
+ }
+
+ /**
+ * @generated
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle(Messages.EcoreCreationWizardTitle);
+ setDefaultPageImageDescriptor(EcoreDiagramEditorPlugin.getBundledImageDescriptor("icons/wizban/NewEcoreWizard.gif")); //$NON-NLS-1$
+ setNeedsProgressMonitor(true);
+ }
+
+ /**
+ * @generated
+ */
+ public void addPages() {
+ diagramModelFilePage = new EcoreCreationWizardPage("DiagramModelFile", getSelection(), "ecorediag"); //$NON-NLS-1$ //$NON-NLS-2$
+ diagramModelFilePage.setTitle(Messages.EcoreCreationWizard_DiagramModelFilePageTitle);
+ diagramModelFilePage.setDescription(Messages.EcoreCreationWizard_DiagramModelFilePageDescription);
+ addPage(diagramModelFilePage);
+
+ domainModelFilePage = new EcoreCreationWizardPage("DomainModelFile", getSelection(), "ecore"); //$NON-NLS-1$ //$NON-NLS-2$
+ domainModelFilePage.setTitle(Messages.EcoreCreationWizard_DomainModelFilePageTitle);
+ domainModelFilePage.setDescription(Messages.EcoreCreationWizard_DomainModelFilePageDescription);
+ addPage(domainModelFilePage);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean performFinish() {
+ IRunnableWithProgress op = new WorkspaceModifyOperation(null) {
+
+ protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
+ diagram = EcoreDiagramEditorUtil.createDiagram(diagramModelFilePage.getURI(), domainModelFilePage.getURI(), monitor);
+ if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
+ try {
+ EcoreDiagramEditorUtil.openDiagram(diagram);
+ } catch (PartInitException e) {
+ ErrorDialog.openError(getContainer().getShell(), Messages.EcoreCreationWizardOpenEditorError, null, e.getStatus());
+ }
+ }
+ }
+ };
+ try {
+ getContainer().run(false, true, op);
+ } catch (InterruptedException e) {
+ return false;
+ } catch (InvocationTargetException e) {
+ if (e.getTargetException() instanceof CoreException) {
+ ErrorDialog.openError(getContainer().getShell(), Messages.EcoreCreationWizardCreationError, null, ((CoreException) e.getTargetException()).getStatus());
+ } else {
+ EcoreDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ return diagram != null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreationWizardPage.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreationWizardPage.java
new file mode 100644
index 0000000..bc201da
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreCreationWizardPage.java
@@ -0,0 +1,95 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ * @generated
+ */
+public class EcoreCreationWizardPage extends WizardNewFileCreationPage {
+
+ /**
+ * @generated
+ */
+ private final String fileExtension;
+
+ /**
+ * @generated
+ */
+ public EcoreCreationWizardPage(String pageName, IStructuredSelection selection, String fileExtension) {
+ super(pageName, selection);
+ this.fileExtension = fileExtension;
+ }
+
+ /**
+ * Override to create files with this extension.
+ *
+ * @generated
+ */
+ protected String getExtension() {
+ return fileExtension;
+ }
+
+ /**
+ * @generated
+ */
+ public URI getURI() {
+ return URI.createPlatformResourceURI(getFilePath().toString(), false);
+ }
+
+ /**
+ * @generated
+ */
+ protected IPath getFilePath() {
+ IPath path = getContainerFullPath();
+ if (path == null) {
+ path = new Path(""); //$NON-NLS-1$
+ }
+ String fileName = getFileName();
+ if (fileName != null) {
+ path = path.append(fileName);
+ }
+ return path;
+ }
+
+ /**
+ * @generated
+ */
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ setFileName(EcoreDiagramEditorUtil.getUniqueFileName(getContainerFullPath(), getFileName(), getExtension()));
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean validatePage() {
+ if (!super.validatePage()) {
+ return false;
+ }
+ String extension = getExtension();
+ if (extension != null && !getFilePath().toString().endsWith("." + extension)) {
+ setErrorMessage(NLS.bind(Messages.EcoreCreationWizardPageExtensionError, extension));
+ return false;
+ }
+ return true;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramActionBarContributor.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramActionBarContributor.java
new file mode 100644
index 0000000..01fc769
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramActionBarContributor.java
@@ -0,0 +1,35 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramActionBarContributor;
+
+/**
+ * @generated
+ */
+public class EcoreDiagramActionBarContributor extends DiagramActionBarContributor {
+
+ /**
+ * @generated
+ */
+ protected Class getEditorClass() {
+ return EcoreDiagramEditor.class;
+ }
+
+ /**
+ * @generated
+ */
+ protected String getEditorId() {
+ return EcoreDiagramEditor.ID;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramContentInitializer.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramContentInitializer.java
new file mode 100644
index 0000000..9049c6f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramContentInitializer.java
@@ -0,0 +1,380 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationDetailsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributes2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperations2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperationsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiterals2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackage2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageContentsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreDiagramContentInitializer {
+
+ /**
+ * @generated
+ */
+ private Map myDomain2NotationMap = new HashMap();
+
+ /**
+ * @generated
+ */
+ private Collection myLinkDescriptors = new LinkedList();
+
+ /**
+ * @generated
+ */
+ public void initDiagramContent(Diagram diagram) {
+ if (!EPackageEditPart.MODEL_ID.equals(diagram.getType())) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Incorrect diagram passed as a parameter: " + diagram.getType());
+ return;
+ }
+ if (false == diagram.getElement() instanceof EPackage) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Incorrect diagram element specified: " + diagram.getElement() + " instead of org.eclipse.emf.ecore.EPackage");
+ return;
+ }
+ createEPackage_79Children(diagram);
+ createLinks(diagram);
+ }
+
+ /**
+ * @generated
+ */
+ private void createEClass_1001Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEClass_1001OutgoingLinks(view));
+ createEClassAttributes_5001Children(getCompartment(view, EClassAttributesEditPart.VISUAL_ID));
+ createEClassOperations_5002Children(getCompartment(view, EClassOperationsEditPart.VISUAL_ID));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEPackage_1002Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEPackage_1002OutgoingLinks(view));
+ createEPackageContents_5003Children(getCompartment(view, EPackageContentsEditPart.VISUAL_ID));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEAnnotation_1003Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEAnnotation_1003OutgoingLinks(view));
+ createEAnnotationDetails_5007Children(getCompartment(view, EAnnotationDetailsEditPart.VISUAL_ID));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEDataType_1004Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEDataType_1004OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEEnum_1005Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEEnum_1005OutgoingLinks(view));
+ createEEnumLiterals_5008Children(getCompartment(view, EEnumLiterals2EditPart.VISUAL_ID));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEAttribute_2001Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEAttribute_2001OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEOperation_2002Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEOperation_2002OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEClass_2003Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEClass_2003OutgoingLinks(view));
+ createEClassAttributes_5004Children(getCompartment(view, EClassAttributes2EditPart.VISUAL_ID));
+ createEClassOperations_5005Children(getCompartment(view, EClassOperations2EditPart.VISUAL_ID));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEDataType_2004Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEDataType_2004OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEEnum_2005Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEEnum_2005OutgoingLinks(view));
+ createEEnumLiterals_5006Children(getCompartment(view, EEnumLiteralsEditPart.VISUAL_ID));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEEnumLiteral_2006Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEEnumLiteral_2006OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEStringToStringMapEntry_2007Children(View view) {
+ myDomain2NotationMap.put(view.getElement(), view);
+ myLinkDescriptors.addAll(EcoreDiagramUpdater.getEStringToStringMapEntry_2007OutgoingLinks(view));
+
+ }
+
+ /**
+ * @generated
+ */
+ private void createEClassAttributes_5001Children(View view) {
+ Collection childNodeDescriptors = EcoreDiagramUpdater.getEClassAttributes_5001SemanticChildren(view);
+ for (Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (EcoreNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createEClassOperations_5002Children(View view) {
+ Collection childNodeDescriptors = EcoreDiagramUpdater.getEClassOperations_5002SemanticChildren(view);
+ for (Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (EcoreNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createEPackageContents_5003Children(View view) {
+ Collection childNodeDescriptors = EcoreDiagramUpdater.getEPackageContents_5003SemanticChildren(view);
+ for (Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (EcoreNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createEClassAttributes_5004Children(View view) {
+ Collection childNodeDescriptors = EcoreDiagramUpdater.getEClassAttributes_5004SemanticChildren(view);
+ for (Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (EcoreNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createEClassOperations_5005Children(View view) {
+ Collection childNodeDescriptors = EcoreDiagramUpdater.getEClassOperations_5005SemanticChildren(view);
+ for (Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (EcoreNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createEEnumLiterals_5006Children(View view) {
+ Collection childNodeDescriptors = EcoreDiagramUpdater.getEEnumLiterals_5006SemanticChildren(view);
+ for (Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (EcoreNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createEAnnotationDetails_5007Children(View view) {
+ Collection childNodeDescriptors = EcoreDiagramUpdater.getEAnnotationDetails_5007SemanticChildren(view);
+ for (Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (EcoreNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createEEnumLiterals_5008Children(View view) {
+ Collection childNodeDescriptors = EcoreDiagramUpdater.getEEnumLiterals_5008SemanticChildren(view);
+ for (Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (EcoreNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createEPackage_79Children(View view) {
+ Collection childNodeDescriptors = EcoreDiagramUpdater.getEPackage_79SemanticChildren(view);
+ for (Iterator it = childNodeDescriptors.iterator(); it.hasNext();) {
+ createNode(view, (EcoreNodeDescriptor) it.next());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createNode(View parentView, EcoreNodeDescriptor nodeDescriptor) {
+ Node node = ViewService.createNode(parentView, nodeDescriptor.getModelElement(), nodeDescriptor.getType(), EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ switch (nodeDescriptor.getVisualID()) {
+ case EClassEditPart.VISUAL_ID:
+ createEClass_1001Children(node);
+ return;
+ case EPackage2EditPart.VISUAL_ID:
+ createEPackage_1002Children(node);
+ return;
+ case EAnnotationEditPart.VISUAL_ID:
+ createEAnnotation_1003Children(node);
+ return;
+ case EDataTypeEditPart.VISUAL_ID:
+ createEDataType_1004Children(node);
+ return;
+ case EEnumEditPart.VISUAL_ID:
+ createEEnum_1005Children(node);
+ return;
+ case EAttributeEditPart.VISUAL_ID:
+ createEAttribute_2001Children(node);
+ return;
+ case EOperationEditPart.VISUAL_ID:
+ createEOperation_2002Children(node);
+ return;
+ case EClass2EditPart.VISUAL_ID:
+ createEClass_2003Children(node);
+ return;
+ case EDataType2EditPart.VISUAL_ID:
+ createEDataType_2004Children(node);
+ return;
+ case EEnum2EditPart.VISUAL_ID:
+ createEEnum_2005Children(node);
+ return;
+ case EEnumLiteralEditPart.VISUAL_ID:
+ createEEnumLiteral_2006Children(node);
+ return;
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ createEStringToStringMapEntry_2007Children(node);
+ return;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private void createLinks(Diagram diagram) {
+ for (boolean continueLinkCreation = true; continueLinkCreation;) {
+ continueLinkCreation = false;
+ Collection additionalDescriptors = new LinkedList();
+ for (Iterator it = myLinkDescriptors.iterator(); it.hasNext();) {
+ EcoreLinkDescriptor nextLinkDescriptor = (EcoreLinkDescriptor) it.next();
+ if (!myDomain2NotationMap.containsKey(nextLinkDescriptor.getSource()) || !myDomain2NotationMap.containsKey(nextLinkDescriptor.getDestination())) {
+ continue;
+ }
+ Edge edge = (Edge) ViewService.getInstance().createEdge(nextLinkDescriptor.getSemanticAdapter(), diagram, nextLinkDescriptor.getType(), ViewUtil.APPEND,
+ EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ if (edge != null) {
+ edge.setSource((View) myDomain2NotationMap.get(nextLinkDescriptor.getSource()));
+ edge.setTarget((View) myDomain2NotationMap.get(nextLinkDescriptor.getDestination()));
+ it.remove();
+ if (nextLinkDescriptor.getModelElement() != null) {
+ myDomain2NotationMap.put(nextLinkDescriptor.getModelElement(), edge);
+ }
+ continueLinkCreation = true;
+ switch (nextLinkDescriptor.getVisualID()) {
+ case EReferenceEditPart.VISUAL_ID:
+ additionalDescriptors.addAll(EcoreDiagramUpdater.getEReference_3002OutgoingLinks(edge));
+ break;
+ }
+ }
+ }
+ myLinkDescriptors.addAll(additionalDescriptors);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private Node getCompartment(View node, int visualID) {
+ String type = EcoreVisualIDRegistry.getType(visualID);
+ for (Iterator it = node.getChildren().iterator(); it.hasNext();) {
+ View nextView = (View) it.next();
+ if (nextView instanceof Node && type.equals(nextView.getType())) {
+ return (Node) nextView;
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditor.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditor.java
new file mode 100644
index 0000000..af6fd86
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditor.java
@@ -0,0 +1,384 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorItem;
+import org.eclipse.emf.ecoretools.diagram.outline.EcoreDiagramOutlinePage;
+import org.eclipse.emf.edit.ui.dnd.LocalTransfer;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gmf.runtime.common.ui.services.marker.MarkerNavigationService;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramDropTargetListener;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.ide.IGotoMarker;
+import org.eclipse.ui.navigator.resources.ProjectExplorer;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.part.IShowInTargetList;
+import org.eclipse.ui.part.ShowInContext;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * @generated
+ */
+public class EcoreDiagramEditor extends DiagramDocumentEditor implements IGotoMarker {
+
+ @Override
+ protected void setPartName(String partName) {
+ String title = null;
+
+ if (getDiagram() != null) {
+ title = getDiagram().getName();
+ }
+
+ if ((title != null) && (!title.equals(""))) {
+ super.setPartName(title);
+ } else {
+ super.setPartName(partName);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorID"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final String CONTEXT_ID = "org.eclipse.emf.ecoretools.diagram.ui.diagramContext"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public EcoreDiagramEditor() {
+ super(true);
+ }
+
+ /**
+ * @generated
+ */
+ protected String getContextID() {
+ return CONTEXT_ID;
+ }
+
+ /**
+ * @generated
+ */
+ protected PaletteRoot createPaletteRoot(PaletteRoot existingPaletteRoot) {
+ PaletteRoot root = super.createPaletteRoot(existingPaletteRoot);
+ new EcorePaletteFactory().fillPalette(root);
+ return root;
+ }
+
+ /**
+ * @generated
+ */
+ protected PreferencesHint getPreferencesHint() {
+ return EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
+ }
+
+ /**
+ * @generated
+ */
+ public String getContributorId() {
+ return EcoreDiagramEditorPlugin.ID;
+ }
+
+ /**
+ * Handle IContentOutlinePage adapter
+ *
+ * @generated NOT
+ */
+ public Object getAdapter(Class type) {
+ if (type == IShowInTargetList.class) {
+ return new IShowInTargetList() {
+
+ public String[] getShowInTargetIds() {
+ return new String[] { ProjectExplorer.VIEW_ID };
+ }
+ };
+ }
+ if (type == IContentOutlinePage.class) {
+ return new EcoreDiagramOutlinePage(this);
+ }
+ return super.getAdapter(type);
+ }
+
+ /**
+ * @generated
+ */
+ protected IDocumentProvider getDocumentProvider(IEditorInput input) {
+ if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
+ return EcoreDiagramEditorPlugin.getInstance().getDocumentProvider();
+ }
+ return super.getDocumentProvider(input);
+ }
+
+ /**
+ * @generated
+ */
+ public TransactionalEditingDomain getEditingDomain() {
+ IDocument document = getEditorInput() != null ? getDocumentProvider().getDocument(getEditorInput()) : null;
+ if (document instanceof IDiagramDocument) {
+ return ((IDiagramDocument) document).getEditingDomain();
+ }
+ return super.getEditingDomain();
+ }
+
+ /**
+ * @generated
+ */
+ protected void setDocumentProvider(IEditorInput input) {
+ if (input instanceof IFileEditorInput || input instanceof URIEditorInput) {
+ setDocumentProvider(EcoreDiagramEditorPlugin.getInstance().getDocumentProvider());
+ } else {
+ super.setDocumentProvider(input);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void gotoMarker(IMarker marker) {
+ MarkerNavigationService.getInstance().gotoMarker(this, marker);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public void doSaveAs() {
+ performSaveAs(new NullProgressMonitor());
+ }
+
+ /**
+ * @generated
+ */
+ protected void performSaveAs(IProgressMonitor progressMonitor) {
+ Shell shell = getSite().getShell();
+ IEditorInput input = getEditorInput();
+ SaveAsDialog dialog = new SaveAsDialog(shell);
+ IFile original = input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile() : null;
+ if (original != null) {
+ dialog.setOriginalFile(original);
+ }
+ dialog.create();
+ 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 = NLS.bind(Messages.EcoreDiagramEditor_SavingDeletedFile, original.getName());
+ dialog.setErrorMessage(null);
+ dialog.setMessage(message, IMessageProvider.WARNING);
+ }
+ if (dialog.open() == Window.CANCEL) {
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(true);
+ }
+ return;
+ }
+ IPath filePath = dialog.getResult();
+ if (filePath == null) {
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(true);
+ }
+ return;
+ }
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IFile file = workspaceRoot.getFile(filePath);
+ final IEditorInput newInput = new FileEditorInput(file);
+ // Check if the editor is already open
+ IEditorMatchingStrategy matchingStrategy = getEditorDescriptor().getEditorMatchingStrategy();
+ IEditorReference[] editorRefs = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
+ for (int i = 0; i < editorRefs.length; i++) {
+ if (matchingStrategy.matches(editorRefs[i], newInput)) {
+ MessageDialog.openWarning(shell, Messages.EcoreDiagramEditor_SaveAsErrorTitle, Messages.EcoreDiagramEditor_SaveAsErrorMessage);
+ return;
+ }
+ }
+ boolean success = false;
+ try {
+ provider.aboutToChange(newInput);
+ getDocumentProvider(newInput).saveDocument(progressMonitor, newInput, getDocumentProvider().getDocument(getEditorInput()), true);
+ success = true;
+ } catch (CoreException x) {
+ IStatus status = x.getStatus();
+ if (status == null || status.getSeverity() != IStatus.CANCEL) {
+ ErrorDialog.openError(shell, Messages.EcoreDiagramEditor_SaveErrorTitle, Messages.EcoreDiagramEditor_SaveErrorMessage, x.getStatus());
+ }
+ } finally {
+ provider.changed(newInput);
+ if (success) {
+ setInput(newInput);
+ }
+ }
+ if (progressMonitor != null) {
+ progressMonitor.setCanceled(!success);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public ShowInContext getShowInContext() {
+ return new ShowInContext(getEditorInput(), getNavigatorSelection());
+ }
+
+ /**
+ * @generated
+ */
+ private ISelection getNavigatorSelection() {
+ IDiagramDocument document = getDiagramDocument();
+ if (document == null) {
+ return StructuredSelection.EMPTY;
+ }
+ Diagram diagram = document.getDiagram();
+ IFile file = WorkspaceSynchronizer.getFile(diagram.eResource());
+ if (file != null) {
+ EcoreNavigatorItem item = new EcoreNavigatorItem(diagram, file, false);
+ return new StructuredSelection(item);
+ }
+ return StructuredSelection.EMPTY;
+ }
+
+ /**
+ * @generated
+ */
+ protected void initializeGraphicalViewer() {
+ super.initializeGraphicalViewer();
+ getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalSelectionTransfer.getTransfer()) {
+
+ protected Object getJavaObject(TransferData data) {
+ return LocalSelectionTransfer.getTransfer().nativeToJava(data);
+ }
+
+ });
+ getDiagramGraphicalViewer().addDropTargetListener(new DropTargetListener(getDiagramGraphicalViewer(), LocalTransfer.getInstance()) {
+
+ protected Object getJavaObject(TransferData data) {
+ return LocalTransfer.getInstance().nativeToJava(data);
+ }
+
+ });
+ }
+
+ /**
+ * @generated
+ */
+ private abstract class DropTargetListener extends DiagramDropTargetListener {
+
+ /**
+ * @generated
+ */
+ public DropTargetListener(EditPartViewer viewer, Transfer xfer) {
+ super(viewer, xfer);
+ }
+
+ /**
+ * @generated
+ */
+ protected List getObjectsBeingDropped() {
+ TransferData data = getCurrentEvent().currentDataType;
+ Collection uris = new HashSet();
+
+ Object transferedObject = getJavaObject(data);
+ if (transferedObject instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) transferedObject;
+ for (Iterator it = selection.iterator(); it.hasNext();) {
+ Object nextSelectedObject = it.next();
+ if (nextSelectedObject instanceof EcoreNavigatorItem) {
+ View view = ((EcoreNavigatorItem) nextSelectedObject).getView();
+ nextSelectedObject = view.getElement();
+ } else if (nextSelectedObject instanceof IAdaptable) {
+ IAdaptable adaptable = (IAdaptable) nextSelectedObject;
+ nextSelectedObject = adaptable.getAdapter(EObject.class);
+ }
+
+ if (nextSelectedObject instanceof EObject) {
+ EObject modelElement = (EObject) nextSelectedObject;
+ Resource modelElementResource = modelElement.eResource();
+ uris.add(modelElementResource.getURI().appendFragment(modelElementResource.getURIFragment(modelElement)));
+ }
+ }
+ }
+
+ List result = new ArrayList();
+ for (Iterator it = uris.iterator(); it.hasNext();) {
+ URI nextURI = (URI) it.next();
+ EObject modelObject = getEditingDomain().getResourceSet().getEObject(nextURI, true);
+ result.add(modelObject);
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected abstract Object getJavaObject(TransferData data);
+
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditorPlugin.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditorPlugin.java
new file mode 100644
index 0000000..7da50c5
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditorPlugin.java
@@ -0,0 +1,260 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.provider.EcoreItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.IItemLabelProvider;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @generated
+ */
+public class EcoreDiagramEditorPlugin extends AbstractUIPlugin {
+
+ /**
+ * @generated
+ */
+ public static final String ID = "org.eclipse.emf.ecoretools.diagram"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final PreferencesHint DIAGRAM_PREFERENCES_HINT = new PreferencesHint(ID);
+
+ /**
+ * @generated
+ */
+ private static EcoreDiagramEditorPlugin instance;
+
+ /**
+ * @generated
+ */
+ private ComposedAdapterFactory adapterFactory;
+
+ /**
+ * @generated
+ */
+ private EcoreDocumentProvider documentProvider;
+
+ /**
+ * @generated
+ */
+ public EcoreDiagramEditorPlugin() {
+ }
+
+ /**
+ * @generated
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ instance = this;
+ PreferencesHint.registerPreferenceStore(DIAGRAM_PREFERENCES_HINT, getPreferenceStore());
+ adapterFactory = createAdapterFactory();
+ }
+
+ /**
+ * @generated
+ */
+ public void stop(BundleContext context) throws Exception {
+ adapterFactory.dispose();
+ adapterFactory = null;
+ instance = null;
+ super.stop(context);
+ }
+
+ /**
+ * @generated
+ */
+ public static EcoreDiagramEditorPlugin getInstance() {
+ return instance;
+ }
+
+ /**
+ * @generated
+ */
+ protected ComposedAdapterFactory createAdapterFactory() {
+ List factories = new ArrayList();
+ fillItemProviderFactories(factories);
+ return new ComposedAdapterFactory(factories);
+ }
+
+ /**
+ * @generated
+ */
+ protected void fillItemProviderFactories(List factories) {
+ factories.add(new EcoreItemProviderAdapterFactory());
+ factories.add(new ResourceItemProviderAdapterFactory());
+ factories.add(new ReflectiveItemProviderAdapterFactory());
+ }
+
+ /**
+ * @generated
+ */
+ public AdapterFactory getItemProvidersAdapterFactory() {
+ return adapterFactory;
+ }
+
+ /**
+ * @generated
+ */
+ public ImageDescriptor getItemImageDescriptor(Object item) {
+ IItemLabelProvider labelProvider = (IItemLabelProvider) adapterFactory.adapt(item, IItemLabelProvider.class);
+ if (labelProvider != null) {
+ return 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 ImageDescriptor getBundledImageDescriptor(String path) {
+ return 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 ImageDescriptor findImageDescriptor(String path) {
+ final IPath p = new Path(path);
+ if (p.isAbsolute() && p.segmentCount() > 1) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin(p.segment(0), p.removeFirstSegments(1).makeAbsolute().toString());
+ } else {
+ return getBundledImageDescriptor(p.makeAbsolute().toString());
+ }
+ }
+
+ /**
+ * Returns string from plug-in's resource bundle
+ *
+ * @generated
+ */
+ public static String getString(String key) {
+ return Platform.getResourceString(getInstance().getBundle(), "%" + key); //$NON-NLS-1$
+ }
+
+ /**
+ * 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 Image getBundledImage(String path) {
+ Image image = getImageRegistry().get(path);
+ if (image == null) {
+ getImageRegistry().put(path, getBundledImageDescriptor(path));
+ image = getImageRegistry().get(path);
+ }
+ return image;
+ }
+
+ /**
+ * @generated
+ */
+ public EcoreDocumentProvider getDocumentProvider() {
+ if (documentProvider == null) {
+ documentProvider = new EcoreDocumentProvider();
+ }
+ return documentProvider;
+ }
+
+ /**
+ * @generated
+ */
+ public void logError(String error) {
+ logError(error, null);
+ }
+
+ /**
+ * @param throwable
+ * actual error or null could be passed
+ * @generated
+ */
+ public void logError(String error, Throwable throwable) {
+ if (error == null && throwable != null) {
+ error = throwable.getMessage();
+ }
+ getLog().log(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, IStatus.OK, error, throwable));
+ debug(error, throwable);
+ }
+
+ /**
+ * @generated
+ */
+ public void logInfo(String message) {
+ logInfo(message, null);
+ }
+
+ /**
+ * @param throwable
+ * actual error or null could be passed
+ * @generated
+ */
+ public void logInfo(String message, Throwable throwable) {
+ if (message == null && throwable != null) {
+ message = throwable.getMessage();
+ }
+ getLog().log(new Status(IStatus.INFO, EcoreDiagramEditorPlugin.ID, IStatus.OK, message, throwable));
+ debug(message, throwable);
+ }
+
+ /**
+ * @generated
+ */
+ private void debug(String message, Throwable throwable) {
+ if (!isDebugging()) {
+ return;
+ }
+ if (message != null) {
+ System.err.println(message);
+ }
+ if (throwable != null) {
+ throwable.printStackTrace();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditorUtil.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditorUtil.java
new file mode 100644
index 0000000..1af51bd
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramEditorUtil.java
@@ -0,0 +1,394 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IPrimaryEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramGraphicalViewer;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class EcoreDiagramEditorUtil {
+
+ /**
+ * @generated
+ */
+ public static Map getSaveOptions() {
+ Map saveOptions = new HashMap();
+ saveOptions.put(XMLResource.OPTION_ENCODING, "UTF-8"); //$NON-NLS-1$
+ saveOptions.put(Resource.OPTION_SAVE_ONLY_IF_CHANGED, Resource.OPTION_SAVE_ONLY_IF_CHANGED_MEMORY_BUFFER);
+ return saveOptions;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean openDiagram(Resource diagram) throws PartInitException {
+ String path = diagram.getURI().toPlatformString(true);
+ IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
+ if (workspaceResource instanceof IFile) {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ return null != page.openEditor(new FileEditorInput((IFile) workspaceResource), EcoreDiagramEditor.ID);
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static void setCharset(IFile file) {
+ if (file == null) {
+ return;
+ }
+ try {
+ file.setCharset("UTF-8", new NullProgressMonitor()); //$NON-NLS-1$
+ } catch (CoreException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to set charset for file " + file.getFullPath(), e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static String getUniqueFileName(IPath containerFullPath, String fileName, String extension) {
+ if (containerFullPath == null) {
+ containerFullPath = new Path(""); //$NON-NLS-1$
+ }
+ if (fileName == null || fileName.trim().length() == 0) {
+ fileName = "default"; //$NON-NLS-1$
+ }
+ 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 (ResourcesPlugin.getWorkspace().getRoot().exists(filePath)) {
+ i++;
+ filePath = containerFullPath.append(fileName + i);
+ if (extension != null) {
+ filePath = filePath.addFileExtension(extension);
+ }
+ }
+ return filePath.lastSegment();
+ }
+
+ /**
+ * Runs the wizard in a dialog.
+ *
+ * @generated
+ */
+ public static void runWizard(Shell shell, Wizard wizard, String settingsKey) {
+ IDialogSettings pluginDialogSettings = EcoreDiagramEditorPlugin.getInstance().getDialogSettings();
+ IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey);
+ if (wizardDialogSettings == null) {
+ wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey);
+ }
+ wizard.setDialogSettings(wizardDialogSettings);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+ dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
+ dialog.open();
+ }
+
+ /**
+ * This method should be called within a workspace modify operation since it
+ * creates resources.
+ *
+ * @generated
+ */
+ public static Resource createDiagram(URI diagramURI, URI modelURI, IProgressMonitor progressMonitor) {
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ progressMonitor.beginTask(Messages.EcoreDiagramEditorUtil_CreateDiagramProgressTask, 3);
+ final Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
+ final Resource modelResource = editingDomain.getResourceSet().createResource(modelURI);
+ final String diagramName = diagramURI.lastSegment();
+ AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, Messages.EcoreDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST) {
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ EPackage model = createInitialModel();
+ attachModelToResource(model, modelResource);
+
+ Diagram diagram = ViewService.createDiagram(model, EPackageEditPart.MODEL_ID, EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ if (diagram != null) {
+ diagramResource.getContents().add(diagram);
+ diagram.setName(diagramName);
+ diagram.setElement(model);
+ }
+
+ try {
+ modelResource.save(org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorUtil.getSaveOptions());
+ diagramResource.save(org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorUtil.getSaveOptions());
+ } catch (IOException e) {
+
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to store model and diagram resources", e); //$NON-NLS-1$
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), null);
+ } catch (ExecutionException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
+ }
+ setCharset(WorkspaceSynchronizer.getFile(modelResource));
+ setCharset(WorkspaceSynchronizer.getFile(diagramResource));
+ return diagramResource;
+ }
+
+ /**
+ * Create a new instance of domain element associated with canvas. <!--
+ * begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static EPackage createInitialModel() {
+ return EcoreFactory.eINSTANCE.createEPackage();
+ }
+
+ /**
+ * Store model element in the resource. <!-- begin-user-doc --> <!--
+ * end-user-doc -->
+ *
+ * @generated
+ */
+ private static void attachModelToResource(EPackage model, Resource resource) {
+ resource.getContents().add(model);
+ }
+
+ /**
+ * @generated
+ */
+ public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List/* EditPart */editParts) {
+ diagramPart.getDiagramGraphicalViewer().deselectAll();
+
+ EditPart firstPrimary = null;
+ for (Iterator it = editParts.iterator(); it.hasNext();) {
+ EditPart nextPart = (EditPart) it.next();
+ diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
+ if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) {
+ firstPrimary = nextPart;
+ }
+ }
+
+ if (!editParts.isEmpty()) {
+ diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart) editParts.get(0));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element, List editPartCollector) {
+ IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer) diagramPart.getViewer();
+ final int intialNumOfEditParts = editPartCollector.size();
+
+ if (element instanceof View) { // support notation element lookup
+ EditPart editPart = (EditPart) viewer.getEditPartRegistry().get(element);
+ if (editPart != null) {
+ editPartCollector.add(editPart);
+ return 1;
+ }
+ }
+
+ String elementID = EMFCoreUtil.getProxyID(element);
+ List associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class);
+ // perform the possible hierarchy disjoint -> take the top-most parts
+ // only
+ for (Iterator editPartIt = associatedParts.iterator(); editPartIt.hasNext();) {
+ EditPart nextPart = (EditPart) editPartIt.next();
+ 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;
+ }
+
+ /**
+ * @generated
+ */
+ public static View findView(DiagramEditPart diagramEditPart, EObject targetElement, LazyElement2ViewMap lazyElement2ViewMap) {
+ boolean hasStructuralURI = false;
+ if (targetElement.eResource() instanceof XMLResource) {
+ hasStructuralURI = ((XMLResource) targetElement.eResource()).getID(targetElement) == null;
+ }
+
+ View view = null;
+ if (hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) {
+ view = (View) lazyElement2ViewMap.getElement2ViewMap().get(targetElement);
+ } else if (findElementsInDiagramByID(diagramEditPart, targetElement, lazyElement2ViewMap.editPartTmpHolder) > 0) {
+ EditPart editPart = (EditPart) lazyElement2ViewMap.editPartTmpHolder.get(0);
+ lazyElement2ViewMap.editPartTmpHolder.clear();
+ view = editPart.getModel() instanceof View ? (View) editPart.getModel() : null;
+ }
+
+ return (view == null) ? diagramEditPart.getDiagramView() : view;
+ }
+
+ /**
+ * @generated
+ */
+ public static class LazyElement2ViewMap {
+
+ /**
+ * @generated
+ */
+ private Map element2ViewMap;
+
+ /**
+ * @generated
+ */
+ private View scope;
+
+ /**
+ * @generated
+ */
+ private Set elementSet;
+
+ /**
+ * @generated
+ */
+ public final List editPartTmpHolder = new ArrayList();
+
+ /**
+ * @generated
+ */
+ public LazyElement2ViewMap(View scope, Set elements) {
+ this.scope = scope;
+ this.elementSet = elements;
+ }
+
+ /**
+ * @generated
+ */
+ public final Map getElement2ViewMap() {
+ if (element2ViewMap == null) {
+ element2ViewMap = new HashMap();
+ // map possible notation elements to itself as these can't be
+ // found by view.getElement()
+ for (Iterator it = elementSet.iterator(); it.hasNext();) {
+ EObject element = (EObject) it.next();
+ if (element instanceof View) {
+ View view = (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;
+ }
+
+ /**
+ * @generated
+ */
+ static Map buildElement2ViewMap(View parentView, Map element2ViewMap, 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 (Iterator it = parentView.getChildren().iterator(); it.hasNext();) {
+ buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
+ if (elements.size() == element2ViewMap.size())
+ return element2ViewMap;
+ }
+ for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) {
+ buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
+ if (elements.size() == element2ViewMap.size())
+ return element2ViewMap;
+ }
+ for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) {
+ buildElement2ViewMap((View) it.next(), element2ViewMap, elements);
+ if (elements.size() == element2ViewMap.size())
+ return element2ViewMap;
+ }
+ return element2ViewMap;
+ }
+ } // LazyElement2ViewMap
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramUpdateCommand.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramUpdateCommand.java
new file mode 100644
index 0000000..f947797
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramUpdateCommand.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.commands.IHandlerListener;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @generated
+ */
+public class EcoreDiagramUpdateCommand implements IHandler {
+
+ /**
+ * @generated
+ */
+ public void addHandlerListener(IHandlerListener handlerListener) {
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @generated
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.size() != 1) {
+ return null;
+ }
+ if (structuredSelection.getFirstElement() instanceof EditPart && ((EditPart) structuredSelection.getFirstElement()).getModel() instanceof View) {
+ EObject modelElement = ((View) ((EditPart) structuredSelection.getFirstElement()).getModel()).getElement();
+ List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
+ for (Iterator it = editPolicies.iterator(); it.hasNext();) {
+ CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy) it.next();
+ nextEditPolicy.refresh();
+ }
+
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isEnabled() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isHandled() {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public void removeHandlerListener(IHandlerListener handlerListener) {
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramUpdater.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramUpdater.java
new file mode 100644
index 0000000..39503a9
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDiagramUpdater.java
@@ -0,0 +1,910 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationDetailsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributes2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperations2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperationsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiterals2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackage2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageContentsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReference2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreDiagramUpdater {
+
+ /**
+ * @generated
+ */
+ public static boolean isShortcutOrphaned(View view) {
+ return !view.isSetElement() || view.getElement() == null || view.getElement().eIsProxy();
+ }
+
+ /**
+ * @generated
+ */
+ public static List getSemanticChildren(View view) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
+ case EClassAttributesEditPart.VISUAL_ID:
+ return getEClassAttributes_5001SemanticChildren(view);
+ case EClassOperationsEditPart.VISUAL_ID:
+ return getEClassOperations_5002SemanticChildren(view);
+ case EPackageContentsEditPart.VISUAL_ID:
+ return getEPackageContents_5003SemanticChildren(view);
+ case EClassAttributes2EditPart.VISUAL_ID:
+ return getEClassAttributes_5004SemanticChildren(view);
+ case EClassOperations2EditPart.VISUAL_ID:
+ return getEClassOperations_5005SemanticChildren(view);
+ case EEnumLiteralsEditPart.VISUAL_ID:
+ return getEEnumLiterals_5006SemanticChildren(view);
+ case EAnnotationDetailsEditPart.VISUAL_ID:
+ return getEAnnotationDetails_5007SemanticChildren(view);
+ case EEnumLiterals2EditPart.VISUAL_ID:
+ return getEEnumLiterals_5008SemanticChildren(view);
+ case EPackageEditPart.VISUAL_ID:
+ return getEPackage_79SemanticChildren(view);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClassAttributes_5001SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ EClass modelElement = (EClass) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getEAttributes().iterator(); it.hasNext();) {
+ EAttribute childElement = (EAttribute) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EAttributeEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClassOperations_5002SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ EClass modelElement = (EClass) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getEOperations().iterator(); it.hasNext();) {
+ EOperation childElement = (EOperation) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EOperationEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEPackageContents_5003SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ EPackage modelElement = (EPackage) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getEClassifiers().iterator(); it.hasNext();) {
+ EClassifier childElement = (EClassifier) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EClass2EditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == EDataType2EditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == EEnum2EditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClassAttributes_5004SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ EClass modelElement = (EClass) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getEAttributes().iterator(); it.hasNext();) {
+ EAttribute childElement = (EAttribute) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EAttributeEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClassOperations_5005SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ EClass modelElement = (EClass) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getEOperations().iterator(); it.hasNext();) {
+ EOperation childElement = (EOperation) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EOperationEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnumLiterals_5006SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ EEnum modelElement = (EEnum) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getELiterals().iterator(); it.hasNext();) {
+ EEnumLiteral childElement = (EEnumLiteral) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EEnumLiteralEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEAnnotationDetails_5007SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ EAnnotation modelElement = (EAnnotation) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getDetails().iterator(); it.hasNext();) {
+ Map.Entry childElement = (Map.Entry) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, (EObject) childElement);
+ if (visualID == EStringToStringMapEntryEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor((EObject) childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnumLiterals_5008SemanticChildren(View view) {
+ if (false == view.eContainer() instanceof View) {
+ return Collections.EMPTY_LIST;
+ }
+ View containerView = (View) view.eContainer();
+ if (!containerView.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ EEnum modelElement = (EEnum) containerView.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getELiterals().iterator(); it.hasNext();) {
+ EEnumLiteral childElement = (EEnumLiteral) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EEnumLiteralEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEPackage_79SemanticChildren(View view) {
+ if (!view.isSetElement()) {
+ return Collections.EMPTY_LIST;
+ }
+ EPackage modelElement = (EPackage) view.getElement();
+ List result = new LinkedList();
+ for (Iterator it = modelElement.getEClassifiers().iterator(); it.hasNext();) {
+ EClassifier childElement = (EClassifier) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EClassEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == EDataTypeEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ if (visualID == EEnumEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator it = modelElement.getESubpackages().iterator(); it.hasNext();) {
+ EPackage childElement = (EPackage) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EPackage2EditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ for (Iterator it = modelElement.getEAnnotations().iterator(); it.hasNext();) {
+ EAnnotation childElement = (EAnnotation) it.next();
+ int visualID = EcoreVisualIDRegistry.getNodeVisualID(view, childElement);
+ if (visualID == EAnnotationEditPart.VISUAL_ID) {
+ result.add(new EcoreNodeDescriptor(childElement, visualID));
+ continue;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getContainedLinks(View view) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
+ case EPackageEditPart.VISUAL_ID:
+ return getEPackage_79ContainedLinks(view);
+ case EClassEditPart.VISUAL_ID:
+ return getEClass_1001ContainedLinks(view);
+ case EPackage2EditPart.VISUAL_ID:
+ return getEPackage_1002ContainedLinks(view);
+ case EAnnotationEditPart.VISUAL_ID:
+ return getEAnnotation_1003ContainedLinks(view);
+ case EDataTypeEditPart.VISUAL_ID:
+ return getEDataType_1004ContainedLinks(view);
+ case EEnumEditPart.VISUAL_ID:
+ return getEEnum_1005ContainedLinks(view);
+ case EAttributeEditPart.VISUAL_ID:
+ return getEAttribute_2001ContainedLinks(view);
+ case EOperationEditPart.VISUAL_ID:
+ return getEOperation_2002ContainedLinks(view);
+ case EClass2EditPart.VISUAL_ID:
+ return getEClass_2003ContainedLinks(view);
+ case EDataType2EditPart.VISUAL_ID:
+ return getEDataType_2004ContainedLinks(view);
+ case EEnum2EditPart.VISUAL_ID:
+ return getEEnum_2005ContainedLinks(view);
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return getEEnumLiteral_2006ContainedLinks(view);
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ return getEStringToStringMapEntry_2007ContainedLinks(view);
+ case EReferenceEditPart.VISUAL_ID:
+ return getEReference_3002ContainedLinks(view);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getIncomingLinks(View view) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
+ case EClassEditPart.VISUAL_ID:
+ return getEClass_1001IncomingLinks(view);
+ case EPackage2EditPart.VISUAL_ID:
+ return getEPackage_1002IncomingLinks(view);
+ case EAnnotationEditPart.VISUAL_ID:
+ return getEAnnotation_1003IncomingLinks(view);
+ case EDataTypeEditPart.VISUAL_ID:
+ return getEDataType_1004IncomingLinks(view);
+ case EEnumEditPart.VISUAL_ID:
+ return getEEnum_1005IncomingLinks(view);
+ case EAttributeEditPart.VISUAL_ID:
+ return getEAttribute_2001IncomingLinks(view);
+ case EOperationEditPart.VISUAL_ID:
+ return getEOperation_2002IncomingLinks(view);
+ case EClass2EditPart.VISUAL_ID:
+ return getEClass_2003IncomingLinks(view);
+ case EDataType2EditPart.VISUAL_ID:
+ return getEDataType_2004IncomingLinks(view);
+ case EEnum2EditPart.VISUAL_ID:
+ return getEEnum_2005IncomingLinks(view);
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return getEEnumLiteral_2006IncomingLinks(view);
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ return getEStringToStringMapEntry_2007IncomingLinks(view);
+ case EReferenceEditPart.VISUAL_ID:
+ return getEReference_3002IncomingLinks(view);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getOutgoingLinks(View view) {
+ switch (EcoreVisualIDRegistry.getVisualID(view)) {
+ case EClassEditPart.VISUAL_ID:
+ return getEClass_1001OutgoingLinks(view);
+ case EPackage2EditPart.VISUAL_ID:
+ return getEPackage_1002OutgoingLinks(view);
+ case EAnnotationEditPart.VISUAL_ID:
+ return getEAnnotation_1003OutgoingLinks(view);
+ case EDataTypeEditPart.VISUAL_ID:
+ return getEDataType_1004OutgoingLinks(view);
+ case EEnumEditPart.VISUAL_ID:
+ return getEEnum_1005OutgoingLinks(view);
+ case EAttributeEditPart.VISUAL_ID:
+ return getEAttribute_2001OutgoingLinks(view);
+ case EOperationEditPart.VISUAL_ID:
+ return getEOperation_2002OutgoingLinks(view);
+ case EClass2EditPart.VISUAL_ID:
+ return getEClass_2003OutgoingLinks(view);
+ case EDataType2EditPart.VISUAL_ID:
+ return getEDataType_2004OutgoingLinks(view);
+ case EEnum2EditPart.VISUAL_ID:
+ return getEEnum_2005OutgoingLinks(view);
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return getEEnumLiteral_2006OutgoingLinks(view);
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ return getEStringToStringMapEntry_2007OutgoingLinks(view);
+ case EReferenceEditPart.VISUAL_ID:
+ return getEReference_3002OutgoingLinks(view);
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEPackage_79ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClass_1001ContainedLinks(View view) {
+ EClass modelElement = (EClass) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_EReference_3002(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_EClass_ESuperTypes_3003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEPackage_1002ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEAnnotation_1003ContainedLinks(View view) {
+ EAnnotation modelElement = (EAnnotation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEDataType_1004ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnum_1005ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEAttribute_2001ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEOperation_2002ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClass_2003ContainedLinks(View view) {
+ EClass modelElement = (EClass) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_EReference_3002(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_EClass_ESuperTypes_3003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEDataType_2004ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnum_2005ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnumLiteral_2006ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEStringToStringMapEntry_2007ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEReference_3002ContainedLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClass_1001IncomingLinks(View view) {
+ EClass modelElement = (EClass) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_EReference_3002(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_EClass_ESuperTypes_3003(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEPackage_1002IncomingLinks(View view) {
+ EPackage modelElement = (EPackage) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEAnnotation_1003IncomingLinks(View view) {
+ EAnnotation modelElement = (EAnnotation) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEDataType_1004IncomingLinks(View view) {
+ EDataType modelElement = (EDataType) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_EReference_3002(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnum_1005IncomingLinks(View view) {
+ EEnum modelElement = (EEnum) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_EReference_3002(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEAttribute_2001IncomingLinks(View view) {
+ EAttribute modelElement = (EAttribute) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEOperation_2002IncomingLinks(View view) {
+ EOperation modelElement = (EOperation) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClass_2003IncomingLinks(View view) {
+ EClass modelElement = (EClass) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_EReference_3002(modelElement, crossReferences));
+ result.addAll(getIncomingFeatureModelFacetLinks_EClass_ESuperTypes_3003(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEDataType_2004IncomingLinks(View view) {
+ EDataType modelElement = (EDataType) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_EReference_3002(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnum_2005IncomingLinks(View view) {
+ EEnum modelElement = (EEnum) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ result.addAll(getIncomingTypeModelFacetLinks_EReference_3002(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnumLiteral_2006IncomingLinks(View view) {
+ EEnumLiteral modelElement = (EEnumLiteral) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEStringToStringMapEntry_2007IncomingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEReference_3002IncomingLinks(View view) {
+ EReference modelElement = (EReference) view.getElement();
+ Map crossReferences = EcoreUtil.CrossReferencer.find(view.eResource().getResourceSet().getResources());
+ List result = new LinkedList();
+ result.addAll(getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement, crossReferences));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClass_1001OutgoingLinks(View view) {
+ EClass modelElement = (EClass) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_EReference_3002(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_EClass_ESuperTypes_3003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEPackage_1002OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEAnnotation_1003OutgoingLinks(View view) {
+ EAnnotation modelElement = (EAnnotation) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getOutgoingFeatureModelFacetLinks_EAnnotation_References_3001(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEDataType_1004OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnum_1005OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEAttribute_2001OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEOperation_2002OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEClass_2003OutgoingLinks(View view) {
+ EClass modelElement = (EClass) view.getElement();
+ List result = new LinkedList();
+ result.addAll(getContainedTypeModelFacetLinks_EReference_3002(modelElement));
+ result.addAll(getOutgoingFeatureModelFacetLinks_EClass_ESuperTypes_3003(modelElement));
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEDataType_2004OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnum_2005OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEEnumLiteral_2006OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEStringToStringMapEntry_2007OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public static List getEReference_3002OutgoingLinks(View view) {
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getContainedTypeModelFacetLinks_EReference_3002(EClass container) {
+ Collection result = new LinkedList();
+ for (Iterator links = container.getEStructuralFeatures().iterator(); links.hasNext();) {
+ Object linkObject = links.next();
+ if (false == linkObject instanceof EReference) {
+ continue;
+ }
+ EReference link = (EReference) linkObject;
+ if (EReferenceEditPart.VISUAL_ID != EcoreVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ EClassifier dst = link.getEType();
+ result.add(new EcoreLinkDescriptor(container, dst, link, EcoreElementTypes.EReference_3002, EReferenceEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingFeatureModelFacetLinks_EAnnotation_References_3001(EObject target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() == EcorePackage.eINSTANCE.getEAnnotation_References()) {
+ result.add(new EcoreLinkDescriptor(setting.getEObject(), target, EcoreElementTypes.EAnnotationReferences_3001, EAnnotationReferencesEditPart.VISUAL_ID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingTypeModelFacetLinks_EReference_3002(EClassifier target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() != EcorePackage.eINSTANCE.getETypedElement_EType() || false == setting.getEObject() instanceof EReference) {
+ continue;
+ }
+ EReference link = (EReference) setting.getEObject();
+ if (EReferenceEditPart.VISUAL_ID != EcoreVisualIDRegistry.getLinkWithClassVisualID(link)) {
+ continue;
+ }
+ if (false == link.eContainer() instanceof EClass) {
+ continue;
+ }
+ EClass container = (EClass) link.eContainer();
+ result.add(new EcoreLinkDescriptor(container, target, link, EcoreElementTypes.EReference_3002, EReferenceEditPart.VISUAL_ID));
+
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getIncomingFeatureModelFacetLinks_EClass_ESuperTypes_3003(EClass target, Map crossReferences) {
+ Collection result = new LinkedList();
+ Collection settings = (Collection) crossReferences.get(target);
+ for (Iterator it = settings.iterator(); it.hasNext();) {
+ EStructuralFeature.Setting setting = (EStructuralFeature.Setting) it.next();
+ if (setting.getEStructuralFeature() == EcorePackage.eINSTANCE.getEClass_ESuperTypes()) {
+ result.add(new EcoreLinkDescriptor(setting.getEObject(), target, EcoreElementTypes.EClassESuperTypes_3003, EReference2EditPart.VISUAL_ID));
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingFeatureModelFacetLinks_EAnnotation_References_3001(EAnnotation source) {
+ Collection result = new LinkedList();
+ for (Iterator destinations = source.getReferences().iterator(); destinations.hasNext();) {
+ EObject destination = (EObject) destinations.next();
+ result.add(new EcoreLinkDescriptor(source, destination, EcoreElementTypes.EAnnotationReferences_3001, EAnnotationReferencesEditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private static Collection getOutgoingFeatureModelFacetLinks_EClass_ESuperTypes_3003(EClass source) {
+ Collection result = new LinkedList();
+ for (Iterator destinations = source.getESuperTypes().iterator(); destinations.hasNext();) {
+ EClass destination = (EClass) destinations.next();
+ result.add(new EcoreLinkDescriptor(source, destination, EcoreElementTypes.EClassESuperTypes_3003, EReference2EditPart.VISUAL_ID));
+ }
+ return result;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDocumentProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDocumentProvider.java
new file mode 100644
index 0000000..801fbc2
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDocumentProvider.java
@@ -0,0 +1,993 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceStatus;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.MultiRule;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocumentProvider;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.EditorStatusCodes;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+
+/**
+ * @generated
+ */
+public class EcoreDocumentProvider extends AbstractDocumentProvider implements IDiagramDocumentProvider {
+
+ /**
+ * @generated
+ */
+ protected ElementInfo createElementInfo(Object element) throws CoreException {
+ if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) {
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, NLS.bind(Messages.EcoreDocumentProvider_IncorrectInputError, new Object[] { element,
+ "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ IEditorInput editorInput = (IEditorInput) element;
+ IDiagramDocument document = (IDiagramDocument) createDocument(editorInput);
+
+ ResourceSetInfo info = new ResourceSetInfo(document, editorInput);
+ info.setModificationStamp(computeModificationStamp(info));
+ info.fStatus = null;
+ return info;
+ }
+
+ /**
+ * @generated
+ */
+ protected IDocument createDocument(Object element) throws CoreException {
+ if (false == element instanceof FileEditorInput && false == element instanceof URIEditorInput) {
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, NLS.bind(Messages.EcoreDocumentProvider_IncorrectInputError, new Object[] { element,
+ "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ IDocument document = createEmptyDocument();
+ setDocumentContent(document, (IEditorInput) element);
+ setupDocument(element, document);
+ return document;
+ }
+
+ /**
+ * Sets up the given document as it would be provided for the given element.
+ * The content of the document is not changed. This default implementation
+ * is empty. Subclasses may reimplement.
+ *
+ * @param element
+ * the blue-print element
+ * @param document
+ * the document to set up
+ * @generated
+ */
+ protected void setupDocument(Object element, IDocument document) {
+ // for subclasses
+ }
+
+ /**
+ * @generated
+ */
+ private long computeModificationStamp(ResourceSetInfo info) {
+ int result = 0;
+ for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ if (file.getLocation() != null) {
+ result += file.getLocation().toFile().lastModified();
+ } else {
+ result += file.getModificationStamp();
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ protected IDocument createEmptyDocument() {
+ DiagramDocument document = new DiagramDocument();
+ document.setEditingDomain(createEditingDomain());
+ return document;
+ }
+
+ /**
+ * @generated
+ */
+ private TransactionalEditingDomain createEditingDomain() {
+ TransactionalEditingDomain editingDomain = DiagramEditingDomainFactory.getInstance().createEditingDomain();
+ editingDomain.setID("org.eclipse.emf.ecoretools.diagram.EditingDomain"); //$NON-NLS-1$
+ final NotificationFilter diagramResourceModifiedFilter = NotificationFilter.createNotifierFilter(editingDomain.getResourceSet())
+ .and(NotificationFilter.createEventTypeFilter(Notification.ADD)).and(NotificationFilter.createFeatureFilter(ResourceSet.class, ResourceSet.RESOURCE_SET__RESOURCES));
+ editingDomain.getResourceSet().eAdapters().add(new Adapter() {
+
+ private Notifier myTarger;
+
+ public Notifier getTarget() {
+ return myTarger;
+ }
+
+ public boolean isAdapterForType(Object type) {
+ return false;
+ }
+
+ public void notifyChanged(Notification notification) {
+ if (diagramResourceModifiedFilter.matches(notification)) {
+ Object value = notification.getNewValue();
+ if (value instanceof Resource) {
+ ((Resource) value).setTrackingModification(true);
+ }
+ }
+ }
+
+ public void setTarget(Notifier newTarget) {
+ myTarger = newTarget;
+ }
+
+ });
+
+ return editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setDocumentContent(IDocument document, IEditorInput element) throws CoreException {
+ IDiagramDocument diagramDocument = (IDiagramDocument) document;
+ TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
+ if (element instanceof FileEditorInput) {
+ IStorage storage = ((FileEditorInput) element).getStorage();
+ Diagram diagram = DiagramIOUtil.load(domain, storage, true, getProgressMonitor());
+ document.setContent(diagram);
+ } else if (element instanceof URIEditorInput) {
+ URI uri = ((URIEditorInput) element).getURI();
+ Resource resource = null;
+ try {
+ resource = domain.getResourceSet().getResource(uri.trimFragment(), false);
+ if (resource == null) {
+ resource = domain.getResourceSet().createResource(uri.trimFragment());
+ }
+ if (!resource.isLoaded()) {
+ try {
+ Map options = new HashMap(GMFResourceFactory.getDefaultLoadOptions());
+ // @see 171060
+ // options.put(org.eclipse.emf.ecore.xmi.XMLResource.OPTION_RECORD_UNKNOWN_FEATURE,
+ // Boolean.TRUE);
+ resource.load(options);
+ } catch (IOException e) {
+ resource.unload();
+ throw e;
+ }
+ }
+ if (uri.fragment() != null) {
+ EObject rootElement = resource.getEObject(uri.fragment());
+ if (rootElement instanceof Diagram) {
+ document.setContent((Diagram) rootElement);
+ return;
+ }
+ } else {
+ for (Iterator it = resource.getContents().iterator(); it.hasNext();) {
+ Object rootElement = it.next();
+ if (rootElement instanceof Diagram) {
+ document.setContent((Diagram) rootElement);
+ return;
+ }
+ }
+ }
+ throw new RuntimeException(Messages.EcoreDocumentProvider_NoDiagramInResourceError);
+ } catch (Exception e) {
+ CoreException thrownExcp = null;
+ if (e instanceof CoreException) {
+ thrownExcp = (CoreException) e;
+ } else {
+ String msg = e.getLocalizedMessage();
+ thrownExcp = new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, msg != null ? msg : Messages.EcoreDocumentProvider_DiagramLoadingError, e));
+ }
+ throw thrownExcp;
+ }
+ } else {
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, NLS.bind(Messages.EcoreDocumentProvider_IncorrectInputError, new Object[] { element,
+ "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public long getModificationStamp(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return computeModificationStamp(info);
+ }
+ return super.getModificationStamp(element);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isDeleted(Object element) {
+ IDiagramDocument document = getDiagramDocument(element);
+ if (document != null) {
+ Resource diagramResource = document.getDiagram().eResource();
+ if (diagramResource != null) {
+ IFile file = WorkspaceSynchronizer.getFile(diagramResource);
+ return file == null || file.getLocation() == null || !file.getLocation().toFile().exists();
+ }
+ }
+ return super.isDeleted(element);
+ }
+
+ /**
+ * @generated
+ */
+ public ResourceSetInfo getResourceSetInfo(Object editorInput) {
+ return (ResourceSetInfo) super.getElementInfo(editorInput);
+ }
+
+ /**
+ * @generated
+ */
+ protected void disposeElementInfo(Object element, ElementInfo info) {
+ if (info instanceof ResourceSetInfo) {
+ ResourceSetInfo resourceSetInfo = (ResourceSetInfo) info;
+ resourceSetInfo.dispose();
+ }
+ super.disposeElementInfo(element, info);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doValidateState(Object element, Object computationContext) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection files2Validate = new ArrayList();
+ for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null && file.isReadOnly()) {
+ files2Validate.add(file);
+ }
+ }
+ ResourcesPlugin.getWorkspace().validateEdit((IFile[]) files2Validate.toArray(new IFile[files2Validate.size()]), computationContext);
+ }
+
+ super.doValidateState(element, computationContext);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isReadOnly(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (info.isUpdateCache()) {
+ try {
+ updateCache(element);
+ } catch (CoreException ex) {
+ EcoreDiagramEditorPlugin.getInstance().logError(Messages.EcoreDocumentProvider_isModifiable, ex);
+ // Error message to log was initially taken from
+ // org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
+ }
+ }
+ return info.isReadOnly();
+ }
+ return super.isReadOnly(element);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isModifiable(Object element) {
+ if (!isStateValidated(element)) {
+ if (element instanceof FileEditorInput || element instanceof URIEditorInput) {
+ return true;
+ }
+ }
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (info.isUpdateCache()) {
+ try {
+ updateCache(element);
+ } catch (CoreException ex) {
+ EcoreDiagramEditorPlugin.getInstance().logError(Messages.EcoreDocumentProvider_isModifiable, ex);
+ // Error message to log was initially taken from
+ // org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.StorageDocumentProvider_isModifiable
+ }
+ }
+ return info.isModifiable();
+ }
+ return super.isModifiable(element);
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateCache(Object element) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null && file.isReadOnly()) {
+ info.setReadOnly(true);
+ info.setModifiable(false);
+ return;
+ }
+ }
+ info.setReadOnly(false);
+ info.setModifiable(true);
+ return;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void doUpdateStateCache(Object element) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ info.setUpdateCache(true);
+ }
+ super.doUpdateStateCache(element);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isSynchronized(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ return info.isSynchronized();
+ }
+ return super.isSynchronized(element);
+ }
+
+ /**
+ * @generated
+ */
+ protected ISchedulingRule getResetRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection rules = new ArrayList();
+ for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(file));
+ }
+ }
+ return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ISchedulingRule getSaveRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection rules = new ArrayList();
+ for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(computeSchedulingRule(file));
+ }
+ }
+ return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ISchedulingRule getSynchronizeRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection rules = new ArrayList();
+ for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ rules.add(ResourcesPlugin.getWorkspace().getRuleFactory().refreshRule(file));
+ }
+ }
+ return new MultiRule((ISchedulingRule[]) rules.toArray(new ISchedulingRule[rules.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected ISchedulingRule getValidateStateRule(Object element) {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ Collection files = new ArrayList();
+ for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ IFile file = WorkspaceSynchronizer.getFile(nextResource);
+ if (file != null) {
+ files.add(file);
+ }
+ }
+ return ResourcesPlugin.getWorkspace().getRuleFactory().validateEditRule((IFile[]) files.toArray(new IFile[files.size()]));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private ISchedulingRule computeSchedulingRule(IResource toCreateOrModify) {
+ if (toCreateOrModify.exists())
+ return ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(toCreateOrModify);
+
+ 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 ResourcesPlugin.getWorkspace().getRuleFactory().createRule(toCreateOrModify);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doSynchronize(Object element, IProgressMonitor monitor) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ for (Iterator it = info.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ handleElementChanged(info, nextResource, monitor);
+ }
+ return;
+ }
+ super.doSynchronize(element, monitor);
+ }
+
+ /**
+ * @generated
+ */
+ protected void doSaveDocument(IProgressMonitor monitor, Object element, IDocument document, boolean overwrite) throws CoreException {
+ ResourceSetInfo info = getResourceSetInfo(element);
+ if (info != null) {
+ if (!overwrite && !info.isSynchronized()) {
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, IResourceStatus.OUT_OF_SYNC_LOCAL, Messages.EcoreDocumentProvider_UnsynchronizedFileSaveError, null));
+ }
+ info.stopResourceListening();
+ fireElementStateChanging(element);
+ List resources = info.getResourceSet().getResources();
+ try {
+ monitor.beginTask(Messages.EcoreDocumentProvider_SaveDiagramTask, resources.size() + 1); // "Saving
+ // diagram"
+ for (Iterator it = resources.iterator(); it.hasNext();) {
+ Resource nextResource = (Resource) it.next();
+ monitor.setTaskName(NLS.bind(Messages.EcoreDocumentProvider_SaveNextResourceTask, nextResource.getURI()));
+ if (nextResource.isLoaded() && !info.getEditingDomain().isReadOnly(nextResource)) {
+ try {
+ nextResource.save(EcoreDiagramEditorUtil.getSaveOptions());
+ } catch (IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, EditorStatusCodes.RESOURCE_FAILURE, e.getLocalizedMessage(), null));
+ }
+ }
+ monitor.worked(1);
+ }
+ monitor.done();
+ info.setModificationStamp(computeModificationStamp(info));
+ } catch (RuntimeException x) {
+ fireElementStateChangeFailed(element);
+ throw x;
+ } finally {
+ info.startResourceListening();
+ }
+ } else {
+ URI newResoruceURI;
+ List affectedFiles = null;
+ if (element instanceof FileEditorInput) {
+ IFile newFile = ((FileEditorInput) element).getFile();
+ affectedFiles = Collections.singletonList(newFile);
+ newResoruceURI = URI.createPlatformResourceURI(newFile.getFullPath().toString(), true);
+ } else if (element instanceof URIEditorInput) {
+ newResoruceURI = ((URIEditorInput) element).getURI();
+ } else {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, NLS.bind(Messages.EcoreDocumentProvider_IncorrectInputError, new Object[] { element,
+ "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ if (false == document instanceof IDiagramDocument) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0,
+ "Incorrect document used: " + document + " instead of org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument", null)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ IDiagramDocument diagramDocument = (IDiagramDocument) document;
+ final Resource newResource = diagramDocument.getEditingDomain().getResourceSet().createResource(newResoruceURI);
+ final Diagram diagramCopy = (Diagram) EcoreUtil.copy(diagramDocument.getDiagram());
+ try {
+ new AbstractTransactionalCommand(diagramDocument.getEditingDomain(), NLS.bind(Messages.EcoreDocumentProvider_SaveAsOperation, diagramCopy.getName()), affectedFiles) {
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ newResource.getContents().add(diagramCopy);
+ return CommandResult.newOKCommandResult();
+ }
+ }.execute(monitor, null);
+ newResource.save(EcoreDiagramEditorUtil.getSaveOptions());
+ } catch (ExecutionException e) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null));
+ } catch (IOException e) {
+ fireElementStateChangeFailed(element);
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, e.getLocalizedMessage(), null));
+ }
+ newResource.unload();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleElementChanged(ResourceSetInfo info, Resource changedResource, IProgressMonitor monitor) {
+ IFile file = WorkspaceSynchronizer.getFile(changedResource);
+ if (file != null) {
+ try {
+ file.refreshLocal(IResource.DEPTH_INFINITE, monitor);
+ } catch (CoreException ex) {
+ EcoreDiagramEditorPlugin.getInstance().logError(Messages.EcoreDocumentProvider_handleElementContentChanged, ex);
+ // Error message to log was initially taken from
+ // org.eclipse.gmf.runtime.diagram.ui.resources.editor.ide.internal.l10n.EditorMessages.FileDocumentProvider_handleElementContentChanged
+ }
+ }
+ changedResource.unload();
+
+ fireElementContentAboutToBeReplaced(info.getEditorInput());
+ removeUnchangedElementListeners(info.getEditorInput(), info);
+ info.fStatus = null;
+ try {
+ setDocumentContent(info.fDocument, info.getEditorInput());
+ } catch (CoreException e) {
+ info.fStatus = e.getStatus();
+ }
+ if (!info.fCanBeSaved) {
+ info.setModificationStamp(computeModificationStamp(info));
+ }
+ addUnchangedElementListeners(info.getEditorInput(), info);
+ fireElementContentReplaced(info.getEditorInput());
+ }
+
+ /**
+ * @generated
+ */
+ protected void handleElementMoved(IEditorInput input, URI uri) {
+ if (input instanceof FileEditorInput) {
+ IFile newFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(URI.decode(uri.path())).removeFirstSegments(1));
+ fireElementMoved(input, newFile == null ? null : new FileEditorInput(newFile));
+ return;
+ }
+ // TODO: append suffix to the URI! (use diagram as a parameter)
+ fireElementMoved(input, new URIEditorInput(uri));
+ }
+
+ /**
+ * @generated
+ */
+ public IEditorInput createInputWithEditingDomain(IEditorInput editorInput, TransactionalEditingDomain domain) {
+ return editorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public IDiagramDocument getDiagramDocument(Object element) {
+ IDocument doc = getDocument(element);
+ if (doc instanceof IDiagramDocument) {
+ return (IDiagramDocument) doc;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected IRunnableContext getOperationRunner(IProgressMonitor monitor) {
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected class ResourceSetInfo extends ElementInfo {
+
+ /**
+ * @generated
+ */
+ private long myModificationStamp = IResource.NULL_STAMP;
+
+ /**
+ * @generated
+ */
+ private WorkspaceSynchronizer mySynchronizer;
+
+ /**
+ * @generated
+ */
+ private Collection myUnSynchronizedResources = new ArrayList();
+
+ /**
+ * @generated
+ */
+ private IDiagramDocument myDocument;
+
+ /**
+ * @generated
+ */
+ private IEditorInput myEditorInput;
+
+ /**
+ * @generated
+ */
+ private boolean myUpdateCache = true;
+
+ /**
+ * @generated
+ */
+ private boolean myModifiable = false;
+
+ /**
+ * @generated
+ */
+ private boolean myReadOnly = true;
+
+ /**
+ * @generated
+ */
+ private ResourceSetModificationListener myResourceSetListener;
+
+ /**
+ * @generated
+ */
+ public ResourceSetInfo(IDiagramDocument document, IEditorInput editorInput) {
+ super(document);
+ myDocument = document;
+ myEditorInput = editorInput;
+ startResourceListening();
+ myResourceSetListener = new ResourceSetModificationListener(this);
+ getResourceSet().eAdapters().add(myResourceSetListener);
+ }
+
+ /**
+ * @generated
+ */
+ public long getModificationStamp() {
+ return myModificationStamp;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModificationStamp(long modificationStamp) {
+ myModificationStamp = modificationStamp;
+ }
+
+ /**
+ * @generated
+ */
+ public TransactionalEditingDomain getEditingDomain() {
+ return myDocument.getEditingDomain();
+ }
+
+ /**
+ * @generated
+ */
+ public ResourceSet getResourceSet() {
+ return getEditingDomain().getResourceSet();
+ }
+
+ /**
+ * @generated
+ */
+ public IEditorInput getEditorInput() {
+ return myEditorInput;
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ stopResourceListening();
+ getResourceSet().eAdapters().remove(myResourceSetListener);
+ for (Iterator it = getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource resource = (Resource) it.next();
+ resource.unload();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isSynchronized() {
+ return myUnSynchronizedResources.size() == 0;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUnSynchronized(Resource resource) {
+ myUnSynchronizedResources.add(resource);
+ }
+
+ /**
+ * @generated
+ */
+ public void setSynchronized(Resource resource) {
+ myUnSynchronizedResources.remove(resource);
+ }
+
+ /**
+ * @generated
+ */
+ public final void stopResourceListening() {
+ mySynchronizer.dispose();
+ mySynchronizer = null;
+ }
+
+ /**
+ * @generated
+ */
+ public final void startResourceListening() {
+ mySynchronizer = new WorkspaceSynchronizer(getEditingDomain(), new SynchronizerDelegate());
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isUpdateCache() {
+ return myUpdateCache;
+ }
+
+ /**
+ * @generated
+ */
+ public void setUpdateCache(boolean update) {
+ myUpdateCache = update;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isModifiable() {
+ return myModifiable;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModifiable(boolean modifiable) {
+ myModifiable = modifiable;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isReadOnly() {
+ return myReadOnly;
+ }
+
+ /**
+ * @generated
+ */
+ public void setReadOnly(boolean readOnly) {
+ myReadOnly = readOnly;
+ }
+
+ /**
+ * @generated
+ */
+ private class SynchronizerDelegate implements WorkspaceSynchronizer.Delegate {
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ }
+
+ /**
+ * @generated
+ */
+ public boolean handleResourceChanged(final Resource resource) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ ResourceSetInfo.this.setUnSynchronized(resource);
+ return true;
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ handleElementChanged(ResourceSetInfo.this, resource, null);
+ }
+ });
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean handleResourceDeleted(Resource resource) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ ResourceSetInfo.this.setUnSynchronized(resource);
+ return true;
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ fireElementDeleted(ResourceSetInfo.this.getEditorInput());
+ }
+ });
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean handleResourceMoved(Resource resource, final URI newURI) {
+ synchronized (ResourceSetInfo.this) {
+ if (ResourceSetInfo.this.fCanBeSaved) {
+ ResourceSetInfo.this.setUnSynchronized(resource);
+ return true;
+ }
+ }
+ if (myDocument.getDiagram().eResource() == resource) {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ handleElementMoved(ResourceSetInfo.this.getEditorInput(), newURI);
+ }
+ });
+ } else {
+ handleResourceDeleted(resource);
+ }
+ return true;
+ }
+
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class ResourceSetModificationListener extends EContentAdapter {
+
+ /**
+ * @generated
+ */
+ private NotificationFilter myModifiedFilter;
+
+ /**
+ * @generated
+ */
+ private ResourceSetInfo myInfo;
+
+ /**
+ * @generated
+ */
+ public ResourceSetModificationListener(ResourceSetInfo info) {
+ myInfo = info;
+ myModifiedFilter = NotificationFilter.createEventTypeFilter(Notification.SET).or(NotificationFilter.createEventTypeFilter(Notification.UNSET)).and(
+ NotificationFilter.createFeatureFilter(Resource.class, Resource.RESOURCE__IS_MODIFIED));
+ }
+
+ /**
+ * @generated
+ */
+ public void notifyChanged(Notification notification) {
+ if (notification.getNotifier() instanceof ResourceSet) {
+ super.notifyChanged(notification);
+ }
+ if (!notification.isTouch() && myModifiedFilter.matches(notification)) {
+ if (notification.getNotifier() instanceof Resource) {
+ Resource resource = (Resource) notification.getNotifier();
+ if (resource.isLoaded()) {
+ boolean modified = false;
+ for (Iterator it = myInfo.getResourceSet().getResources().iterator(); it.hasNext() && !modified;) {
+ Resource nextResource = (Resource) it.next();
+ if (nextResource.isLoaded()) {
+ modified = nextResource.isModified();
+ }
+ }
+ boolean dirtyStateChanged = false;
+ synchronized (myInfo) {
+ if (modified != myInfo.fCanBeSaved) {
+ myInfo.fCanBeSaved = modified;
+ dirtyStateChanged = true;
+ }
+ if (!resource.isModified()) {
+ myInfo.setSynchronized(resource);
+ }
+ }
+ if (dirtyStateChanged) {
+ fireElementDirtyStateChanged(myInfo.getEditorInput(), modified);
+
+ if (!modified) {
+ myInfo.setModificationStamp(computeModificationStamp(myInfo));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDomainModelElementTester.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDomainModelElementTester.java
new file mode 100644
index 0000000..40f729c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreDomainModelElementTester.java
@@ -0,0 +1,97 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+
+/**
+ * @generated
+ */
+public class EcoreDomainModelElementTester extends PropertyTester {
+
+ /**
+ * @generated
+ */
+ public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
+ if (false == receiver instanceof EObject) {
+ return false;
+ }
+ EObject eObject = (EObject) receiver;
+ EClass eClass = eObject.eClass();
+ if (eClass == EcorePackage.eINSTANCE.getEAttribute()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEAnnotation()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEClass()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEClassifier()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEDataType()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEEnum()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEEnumLiteral()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEFactory()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEModelElement()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getENamedElement()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEObject()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEOperation()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEPackage()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEParameter()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEReference()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEStructuralFeature()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getETypedElement()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEStringToStringMapEntry()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getEGenericType()) {
+ return true;
+ }
+ if (eClass == EcorePackage.eINSTANCE.getETypeParameter()) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreElementChooserDialog.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreElementChooserDialog.java
new file mode 100644
index 0000000..3967067
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreElementChooserDialog.java
@@ -0,0 +1,376 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.util.Collections;
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.edit.provider.IWrapperItemProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+/**
+ * @generated
+ */
+public class EcoreElementChooserDialog extends Dialog {
+
+ /**
+ * @generated
+ */
+ private TreeViewer myTreeViewer;
+
+ /**
+ * @generated
+ */
+ private URI mySelectedModelElementURI;
+
+ /**
+ * @generated
+ */
+ private View myView;
+
+ /**
+ * @generated
+ */
+ private TransactionalEditingDomain myEditingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+
+ /**
+ * @generated
+ */
+ public EcoreElementChooserDialog(Shell parentShell, View view) {
+ super(parentShell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ myView = view;
+ }
+
+ /**
+ * @generated
+ */
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+ getShell().setText(Messages.EcoreElementChooserDialog_SelectModelElementTitle);
+ createModelBrowser(composite);
+ return composite;
+ }
+
+ /**
+ * @generated
+ */
+ protected Control createButtonBar(Composite parent) {
+ Control buttonBar = super.createButtonBar(parent);
+ setOkButtonEnabled(false);
+ return buttonBar;
+ }
+
+ /**
+ * @generated
+ */
+ private void createModelBrowser(Composite composite) {
+ myTreeViewer = new TreeViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ myTreeViewer.getTree().setLayoutData(layoutData);
+ myTreeViewer.setContentProvider(new ModelElementsTreeContentProvider());
+ myTreeViewer.setLabelProvider(new ModelElementsTreeLabelProvider());
+ myTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
+ myTreeViewer.addFilter(new ModelFilesFilter());
+ myTreeViewer.addSelectionChangedListener(new OkButtonEnabler());
+ }
+
+ /**
+ * @generated
+ */
+ private void setOkButtonEnabled(boolean enabled) {
+ getButton(IDialogConstants.OK_ID).setEnabled(enabled);
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isValidModelFile(IFile file) {
+ String fileExtension = file.getFullPath().getFileExtension();
+ return "ecore".equals(fileExtension); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ public URI getSelectedModelElementURI() {
+ return mySelectedModelElementURI;
+ }
+
+ /**
+ * @generated
+ */
+ public int open() {
+ int result = super.open();
+ for (Iterator it = myEditingDomain.getResourceSet().getResources().iterator(); it.hasNext();) {
+ Resource resource = (Resource) it.next();
+ resource.unload();
+ }
+ myEditingDomain.dispose();
+ return result;
+ }
+
+ /**
+ * @generated
+ */
+ private class ModelElementsTreeContentProvider implements ITreeContentProvider {
+
+ /**
+ * @generated
+ */
+ private ITreeContentProvider myWorkbenchContentProvider = new WorkbenchContentProvider();
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryContentProvider myAdapterFctoryContentProvier = new AdapterFactoryContentProvider(EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public Object[] getChildren(Object parentElement) {
+ Object[] result = myWorkbenchContentProvider.getChildren(parentElement);
+ if (result != null && result.length > 0) {
+ return result;
+ }
+ if (parentElement instanceof IFile) {
+ IFile modelFile = (IFile) parentElement;
+ IPath resourcePath = modelFile.getFullPath();
+ ResourceSet resourceSet = myEditingDomain.getResourceSet();
+ try {
+ Resource modelResource = resourceSet.getResource(URI.createPlatformResourceURI(resourcePath.toString(), true), true);
+ return myAdapterFctoryContentProvier.getChildren(modelResource);
+ } catch (WrappedException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to load resource: " + resourcePath.toString(), e); //$NON-NLS-1$
+ }
+ return Collections.EMPTY_LIST.toArray();
+ }
+ return myAdapterFctoryContentProvier.getChildren(parentElement);
+ }
+
+ /**
+ * @generated
+ */
+ public Object getParent(Object element) {
+ Object parent = myWorkbenchContentProvider.getParent(element);
+ if (parent != null) {
+ return parent;
+ }
+ if (element instanceof EObject) {
+ EObject eObject = (EObject) element;
+ if (eObject.eContainer() == null && eObject.eResource().getURI().isFile()) {
+ String path = eObject.eResource().getURI().path();
+ return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(path));
+ }
+ return myAdapterFctoryContentProvier.getParent(eObject);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean hasChildren(Object element) {
+ if (element instanceof IFile) {
+ return isValidModelFile((IFile) element);
+ }
+ return myWorkbenchContentProvider.hasChildren(element) || myAdapterFctoryContentProvier.hasChildren(element);
+ }
+
+ /**
+ * @generated
+ */
+ public Object[] getElements(Object inputElement) {
+ Object[] elements = myWorkbenchContentProvider.getElements(inputElement);
+ return elements;
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkbenchContentProvider.dispose();
+ myAdapterFctoryContentProvier.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ myWorkbenchContentProvider.inputChanged(viewer, oldInput, newInput);
+ myAdapterFctoryContentProvier.inputChanged(viewer, oldInput, newInput);
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class ModelElementsTreeLabelProvider implements ILabelProvider {
+
+ /**
+ * @generated
+ */
+ private WorkbenchLabelProvider myWorkbenchLabelProvider = new WorkbenchLabelProvider();
+
+ /**
+ * @generated
+ */
+ private AdapterFactoryLabelProvider myAdapterFactoryLabelProvider = new AdapterFactoryLabelProvider(EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ Image result = myWorkbenchLabelProvider.getImage(element);
+ return result != null ? result : myAdapterFactoryLabelProvider.getImage(element);
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ String result = myWorkbenchLabelProvider.getText(element);
+ return result != null && result.length() > 0 ? result : myAdapterFactoryLabelProvider.getText(element);
+ }
+
+ /**
+ * @generated
+ */
+ public void addListener(ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.addListener(listener);
+ myAdapterFactoryLabelProvider.addListener(listener);
+ }
+
+ /**
+ * @generated
+ */
+ public void dispose() {
+ myWorkbenchLabelProvider.dispose();
+ myAdapterFactoryLabelProvider.dispose();
+ }
+
+ /**
+ * @generated
+ */
+ public boolean isLabelProperty(Object element, String property) {
+ return myWorkbenchLabelProvider.isLabelProperty(element, property) || myAdapterFactoryLabelProvider.isLabelProperty(element, property);
+ }
+
+ /**
+ * @generated
+ */
+ public void removeListener(ILabelProviderListener listener) {
+ myWorkbenchLabelProvider.removeListener(listener);
+ myAdapterFactoryLabelProvider.removeListener(listener);
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class ModelFilesFilter extends ViewerFilter {
+
+ /**
+ * @generated
+ */
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof IContainer) {
+ return true;
+ }
+ if (element instanceof IFile) {
+ IFile file = (IFile) element;
+ return isValidModelFile(file);
+ }
+ return true;
+ }
+
+ }
+
+ /**
+ * @generated
+ */
+ private class OkButtonEnabler implements ISelectionChangedListener {
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (event.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof IWrapperItemProvider) {
+ selectedElement = ((IWrapperItemProvider) selectedElement).getValue();
+ }
+ if (selectedElement instanceof FeatureMap.Entry) {
+ selectedElement = ((FeatureMap.Entry) selectedElement).getValue();
+ }
+ if (selectedElement instanceof EObject) {
+ EObject selectedModelElement = (EObject) selectedElement;
+ setOkButtonEnabled(ViewService.getInstance().provides(Node.class, new EObjectAdapter(selectedModelElement), myView, null, ViewUtil.APPEND, true,
+ EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
+ mySelectedModelElementURI = EcoreUtil.getURI(selectedModelElement);
+ return;
+ }
+ }
+ }
+ mySelectedModelElementURI = null;
+ setOkButtonEnabled(false);
+ }
+
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreInitDiagramFileAction.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreInitDiagramFileAction.java
new file mode 100644
index 0000000..c685fcb
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreInitDiagramFileAction.java
@@ -0,0 +1,99 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.common.util.WrappedException;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class EcoreInitDiagramFileAction implements IObjectActionDelegate {
+
+ /**
+ * @generated
+ */
+ private IWorkbenchPart targetPart;
+
+ /**
+ * @generated
+ */
+ private URI domainModelURI;
+
+ /**
+ * @generated
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ this.targetPart = targetPart;
+ }
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ domainModelURI = null;
+ action.setEnabled(false);
+ if (selection instanceof IStructuredSelection == false || selection.isEmpty()) {
+ return;
+ }
+ IFile file = (IFile) ((IStructuredSelection) selection).getFirstElement();
+ domainModelURI = URI.createPlatformResourceURI(file.getFullPath().toString(), true);
+ action.setEnabled(true);
+ }
+
+ /**
+ * @generated
+ */
+ private Shell getShell() {
+ return targetPart.getSite().getShell();
+ }
+
+ /**
+ * @generated
+ */
+ public void run(IAction action) {
+ TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE.createEditingDomain();
+ ResourceSet resourceSet = editingDomain.getResourceSet();
+ EObject diagramRoot = null;
+ try {
+ Resource resource = resourceSet.getResource(domainModelURI, true);
+ diagramRoot = (EObject) resource.getContents().get(0);
+ } catch (WrappedException ex) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$
+ }
+ if (diagramRoot == null) {
+ MessageDialog.openError(getShell(), Messages.EcoreInitDiagramFileAction_InitDiagramFileResourceErrorDialogTitle,
+ Messages.EcoreInitDiagramFileAction_InitDiagramFileResourceErrorDialogMessage);
+ return;
+ }
+ Wizard wizard = new EcoreNewDiagramFileWizard(domainModelURI, diagramRoot, editingDomain);
+ wizard.setWindowTitle(NLS.bind(Messages.EcoreInitDiagramFileAction_InitDiagramFileWizardTitle, EPackageEditPart.MODEL_ID));
+ EcoreDiagramEditorUtil.runWizard(getShell(), wizard, "InitDiagramFile"); //$NON-NLS-1$
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreLinkDescriptor.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreLinkDescriptor.java
new file mode 100644
index 0000000..4d53bb8
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreLinkDescriptor.java
@@ -0,0 +1,104 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+
+/**
+ * @generated
+ */
+public class EcoreLinkDescriptor extends EcoreNodeDescriptor {
+
+ /**
+ * @generated
+ */
+ private EObject mySource;
+
+ /**
+ * @generated
+ */
+ private EObject myDestination;
+
+ /**
+ * @generated
+ */
+ private IAdaptable mySemanticAdapter;
+
+ /**
+ * @generated
+ */
+ private EcoreLinkDescriptor(EObject source, EObject destination, EObject linkElement, int linkVID) {
+ super(linkElement, linkVID);
+ mySource = source;
+ myDestination = destination;
+ }
+
+ /**
+ * @generated
+ */
+ public EcoreLinkDescriptor(EObject source, EObject destination, IElementType elementType, int linkVID) {
+ this(source, destination, (EObject) null, linkVID);
+ final IElementType elementTypeCopy = elementType;
+ mySemanticAdapter = new IAdaptable() {
+
+ public Object getAdapter(Class adapter) {
+ if (IElementType.class.equals(adapter)) {
+ return elementTypeCopy;
+ }
+ return null;
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public EcoreLinkDescriptor(EObject source, EObject destination, EObject linkElement, IElementType elementType, int linkVID) {
+ this(source, destination, linkElement, linkVID);
+ final IElementType elementTypeCopy = elementType;
+ mySemanticAdapter = new EObjectAdapter(linkElement) {
+
+ public Object getAdapter(Class adapter) {
+ if (IElementType.class.equals(adapter)) {
+ return elementTypeCopy;
+ }
+ return super.getAdapter(adapter);
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getSource() {
+ return mySource;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getDestination() {
+ return myDestination;
+ }
+
+ /**
+ * @generated
+ */
+ public IAdaptable getSemanticAdapter() {
+ return mySemanticAdapter;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreLoadResourceAction.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreLoadResourceAction.java
new file mode 100644
index 0000000..762d0aa
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreLoadResourceAction.java
@@ -0,0 +1,75 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.edit.ui.action.LoadResourceAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * @generated
+ */
+public class EcoreLoadResourceAction implements IObjectActionDelegate {
+
+ /**
+ * @generated
+ */
+ private EPackageEditPart mySelectedElement;
+
+ /**
+ * @generated
+ */
+ private Shell myShell;
+
+ /**
+ * @generated
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ myShell = targetPart.getSite().getShell();
+ }
+
+ /**
+ * @generated
+ */
+ public void run(IAction action) {
+ LoadResourceAction.LoadResourceDialog loadResourceDialog = new LoadResourceAction.LoadResourceDialog(myShell, mySelectedElement.getEditingDomain());
+ loadResourceDialog.open();
+ }
+
+ /**
+ * @generated
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ mySelectedElement = null;
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+ if (structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof EPackageEditPart) {
+ mySelectedElement = (EPackageEditPart) structuredSelection.getFirstElement();
+ }
+ }
+ action.setEnabled(isEnabled());
+ }
+
+ /**
+ * @generated
+ */
+ private boolean isEnabled() {
+ return mySelectedElement != null;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreMatchingStrategy.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreMatchingStrategy.java
new file mode 100644
index 0000000..bbd1f99
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreMatchingStrategy.java
@@ -0,0 +1,46 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorMatchingStrategy;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * @generated
+ */
+public class EcoreMatchingStrategy implements IEditorMatchingStrategy {
+
+ /**
+ * @generated
+ */
+ public boolean matches(IEditorReference editorRef, IEditorInput input) {
+ IEditorInput editorInput;
+ try {
+ editorInput = editorRef.getEditorInput();
+ } catch (PartInitException e) {
+ return false;
+ }
+
+ if (editorInput.equals(input)) {
+ return true;
+ }
+ if (editorInput instanceof URIEditorInput && input instanceof URIEditorInput) {
+ return ((URIEditorInput) editorInput).getURI().equals(((URIEditorInput) input).getURI());
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreNewDiagramFileWizard.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreNewDiagramFileWizard.java
new file mode 100644
index 0000000..18b398d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreNewDiagramFileWizard.java
@@ -0,0 +1,175 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.diagram.core.services.view.CreateDiagramViewOperation;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+
+/**
+ * @generated
+ */
+public class EcoreNewDiagramFileWizard extends Wizard {
+
+ /**
+ * @generated
+ */
+ private WizardNewFileCreationPage myFileCreationPage;
+
+ /**
+ * @generated
+ */
+ private ModelElementSelectionPage diagramRootElementSelectionPage;
+
+ /**
+ * @generated
+ */
+ private TransactionalEditingDomain myEditingDomain;
+
+ /**
+ * @generated
+ */
+ public EcoreNewDiagramFileWizard(URI domainModelURI, EObject diagramRoot, TransactionalEditingDomain editingDomain) {
+ assert domainModelURI != null : "Domain model uri must be specified"; //$NON-NLS-1$
+ assert diagramRoot != null : "Doagram root element must be specified"; //$NON-NLS-1$
+ assert editingDomain != null : "Editing domain must be specified"; //$NON-NLS-1$
+
+ myFileCreationPage = new WizardNewFileCreationPage(Messages.EcoreNewDiagramFileWizard_CreationPageName, StructuredSelection.EMPTY);
+ myFileCreationPage.setTitle(Messages.EcoreNewDiagramFileWizard_CreationPageTitle);
+ myFileCreationPage.setDescription(NLS.bind(Messages.EcoreNewDiagramFileWizard_CreationPageDescription, EPackageEditPart.MODEL_ID));
+ IPath filePath;
+ String fileName = domainModelURI.trimFileExtension().lastSegment();
+ if (domainModelURI.isPlatformResource()) {
+ filePath = new Path(domainModelURI.trimSegments(1).toPlatformString(true));
+ } else if (domainModelURI.isFile()) {
+ filePath = new Path(domainModelURI.trimSegments(1).toFileString());
+ } else {
+ // TODO : use some default path
+ throw new IllegalArgumentException("Unsupported URI: " + domainModelURI); //$NON-NLS-1$
+ }
+ myFileCreationPage.setContainerFullPath(filePath);
+ myFileCreationPage.setFileName(EcoreDiagramEditorUtil.getUniqueFileName(filePath, fileName, "ecorediag")); //$NON-NLS-1$
+
+ diagramRootElementSelectionPage = new DiagramRootElementSelectionPage(Messages.EcoreNewDiagramFileWizard_RootSelectionPageName);
+ diagramRootElementSelectionPage.setTitle(Messages.EcoreNewDiagramFileWizard_RootSelectionPageTitle);
+ diagramRootElementSelectionPage.setDescription(Messages.EcoreNewDiagramFileWizard_RootSelectionPageDescription);
+ diagramRootElementSelectionPage.setModelElement(diagramRoot);
+
+ myEditingDomain = editingDomain;
+ }
+
+ /**
+ * @generated
+ */
+ public void addPages() {
+ addPage(myFileCreationPage);
+ addPage(diagramRootElementSelectionPage);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean performFinish() {
+ List affectedFiles = new LinkedList();
+ IFile diagramFile = myFileCreationPage.createNewFile();
+ EcoreDiagramEditorUtil.setCharset(diagramFile);
+ affectedFiles.add(diagramFile);
+ URI diagramModelURI = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
+ ResourceSet resourceSet = myEditingDomain.getResourceSet();
+ final Resource diagramResource = resourceSet.createResource(diagramModelURI);
+ AbstractTransactionalCommand command = new AbstractTransactionalCommand(myEditingDomain, Messages.EcoreNewDiagramFileWizard_InitDiagramCommand, affectedFiles) {
+
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+ int diagramVID = EcoreVisualIDRegistry.getDiagramVisualID(diagramRootElementSelectionPage.getModelElement());
+ if (diagramVID != EPackageEditPart.VISUAL_ID) {
+ return CommandResult.newErrorCommandResult(Messages.EcoreNewDiagramFileWizard_IncorrectRootError);
+ }
+ Diagram diagram = ViewService.createDiagram(diagramRootElementSelectionPage.getModelElement(), EPackageEditPart.MODEL_ID, EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ diagramResource.getContents().add(diagram);
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ try {
+ OperationHistoryFactory.getOperationHistory().execute(command, new NullProgressMonitor(), null);
+ diagramResource.save(EcoreDiagramEditorUtil.getSaveOptions());
+ EcoreDiagramEditorUtil.openDiagram(diagramResource);
+ } catch (ExecutionException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
+ } catch (IOException ex) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Save operation failed for: " + diagramModelURI, ex); //$NON-NLS-1$
+ } catch (PartInitException ex) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to open editor", ex); //$NON-NLS-1$
+ }
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ private static class DiagramRootElementSelectionPage extends ModelElementSelectionPage {
+
+ /**
+ * @generated
+ */
+ protected DiagramRootElementSelectionPage(String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * @generated
+ */
+ protected String getSelectionTitle() {
+ return Messages.EcoreNewDiagramFileWizard_RootSelectionPageSelectionTitle;
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean validatePage() {
+ if (selectedModelElement == null) {
+ setErrorMessage(Messages.EcoreNewDiagramFileWizard_RootSelectionPageNoSelectionMessage);
+ return false;
+ }
+ boolean result = ViewService.getInstance().provides(
+ new CreateDiagramViewOperation(new EObjectAdapter(selectedModelElement), EPackageEditPart.MODEL_ID, EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT));
+ setErrorMessage(result ? null : Messages.EcoreNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage);
+ return result;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreNodeDescriptor.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreNodeDescriptor.java
new file mode 100644
index 0000000..7c3deae
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreNodeDescriptor.java
@@ -0,0 +1,69 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * @generated
+ */
+public class EcoreNodeDescriptor {
+
+ /**
+ * @generated
+ */
+ private EObject myModelElement;
+
+ /**
+ * @generated
+ */
+ private int myVisualID;
+
+ /**
+ * @generated
+ */
+ private String myType;
+
+ /**
+ * @generated
+ */
+ public EcoreNodeDescriptor(EObject modelElement, int visualID) {
+ myModelElement = modelElement;
+ myVisualID = visualID;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getModelElement() {
+ return myModelElement;
+ }
+
+ /**
+ * @generated
+ */
+ public int getVisualID() {
+ return myVisualID;
+ }
+
+ /**
+ * @generated
+ */
+ public String getType() {
+ if (myType == null) {
+ myType = EcoreVisualIDRegistry.getType(getVisualID());
+ }
+ return myType;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcorePaletteFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcorePaletteFactory.java
new file mode 100644
index 0000000..b38ba57
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcorePaletteFactory.java
@@ -0,0 +1,278 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreElementTypes;
+import org.eclipse.gef.Tool;
+import org.eclipse.gef.palette.PaletteContainer;
+import org.eclipse.gef.palette.PaletteDrawer;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.palette.PaletteSeparator;
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool;
+import org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool;
+
+/**
+ * @generated
+ */
+public class EcorePaletteFactory {
+
+ /**
+ * @generated
+ */
+ public void fillPalette(PaletteRoot paletteRoot) {
+ paletteRoot.add(createObjects1Group());
+ paletteRoot.add(createConnections2Group());
+ }
+
+ /**
+ * Creates "Objects" palette tool group
+ *
+ * @generated
+ */
+ private PaletteContainer createObjects1Group() {
+ PaletteDrawer paletteContainer = new PaletteDrawer(Messages.Objects1Group_title);
+ paletteContainer.setDescription(Messages.Objects1Group_desc);
+ paletteContainer.add(createEPackage1CreationTool());
+ paletteContainer.add(createEClass2CreationTool());
+ paletteContainer.add(createEDataType3CreationTool());
+ paletteContainer.add(createEEnum4CreationTool());
+ paletteContainer.add(createEAnnotation5CreationTool());
+ paletteContainer.add(new PaletteSeparator());
+ paletteContainer.add(createEOperation7CreationTool());
+ paletteContainer.add(createEAttribute8CreationTool());
+ paletteContainer.add(createEEnumLiteral9CreationTool());
+ paletteContainer.add(createDetailsEntry10CreationTool());
+ return paletteContainer;
+ }
+
+ /**
+ * Creates "Connections" palette tool group
+ *
+ * @generated
+ */
+ private PaletteContainer createConnections2Group() {
+ PaletteDrawer paletteContainer = new PaletteDrawer(Messages.Connections2Group_title);
+ paletteContainer.setDescription(Messages.Connections2Group_desc);
+ paletteContainer.add(createEReference1CreationTool());
+ paletteContainer.add(createInheritance2CreationTool());
+ paletteContainer.add(createEAnnotationlink3CreationTool());
+ return paletteContainer;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEPackage1CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(1);
+ types.add(EcoreElementTypes.EPackage_1002);
+ NodeToolEntry entry = new NodeToolEntry(Messages.EPackage1CreationTool_title, Messages.EPackage1CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EPackage.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EPackage_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEClass2CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(2);
+ types.add(EcoreElementTypes.EClass_1001);
+ types.add(EcoreElementTypes.EClass_2003);
+ NodeToolEntry entry = new NodeToolEntry(Messages.EClass2CreationTool_title, Messages.EClass2CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EClass.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EClass_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEDataType3CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(2);
+ types.add(EcoreElementTypes.EDataType_2004);
+ types.add(EcoreElementTypes.EDataType_1004);
+ NodeToolEntry entry = new NodeToolEntry(Messages.EDataType3CreationTool_title, Messages.EDataType3CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EDataType.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EDataType_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEEnum4CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(2);
+ types.add(EcoreElementTypes.EEnum_2005);
+ types.add(EcoreElementTypes.EEnum_1005);
+ NodeToolEntry entry = new NodeToolEntry(Messages.EEnum4CreationTool_title, Messages.EEnum4CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EENum.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EENum_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEAnnotation5CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(1);
+ types.add(EcoreElementTypes.EAnnotation_1003);
+ NodeToolEntry entry = new NodeToolEntry(Messages.EAnnotation5CreationTool_title, Messages.EAnnotation5CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EAnnotation_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEOperation7CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(1);
+ types.add(EcoreElementTypes.EOperation_2002);
+ NodeToolEntry entry = new NodeToolEntry(Messages.EOperation7CreationTool_title, Messages.EOperation7CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EOperation.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EOperation_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEAttribute8CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(1);
+ types.add(EcoreElementTypes.EAttribute_2001);
+ NodeToolEntry entry = new NodeToolEntry(Messages.EAttribute8CreationTool_title, Messages.EAttribute8CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EAttribute.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EAttribute_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEEnumLiteral9CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(1);
+ types.add(EcoreElementTypes.EEnumLiteral_2006);
+ NodeToolEntry entry = new NodeToolEntry(Messages.EEnumLiteral9CreationTool_title, Messages.EEnumLiteral9CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EEnumLiteral_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createDetailsEntry10CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(1);
+ types.add(EcoreElementTypes.EStringToStringMapEntry_2007);
+ NodeToolEntry entry = new NodeToolEntry(Messages.DetailsEntry10CreationTool_title, Messages.DetailsEntry10CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EStringToStringMapEntry_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEReference1CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(1);
+ types.add(EcoreElementTypes.EReference_3002);
+ LinkToolEntry entry = new LinkToolEntry(Messages.EReference1CreationTool_title, Messages.EReference1CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EReference.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/EReference_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createInheritance2CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(1);
+ types.add(EcoreElementTypes.EClassESuperTypes_3003);
+ LinkToolEntry entry = new LinkToolEntry(Messages.Inheritance2CreationTool_title, Messages.Inheritance2CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/Inheritance.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/Inheritance_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private ToolEntry createEAnnotationlink3CreationTool() {
+ List/* <IElementType> */types = new ArrayList/* <IElementType> */(1);
+ types.add(EcoreElementTypes.EAnnotationReferences_3001);
+ LinkToolEntry entry = new LinkToolEntry(Messages.EAnnotationlink3CreationTool_title, Messages.EAnnotationlink3CreationTool_desc, types);
+ entry.setSmallIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink.gif")); //$NON-NLS-1$
+ entry.setLargeIcon(EcoreDiagramEditorPlugin.findImageDescriptor("/org.eclipse.emf.ecoretools.diagram/icons/AnnotationLink_24.gif")); //$NON-NLS-1$
+ return entry;
+ }
+
+ /**
+ * @generated
+ */
+ private static class NodeToolEntry extends ToolEntry {
+
+ /**
+ * @generated
+ */
+ private final List elementTypes;
+
+ /**
+ * @generated
+ */
+ private NodeToolEntry(String title, String description, List elementTypes) {
+ super(title, description, null, null);
+ this.elementTypes = elementTypes;
+ }
+
+ /**
+ * @generated
+ */
+ public Tool createTool() {
+ Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
+ tool.setProperties(getToolProperties());
+ return tool;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static class LinkToolEntry extends ToolEntry {
+
+ /**
+ * @generated
+ */
+ private final List relationshipTypes;
+
+ /**
+ * @generated
+ */
+ private LinkToolEntry(String title, String description, List relationshipTypes) {
+ super(title, description, null, null);
+ this.relationshipTypes = relationshipTypes;
+ }
+
+ /**
+ * @generated
+ */
+ public Tool createTool() {
+ Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
+ tool.setProperties(getToolProperties());
+ return tool;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreShortcutPropertyTester.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreShortcutPropertyTester.java
new file mode 100644
index 0000000..c8bd92f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreShortcutPropertyTester.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreShortcutPropertyTester extends PropertyTester {
+
+ /**
+ * @generated
+ */
+ protected static final String SHORTCUT_PROPERTY = "isShortcut"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
+ if (false == receiver instanceof View) {
+ return false;
+ }
+ View view = (View) receiver;
+ if (SHORTCUT_PROPERTY.equals(method)) {
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return EPackageEditPart.MODEL_ID.equals(annotation.getDetails().get("modelID")); //$NON-NLS-1$
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreUriEditorInputTester.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreUriEditorInputTester.java
new file mode 100644
index 0000000..6090b60
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreUriEditorInputTester.java
@@ -0,0 +1,34 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.common.ui.URIEditorInput;
+
+/**
+ * @generated
+ */
+public class EcoreUriEditorInputTester extends PropertyTester {
+
+ /**
+ * @generated
+ */
+ public boolean test(Object receiver, String method, Object[] args, Object expectedValue) {
+ if (false == receiver instanceof URIEditorInput) {
+ return false;
+ }
+ URIEditorInput editorInput = (URIEditorInput) receiver;
+ return "ecorediag".equals(editorInput.getURI().fileExtension()); //$NON-NLS-1$
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreVisualIDRegistry.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreVisualIDRegistry.java
new file mode 100644
index 0000000..976868e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/EcoreVisualIDRegistry.java
@@ -0,0 +1,435 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationDetailsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationSourceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributes2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperations2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperationsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeInstanceClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeInstanceClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiterals2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackage2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageContentsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceLowerBoundUpperBoundEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.expressions.EcoreAbstractExpression;
+import org.eclipse.emf.ecoretools.diagram.expressions.EcoreOCLFactory;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * This registry is used to determine which type of visual object should be
+ * created for the corresponding Diagram, Node, ChildNode or Link represented by
+ * a domain model object.
+ *
+ * @generated
+ */
+public class EcoreVisualIDRegistry {
+
+ /**
+ * @generated
+ */
+ private static final String DEBUG_KEY = EcoreDiagramEditorPlugin.getInstance().getBundle().getSymbolicName() + "/debug/visualID"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private static final EcoreAbstractExpression EDataType_1004_Constraint = EcoreOCLFactory.getExpression("not oclIsKindOf(ecore::EEnum)", EcorePackage.eINSTANCE.getEDataType());
+
+ /**
+ * @generated
+ */
+ private static final EcoreAbstractExpression EDataType_2004_Constraint = EcoreOCLFactory.getExpression("not oclIsKindOf(ecore::EEnum)", EcorePackage.eINSTANCE.getEDataType());
+
+ /**
+ * @generated
+ */
+ private static final EcoreAbstractExpression EReference_3002_Constraint = EcoreOCLFactory.getExpression("not containment and not container", EcorePackage.eINSTANCE.getEReference());
+
+ /**
+ * @generated
+ */
+ public static int getVisualID(View view) {
+ if (view instanceof Diagram) {
+ if (EPackageEditPart.MODEL_ID.equals(view.getType())) {
+ return EPackageEditPart.VISUAL_ID;
+ } else {
+ return -1;
+ }
+ }
+ return org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry.getVisualID(view.getType());
+ }
+
+ /**
+ * @generated
+ */
+ public static String getModelID(View view) {
+ View diagram = view.getDiagram();
+ while (view != diagram) {
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ return (String) annotation.getDetails().get("modelID"); //$NON-NLS-1$
+ }
+ view = (View) view.eContainer();
+ }
+ return diagram != null ? diagram.getType() : null;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getVisualID(String type) {
+ try {
+ return Integer.parseInt(type);
+ } catch (NumberFormatException e) {
+ if (Boolean.TRUE.toString().equalsIgnoreCase(Platform.getDebugOption(DEBUG_KEY))) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to parse view type as a visualID number: " + type);
+ }
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static String getType(int visualID) {
+ return String.valueOf(visualID);
+ }
+
+ /**
+ * @generated
+ */
+ public static int getDiagramVisualID(EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ if (EcorePackage.eINSTANCE.getEPackage().isSuperTypeOf(domainElement.eClass()) && isDiagram((EPackage) domainElement)) {
+ return EPackageEditPart.VISUAL_ID;
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getNodeVisualID(View containerView, EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ String containerModelID = org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry.getModelID(containerView);
+ if (!EPackageEditPart.MODEL_ID.equals(containerModelID) && !"ecore".equals(containerModelID)) { //$NON-NLS-1$
+ return -1;
+ }
+ int containerVisualID;
+ if (EPackageEditPart.MODEL_ID.equals(containerModelID)) {
+ containerVisualID = org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry.getVisualID(containerView);
+ } else {
+ if (containerView instanceof Diagram) {
+ containerVisualID = EPackageEditPart.VISUAL_ID;
+ } else {
+ return -1;
+ }
+ }
+ switch (containerVisualID) {
+ case EClassAttributesEditPart.VISUAL_ID:
+ if (EcorePackage.eINSTANCE.getEAttribute().isSuperTypeOf(domainElement.eClass())) {
+ return EAttributeEditPart.VISUAL_ID;
+ }
+ break;
+ case EClassOperationsEditPart.VISUAL_ID:
+ if (EcorePackage.eINSTANCE.getEOperation().isSuperTypeOf(domainElement.eClass())) {
+ return EOperationEditPart.VISUAL_ID;
+ }
+ break;
+ case EPackageContentsEditPart.VISUAL_ID:
+ if (EcorePackage.eINSTANCE.getEClass().isSuperTypeOf(domainElement.eClass())) {
+ return EClass2EditPart.VISUAL_ID;
+ }
+ if (EcorePackage.eINSTANCE.getEDataType().isSuperTypeOf(domainElement.eClass()) && evaluate(EDataType_2004_Constraint, domainElement)) {
+ return EDataType2EditPart.VISUAL_ID;
+ }
+ if (EcorePackage.eINSTANCE.getEEnum().isSuperTypeOf(domainElement.eClass())) {
+ return EEnum2EditPart.VISUAL_ID;
+ }
+ break;
+ case EClassAttributes2EditPart.VISUAL_ID:
+ if (EcorePackage.eINSTANCE.getEAttribute().isSuperTypeOf(domainElement.eClass())) {
+ return EAttributeEditPart.VISUAL_ID;
+ }
+ break;
+ case EClassOperations2EditPart.VISUAL_ID:
+ if (EcorePackage.eINSTANCE.getEOperation().isSuperTypeOf(domainElement.eClass())) {
+ return EOperationEditPart.VISUAL_ID;
+ }
+ break;
+ case EEnumLiteralsEditPart.VISUAL_ID:
+ if (EcorePackage.eINSTANCE.getEEnumLiteral().isSuperTypeOf(domainElement.eClass())) {
+ return EEnumLiteralEditPart.VISUAL_ID;
+ }
+ break;
+ case EAnnotationDetailsEditPart.VISUAL_ID:
+ if (EcorePackage.eINSTANCE.getEStringToStringMapEntry().isSuperTypeOf(domainElement.eClass())) {
+ return EStringToStringMapEntryEditPart.VISUAL_ID;
+ }
+ break;
+ case EEnumLiterals2EditPart.VISUAL_ID:
+ if (EcorePackage.eINSTANCE.getEEnumLiteral().isSuperTypeOf(domainElement.eClass())) {
+ return EEnumLiteralEditPart.VISUAL_ID;
+ }
+ break;
+ case EPackageEditPart.VISUAL_ID:
+ if (EcorePackage.eINSTANCE.getEClass().isSuperTypeOf(domainElement.eClass())) {
+ return EClassEditPart.VISUAL_ID;
+ }
+ if (EcorePackage.eINSTANCE.getEPackage().isSuperTypeOf(domainElement.eClass())) {
+ return EPackage2EditPart.VISUAL_ID;
+ }
+ if (EcorePackage.eINSTANCE.getEAnnotation().isSuperTypeOf(domainElement.eClass())) {
+ return EAnnotationEditPart.VISUAL_ID;
+ }
+ if (EcorePackage.eINSTANCE.getEDataType().isSuperTypeOf(domainElement.eClass()) && evaluate(EDataType_1004_Constraint, domainElement)) {
+ return EDataTypeEditPart.VISUAL_ID;
+ }
+ if (EcorePackage.eINSTANCE.getEEnum().isSuperTypeOf(domainElement.eClass())) {
+ return EEnumEditPart.VISUAL_ID;
+ }
+ break;
+ }
+ return -1;
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean canCreateNode(View containerView, int nodeVisualID) {
+ String containerModelID = org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry.getModelID(containerView);
+ if (!EPackageEditPart.MODEL_ID.equals(containerModelID) && !"ecore".equals(containerModelID)) { //$NON-NLS-1$
+ return false;
+ }
+ int containerVisualID;
+ if (EPackageEditPart.MODEL_ID.equals(containerModelID)) {
+ containerVisualID = org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry.getVisualID(containerView);
+ } else {
+ if (containerView instanceof Diagram) {
+ containerVisualID = EPackageEditPart.VISUAL_ID;
+ } else {
+ return false;
+ }
+ }
+ switch (containerVisualID) {
+ case EClassEditPart.VISUAL_ID:
+ if (EClassNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EClassAttributesEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EClassOperationsEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EPackage2EditPart.VISUAL_ID:
+ if (EPackageNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EPackageContentsEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EAnnotationEditPart.VISUAL_ID:
+ if (EAnnotationSourceEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EAnnotationDetailsEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EDataTypeEditPart.VISUAL_ID:
+ if (EDataTypeNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EDataTypeInstanceClassEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EEnumEditPart.VISUAL_ID:
+ if (EEnumNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EEnumLiterals2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EClass2EditPart.VISUAL_ID:
+ if (EClassName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EClassAttributes2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EClassOperations2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EDataType2EditPart.VISUAL_ID:
+ if (EDataTypeName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EDataTypeInstanceClass2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EEnum2EditPart.VISUAL_ID:
+ if (EEnumName2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EEnumLiteralsEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EClassAttributesEditPart.VISUAL_ID:
+ if (EAttributeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EClassOperationsEditPart.VISUAL_ID:
+ if (EOperationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EPackageContentsEditPart.VISUAL_ID:
+ if (EClass2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EDataType2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EEnum2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EClassAttributes2EditPart.VISUAL_ID:
+ if (EAttributeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EClassOperations2EditPart.VISUAL_ID:
+ if (EOperationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EEnumLiteralsEditPart.VISUAL_ID:
+ if (EEnumLiteralEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EAnnotationDetailsEditPart.VISUAL_ID:
+ if (EStringToStringMapEntryEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EEnumLiterals2EditPart.VISUAL_ID:
+ if (EEnumLiteralEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EPackageEditPart.VISUAL_ID:
+ if (EClassEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EPackage2EditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EAnnotationEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EDataTypeEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EEnumEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ case EReferenceEditPart.VISUAL_ID:
+ if (EReferenceNameEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ if (EReferenceLowerBoundUpperBoundEditPart.VISUAL_ID == nodeVisualID) {
+ return true;
+ }
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static int getLinkWithClassVisualID(EObject domainElement) {
+ if (domainElement == null) {
+ return -1;
+ }
+ if (EcorePackage.eINSTANCE.getEReference().isSuperTypeOf(domainElement.eClass()) && evaluate(EReference_3002_Constraint, domainElement)) {
+ return EReferenceEditPart.VISUAL_ID;
+ }
+ return -1;
+ }
+
+ /**
+ * User can change implementation of this method to handle some specific
+ * situations not covered by default logic.
+ *
+ * @generated
+ */
+ private static boolean isDiagram(EPackage element) {
+ return true;
+ }
+
+ /**
+ * @generated
+ */
+ private static boolean evaluate(EcoreAbstractExpression expression, Object element) {
+ Object result = expression.evaluate(element);
+ return result instanceof Boolean && ((Boolean) result).booleanValue();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/Messages.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/Messages.java
new file mode 100644
index 0000000..2670984
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/Messages.java
@@ -0,0 +1,581 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @generated
+ */
+public class Messages extends NLS {
+
+ /**
+ * @generated
+ */
+ static {
+ NLS.initializeMessages("messages", Messages.class); //$NON-NLS-1$
+ }
+
+ /**
+ * @generated
+ */
+ private Messages() {
+ }
+
+ /**
+ * @generated
+ */
+ public static String EcoreCreationWizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreCreationWizard_DiagramModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreCreationWizard_DiagramModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String EcoreCreationWizard_DomainModelFilePageTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreCreationWizard_DomainModelFilePageDescription;
+
+ /**
+ * @generated
+ */
+ public static String EcoreCreationWizardOpenEditorError;
+
+ /**
+ * @generated
+ */
+ public static String EcoreCreationWizardCreationError;
+
+ /**
+ * @generated
+ */
+ public static String EcoreCreationWizardPageExtensionError;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDiagramEditorUtil_OpenModelResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDiagramEditorUtil_OpenModelResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDiagramEditorUtil_CreateDiagramProgressTask;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDiagramEditorUtil_CreateDiagramCommandLabel;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDocumentProvider_isModifiable;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDocumentProvider_handleElementContentChanged;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDocumentProvider_IncorrectInputError;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDocumentProvider_NoDiagramInResourceError;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDocumentProvider_DiagramLoadingError;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDocumentProvider_UnsynchronizedFileSaveError;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDocumentProvider_SaveDiagramTask;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDocumentProvider_SaveNextResourceTask;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDocumentProvider_SaveAsOperation;
+
+ /**
+ * @generated
+ */
+ public static String EcoreInitDiagramFileAction_InitDiagramFileResourceErrorDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreInitDiagramFileAction_InitDiagramFileResourceErrorDialogMessage;
+
+ /**
+ * @generated
+ */
+ public static String EcoreInitDiagramFileAction_InitDiagramFileWizardTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreInitDiagramFileAction_OpenModelFileDialogTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_CreationPageName;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_CreationPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_CreationPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_RootSelectionPageName;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_RootSelectionPageTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_RootSelectionPageDescription;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_RootSelectionPageSelectionTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_RootSelectionPageNoSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_RootSelectionPageInvalidSelectionMessage;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_InitDiagramCommand;
+
+ /**
+ * @generated
+ */
+ public static String EcoreNewDiagramFileWizard_IncorrectRootError;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDiagramEditor_SavingDeletedFile;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDiagramEditor_SaveAsErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDiagramEditor_SaveAsErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDiagramEditor_SaveErrorTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreDiagramEditor_SaveErrorMessage;
+
+ /**
+ * @generated
+ */
+ public static String EcoreElementChooserDialog_SelectModelElementTitle;
+
+ /**
+ * @generated
+ */
+ public static String ModelElementSelectionPageMessage;
+
+ /**
+ * @generated
+ */
+ public static String ValidateActionMessage;
+
+ /**
+ * @generated
+ */
+ public static String Objects1Group_title;
+
+ /**
+ * @generated
+ */
+ public static String Objects1Group_desc;
+
+ /**
+ * @generated
+ */
+ public static String Connections2Group_title;
+
+ /**
+ * @generated
+ */
+ public static String Connections2Group_desc;
+
+ /**
+ * @generated
+ */
+ public static String EPackage1CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EPackage1CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EClass2CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EClass2CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EDataType3CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EDataType3CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EEnum4CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EEnum4CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EAnnotation5CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EAnnotation5CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EOperation7CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EOperation7CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EAttribute8CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EAttribute8CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EEnumLiteral9CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EEnumLiteral9CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String DetailsEntry10CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String DetailsEntry10CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EReference1CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EReference1CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String Inheritance2CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String Inheritance2CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EAnnotationlink3CreationTool_title;
+
+ /**
+ * @generated
+ */
+ public static String EAnnotationlink3CreationTool_desc;
+
+ /**
+ * @generated
+ */
+ public static String EClassAttributesEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String EClassOperationsEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String EPackageContentsEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String EClassAttributes2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String EClassOperations2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String EEnumLiteralsEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String EAnnotationDetailsEditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String EEnumLiterals2EditPart_title;
+
+ /**
+ * @generated
+ */
+ public static String CommandName_OpenDiagram;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EPackage_79_links;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EClass_1001_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EClass_1001_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EPackage_1002_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EAnnotation_1003_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EAnnotation_1003_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EDataType_1004_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EEnum_1005_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EAttribute_2001_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EOperation_2002_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EClass_2003_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EClass_2003_outgoinglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EDataType_2004_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EEnum_2005_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EEnumLiteral_2006_incominglinks;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EAnnotationReferences_3001_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EAnnotationReferences_3001_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EReference_3002_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EReference_3002_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EClassESuperTypes_3003_target;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorGroupName_EClassESuperTypes_3003_source;
+
+ /**
+ * @generated
+ */
+ public static String NavigatorActionProvider_OpenDiagramActionName;
+
+ /**
+ * @generated
+ */
+ public static String AbstractParser_UnexpectedValueTypeMessage;
+
+ /**
+ * @generated
+ */
+ public static String AbstractParser_WrongStringConversionMessage;
+
+ /**
+ * @generated
+ */
+ public static String AbstractParser_UnknownLiteralMessage;
+
+ /**
+ * @generated
+ */
+ public static String MessageFormatParser_InvalidInputError;
+
+ /**
+ * @generated
+ */
+ public static String EcoreModelingAssistantProviderTitle;
+
+ /**
+ * @generated
+ */
+ public static String EcoreModelingAssistantProviderMessage;
+
+ // TODO: put accessor fields manually
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/ModelElementSelectionPage.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/ModelElementSelectionPage.java
new file mode 100644
index 0000000..f716f5e
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/ModelElementSelectionPage.java
@@ -0,0 +1,154 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.edit.provider.IWrapperItemProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Wizard page that allows to select element from model.
+ *
+ * @generated
+ */
+public class ModelElementSelectionPage extends WizardPage {
+
+ /**
+ * @generated
+ */
+ protected EObject selectedModelElement;
+
+ /**
+ * @generated
+ */
+ private TreeViewer modelViewer;
+
+ /**
+ * @generated
+ */
+ public ModelElementSelectionPage(String pageName) {
+ super(pageName);
+ }
+
+ /**
+ * @generated
+ */
+ public EObject getModelElement() {
+ return selectedModelElement;
+ }
+
+ /**
+ * @generated
+ */
+ public void setModelElement(EObject modelElement) {
+ selectedModelElement = modelElement;
+ if (modelViewer != null) {
+ if (selectedModelElement != null) {
+ modelViewer.setInput(selectedModelElement.eResource());
+ modelViewer.setSelection(new StructuredSelection(selectedModelElement));
+ } else {
+ modelViewer.setInput(null);
+ }
+ setPageComplete(validatePage());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite plate = new Composite(parent, SWT.NONE);
+ plate.setLayoutData(new GridData(GridData.FILL_BOTH));
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ plate.setLayout(layout);
+ setControl(plate);
+
+ Label label = new Label(plate, SWT.NONE);
+ label.setText(getSelectionTitle());
+ label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ modelViewer = new TreeViewer(plate, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 300;
+ layoutData.widthHint = 300;
+ modelViewer.getTree().setLayoutData(layoutData);
+ modelViewer.setContentProvider(new AdapterFactoryContentProvider(EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
+ modelViewer.setLabelProvider(new AdapterFactoryLabelProvider(EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()));
+ if (selectedModelElement != null) {
+ modelViewer.setInput(selectedModelElement.eResource());
+ modelViewer.setSelection(new StructuredSelection(selectedModelElement));
+ }
+ modelViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ public void selectionChanged(SelectionChangedEvent event) {
+ ModelElementSelectionPage.this.updateSelection((IStructuredSelection) event.getSelection());
+ }
+ });
+
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * Override to provide custom model element description.
+ *
+ * @generated
+ */
+ protected String getSelectionTitle() {
+ return Messages.ModelElementSelectionPageMessage;
+ }
+
+ /**
+ * @generated
+ */
+ protected void updateSelection(IStructuredSelection selection) {
+ selectedModelElement = null;
+ if (selection.size() == 1) {
+ Object selectedElement = selection.getFirstElement();
+ if (selectedElement instanceof IWrapperItemProvider) {
+ selectedElement = ((IWrapperItemProvider) selectedElement).getValue();
+ }
+ if (selectedElement instanceof FeatureMap.Entry) {
+ selectedElement = ((FeatureMap.Entry) selectedElement).getValue();
+ }
+ if (selectedElement instanceof EObject) {
+ selectedModelElement = (EObject) selectedElement;
+ }
+ }
+ setPageComplete(validatePage());
+ }
+
+ /**
+ * Override to provide specific validation of the selected model element.
+ *
+ * @generated
+ */
+ protected boolean validatePage() {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/ValidateAction.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/ValidateAction.java
new file mode 100644
index 0000000..9148645
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/part/ValidateAction.java
@@ -0,0 +1,270 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.part;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.util.Diagnostic;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.Diagnostician;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreMarkerNavigationProvider;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreValidationProvider;
+import org.eclipse.emf.validation.model.EvaluationMode;
+import org.eclipse.emf.validation.model.IConstraintStatus;
+import org.eclipse.emf.validation.service.IBatchValidator;
+import org.eclipse.emf.validation.service.ModelValidationService;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor;
+import org.eclipse.gmf.runtime.diagram.ui.OffscreenEditPartFactory;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.IDiagramWorkbenchPart;
+import org.eclipse.gmf.runtime.emf.core.util.EMFCoreUtil;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation;
+
+/**
+ * @generated
+ */
+public class ValidateAction extends Action {
+
+ /**
+ * @generated
+ */
+ public static final String VALIDATE_ACTION_KEY = "validateAction"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private IWorkbenchPartDescriptor workbenchPartDescriptor;
+
+ /**
+ * @generated
+ */
+ public ValidateAction(IWorkbenchPartDescriptor workbenchPartDescriptor) {
+ setId(VALIDATE_ACTION_KEY);
+ setText(Messages.ValidateActionMessage);
+ this.workbenchPartDescriptor = workbenchPartDescriptor;
+ }
+
+ /**
+ * @generated
+ */
+ public void run() {
+ IWorkbenchPart workbenchPart = workbenchPartDescriptor.getPartPage().getActivePart();
+ if (workbenchPart instanceof IDiagramWorkbenchPart) {
+ final IDiagramWorkbenchPart part = (IDiagramWorkbenchPart) workbenchPart;
+ try {
+ new WorkspaceModifyDelegatingOperation(new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
+ runValidation(part.getDiagramEditPart(), part.getDiagram());
+ }
+ }).run(new NullProgressMonitor());
+ } catch (Exception e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void runValidation(View view) {
+ try {
+ if (EcoreDiagramEditorUtil.openDiagram(view.eResource())) {
+ IEditorPart editorPart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ if (editorPart instanceof IDiagramWorkbenchPart) {
+ runValidation(((IDiagramWorkbenchPart) editorPart).getDiagramEditPart(), view);
+ } else {
+ runNonUIValidation(view);
+ }
+ }
+ } catch (Exception e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void runNonUIValidation(View view) {
+ DiagramEditPart diagramEditPart = OffscreenEditPartFactory.getInstance().createDiagramEditPart(view.getDiagram());
+ runValidation(diagramEditPart, view);
+ }
+
+ /**
+ * @generated
+ */
+ public static void runValidation(DiagramEditPart diagramEditPart, View view) {
+ final DiagramEditPart fpart = diagramEditPart;
+ final View fview = view;
+ EcoreValidationProvider.runWithConstraints(view, new Runnable() {
+
+ public void run() {
+ validate(fpart, fview);
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ private static Diagnostic runEMFValidator(View target) {
+ if (target.isSetElement() && target.getElement() != null) {
+ return new Diagnostician() {
+
+ public String getObjectLabel(EObject eObject) {
+ return EMFCoreUtil.getQualifiedName(eObject, true);
+ }
+ }.validate(target.getElement());
+ }
+ return Diagnostic.OK_INSTANCE;
+ }
+
+ /**
+ * @generated
+ */
+ private static void validate(DiagramEditPart diagramEditPart, View view) {
+ IFile target = view.eResource() != null ? WorkspaceSynchronizer.getFile(view.eResource()) : null;
+ if (target != null) {
+ EcoreMarkerNavigationProvider.deleteMarkers(target);
+ }
+ Diagnostic diagnostic = runEMFValidator(view);
+ createMarkers(target, diagnostic, diagramEditPart);
+ IBatchValidator validator = (IBatchValidator) ModelValidationService.getInstance().newValidator(EvaluationMode.BATCH);
+ validator.setIncludeLiveConstraints(true);
+ if (view.isSetElement() && view.getElement() != null) {
+ IStatus status = validator.validate(view.getElement());
+ createMarkers(target, status, diagramEditPart);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void createMarkers(IFile target, IStatus validationStatus, DiagramEditPart diagramEditPart) {
+ if (validationStatus.isOK()) {
+ return;
+ }
+ final IStatus rootStatus = validationStatus;
+ List allStatuses = new ArrayList();
+ EcoreDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new EcoreDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet(),
+ allStatuses));
+ for (Iterator it = allStatuses.iterator(); it.hasNext();) {
+ IConstraintStatus nextStatus = (IConstraintStatus) it.next();
+ View view = EcoreDiagramEditorUtil.findView(diagramEditPart, nextStatus.getTarget(), element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(nextStatus.getTarget(), true), nextStatus.getMessage(), nextStatus
+ .getSeverity());
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void createMarkers(IFile target, Diagnostic emfValidationStatus, DiagramEditPart diagramEditPart) {
+ if (emfValidationStatus.getSeverity() == Diagnostic.OK) {
+ return;
+ }
+ final Diagnostic rootStatus = emfValidationStatus;
+ List allDiagnostics = new ArrayList();
+ EcoreDiagramEditorUtil.LazyElement2ViewMap element2ViewMap = new EcoreDiagramEditorUtil.LazyElement2ViewMap(diagramEditPart.getDiagramView(), collectTargetElements(rootStatus, new HashSet(),
+ allDiagnostics));
+ for (Iterator it = emfValidationStatus.getChildren().iterator(); it.hasNext();) {
+ Diagnostic nextDiagnostic = (Diagnostic) it.next();
+ List data = nextDiagnostic.getData();
+ if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
+ EObject element = (EObject) data.get(0);
+ View view = EcoreDiagramEditorUtil.findView(diagramEditPart, element, element2ViewMap);
+ addMarker(diagramEditPart.getViewer(), target, view.eResource().getURIFragment(view), EMFCoreUtil.getQualifiedName(element, true), nextDiagnostic.getMessage(),
+ diagnosticToStatusSeverity(nextDiagnostic.getSeverity()));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private static void addMarker(EditPartViewer viewer, IFile target, String elementId, String location, String message, int statusSeverity) {
+ if (target == null) {
+ return;
+ }
+ EcoreMarkerNavigationProvider.addMarker(target, elementId, location, message, statusSeverity);
+ }
+
+ /**
+ * @generated
+ */
+ private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
+ if (diagnosticSeverity == Diagnostic.OK) {
+ return IStatus.OK;
+ } else if (diagnosticSeverity == Diagnostic.INFO) {
+ return IStatus.INFO;
+ } else if (diagnosticSeverity == Diagnostic.WARNING) {
+ return IStatus.WARNING;
+ } else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
+ return IStatus.ERROR;
+ }
+ return IStatus.INFO;
+ }
+
+ /**
+ * @generated
+ */
+ private static Set collectTargetElements(IStatus status, Set targetElementCollector, List allConstraintStatuses) {
+ if (status instanceof IConstraintStatus) {
+ targetElementCollector.add(((IConstraintStatus) status).getTarget());
+ allConstraintStatuses.add(status);
+ }
+ if (status.isMultiStatus()) {
+ IStatus[] children = status.getChildren();
+ for (int i = 0; i < children.length; i++) {
+ collectTargetElements(children[i], targetElementCollector, allConstraintStatuses);
+ }
+ }
+ return targetElementCollector;
+ }
+
+ /**
+ * @generated
+ */
+ private static Set collectTargetElements(Diagnostic diagnostic, Set targetElementCollector, List allDiagnostics) {
+ List data = diagnostic.getData();
+ EObject target = null;
+ if (data != null && !data.isEmpty() && data.get(0) instanceof EObject) {
+ target = (EObject) data.get(0);
+ targetElementCollector.add(target);
+ allDiagnostics.add(diagnostic);
+ }
+ if (diagnostic.getChildren() != null && !diagnostic.getChildren().isEmpty()) {
+ for (Iterator it = diagnostic.getChildren().iterator(); it.hasNext();) {
+ collectTargetElements((Diagnostic) it.next(), targetElementCollector, allDiagnostics);
+ }
+ }
+ return targetElementCollector;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramAppearancePreferencePage.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramAppearancePreferencePage.java
new file mode 100644
index 0000000..7e8604b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramAppearancePreferencePage.java
@@ -0,0 +1,29 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.preferences;
+
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage;
+
+/**
+ * @generated
+ */
+public class DiagramAppearancePreferencePage extends AppearancePreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramAppearancePreferencePage() {
+ setPreferenceStore(EcoreDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramConnectionsPreferencePage.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramConnectionsPreferencePage.java
new file mode 100644
index 0000000..e774fd5
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramConnectionsPreferencePage.java
@@ -0,0 +1,29 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.preferences;
+
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.ConnectionsPreferencePage;
+
+/**
+ * @generated
+ */
+public class DiagramConnectionsPreferencePage extends ConnectionsPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramConnectionsPreferencePage() {
+ setPreferenceStore(EcoreDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramGeneralPreferencePage.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramGeneralPreferencePage.java
new file mode 100644
index 0000000..34d603d
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramGeneralPreferencePage.java
@@ -0,0 +1,29 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.preferences;
+
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.DiagramsPreferencePage;
+
+/**
+ * @generated
+ */
+public class DiagramGeneralPreferencePage extends DiagramsPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramGeneralPreferencePage() {
+ setPreferenceStore(EcoreDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramPreferenceInitializer.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramPreferenceInitializer.java
new file mode 100644
index 0000000..7db4909
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramPreferenceInitializer.java
@@ -0,0 +1,42 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+/**
+ * @generated
+ */
+public class DiagramPreferenceInitializer extends AbstractPreferenceInitializer {
+
+ /**
+ * @generated
+ */
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = getPreferenceStore();
+ DiagramPrintingPreferencePage.initDefaults(store);
+ DiagramGeneralPreferencePage.initDefaults(store);
+ DiagramAppearancePreferencePage.initDefaults(store);
+ DiagramConnectionsPreferencePage.initDefaults(store);
+ DiagramRulersAndGridPreferencePage.initDefaults(store);
+ }
+
+ /**
+ * @generated
+ */
+ protected IPreferenceStore getPreferenceStore() {
+ return EcoreDiagramEditorPlugin.getInstance().getPreferenceStore();
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramPrintingPreferencePage.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramPrintingPreferencePage.java
new file mode 100644
index 0000000..8c71a86
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramPrintingPreferencePage.java
@@ -0,0 +1,29 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.preferences;
+
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.PrintingPreferencePage;
+
+/**
+ * @generated
+ */
+public class DiagramPrintingPreferencePage extends PrintingPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramPrintingPreferencePage() {
+ setPreferenceStore(EcoreDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramRulersAndGridPreferencePage.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramRulersAndGridPreferencePage.java
new file mode 100644
index 0000000..4bb15fb
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/preferences/DiagramRulersAndGridPreferencePage.java
@@ -0,0 +1,29 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.preferences;
+
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.gmf.runtime.diagram.ui.preferences.RulerGridPreferencePage;
+
+/**
+ * @generated
+ */
+public class DiagramRulersAndGridPreferencePage extends RulerGridPreferencePage {
+
+ /**
+ * @generated
+ */
+ public DiagramRulersAndGridPreferencePage() {
+ setPreferenceStore(EcoreDiagramEditorPlugin.getInstance().getPreferenceStore());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreEditPartProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreEditPartProvider.java
new file mode 100644
index 0000000..20681ec
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreEditPartProvider.java
@@ -0,0 +1,153 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import java.lang.ref.WeakReference;
+
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EcoreEditPartFactory;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.AbstractEditPartProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.CreateGraphicEditPartOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.IEditPartOperation;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreEditPartProvider extends AbstractEditPartProvider {
+
+ /**
+ * @generated
+ */
+ private EditPartFactory factory;
+
+ /**
+ * @generated
+ */
+ private boolean allowCaching;
+
+ /**
+ * @generated
+ */
+ private WeakReference cachedPart;
+
+ /**
+ * @generated
+ */
+ private WeakReference cachedView;
+
+ /**
+ * @generated
+ */
+ public EcoreEditPartProvider() {
+ setFactory(new EcoreEditPartFactory());
+ setAllowCaching(true);
+ }
+
+ /**
+ * @generated
+ */
+ public final EditPartFactory getFactory() {
+ return factory;
+ }
+
+ /**
+ * @generated
+ */
+ protected void setFactory(EditPartFactory factory) {
+ this.factory = factory;
+ }
+
+ /**
+ * @generated
+ */
+ public final boolean isAllowCaching() {
+ return allowCaching;
+ }
+
+ /**
+ * @generated
+ */
+ protected synchronized void setAllowCaching(boolean allowCaching) {
+ this.allowCaching = allowCaching;
+ if (!allowCaching) {
+ cachedPart = null;
+ cachedView = null;
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected IGraphicalEditPart createEditPart(View view) {
+ EditPart part = factory.createEditPart(null, view);
+ if (part instanceof IGraphicalEditPart) {
+ return (IGraphicalEditPart) part;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected IGraphicalEditPart getCachedPart(View view) {
+ if (cachedView != null && cachedView.get() == view) {
+ return (IGraphicalEditPart) cachedPart.get();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public synchronized IGraphicalEditPart createGraphicEditPart(View view) {
+ if (isAllowCaching()) {
+ IGraphicalEditPart part = getCachedPart(view);
+ cachedPart = null;
+ cachedView = null;
+ if (part != null) {
+ return part;
+ }
+ }
+ return createEditPart(view);
+ }
+
+ /**
+ * @generated
+ */
+ public synchronized boolean provides(IOperation operation) {
+ if (operation instanceof CreateGraphicEditPartOperation) {
+ View view = ((IEditPartOperation) operation).getView();
+ if (!EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(view))) {
+ return false;
+ }
+ if (isAllowCaching() && getCachedPart(view) != null) {
+ return true;
+ }
+ IGraphicalEditPart part = createEditPart(view);
+ if (part != null) {
+ if (isAllowCaching()) {
+ cachedPart = new WeakReference(part);
+ cachedView = new WeakReference(view);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreElementTypes.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreElementTypes.java
new file mode 100644
index 0000000..c898aa0
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreElementTypes.java
@@ -0,0 +1,313 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import java.util.HashSet;
+import java.util.IdentityHashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.ENamedElement;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EcoreElementTypes extends ElementInitializers {
+
+ /**
+ * @generated
+ */
+ private EcoreElementTypes() {
+ }
+
+ /**
+ * @generated
+ */
+ private static Map elements;
+
+ /**
+ * @generated
+ */
+ private static ImageRegistry imageRegistry;
+
+ /**
+ * @generated
+ */
+ private static Set KNOWN_ELEMENT_TYPES;
+
+ /**
+ * @generated
+ */
+ public static final IElementType EPackage_79 = getElementType("org.eclipse.emf.ecoretools.diagram.EPackage_79"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EClass_1001 = getElementType("org.eclipse.emf.ecoretools.diagram.EClass_1001"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EPackage_1002 = getElementType("org.eclipse.emf.ecoretools.diagram.EPackage_1002"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EAnnotation_1003 = getElementType("org.eclipse.emf.ecoretools.diagram.EAnnotation_1003"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EDataType_1004 = getElementType("org.eclipse.emf.ecoretools.diagram.EDataType_1004"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EEnum_1005 = getElementType("org.eclipse.emf.ecoretools.diagram.EEnum_1005"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EAttribute_2001 = getElementType("org.eclipse.emf.ecoretools.diagram.EAttribute_2001"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EOperation_2002 = getElementType("org.eclipse.emf.ecoretools.diagram.EOperation_2002"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EClass_2003 = getElementType("org.eclipse.emf.ecoretools.diagram.EClass_2003"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EDataType_2004 = getElementType("org.eclipse.emf.ecoretools.diagram.EDataType_2004"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EEnum_2005 = getElementType("org.eclipse.emf.ecoretools.diagram.EEnum_2005"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EEnumLiteral_2006 = getElementType("org.eclipse.emf.ecoretools.diagram.EEnumLiteral_2006"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EStringToStringMapEntry_2007 = getElementType("org.eclipse.emf.ecoretools.diagram.EStringToStringMapEntry_2007"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EAnnotationReferences_3001 = getElementType("org.eclipse.emf.ecoretools.diagram.EAnnotationReferences_3001"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EReference_3002 = getElementType("org.eclipse.emf.ecoretools.diagram.EReference_3002"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public static final IElementType EClassESuperTypes_3003 = getElementType("org.eclipse.emf.ecoretools.diagram.EClassESuperTypes_3003"); //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private static ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ imageRegistry = new ImageRegistry();
+ }
+ return imageRegistry;
+ }
+
+ /**
+ * @generated
+ */
+ private static String getImageRegistryKey(ENamedElement element) {
+ return element.getName();
+ }
+
+ /**
+ * @generated
+ */
+ private static ImageDescriptor getProvidedImageDescriptor(ENamedElement element) {
+ if (element instanceof EStructuralFeature) {
+ EStructuralFeature feature = ((EStructuralFeature) element);
+ EClass eContainingClass = feature.getEContainingClass();
+ EClassifier eType = feature.getEType();
+ if (eContainingClass != null && !eContainingClass.isAbstract()) {
+ element = eContainingClass;
+ } else if (eType instanceof EClass && !((EClass) eType).isAbstract()) {
+ element = eType;
+ }
+ }
+ if (element instanceof EClass) {
+ EClass eClass = (EClass) element;
+ if (!eClass.isAbstract()) {
+ return EcoreDiagramEditorPlugin.getInstance().getItemImageDescriptor(eClass.getEPackage().getEFactoryInstance().create(eClass));
+ }
+ }
+ // TODO : support structural features
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public static ImageDescriptor getImageDescriptor(ENamedElement element) {
+ String key = getImageRegistryKey(element);
+ ImageDescriptor imageDescriptor = getImageRegistry().getDescriptor(key);
+ if (imageDescriptor == null) {
+ imageDescriptor = getProvidedImageDescriptor(element);
+ if (imageDescriptor == null) {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+ getImageRegistry().put(key, imageDescriptor);
+ }
+ return imageDescriptor;
+ }
+
+ /**
+ * @generated
+ */
+ public static Image getImage(ENamedElement element) {
+ String key = getImageRegistryKey(element);
+ Image image = getImageRegistry().get(key);
+ if (image == null) {
+ ImageDescriptor imageDescriptor = getProvidedImageDescriptor(element);
+ if (imageDescriptor == null) {
+ imageDescriptor = ImageDescriptor.getMissingImageDescriptor();
+ }
+ getImageRegistry().put(key, imageDescriptor);
+ image = getImageRegistry().get(key);
+ }
+ return image;
+ }
+
+ /**
+ * @generated
+ */
+ public static ImageDescriptor getImageDescriptor(IAdaptable hint) {
+ ENamedElement element = getElement(hint);
+ if (element == null) {
+ return null;
+ }
+ return getImageDescriptor(element);
+ }
+
+ /**
+ * @generated
+ */
+ public static Image getImage(IAdaptable hint) {
+ ENamedElement element = getElement(hint);
+ if (element == null) {
+ return null;
+ }
+ return getImage(element);
+ }
+
+ /**
+ * Returns 'type' of the ecore object associated with the hint.
+ *
+ * @generated
+ */
+ public static ENamedElement getElement(IAdaptable hint) {
+ Object type = hint.getAdapter(IElementType.class);
+ if (elements == null) {
+ elements = new IdentityHashMap();
+
+ elements.put(EPackage_79, EcorePackage.eINSTANCE.getEPackage());
+
+ elements.put(EClass_1001, EcorePackage.eINSTANCE.getEClass());
+
+ elements.put(EPackage_1002, EcorePackage.eINSTANCE.getEPackage());
+
+ elements.put(EAnnotation_1003, EcorePackage.eINSTANCE.getEAnnotation());
+
+ elements.put(EDataType_1004, EcorePackage.eINSTANCE.getEDataType());
+
+ elements.put(EEnum_1005, EcorePackage.eINSTANCE.getEEnum());
+
+ elements.put(EAttribute_2001, EcorePackage.eINSTANCE.getEAttribute());
+
+ elements.put(EOperation_2002, EcorePackage.eINSTANCE.getEOperation());
+
+ elements.put(EClass_2003, EcorePackage.eINSTANCE.getEClass());
+
+ elements.put(EDataType_2004, EcorePackage.eINSTANCE.getEDataType());
+
+ elements.put(EEnum_2005, EcorePackage.eINSTANCE.getEEnum());
+
+ elements.put(EEnumLiteral_2006, EcorePackage.eINSTANCE.getEEnumLiteral());
+
+ elements.put(EStringToStringMapEntry_2007, EcorePackage.eINSTANCE.getEStringToStringMapEntry());
+
+ elements.put(EAnnotationReferences_3001, EcorePackage.eINSTANCE.getEAnnotation_References());
+
+ elements.put(EReference_3002, EcorePackage.eINSTANCE.getEReference());
+
+ elements.put(EClassESuperTypes_3003, EcorePackage.eINSTANCE.getEClass_ESuperTypes());
+ }
+ return (ENamedElement) elements.get(type);
+ }
+
+ /**
+ * @generated
+ */
+ private static IElementType getElementType(String id) {
+ return ElementTypeRegistry.getInstance().getType(id);
+ }
+
+ /**
+ * @generated
+ */
+ public static boolean isKnownElementType(IElementType elementType) {
+ if (KNOWN_ELEMENT_TYPES == null) {
+ KNOWN_ELEMENT_TYPES = new HashSet();
+ KNOWN_ELEMENT_TYPES.add(EPackage_79);
+ KNOWN_ELEMENT_TYPES.add(EClass_1001);
+ KNOWN_ELEMENT_TYPES.add(EPackage_1002);
+ KNOWN_ELEMENT_TYPES.add(EAnnotation_1003);
+ KNOWN_ELEMENT_TYPES.add(EDataType_1004);
+ KNOWN_ELEMENT_TYPES.add(EEnum_1005);
+ KNOWN_ELEMENT_TYPES.add(EAttribute_2001);
+ KNOWN_ELEMENT_TYPES.add(EOperation_2002);
+ KNOWN_ELEMENT_TYPES.add(EClass_2003);
+ KNOWN_ELEMENT_TYPES.add(EDataType_2004);
+ KNOWN_ELEMENT_TYPES.add(EEnum_2005);
+ KNOWN_ELEMENT_TYPES.add(EEnumLiteral_2006);
+ KNOWN_ELEMENT_TYPES.add(EStringToStringMapEntry_2007);
+ KNOWN_ELEMENT_TYPES.add(EAnnotationReferences_3001);
+ KNOWN_ELEMENT_TYPES.add(EReference_3002);
+ KNOWN_ELEMENT_TYPES.add(EClassESuperTypes_3003);
+ }
+ return KNOWN_ELEMENT_TYPES.contains(elementType);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreIconProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreIconProvider.java
new file mode 100644
index 0000000..9b62523
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreIconProvider.java
@@ -0,0 +1,43 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.ui.services.icon.GetIconOperation;
+import org.eclipse.gmf.runtime.common.ui.services.icon.IIconProvider;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EcoreIconProvider extends AbstractProvider implements IIconProvider {
+
+ /**
+ * @generated
+ */
+ public Image getIcon(IAdaptable hint, int flags) {
+ return EcoreElementTypes.getImage(hint);
+ }
+
+ /**
+ * @generated
+ */
+ public boolean provides(IOperation operation) {
+ if (operation instanceof GetIconOperation) {
+ return ((GetIconOperation) operation).execute(this) != null;
+ }
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreMarkerNavigationProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreMarkerNavigationProvider.java
new file mode 100644
index 0000000..a05b3cc
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreMarkerNavigationProvider.java
@@ -0,0 +1,93 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import java.util.Arrays;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.emf.ui.providers.marker.AbstractModelMarkerNavigationProvider;
+
+/**
+ * @generated
+ */
+public class EcoreMarkerNavigationProvider extends AbstractModelMarkerNavigationProvider {
+
+ /**
+ * @generated
+ */
+ public static final String MARKER_TYPE = EcoreDiagramEditorPlugin.ID + ".diagnostic"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ protected void doGotoMarker(IMarker marker) {
+ String elementId = marker.getAttribute(org.eclipse.gmf.runtime.common.core.resources.IMarker.ELEMENT_ID, null);
+ if (elementId == null || !(getEditor() instanceof DiagramEditor)) {
+ return;
+ }
+ DiagramEditor editor = (DiagramEditor) getEditor();
+ Map editPartRegistry = editor.getDiagramGraphicalViewer().getEditPartRegistry();
+ EObject targetView = editor.getDiagram().eResource().getEObject(elementId);
+ if (targetView == null) {
+ return;
+ }
+ EditPart targetEditPart = (EditPart) editPartRegistry.get(targetView);
+ if (targetEditPart != null) {
+ EcoreDiagramEditorUtil.selectElementsInDiagram(editor, Arrays.asList(new EditPart[] { targetEditPart }));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static void deleteMarkers(IResource resource) {
+ try {
+ resource.deleteMarkers(MARKER_TYPE, true, IResource.DEPTH_ZERO);
+ } catch (CoreException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Failed to delete validation markers", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public static IMarker addMarker(IFile file, String elementId, String location, String message, int statusSeverity) {
+ IMarker marker = null;
+ try {
+ marker = file.createMarker(MARKER_TYPE);
+ marker.setAttribute(IMarker.MESSAGE, message);
+ marker.setAttribute(IMarker.LOCATION, location);
+ marker.setAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, elementId);
+ int markerSeverity = IMarker.SEVERITY_INFO;
+ if (statusSeverity == IStatus.WARNING) {
+ markerSeverity = IMarker.SEVERITY_WARNING;
+ } else if (statusSeverity == IStatus.ERROR || statusSeverity == IStatus.CANCEL) {
+ markerSeverity = IMarker.SEVERITY_ERROR;
+ }
+ marker.setAttribute(IMarker.SEVERITY, markerSeverity);
+ } catch (CoreException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Failed to create validation marker", e); //$NON-NLS-1$
+ }
+ return marker;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreModelingAssistantProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreModelingAssistantProvider.java
new file mode 100644
index 0000000..a476a89
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreModelingAssistantProvider.java
@@ -0,0 +1,301 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageContentsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.ui.services.modelingassistant.ModelingAssistantProvider;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.ElementListSelectionDialog;
+
+/**
+ * @generated
+ */
+public class EcoreModelingAssistantProvider extends ModelingAssistantProvider {
+
+ /**
+ * @generated
+ */
+ public List getTypesForPopupBar(IAdaptable host) {
+ IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
+ if (editPart instanceof EClassEditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EAttribute_2001);
+ types.add(EcoreElementTypes.EOperation_2002);
+ return types;
+ }
+ if (editPart instanceof EAnnotationEditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EStringToStringMapEntry_2007);
+ return types;
+ }
+ if (editPart instanceof EEnumEditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EEnumLiteral_2006);
+ return types;
+ }
+ if (editPart instanceof EClass2EditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EAttribute_2001);
+ types.add(EcoreElementTypes.EOperation_2002);
+ return types;
+ }
+ if (editPart instanceof EEnum2EditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EEnumLiteral_2006);
+ return types;
+ }
+ if (editPart instanceof EPackageContentsEditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EClass_2003);
+ types.add(EcoreElementTypes.EDataType_2004);
+ types.add(EcoreElementTypes.EEnum_2005);
+ return types;
+ }
+ if (editPart instanceof EPackageEditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EClass_1001);
+ types.add(EcoreElementTypes.EPackage_1002);
+ types.add(EcoreElementTypes.EAnnotation_1003);
+ types.add(EcoreElementTypes.EDataType_1004);
+ types.add(EcoreElementTypes.EEnum_1005);
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getRelTypesOnSource(IAdaptable source) {
+ IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
+ if (sourceEditPart instanceof EClassEditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EReference_3002);
+ types.add(EcoreElementTypes.EClassESuperTypes_3003);
+ return types;
+ }
+ if (sourceEditPart instanceof EAnnotationEditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EAnnotationReferences_3001);
+ return types;
+ }
+ if (sourceEditPart instanceof EClass2EditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EReference_3002);
+ types.add(EcoreElementTypes.EClassESuperTypes_3003);
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getRelTypesOnTarget(IAdaptable target) {
+ IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
+ if (targetEditPart instanceof EClassEditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EClassESuperTypes_3003);
+ return types;
+ }
+ if (targetEditPart instanceof EClass2EditPart) {
+ List types = new ArrayList();
+ types.add(EcoreElementTypes.EClassESuperTypes_3003);
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getRelTypesOnSourceAndTarget(IAdaptable source, IAdaptable target) {
+ IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
+ IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
+ if (sourceEditPart instanceof EClassEditPart) {
+ List types = new ArrayList();
+ if (targetEditPart instanceof EClassEditPart) {
+ types.add(EcoreElementTypes.EClassESuperTypes_3003);
+ }
+ if (targetEditPart instanceof EClass2EditPart) {
+ types.add(EcoreElementTypes.EClassESuperTypes_3003);
+ }
+ return types;
+ }
+ if (sourceEditPart instanceof EAnnotationEditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (sourceEditPart instanceof EClass2EditPart) {
+ List types = new ArrayList();
+ if (targetEditPart instanceof EClassEditPart) {
+ types.add(EcoreElementTypes.EClassESuperTypes_3003);
+ }
+ if (targetEditPart instanceof EClass2EditPart) {
+ types.add(EcoreElementTypes.EClassESuperTypes_3003);
+ }
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getTypesForSource(IAdaptable target, IElementType relationshipType) {
+ IGraphicalEditPart targetEditPart = (IGraphicalEditPart) target.getAdapter(IGraphicalEditPart.class);
+ if (targetEditPart instanceof EClassEditPart) {
+ List types = new ArrayList();
+ if (relationshipType == EcoreElementTypes.EClassESuperTypes_3003) {
+ types.add(EcoreElementTypes.EClass_1001);
+ }
+ if (relationshipType == EcoreElementTypes.EClassESuperTypes_3003) {
+ types.add(EcoreElementTypes.EClass_2003);
+ }
+ return types;
+ }
+ if (targetEditPart instanceof EClass2EditPart) {
+ List types = new ArrayList();
+ if (relationshipType == EcoreElementTypes.EClassESuperTypes_3003) {
+ types.add(EcoreElementTypes.EClass_1001);
+ }
+ if (relationshipType == EcoreElementTypes.EClassESuperTypes_3003) {
+ types.add(EcoreElementTypes.EClass_2003);
+ }
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public List getTypesForTarget(IAdaptable source, IElementType relationshipType) {
+ IGraphicalEditPart sourceEditPart = (IGraphicalEditPart) source.getAdapter(IGraphicalEditPart.class);
+ if (sourceEditPart instanceof EClassEditPart) {
+ List types = new ArrayList();
+ if (relationshipType == EcoreElementTypes.EClassESuperTypes_3003) {
+ types.add(EcoreElementTypes.EClass_1001);
+ }
+ if (relationshipType == EcoreElementTypes.EClassESuperTypes_3003) {
+ types.add(EcoreElementTypes.EClass_2003);
+ }
+ return types;
+ }
+ if (sourceEditPart instanceof EAnnotationEditPart) {
+ List types = new ArrayList();
+ return types;
+ }
+ if (sourceEditPart instanceof EClass2EditPart) {
+ List types = new ArrayList();
+ if (relationshipType == EcoreElementTypes.EClassESuperTypes_3003) {
+ types.add(EcoreElementTypes.EClass_1001);
+ }
+ if (relationshipType == EcoreElementTypes.EClassESuperTypes_3003) {
+ types.add(EcoreElementTypes.EClass_2003);
+ }
+ return types;
+ }
+ return Collections.EMPTY_LIST;
+ }
+
+ /**
+ * @generated
+ */
+ public EObject selectExistingElementForSource(IAdaptable target, IElementType relationshipType) {
+ return selectExistingElement(target, getTypesForSource(target, relationshipType));
+ }
+
+ /**
+ * @generated
+ */
+ public EObject selectExistingElementForTarget(IAdaptable source, IElementType relationshipType) {
+ return selectExistingElement(source, getTypesForTarget(source, relationshipType));
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject selectExistingElement(IAdaptable host, Collection types) {
+ if (types.isEmpty()) {
+ return null;
+ }
+ IGraphicalEditPart editPart = (IGraphicalEditPart) host.getAdapter(IGraphicalEditPart.class);
+ if (editPart == null) {
+ return null;
+ }
+ Diagram diagram = (Diagram) editPart.getRoot().getContents().getModel();
+ Collection elements = new HashSet();
+ for (Iterator it = diagram.getElement().eAllContents(); it.hasNext();) {
+ EObject element = (EObject) it.next();
+ if (isApplicableElement(element, types)) {
+ elements.add(element);
+ }
+ }
+ if (elements.isEmpty()) {
+ return null;
+ }
+ return selectElement((EObject[]) elements.toArray(new EObject[elements.size()]));
+ }
+
+ /**
+ * @generated
+ */
+ protected boolean isApplicableElement(EObject element, Collection types) {
+ IElementType type = ElementTypeRegistry.getInstance().getElementType(element);
+ return types.contains(type);
+ }
+
+ /**
+ * @generated
+ */
+ protected EObject selectElement(EObject[] elements) {
+ Shell shell = Display.getCurrent().getActiveShell();
+ ILabelProvider labelProvider = new AdapterFactoryLabelProvider(EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory());
+ ElementListSelectionDialog dialog = new ElementListSelectionDialog(shell, labelProvider);
+ dialog.setMessage(Messages.EcoreModelingAssistantProviderMessage);
+ dialog.setTitle(Messages.EcoreModelingAssistantProviderTitle);
+ dialog.setMultipleSelection(false);
+ dialog.setElements(elements);
+ EObject selected = null;
+ if (dialog.open() == Window.OK) {
+ selected = (EObject) dialog.getFirstResult();
+ }
+ return selected;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreParserProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreParserProvider.java
new file mode 100644
index 0000000..b2ce40c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreParserProvider.java
@@ -0,0 +1,544 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationSourceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeInstanceClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeInstanceClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceLowerBoundUpperBoundEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.parsers.MessageFormatParser;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.GetParserOperation;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParser;
+import org.eclipse.gmf.runtime.common.ui.services.parser.IParserProvider;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.ui.services.parser.ParserHintAdapter;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreParserProvider extends AbstractProvider implements IParserProvider {
+
+ /**
+ * @generated
+ */
+ private IParser eClassName_4001Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEClassName_4001Parser() {
+ if (eClassName_4001Parser == null) {
+ eClassName_4001Parser = createEClassName_4001Parser();
+ }
+ return eClassName_4001Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEClassName_4001Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser ePackageName_4006Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEPackageName_4006Parser() {
+ if (ePackageName_4006Parser == null) {
+ ePackageName_4006Parser = createEPackageName_4006Parser();
+ }
+ return ePackageName_4006Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEPackageName_4006Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eAnnotationSource_4007Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEAnnotationSource_4007Parser() {
+ if (eAnnotationSource_4007Parser == null) {
+ eAnnotationSource_4007Parser = createEAnnotationSource_4007Parser();
+ }
+ return eAnnotationSource_4007Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEAnnotationSource_4007Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getEAnnotation_Source(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eDataTypeName_4008Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEDataTypeName_4008Parser() {
+ if (eDataTypeName_4008Parser == null) {
+ eDataTypeName_4008Parser = createEDataTypeName_4008Parser();
+ }
+ return eDataTypeName_4008Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEDataTypeName_4008Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eDataTypeInstanceClassName_4009Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEDataTypeInstanceClassName_4009Parser() {
+ if (eDataTypeInstanceClassName_4009Parser == null) {
+ eDataTypeInstanceClassName_4009Parser = createEDataTypeInstanceClassName_4009Parser();
+ }
+ return eDataTypeInstanceClassName_4009Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEDataTypeInstanceClassName_4009Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getEClassifier_InstanceClassName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<javaclass>> {0}");
+ parser.setEditorPattern("<<javaclass>> {0}");
+ parser.setEditPattern("<<javaclass>> {0}");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eEnumName_4010Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEEnumName_4010Parser() {
+ if (eEnumName_4010Parser == null) {
+ eEnumName_4010Parser = createEEnumName_4010Parser();
+ }
+ return eEnumName_4010Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEEnumName_4010Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eAttribute_2001Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEAttribute_2001Parser() {
+ if (eAttribute_2001Parser == null) {
+ eAttribute_2001Parser = createEAttribute_2001Parser();
+ }
+ return eAttribute_2001Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEAttribute_2001Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eOperation_2002Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEOperation_2002Parser() {
+ if (eOperation_2002Parser == null) {
+ eOperation_2002Parser = createEOperation_2002Parser();
+ }
+ return eOperation_2002Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEOperation_2002Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eClassName_4002Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEClassName_4002Parser() {
+ if (eClassName_4002Parser == null) {
+ eClassName_4002Parser = createEClassName_4002Parser();
+ }
+ return eClassName_4002Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEClassName_4002Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eDataTypeName_4003Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEDataTypeName_4003Parser() {
+ if (eDataTypeName_4003Parser == null) {
+ eDataTypeName_4003Parser = createEDataTypeName_4003Parser();
+ }
+ return eDataTypeName_4003Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEDataTypeName_4003Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eDataTypeInstanceClassName_4004Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEDataTypeInstanceClassName_4004Parser() {
+ if (eDataTypeInstanceClassName_4004Parser == null) {
+ eDataTypeInstanceClassName_4004Parser = createEDataTypeInstanceClassName_4004Parser();
+ }
+ return eDataTypeInstanceClassName_4004Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEDataTypeInstanceClassName_4004Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getEClassifier_InstanceClassName(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("<<javaclass>> {0}");
+ parser.setEditorPattern("<<javaclass>> {0}");
+ parser.setEditPattern("<<javaclass>> {0}");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eEnumName_4005Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEEnumName_4005Parser() {
+ if (eEnumName_4005Parser == null) {
+ eEnumName_4005Parser = createEEnumName_4005Parser();
+ }
+ return eEnumName_4005Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEEnumName_4005Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eEnumLiteral_2006Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEEnumLiteral_2006Parser() {
+ if (eEnumLiteral_2006Parser == null) {
+ eEnumLiteral_2006Parser = createEEnumLiteral_2006Parser();
+ }
+ return eEnumLiteral_2006Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEEnumLiteral_2006Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eStringToStringMapEntry_2007Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEStringToStringMapEntry_2007Parser() {
+ if (eStringToStringMapEntry_2007Parser == null) {
+ eStringToStringMapEntry_2007Parser = createEStringToStringMapEntry_2007Parser();
+ }
+ return eStringToStringMapEntry_2007Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEStringToStringMapEntry_2007Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getEStringToStringMapEntry_Key(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eReferenceName_4011Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEReferenceName_4011Parser() {
+ if (eReferenceName_4011Parser == null) {
+ eReferenceName_4011Parser = createEReferenceName_4011Parser();
+ }
+ return eReferenceName_4011Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEReferenceName_4011Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getENamedElement_Name(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ private IParser eReferenceLowerBoundUpperBound_4012Parser;
+
+ /**
+ * @generated
+ */
+ private IParser getEReferenceLowerBoundUpperBound_4012Parser() {
+ if (eReferenceLowerBoundUpperBound_4012Parser == null) {
+ eReferenceLowerBoundUpperBound_4012Parser = createEReferenceLowerBoundUpperBound_4012Parser();
+ }
+ return eReferenceLowerBoundUpperBound_4012Parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser createEReferenceLowerBoundUpperBound_4012Parser() {
+ EAttribute[] features = new EAttribute[] { EcorePackage.eINSTANCE.getETypedElement_LowerBound(), EcorePackage.eINSTANCE.getETypedElement_UpperBound(), };
+ MessageFormatParser parser = new MessageFormatParser(features);
+ parser.setViewPattern("{0}..{1,choice,-1#*|-1<{1}}");
+ parser.setEditorPattern("{0}..{1,choice,-1#*|-1<{1}}");
+ parser.setEditPattern("{0}..{1}");
+ return parser;
+ }
+
+ /**
+ * @generated
+ */
+ protected IParser getParser(int visualID) {
+ switch (visualID) {
+ case EClassNameEditPart.VISUAL_ID:
+ return getEClassName_4001Parser();
+ case EPackageNameEditPart.VISUAL_ID:
+ return getEPackageName_4006Parser();
+ case EAnnotationSourceEditPart.VISUAL_ID:
+ return getEAnnotationSource_4007Parser();
+ case EDataTypeNameEditPart.VISUAL_ID:
+ return getEDataTypeName_4008Parser();
+ case EDataTypeInstanceClassEditPart.VISUAL_ID:
+ return getEDataTypeInstanceClassName_4009Parser();
+ case EEnumNameEditPart.VISUAL_ID:
+ return getEEnumName_4010Parser();
+ case EAttributeEditPart.VISUAL_ID:
+ return getEAttribute_2001Parser();
+ case EOperationEditPart.VISUAL_ID:
+ return getEOperation_2002Parser();
+ case EClassName2EditPart.VISUAL_ID:
+ return getEClassName_4002Parser();
+ case EDataTypeName2EditPart.VISUAL_ID:
+ return getEDataTypeName_4003Parser();
+ case EDataTypeInstanceClass2EditPart.VISUAL_ID:
+ return getEDataTypeInstanceClassName_4004Parser();
+ case EEnumName2EditPart.VISUAL_ID:
+ return getEEnumName_4005Parser();
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return getEEnumLiteral_2006Parser();
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ return getEStringToStringMapEntry_2007Parser();
+ case EReferenceNameEditPart.VISUAL_ID:
+ return getEReferenceName_4011Parser();
+ case EReferenceLowerBoundUpperBoundEditPart.VISUAL_ID:
+ return getEReferenceLowerBoundUpperBound_4012Parser();
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public IParser getParser(IAdaptable hint) {
+ String vid = (String) hint.getAdapter(String.class);
+ if (vid != null) {
+ return getParser(EcoreVisualIDRegistry.getVisualID(vid));
+ }
+ View view = (View) hint.getAdapter(View.class);
+ if (view != null) {
+ return getParser(EcoreVisualIDRegistry.getVisualID(view));
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ public boolean provides(IOperation operation) {
+ if (operation instanceof GetParserOperation) {
+ IAdaptable hint = ((GetParserOperation) operation).getHint();
+ if (EcoreElementTypes.getElement(hint) == null) {
+ return false;
+ }
+ return getParser(hint) != null;
+ }
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ public static class HintAdapter extends ParserHintAdapter {
+
+ /**
+ * @generated
+ */
+ private final IElementType elementType;
+
+ /**
+ * @generated
+ */
+ public HintAdapter(IElementType type, EObject object, String parserHint) {
+ super(object, parserHint);
+ assert type != null;
+ elementType = type;
+ }
+
+ /**
+ * @generated
+ */
+ public Object getAdapter(Class adapter) {
+ if (IElementType.class.equals(adapter)) {
+ return elementType;
+ }
+ return super.getAdapter(adapter);
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreShortcutsDecoratorProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreShortcutsDecoratorProvider.java
new file mode 100644
index 0000000..b941e0b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreShortcutsDecoratorProvider.java
@@ -0,0 +1,99 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ShapeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EcoreShortcutsDecoratorProvider extends AbstractProvider implements IDecoratorProvider {
+
+ /**
+ * @generated
+ */
+ public static final String SHORTCUTS_DECORATOR_ID = "shortcuts"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ public boolean provides(IOperation operation) {
+ if (!(operation instanceof CreateDecoratorsOperation)) {
+ return false;
+ }
+ IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();
+ View view = (View) decoratorTarget.getAdapter(View.class);
+ return view != null && EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(view));
+ }
+
+ /**
+ * @generated
+ */
+ public void createDecorators(IDecoratorTarget decoratorTarget) {
+ View view = (View) decoratorTarget.getAdapter(View.class);
+ if (view != null) {
+ EAnnotation annotation = view.getEAnnotation("Shortcut"); //$NON-NLS-1$
+ if (annotation != null) {
+ decoratorTarget.installDecorator(SHORTCUTS_DECORATOR_ID, new ShortcutsDecorator(decoratorTarget));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected class ShortcutsDecorator extends AbstractDecorator {
+
+ /**
+ * @generated
+ */
+ public ShortcutsDecorator(IDecoratorTarget decoratorTarget) {
+ super(decoratorTarget);
+ }
+
+ /**
+ * @generated
+ */
+ public void activate() {
+ refresh();
+ }
+
+ /**
+ * @generated
+ */
+ public void refresh() {
+ removeDecoration();
+ EditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class);
+ Image image = EcoreDiagramEditorPlugin.getInstance().getBundledImage("icons/shortcut.gif"); //$NON-NLS-1$
+ if (editPart instanceof ShapeEditPart) {
+ setDecoration(getDecoratorTarget().addShapeDecoration(image, IDecoratorTarget.Direction.SOUTH_WEST, 0, false));
+ } else if (editPart instanceof ConnectionEditPart) {
+ setDecoration(getDecoratorTarget().addConnectionDecoration(image, 50, false));
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreValidationDecoratorProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreValidationDecoratorProvider.java
new file mode 100644
index 0000000..eb6541a
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreValidationDecoratorProvider.java
@@ -0,0 +1,417 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.draw2d.FlowLayout;
+import org.eclipse.draw2d.Label;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+import org.eclipse.gef.EditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.common.ui.resources.FileChangeManager;
+import org.eclipse.gmf.runtime.common.ui.resources.IFileObserver;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditDomain;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.AbstractDecorator;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.CreateDecoratorsOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecorator;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorProvider;
+import org.eclipse.gmf.runtime.diagram.ui.services.decorator.IDecoratorTarget;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.MapModeUtil;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @generated
+ */
+public class EcoreValidationDecoratorProvider extends AbstractProvider implements IDecoratorProvider {
+
+ /**
+ * @generated
+ */
+ private static final String KEY = "validationStatus"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private static final String MARKER_TYPE = EcoreDiagramEditorPlugin.ID + ".diagnostic"; //$NON-NLS-1$
+
+ /**
+ * @generated
+ */
+ private static MarkerObserver fileObserver;
+
+ /**
+ * @generated
+ */
+ private static Map/* <String, List<IDecorator>> */allDecorators = new HashMap();
+
+ /**
+ * @generated
+ */
+ public void createDecorators(IDecoratorTarget decoratorTarget) {
+ EditPart editPart = (EditPart) decoratorTarget.getAdapter(EditPart.class);
+ if (editPart instanceof GraphicalEditPart || editPart instanceof AbstractConnectionEditPart) {
+ Object model = editPart.getModel();
+ if ((model instanceof View)) {
+ View view = (View) model;
+ if (!(view instanceof Edge) && !view.isSetElement()) {
+ return;
+ }
+ }
+ EditDomain ed = editPart.getViewer().getEditDomain();
+ if (!(ed instanceof DiagramEditDomain)) {
+ return;
+ }
+ if (((DiagramEditDomain) ed).getEditorPart() instanceof EcoreDiagramEditor) {
+ decoratorTarget.installDecorator(KEY, new StatusDecorator(decoratorTarget));
+ }
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public boolean provides(IOperation operation) {
+ if (!(operation instanceof CreateDecoratorsOperation)) {
+ return false;
+ }
+ IDecoratorTarget decoratorTarget = ((CreateDecoratorsOperation) operation).getDecoratorTarget();
+ View view = (View) decoratorTarget.getAdapter(View.class);
+ return view != null && EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(view));
+ }
+
+ /**
+ * @generated
+ */
+ public static void refreshDecorators(View view) {
+ refreshDecorators(ViewUtil.getIdStr(view), view.getDiagram());
+ }
+
+ /**
+ * @generated
+ */
+ private static void refreshDecorators(String viewId, Diagram diagram) {
+ final List decorators = viewId != null ? (List) allDecorators.get(viewId) : null;
+ if (decorators == null || decorators.isEmpty() || diagram == null) {
+ return;
+ }
+ final Diagram fdiagram = diagram;
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+
+ public void run() {
+ try {
+ TransactionUtil.getEditingDomain(fdiagram).runExclusive(new Runnable() {
+
+ public void run() {
+ for (Iterator it = decorators.iterator(); it.hasNext();) {
+ IDecorator decorator = (IDecorator) it.next();
+ decorator.refresh();
+ }
+ }
+ });
+ } catch (Exception e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Decorator refresh failure", e); //$NON-NLS-1$
+ }
+ }
+ });
+ }
+
+ /**
+ * @generated
+ */
+ public static class StatusDecorator extends AbstractDecorator {
+
+ /**
+ * @generated
+ */
+ private String viewId;
+
+ /**
+ * @generated
+ */
+ public StatusDecorator(IDecoratorTarget decoratorTarget) {
+ super(decoratorTarget);
+ try {
+ final View view = (View) getDecoratorTarget().getAdapter(View.class);
+ TransactionUtil.getEditingDomain(view).runExclusive(new Runnable() {
+
+ public void run() {
+ StatusDecorator.this.viewId = view != null ? ViewUtil.getIdStr(view) : null;
+ }
+ });
+ } catch (Exception e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("ViewID access failure", e); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void refresh() {
+ removeDecoration();
+ View view = (View) getDecoratorTarget().getAdapter(View.class);
+ if (view == null || view.eResource() == null) {
+ return;
+ }
+ EditPart editPart = (EditPart) getDecoratorTarget().getAdapter(EditPart.class);
+ if (editPart == null || editPart.getViewer() == null) {
+ return;
+ }
+
+ // query for all the validation markers of the current resource
+ String elementId = ViewUtil.getIdStr(view);
+ if (elementId == null) {
+ return;
+ }
+ int severity = IMarker.SEVERITY_INFO;
+ IMarker foundMarker = null;
+ IResource resource = WorkspaceSynchronizer.getFile(view.eResource());
+ if (resource == null || !resource.exists()) {
+ return;
+ }
+ IMarker[] markers = null;
+ try {
+ markers = resource.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
+ } catch (CoreException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Validation markers refresh failure", e); //$NON-NLS-1$
+ }
+ if (markers == null || markers.length == 0) {
+ return;
+ }
+ Label toolTip = null;
+ for (int i = 0; i < markers.length; i++) {
+ IMarker marker = markers[i];
+ String attribute = marker.getAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, ""); //$NON-NLS-1$
+ if (attribute.equals(elementId)) {
+ int nextSeverity = marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
+ Image nextImage = getImage(nextSeverity);
+ if (foundMarker == null) {
+ foundMarker = marker;
+ toolTip = new Label(marker.getAttribute(IMarker.MESSAGE, ""), //$NON-NLS-1$
+ nextImage);
+ } else {
+ if (toolTip.getChildren().isEmpty()) {
+ Label comositeLabel = new Label();
+ FlowLayout fl = new FlowLayout(false);
+ fl.setMinorSpacing(0);
+ comositeLabel.setLayoutManager(fl);
+ comositeLabel.add(toolTip);
+ toolTip = comositeLabel;
+ }
+ toolTip.add(new Label(marker.getAttribute(IMarker.MESSAGE, ""), //$NON-NLS-1$
+ nextImage));
+ }
+ severity = (nextSeverity > severity) ? nextSeverity : severity;
+ }
+ }
+ if (foundMarker == null) {
+ return;
+ }
+
+ // add decoration
+ if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
+ if (view instanceof Edge) {
+ setDecoration(getDecoratorTarget().addConnectionDecoration(getImage(severity), 50, true));
+ } else {
+ int margin = -1;
+ if (editPart instanceof org.eclipse.gef.GraphicalEditPart) {
+ margin = MapModeUtil.getMapMode(((org.eclipse.gef.GraphicalEditPart) editPart).getFigure()).DPtoLP(margin);
+ }
+ setDecoration(getDecoratorTarget().addShapeDecoration(getImage(severity), IDecoratorTarget.Direction.NORTH_EAST, margin, true));
+ }
+ getDecoration().setToolTip(toolTip);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ private Image getImage(int severity) {
+ String imageName = ISharedImages.IMG_OBJS_ERROR_TSK;
+ switch (severity) {
+ case IMarker.SEVERITY_ERROR:
+ imageName = ISharedImages.IMG_OBJS_ERROR_TSK;
+ break;
+ case IMarker.SEVERITY_WARNING:
+ imageName = ISharedImages.IMG_OBJS_WARN_TSK;
+ break;
+ default:
+ imageName = ISharedImages.IMG_OBJS_INFO_TSK;
+ }
+ return PlatformUI.getWorkbench().getSharedImages().getImage(imageName);
+ }
+
+ /**
+ * @generated
+ */
+ public void activate() {
+ if (viewId == null) {
+ return;
+ }
+
+ // add self to global decorators registry
+ List list = (List) allDecorators.get(viewId);
+ if (list == null) {
+ list = new ArrayList(2);
+ list.add(this);
+ allDecorators.put(viewId, list);
+ } else if (!list.contains(this)) {
+ list.add(this);
+ }
+
+ // start listening to changes in resources
+ View view = (View) getDecoratorTarget().getAdapter(View.class);
+ if (view == null) {
+ return;
+ }
+ Diagram diagramView = view.getDiagram();
+ if (diagramView == null) {
+ return;
+ }
+ if (fileObserver == null) {
+ FileChangeManager.getInstance().addFileObserver(fileObserver = new MarkerObserver(diagramView));
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void deactivate() {
+ if (viewId == null) {
+ return;
+ }
+
+ // remove self from global decorators registry
+ List list = (List) allDecorators.get(viewId);
+ if (list != null) {
+ list.remove(this);
+ if (list.isEmpty()) {
+ allDecorators.remove(viewId);
+ }
+ }
+
+ // stop listening to changes in resources if there are no more
+ // decorators
+ if (fileObserver != null && allDecorators.isEmpty()) {
+ FileChangeManager.getInstance().removeFileObserver(fileObserver);
+ fileObserver = null;
+ }
+ super.deactivate();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ static class MarkerObserver implements IFileObserver {
+
+ /**
+ * @generated
+ */
+ private Diagram diagram;
+
+ /**
+ * @generated
+ */
+ private MarkerObserver(Diagram diagram) {
+ this.diagram = diagram;
+ }
+
+ /**
+ * @generated
+ */
+ public void handleFileRenamed(IFile oldFile, IFile file) {
+ }
+
+ /**
+ * @generated
+ */
+ public void handleFileMoved(IFile oldFile, IFile file) {
+ }
+
+ /**
+ * @generated
+ */
+ public void handleFileDeleted(IFile file) {
+ }
+
+ /**
+ * @generated
+ */
+ public void handleFileChanged(IFile file) {
+ }
+
+ /**
+ * @generated
+ */
+ public void handleMarkerAdded(IMarker marker) {
+ if (marker.getAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, null) != null) {
+ handleMarkerChanged(marker);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ public void handleMarkerDeleted(IMarker marker, Map attributes) {
+ String viewId = (String) attributes.get(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID);
+ refreshDecorators(viewId, diagram);
+ }
+
+ /**
+ * @generated
+ */
+ public void handleMarkerChanged(IMarker marker) {
+ if (!MARKER_TYPE.equals(getType(marker))) {
+ return;
+ }
+ String viewId = marker.getAttribute(org.eclipse.gmf.runtime.common.ui.resources.IMarker.ELEMENT_ID, ""); //$NON-NLS-1$
+ refreshDecorators(viewId, diagram);
+ }
+
+ /**
+ * @generated
+ */
+ private String getType(IMarker marker) {
+ try {
+ return marker.getType();
+ } catch (CoreException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Validation marker refresh failure", e); //$NON-NLS-1$
+ return ""; //$NON-NLS-1$
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreValidationProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreValidationProvider.java
new file mode 100644
index 0000000..46279d4
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreValidationProvider.java
@@ -0,0 +1,94 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.part.ValidateAction;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gmf.runtime.common.ui.services.action.contributionitem.AbstractContributionItemProvider;
+import org.eclipse.gmf.runtime.common.ui.util.IWorkbenchPartDescriptor;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.action.IAction;
+
+/**
+ * @generated
+ */
+public class EcoreValidationProvider extends AbstractContributionItemProvider {
+
+ /**
+ * @generated
+ */
+ private static boolean constraintsActive = false;
+
+ /**
+ * @generated
+ */
+ public static boolean shouldConstraintsBePrivate() {
+ return false;
+ }
+
+ /**
+ * @generated
+ */
+ protected IAction createAction(String actionId, IWorkbenchPartDescriptor partDescriptor) {
+ if (ValidateAction.VALIDATE_ACTION_KEY.equals(actionId)) {
+ return new ValidateAction(partDescriptor);
+ }
+ return super.createAction(actionId, partDescriptor);
+ }
+
+ /**
+ * @generated
+ */
+ public static void runWithConstraints(View view, Runnable op) {
+ final Runnable fop = op;
+ Runnable task = new Runnable() {
+
+ public void run() {
+ try {
+ constraintsActive = true;
+ fop.run();
+ } finally {
+ constraintsActive = false;
+ }
+ }
+ };
+ TransactionalEditingDomain txDomain = TransactionUtil.getEditingDomain(view);
+ if (txDomain != null) {
+ try {
+ txDomain.runExclusive(task);
+ } catch (Exception e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Validation action failed", e); //$NON-NLS-1$
+ }
+ } else {
+ task.run();
+ }
+ }
+
+ /**
+ * @generated
+ */
+ static boolean isInDefaultEditorContext(Object object) {
+ if (shouldConstraintsBePrivate() && !constraintsActive) {
+ return false;
+ }
+ if (object instanceof View) {
+ return constraintsActive && EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID((View) object));
+ }
+ return true;
+ }
+
+} // EcoreValidationProvider
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreViewProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreViewProvider.java
new file mode 100644
index 0000000..52445e8
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/EcoreViewProvider.java
@@ -0,0 +1,370 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationDetailsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationSourceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributes2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperations2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperationsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeInstanceClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeInstanceClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiterals2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackage2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageContentsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReference2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceLowerBoundUpperBoundEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EAnnotationDetailsViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EAnnotationReferencesViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EAnnotationSourceViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EAnnotationViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EAttributeViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EClass2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EClassAttributes2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EClassAttributesViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EClassName2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EClassNameViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EClassOperations2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EClassOperationsViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EClassViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EDataType2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EDataTypeInstanceClass2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EDataTypeInstanceClassViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EDataTypeName2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EDataTypeNameViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EDataTypeViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EEnum2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EEnumLiteralViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EEnumLiterals2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EEnumLiteralsViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EEnumName2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EEnumNameViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EEnumViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EOperationViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EPackage2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EPackageContentsViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EPackageNameViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EPackageViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EReference2ViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EReferenceLowerBoundUpperBoundViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EReferenceNameViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EReferenceViewFactory;
+import org.eclipse.emf.ecoretools.diagram.view.factories.EStringToStringMapEntryViewFactory;
+import org.eclipse.gmf.runtime.diagram.core.providers.AbstractViewProvider;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.IHintedType;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EcoreViewProvider extends AbstractViewProvider {
+
+ /**
+ * @generated
+ */
+ protected Class getDiagramViewClass(IAdaptable semanticAdapter, String diagramKind) {
+ EObject semanticElement = getSemanticElement(semanticAdapter);
+ if (EPackageEditPart.MODEL_ID.equals(diagramKind) && EcoreVisualIDRegistry.getDiagramVisualID(semanticElement) != -1) {
+ return EPackageViewFactory.class;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Class getNodeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
+ if (containerView == null) {
+ return null;
+ }
+ IElementType elementType = getSemanticElementType(semanticAdapter);
+ 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 = EcoreVisualIDRegistry.getNodeVisualID(containerView, domainElement);
+ } else {
+ visualID = EcoreVisualIDRegistry.getVisualID(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 (!EcoreElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
+ return null; // foreign element type
+ }
+ String elementTypeHint = ((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 != EcoreVisualIDRegistry.getNodeVisualID(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 (!EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(containerView))) {
+ return null; // foreign diagram
+ }
+ switch (visualID) {
+ case EClassEditPart.VISUAL_ID:
+ case EAnnotationEditPart.VISUAL_ID:
+ case EAttributeEditPart.VISUAL_ID:
+ case EOperationEditPart.VISUAL_ID:
+ case EDataType2EditPart.VISUAL_ID:
+ case EEnum2EditPart.VISUAL_ID:
+ case EEnumLiteralEditPart.VISUAL_ID:
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ case EPackage2EditPart.VISUAL_ID:
+ case EDataTypeEditPart.VISUAL_ID:
+ case EEnumEditPart.VISUAL_ID:
+ case EClass2EditPart.VISUAL_ID:
+ if (domainElement == null || visualID != EcoreVisualIDRegistry.getNodeVisualID(containerView, domainElement)) {
+ return null; // visual id in semantic hint should
+ // match visual id for domain element
+ }
+ break;
+ case EClassNameEditPart.VISUAL_ID:
+ case EClassAttributesEditPart.VISUAL_ID:
+ case EClassOperationsEditPart.VISUAL_ID:
+ if (EClassEditPart.VISUAL_ID != EcoreVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EPackageNameEditPart.VISUAL_ID:
+ case EPackageContentsEditPart.VISUAL_ID:
+ if (EPackage2EditPart.VISUAL_ID != EcoreVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EAnnotationSourceEditPart.VISUAL_ID:
+ case EAnnotationDetailsEditPart.VISUAL_ID:
+ if (EAnnotationEditPart.VISUAL_ID != EcoreVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EDataTypeNameEditPart.VISUAL_ID:
+ case EDataTypeInstanceClassEditPart.VISUAL_ID:
+ if (EDataTypeEditPart.VISUAL_ID != EcoreVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EEnumNameEditPart.VISUAL_ID:
+ case EEnumLiterals2EditPart.VISUAL_ID:
+ if (EEnumEditPart.VISUAL_ID != EcoreVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EClassName2EditPart.VISUAL_ID:
+ case EClassAttributes2EditPart.VISUAL_ID:
+ case EClassOperations2EditPart.VISUAL_ID:
+ if (EClass2EditPart.VISUAL_ID != EcoreVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EDataTypeName2EditPart.VISUAL_ID:
+ case EDataTypeInstanceClass2EditPart.VISUAL_ID:
+ if (EDataType2EditPart.VISUAL_ID != EcoreVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EEnumName2EditPart.VISUAL_ID:
+ case EEnumLiteralsEditPart.VISUAL_ID:
+ if (EEnum2EditPart.VISUAL_ID != EcoreVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ case EReferenceNameEditPart.VISUAL_ID:
+ case EReferenceLowerBoundUpperBoundEditPart.VISUAL_ID:
+ if (EReferenceEditPart.VISUAL_ID != EcoreVisualIDRegistry.getVisualID(containerView) || containerView.getElement() != domainElement) {
+ return null; // wrong container
+ }
+ break;
+ default:
+ return null;
+ }
+ }
+ }
+ return getNodeViewClass(containerView, visualID);
+ }
+
+ /**
+ * @generated
+ */
+ protected Class getNodeViewClass(View containerView, int visualID) {
+ if (containerView == null || !EcoreVisualIDRegistry.canCreateNode(containerView, visualID)) {
+ return null;
+ }
+ switch (visualID) {
+ case EClassEditPart.VISUAL_ID:
+ return EClassViewFactory.class;
+ case EClassNameEditPart.VISUAL_ID:
+ return EClassNameViewFactory.class;
+ case EPackage2EditPart.VISUAL_ID:
+ return EPackage2ViewFactory.class;
+ case EPackageNameEditPart.VISUAL_ID:
+ return EPackageNameViewFactory.class;
+ case EAnnotationEditPart.VISUAL_ID:
+ return EAnnotationViewFactory.class;
+ case EAnnotationSourceEditPart.VISUAL_ID:
+ return EAnnotationSourceViewFactory.class;
+ case EDataTypeEditPart.VISUAL_ID:
+ return EDataTypeViewFactory.class;
+ case EDataTypeNameEditPart.VISUAL_ID:
+ return EDataTypeNameViewFactory.class;
+ case EDataTypeInstanceClassEditPart.VISUAL_ID:
+ return EDataTypeInstanceClassViewFactory.class;
+ case EEnumEditPart.VISUAL_ID:
+ return EEnumViewFactory.class;
+ case EEnumNameEditPart.VISUAL_ID:
+ return EEnumNameViewFactory.class;
+ case EAttributeEditPart.VISUAL_ID:
+ return EAttributeViewFactory.class;
+ case EOperationEditPart.VISUAL_ID:
+ return EOperationViewFactory.class;
+ case EClass2EditPart.VISUAL_ID:
+ return EClass2ViewFactory.class;
+ case EClassName2EditPart.VISUAL_ID:
+ return EClassName2ViewFactory.class;
+ case EDataType2EditPart.VISUAL_ID:
+ return EDataType2ViewFactory.class;
+ case EDataTypeName2EditPart.VISUAL_ID:
+ return EDataTypeName2ViewFactory.class;
+ case EDataTypeInstanceClass2EditPart.VISUAL_ID:
+ return EDataTypeInstanceClass2ViewFactory.class;
+ case EEnum2EditPart.VISUAL_ID:
+ return EEnum2ViewFactory.class;
+ case EEnumName2EditPart.VISUAL_ID:
+ return EEnumName2ViewFactory.class;
+ case EEnumLiteralEditPart.VISUAL_ID:
+ return EEnumLiteralViewFactory.class;
+ case EStringToStringMapEntryEditPart.VISUAL_ID:
+ return EStringToStringMapEntryViewFactory.class;
+ case EClassAttributesEditPart.VISUAL_ID:
+ return EClassAttributesViewFactory.class;
+ case EClassOperationsEditPart.VISUAL_ID:
+ return EClassOperationsViewFactory.class;
+ case EPackageContentsEditPart.VISUAL_ID:
+ return EPackageContentsViewFactory.class;
+ case EClassAttributes2EditPart.VISUAL_ID:
+ return EClassAttributes2ViewFactory.class;
+ case EClassOperations2EditPart.VISUAL_ID:
+ return EClassOperations2ViewFactory.class;
+ case EEnumLiteralsEditPart.VISUAL_ID:
+ return EEnumLiteralsViewFactory.class;
+ case EAnnotationDetailsEditPart.VISUAL_ID:
+ return EAnnotationDetailsViewFactory.class;
+ case EEnumLiterals2EditPart.VISUAL_ID:
+ return EEnumLiterals2ViewFactory.class;
+ case EReferenceNameEditPart.VISUAL_ID:
+ return EReferenceNameViewFactory.class;
+ case EReferenceLowerBoundUpperBoundEditPart.VISUAL_ID:
+ return EReferenceLowerBoundUpperBoundViewFactory.class;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected Class getEdgeViewClass(IAdaptable semanticAdapter, View containerView, String semanticHint) {
+ IElementType elementType = getSemanticElementType(semanticAdapter);
+ if (!EcoreElementTypes.isKnownElementType(elementType) || (!(elementType instanceof IHintedType))) {
+ return null; // foreign element type
+ }
+ String elementTypeHint = ((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 = EcoreVisualIDRegistry.getVisualID(elementTypeHint);
+ EObject domainElement = getSemanticElement(semanticAdapter);
+ if (domainElement != null && visualID != EcoreVisualIDRegistry.getLinkWithClassVisualID(domainElement)) {
+ return null; // visual id for link EClass should match visual id
+ // from element type
+ }
+ return getEdgeViewClass(visualID);
+ }
+
+ /**
+ * @generated
+ */
+ protected Class getEdgeViewClass(int visualID) {
+ switch (visualID) {
+ case EAnnotationReferencesEditPart.VISUAL_ID:
+ return EAnnotationReferencesViewFactory.class;
+ case EReferenceEditPart.VISUAL_ID:
+ return EReferenceViewFactory.class;
+ case EReference2EditPart.VISUAL_ID:
+ return EReference2ViewFactory.class;
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ private IElementType getSemanticElementType(IAdaptable semanticAdapter) {
+ if (semanticAdapter == null) {
+ return null;
+ }
+ return (IElementType) semanticAdapter.getAdapter(IElementType.class);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/ElementInitializers.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/ElementInitializers.java
new file mode 100644
index 0000000..7c06dc7
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/providers/ElementInitializers.java
@@ -0,0 +1,170 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.providers;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecoretools.diagram.expressions.EcoreAbstractExpression;
+import org.eclipse.emf.ecoretools.diagram.expressions.EcoreOCLFactory;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+
+/**
+ * @generated
+ */
+public class ElementInitializers {
+
+ /**
+ * @generated
+ */
+ public static class Initializers {
+
+ /**
+ * @generated
+ */
+ public static final IObjectInitializer EReference_3002 = new ObjectInitializer(EcorePackage.eINSTANCE.getEReference()) {
+
+ protected void init() {
+ add(createExpressionFeatureInitializer(EcorePackage.eINSTANCE.getEReference_Containment(), EcoreOCLFactory.getExpression("false", //$NON-NLS-1$
+ EcorePackage.eINSTANCE.getEReference())));
+ }
+ }; // EReference_3002 ObjectInitializer
+
+ /**
+ * @generated
+ */
+ private Initializers() {
+ }
+
+ /**
+ * @generated
+ */
+ public static interface IObjectInitializer {
+
+ /**
+ * @generated
+ */
+ public void init(EObject instance);
+ }
+
+ /**
+ * @generated
+ */
+ public static abstract class ObjectInitializer implements IObjectInitializer {
+
+ /**
+ * @generated
+ */
+ final EClass element;
+
+ /**
+ * @generated
+ */
+ private List featureInitializers = new ArrayList();
+
+ /**
+ * @generated
+ */
+ ObjectInitializer(EClass element) {
+ this.element = element;
+ init();
+ }
+
+ /**
+ * @generated
+ */
+ protected abstract void init();
+
+ /**
+ * @generated
+ */
+ protected final IFeatureInitializer add(IFeatureInitializer initializer) {
+ featureInitializers.add(initializer);
+ return initializer;
+ }
+
+ /**
+ * @generated
+ */
+ public void init(EObject instance) {
+ for (Iterator it = featureInitializers.iterator(); it.hasNext();) {
+ IFeatureInitializer nextExpr = (IFeatureInitializer) it.next();
+ try {
+ nextExpr.init(instance);
+ } catch (RuntimeException e) {
+ EcoreDiagramEditorPlugin.getInstance().logError("Feature initialization failed", e); //$NON-NLS-1$
+ }
+ }
+ }
+ } // end of ObjectInitializer
+
+ /**
+ * @generated
+ */
+ interface IFeatureInitializer {
+
+ /**
+ * @generated
+ */
+ void init(EObject contextInstance);
+ }
+
+ /**
+ * @generated
+ */
+ static IFeatureInitializer createNewElementFeatureInitializer(EStructuralFeature initFeature, ObjectInitializer[] newObjectInitializers) {
+ final EStructuralFeature feature = initFeature;
+ final ObjectInitializer[] initializers = newObjectInitializers;
+ return new IFeatureInitializer() {
+
+ public void init(EObject contextInstance) {
+ for (int i = 0; i < initializers.length; i++) {
+ EObject newInstance = initializers[i].element.getEPackage().getEFactoryInstance().create(initializers[i].element);
+ if (feature.isMany()) {
+ ((Collection) contextInstance.eGet(feature)).add(newInstance);
+ } else {
+ contextInstance.eSet(feature, newInstance);
+ }
+ initializers[i].init(newInstance);
+ }
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ static IFeatureInitializer createExpressionFeatureInitializer(EStructuralFeature initFeature, EcoreAbstractExpression valueExpression) {
+ final EStructuralFeature feature = initFeature;
+ final EcoreAbstractExpression expression = valueExpression;
+ return new IFeatureInitializer() {
+
+ public void init(EObject contextInstance) {
+ expression.assignTo(feature, contextInstance);
+ }
+ };
+ }
+
+ /**
+ * @generated
+ */
+ static class Java {
+ }
+ } // end of Initializers
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/sheet/EcorePropertySection.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/sheet/EcorePropertySection.java
new file mode 100644
index 0000000..7d1486b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/sheet/EcorePropertySection.java
@@ -0,0 +1,122 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.sheet;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
+import org.eclipse.emf.edit.provider.IItemPropertySource;
+import org.eclipse.emf.edit.ui.provider.PropertySource;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.properties.sections.AdvancedPropertySection;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IPropertySourceProvider;
+
+/**
+ * @generated
+ */
+public class EcorePropertySection extends AdvancedPropertySection implements IPropertySourceProvider {
+
+ /**
+ * @generated
+ */
+ public IPropertySource getPropertySource(Object object) {
+ if (object instanceof IPropertySource) {
+ return (IPropertySource) object;
+ }
+ AdapterFactory af = getAdapterFactory(object);
+ if (af != null) {
+ IItemPropertySource ips = (IItemPropertySource) af.adapt(object, IItemPropertySource.class);
+ if (ips != null) {
+ return new PropertySource(object, ips);
+ }
+ }
+ if (object instanceof IAdaptable) {
+ return (IPropertySource) ((IAdaptable) object).getAdapter(IPropertySource.class);
+ }
+ return null;
+ }
+
+ /**
+ * @generated
+ */
+ protected IPropertySourceProvider getPropertySourceProvider() {
+ return this;
+ }
+
+ /**
+ * Modify/unwrap selection.
+ *
+ * @generated NOT
+ */
+ protected Object transformSelection(Object selected) {
+
+ if (selected instanceof EditPart) {
+ Object model = ((EditPart) selected).getModel();
+ return model instanceof View ? ((View) model).getElement() : null;
+ }
+ if (selected instanceof View) {
+ return ((View) selected).getElement();
+ }
+ if (selected instanceof IAdaptable) {
+ View view = (View) ((IAdaptable) selected).getAdapter(View.class);
+ if (view != null) {
+ return view.getElement();
+ }
+ }
+ return selected;
+ }
+
+ /**
+ * @generated
+ */
+ public void setInput(IWorkbenchPart part, ISelection selection) {
+ if (selection.isEmpty() || false == selection instanceof StructuredSelection) {
+ super.setInput(part, selection);
+ return;
+ }
+ final StructuredSelection structuredSelection = ((StructuredSelection) selection);
+ ArrayList transformedSelection = new ArrayList(structuredSelection.size());
+ for (Iterator it = structuredSelection.iterator(); it.hasNext();) {
+ Object r = transformSelection(it.next());
+ if (r != null) {
+ transformedSelection.add(r);
+ }
+ }
+ super.setInput(part, new StructuredSelection(transformedSelection));
+ }
+
+ /**
+ * @generated
+ */
+ protected AdapterFactory getAdapterFactory(Object object) {
+ if (getEditingDomain() instanceof AdapterFactoryEditingDomain) {
+ return ((AdapterFactoryEditingDomain) getEditingDomain()).getAdapterFactory();
+ }
+ TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(object);
+ if (editingDomain != null) {
+ return ((AdapterFactoryEditingDomain) editingDomain).getAdapterFactory();
+ }
+ return null;
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/sheet/EcoreSheetLabelProvider.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/sheet/EcoreSheetLabelProvider.java
new file mode 100644
index 0000000..f694ed6
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/sheet/EcoreSheetLabelProvider.java
@@ -0,0 +1,91 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.sheet;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.navigator.EcoreNavigatorGroup;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @generated
+ */
+public class EcoreSheetLabelProvider extends DecoratingLabelProvider {
+
+ /**
+ * @generated
+ */
+ public EcoreSheetLabelProvider() {
+ super(new AdapterFactoryLabelProvider(EcoreDiagramEditorPlugin.getInstance().getItemProvidersAdapterFactory()), null);
+ }
+
+ /**
+ * @generated
+ */
+ public String getText(Object element) {
+ Object selected = unwrap(element);
+ if (selected instanceof EcoreNavigatorGroup) {
+ return ((EcoreNavigatorGroup) selected).getGroupName();
+ }
+ return super.getText(selected);
+ }
+
+ /**
+ * @generated
+ */
+ public Image getImage(Object element) {
+ return super.getImage(unwrap(element));
+ }
+
+ /**
+ * @generated
+ */
+ private Object unwrap(Object element) {
+ if (element instanceof IStructuredSelection) {
+ return unwrap(((IStructuredSelection) element).getFirstElement());
+ }
+ if (element instanceof EditPart) {
+ return unwrapEditPart((EditPart) element);
+ }
+ if (element instanceof IAdaptable) {
+ View view = (View) ((IAdaptable) element).getAdapter(View.class);
+ if (view != null) {
+ return unwrapView(view);
+ }
+ }
+ return element;
+ }
+
+ /**
+ * @generated
+ */
+ private Object unwrapEditPart(EditPart p) {
+ if (p.getModel() instanceof View) {
+ return unwrapView((View) p.getModel());
+ }
+ return p.getModel();
+ }
+
+ /**
+ * @generated
+ */
+ private Object unwrapView(View view) {
+ return view.getElement() == null ? view : view.getElement();
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationDetailsViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationDetailsViewFactory.java
new file mode 100644
index 0000000..91bc7ba
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationDetailsViewFactory.java
@@ -0,0 +1,76 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationDetailsEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAnnotationDetailsViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EAnnotationDetailsEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationReferencesViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationReferencesViewFactory.java
new file mode 100644
index 0000000..f5e9d53
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationReferencesViewFactory.java
@@ -0,0 +1,65 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationReferencesEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.notation.ConnectorStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.Routing;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EAnnotationReferencesViewFactory extends ConnectionViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ConnectorStyle connectorStyle = (ConnectorStyle) view.getStyle(NotationPackage.Literals.CONNECTOR_STYLE);
+ connectorStyle.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ connectorStyle.setRouting(Routing.MANUAL_LITERAL);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createConnectorStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EAnnotationReferencesEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationSourceViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationSourceViewFactory.java
new file mode 100644
index 0000000..cd63b33
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationSourceViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAnnotationSourceViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationViewFactory.java
new file mode 100644
index 0000000..db7851c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAnnotationViewFactory.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationDetailsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAnnotationSourceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.ShapeStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EAnnotationViewFactory extends AbstractShapeViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ static final Color THIS_BACK = new Color(null, 232, 211, 223);
+
+ static final int fontHeight = 10;
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
+ style.setFillColor(FigureUtilities.colorToInteger(THIS_BACK));
+ style.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontHeight(fontHeight);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EAnnotationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", EPackageEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EAnnotationSourceEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EAnnotationDetailsEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAttributeViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAttributeViewFactory.java
new file mode 100644
index 0000000..202c185
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EAttributeViewFactory.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EAttributeEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EAttributeViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EAttributeEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClass2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClass2ViewFactory.java
new file mode 100644
index 0000000..d769920
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClass2ViewFactory.java
@@ -0,0 +1,83 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributes2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperations2EditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.ShapeStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EClass2ViewFactory extends AbstractShapeViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ static final Color THIS_BACK = new Color(null, 248, 249, 209);
+
+ static final int fontHeight = 10;
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
+ style.setFillColor(FigureUtilities.colorToInteger(THIS_BACK));
+ style.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontHeight(fontHeight);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EClass2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EClassName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EClassAttributes2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EClassOperations2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassAttributes2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassAttributes2ViewFactory.java
new file mode 100644
index 0000000..bdb9e86
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassAttributes2ViewFactory.java
@@ -0,0 +1,76 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributes2EditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassAttributes2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EClassAttributes2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassAttributesViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassAttributesViewFactory.java
new file mode 100644
index 0000000..b2b32a8
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassAttributesViewFactory.java
@@ -0,0 +1,76 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributesEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassAttributesViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EClassAttributesEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassESuperTypesViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassESuperTypesViewFactory.java
new file mode 100644
index 0000000..9b19324
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassESuperTypesViewFactory.java
@@ -0,0 +1,50 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassESuperTypesEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassESuperTypesViewFactory extends ConnectionViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createConnectorStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EClassESuperTypesEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassName2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassName2ViewFactory.java
new file mode 100644
index 0000000..f0418c1
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassName2ViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassNameViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassNameViewFactory.java
new file mode 100644
index 0000000..0d9d34c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassNameViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassOperations2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassOperations2ViewFactory.java
new file mode 100644
index 0000000..a2bc789
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassOperations2ViewFactory.java
@@ -0,0 +1,76 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperations2EditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassOperations2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EClassOperations2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassOperationsViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassOperationsViewFactory.java
new file mode 100644
index 0000000..0e67a51
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassOperationsViewFactory.java
@@ -0,0 +1,76 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperationsEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EClassOperationsViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EClassOperationsEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassViewFactory.java
new file mode 100644
index 0000000..58c52d0
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EClassViewFactory.java
@@ -0,0 +1,92 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassAttributesEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EClassOperationsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.ShapeStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EClassViewFactory extends AbstractShapeViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ static final Color THIS_BACK = new Color(null, 248, 249, 209);
+
+ static final int fontHeight = 10;
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
+ style.setFillColor(FigureUtilities.colorToInteger(THIS_BACK));
+ style.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontHeight(fontHeight);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EClassEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", EPackageEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EClassNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EClassAttributesEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EClassOperationsEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataType2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataType2ViewFactory.java
new file mode 100644
index 0000000..88c91dc
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataType2ViewFactory.java
@@ -0,0 +1,81 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataType2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeInstanceClass2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.ShapeStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EDataType2ViewFactory extends AbstractShapeViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ static final Color THIS_BACK = new Color(null, 248, 249, 209);
+
+ static final int fontHeight = 10;
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
+ style.setFillColor(FigureUtilities.colorToInteger(THIS_BACK));
+ style.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontHeight(fontHeight);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EDataType2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EDataTypeName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EDataTypeInstanceClass2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeInstanceClass2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeInstanceClass2ViewFactory.java
new file mode 100644
index 0000000..0681677
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeInstanceClass2ViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EDataTypeInstanceClass2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeInstanceClassViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeInstanceClassViewFactory.java
new file mode 100644
index 0000000..88a1d48
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeInstanceClassViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EDataTypeInstanceClassViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeName2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeName2ViewFactory.java
new file mode 100644
index 0000000..f773591
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeName2ViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EDataTypeName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeNameViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeNameViewFactory.java
new file mode 100644
index 0000000..af43a46
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeNameViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EDataTypeNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeViewFactory.java
new file mode 100644
index 0000000..b935182
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EDataTypeViewFactory.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeInstanceClassEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EDataTypeNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.ShapeStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EDataTypeViewFactory extends AbstractShapeViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ static final Color THIS_BACK = new Color(null, 248, 249, 209);
+
+ static final int fontHeight = 10;
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
+ style.setFillColor(FigureUtilities.colorToInteger(THIS_BACK));
+ style.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontHeight(fontHeight);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EDataTypeEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", EPackageEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EDataTypeNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EDataTypeInstanceClassEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnum2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnum2ViewFactory.java
new file mode 100644
index 0000000..d335559
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnum2ViewFactory.java
@@ -0,0 +1,81 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnum2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumName2EditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.ShapeStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EEnum2ViewFactory extends AbstractShapeViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ static final Color THIS_BACK = new Color(null, 248, 249, 209);
+
+ static final int fontHeight = 10;
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
+ style.setFillColor(FigureUtilities.colorToInteger(THIS_BACK));
+ style.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontHeight(fontHeight);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EEnum2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EEnumName2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EEnumLiteralsEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiteralViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiteralViewFactory.java
new file mode 100644
index 0000000..784df1f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiteralViewFactory.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumLiteralViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EEnumLiteralEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiterals2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiterals2ViewFactory.java
new file mode 100644
index 0000000..7fb19b1
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiterals2ViewFactory.java
@@ -0,0 +1,76 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiterals2EditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumLiterals2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EEnumLiterals2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiteralsViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiteralsViewFactory.java
new file mode 100644
index 0000000..231e5a4
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumLiteralsViewFactory.java
@@ -0,0 +1,76 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiteralsEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumLiteralsViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EEnumLiteralsEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumName2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumName2ViewFactory.java
new file mode 100644
index 0000000..d97fce8
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumName2ViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumName2ViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumNameViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumNameViewFactory.java
new file mode 100644
index 0000000..945ca38
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumNameViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EEnumNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumViewFactory.java
new file mode 100644
index 0000000..1c8dd42
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EEnumViewFactory.java
@@ -0,0 +1,90 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumLiterals2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EEnumNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.ShapeStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EEnumViewFactory extends AbstractShapeViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ static final Color THIS_BACK = new Color(null, 248, 249, 209);
+
+ static final int fontHeight = 10;
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
+ style.setFillColor(FigureUtilities.colorToInteger(THIS_BACK));
+ style.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontHeight(fontHeight);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EEnumEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", EPackageEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EEnumNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EEnumLiterals2EditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EOperationViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EOperationViewFactory.java
new file mode 100644
index 0000000..5b25a28
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EOperationViewFactory.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EOperationEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EOperationViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EOperationEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackage2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackage2ViewFactory.java
new file mode 100644
index 0000000..33c7e48
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackage2ViewFactory.java
@@ -0,0 +1,95 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackage2EditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageContentsEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractShapeViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.MultiDiagramLinkStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.ShapeStyle;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EPackage2ViewFactory extends AbstractShapeViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ static final Color THIS_BACK = new Color(null, 190, 166, 206);
+
+ static final int fontHeight = 10;
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ShapeStyle style = (ShapeStyle) view.getStyle(NotationPackage.Literals.SHAPE_STYLE);
+ style.setFillColor(FigureUtilities.colorToInteger(THIS_BACK));
+ style.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontColor(FigureUtilities.colorToInteger(THIS_FORE));
+ style.setFontHeight(fontHeight);
+ }
+
+ /**
+ * @generated NOT
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createShapeStyle());
+ {
+ MultiDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE.createMultiDiagramLinkStyle();
+ styles.add(diagramFacet);
+ }
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EPackage2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ if (!EPackageEditPart.MODEL_ID.equals(EcoreVisualIDRegistry.getModelID(containerView))) {
+ EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
+ shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
+ shortcutAnnotation.getDetails().put("modelID", EPackageEditPart.MODEL_ID); //$NON-NLS-1$
+ view.getEAnnotations().add(shortcutAnnotation);
+ }
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EPackageNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EPackageContentsEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageContentsViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageContentsViewFactory.java
new file mode 100644
index 0000000..8967c5f
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageContentsViewFactory.java
@@ -0,0 +1,76 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageContentsEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.DrawerStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.TitleStyle;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackageContentsViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDrawerStyle());
+ styles.add(NotationFactory.eINSTANCE.createSortingStyle());
+ styles.add(NotationFactory.eINSTANCE.createFilteringStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EPackageContentsEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ setupCompartmentTitle(view);
+ setupCompartmentCollapsed(view);
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentTitle(View view) {
+ TitleStyle titleStyle = (TitleStyle) view.getStyle(NotationPackage.eINSTANCE.getTitleStyle());
+ if (titleStyle != null) {
+ titleStyle.setShowTitle(true);
+ }
+ }
+
+ /**
+ * @generated
+ */
+ protected void setupCompartmentCollapsed(View view) {
+ DrawerStyle drawerStyle = (DrawerStyle) view.getStyle(NotationPackage.eINSTANCE.getDrawerStyle());
+ if (drawerStyle != null) {
+ drawerStyle.setCollapsed(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageNameViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageNameViewFactory.java
new file mode 100644
index 0000000..0addd00
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageNameViewFactory.java
@@ -0,0 +1,33 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.BasicNodeViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackageNameViewFactory extends BasicNodeViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageViewFactory.java
new file mode 100644
index 0000000..9d1a424
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EPackageViewFactory.java
@@ -0,0 +1,43 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.DiagramViewFactory;
+import org.eclipse.gmf.runtime.notation.MeasurementUnit;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EPackageViewFactory extends DiagramViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createDiagramStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected MeasurementUnit getMeasurementUnit() {
+ return MeasurementUnit.PIXEL_LITERAL;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReference2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReference2ViewFactory.java
new file mode 100644
index 0000000..7f652ef
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReference2ViewFactory.java
@@ -0,0 +1,65 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReference2EditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.notation.ConnectorStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.Routing;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EReference2ViewFactory extends ConnectionViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ ConnectorStyle connectorStyle = (ConnectorStyle) view.getStyle(NotationPackage.Literals.CONNECTOR_STYLE);
+ connectorStyle.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ connectorStyle.setRouting(Routing.RECTILINEAR_LITERAL);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createConnectorStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EReference2EditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceLowerBoundUpperBound2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceLowerBoundUpperBound2ViewFactory.java
new file mode 100644
index 0000000..a20ccba
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceLowerBoundUpperBound2ViewFactory.java
@@ -0,0 +1,51 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EReferenceLowerBoundUpperBound2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(10));
+ location.setY(mapMode.DPtoLP(10));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceLowerBoundUpperBoundViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceLowerBoundUpperBoundViewFactory.java
new file mode 100644
index 0000000..5ab3afa
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceLowerBoundUpperBoundViewFactory.java
@@ -0,0 +1,51 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EReferenceLowerBoundUpperBoundViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(10));
+ location.setY(mapMode.DPtoLP(10));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceName2ViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceName2ViewFactory.java
new file mode 100644
index 0000000..041b120
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceName2ViewFactory.java
@@ -0,0 +1,51 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.util.MeasurementUnitHelper;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode;
+import org.eclipse.gmf.runtime.notation.Location;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EReferenceName2ViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ Location location = (Location) view.getLayoutConstraint();
+ IMapMode mapMode = MeasurementUnitHelper.getMapMode(containerView.getDiagram().getMeasurementUnit());
+ location.setX(mapMode.DPtoLP(-10));
+ location.setY(mapMode.DPtoLP(-10));
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceNameViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceNameViewFactory.java
new file mode 100644
index 0000000..d73954b
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceNameViewFactory.java
@@ -0,0 +1,44 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EReferenceNameViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ public View createView(IAdaptable semanticAdapter, View containerView, String semanticHint, int index, boolean persisted, PreferencesHint preferencesHint) {
+ Node view = (Node) super.createView(semanticAdapter, containerView, semanticHint, index, persisted, preferencesHint);
+ return view;
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceViewFactory.java
new file mode 100644
index 0000000..dafac63
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EReferenceViewFactory.java
@@ -0,0 +1,83 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceLowerBoundUpperBoundEditPart;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EReferenceNameEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.ConnectionViewFactory;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.EObjectAdapter;
+import org.eclipse.gmf.runtime.notation.ConnectorStyle;
+import org.eclipse.gmf.runtime.notation.FontStyle;
+import org.eclipse.gmf.runtime.notation.NotationFactory;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.Routing;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @generated
+ */
+public class EReferenceViewFactory extends ConnectionViewFactory {
+
+ static final Color THIS_FORE = new Color(null, 0, 0, 0);
+
+ static final int fontHeight = 10;
+
+ @Override
+ protected void initializeFromPreferences(View view) {
+ super.initializeFromPreferences(view);
+ FontStyle fontStyle = (FontStyle) view.getStyle(NotationPackage.Literals.FONT_STYLE);
+ fontStyle.setFontHeight(fontHeight);
+ fontStyle.setFontColor(FigureUtilities.colorToInteger(THIS_FORE));
+ ConnectorStyle connectorStyle = (ConnectorStyle) view.getStyle(NotationPackage.Literals.CONNECTOR_STYLE);
+ connectorStyle.setLineColor(FigureUtilities.colorToInteger(THIS_FORE));
+ connectorStyle.setRouting(Routing.MANUAL_LITERAL);
+ }
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ styles.add(NotationFactory.eINSTANCE.createConnectorStyle());
+ styles.add(NotationFactory.eINSTANCE.createFontStyle());
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EReferenceEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ IAdaptable eObjectAdapter = null;
+ EObject eObject = (EObject) semanticAdapter.getAdapter(EObject.class);
+ if (eObject != null) {
+ eObjectAdapter = new EObjectAdapter(eObject);
+ }
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EReferenceNameEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ getViewService().createNode(eObjectAdapter, view, EcoreVisualIDRegistry.getType(EReferenceLowerBoundUpperBoundEditPart.VISUAL_ID), ViewUtil.APPEND, true, getPreferencesHint());
+ }
+}
diff --git a/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EStringToStringMapEntryViewFactory.java b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EStringToStringMapEntryViewFactory.java
new file mode 100644
index 0000000..79c528c
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecoretools.diagram/src/org/eclipse/emf/ecoretools/diagram/view/factories/EStringToStringMapEntryViewFactory.java
@@ -0,0 +1,47 @@
+/***********************************************************************
+ * Copyright (c) 2007 Anyware Technologies
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Anyware Technologies - initial API and implementation
+ **********************************************************************/
+
+package org.eclipse.emf.ecoretools.diagram.view.factories;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EStringToStringMapEntryEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+import org.eclipse.gmf.runtime.diagram.ui.view.factories.AbstractLabelViewFactory;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @generated
+ */
+public class EStringToStringMapEntryViewFactory extends AbstractLabelViewFactory {
+
+ /**
+ * @generated
+ */
+ protected List createStyles(View view) {
+ List styles = new ArrayList();
+ return styles;
+ }
+
+ /**
+ * @generated
+ */
+ protected void decorateView(View containerView, View view, IAdaptable semanticAdapter, String semanticHint, int index, boolean persisted) {
+ if (semanticHint == null) {
+ semanticHint = EcoreVisualIDRegistry.getType(EStringToStringMapEntryEditPart.VISUAL_ID);
+ view.setType(semanticHint);
+ }
+ super.decorateView(containerView, view, semanticAdapter, semanticHint, index, persisted);
+ }
+}

Back to the top