https://bugs.eclipse.org/bugs/show_bug.cgi?id=77412
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/plugin.properties b/deprecated/examples/org.eclipse.uml2.examples.ui/plugin.properties
index d6242f1..f648125 100644
--- a/deprecated/examples/org.eclipse.uml2.examples.ui/plugin.properties
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/plugin.properties
@@ -8,7 +8,7 @@
# * Contributors:
# * IBM - initial API and implementation
# *
-# * $Id: plugin.properties,v 1.8 2005/04/06 19:59:55 khussey Exp $
+# * $Id: plugin.properties,v 1.9 2005/04/14 17:32:07 khussey Exp $
# */
# NLS_MESSAGEFORMAT_VAR
@@ -25,31 +25,36 @@
_UI_editorActions_label = UML2 Examples UI Editor Actions
-_UI_ElementMenu_label = Ele&ment
-_UI_ExtensionMenu_label = E&xtension
+_UI_ElementMenu_label = &Element
_UI_PackageMenu_label = P&ackage
_UI_ProfileMenu_label = Pr&ofile
_UI_StereotypeMenu_label = &Stereotype
-_UI_ApplyProfileAction_label = &Apply...
-_UI_ApplyStereotypeAction_label = &Apply...
-_UI_CreateExtensionAction_label = &Create...
-_UI_DefineProfileAction_label = &Define
-_UI_ImportPrimitiveTypeAction_label = &Import Primitive Type...
-_UI_ReferenceMetaclassAction_label = &Reference Metaclass...
-_UI_UnapplyProfileAction_label = &Unapply...
-_UI_UnapplyStereotypeAction_label = &Unapply...
+_UI_ApplyStereotypeAction_label = &Apply Stereotype...
_UI_DestroyElementAction_label = &Destroy
+_UI_UnapplyStereotypeAction_label = &Unapply Stereotype...
+
+_UI_ApplyProfileAction_label = &Apply Profile...
+_UI_ImportPrimitiveTypeAction_label = &Import Primitive Type...
+_UI_UnapplyProfileAction_label = &Unapply Profile...
+
+_UI_CreateExtensionAction_label = &Create Extension...
+
+_UI_DefineProfileAction_label = &Define
+_UI_ReferenceMetaclassAction_label = &Reference Metaclass...
+
+_UI_ApplyStereotypeActionCommand_label = Apply Stereotype(s)
+_UI_DestroyElementActionCommand_label = Destroy Element ''{0}''
+_UI_UnapplyStereotypeActionCommand_label = Unapply Stereotype(s)
_UI_ApplyProfileActionCommand_label = Apply Profile(s)
-_UI_ApplyStereotypeActionCommand_label = Apply Stereotype(s)
-_UI_CreateExtensionActionCommand_label = Create Extension(s)
-_UI_DefineProfileActionCommand_label = Define Profile ''{0}''
_UI_ImportPrimitiveTypeActionCommand_label = Import Primitive Type(s)
-_UI_ReferenceMetaclassActionCommand_label = Reference Metaclass(es)
_UI_UnapplyProfileActionCommand_label = Unapply Profile(s)
-_UI_UnapplyStereotypeActionCommand_label = Unapply Stereotype(s)
-_UI_DestroyElementActionCommand_label = Destroy Element ''{0}''
+
+_UI_DefineProfileActionCommand_label = Define Profile ''{0}''
+_UI_ReferenceMetaclassActionCommand_label = Reference Metaclass(es)
+
+_UI_CreateExtensionActionCommand_label = Create Extension(s)
# ==============================================================================
# %%% END OF TRANSLATED PROPERTIES %%%
@@ -72,3 +77,32 @@
_UI_ConvertFromEcoreAction_label = &Convert to UML2...
_UI_ConvertFromEcoreActionCommand_label = Convert Ecore Package ''{0}'' to UML2
_UI_ConvertingFromEcore_message = Converting Ecore package ''{0}'' to UML2...
+
+_UI_ModelMenu_label = &Model
+_UI_GenerateMenu_label = &Generate
+
+_UI_ConvertToMetamodelAction_label = Convert to &Metamodel
+_UI_ConvertToMetamodelActionCommand_label = Convert Model {0} to a Metamodel
+_UI_ConvertToModelLibraryAction_label = Convert to Model &Library
+_UI_ConvertToModelLibraryActionCommand_label = Convert Model {0} to a Model Library
+
+_UI_GenerateEcorePrimitiveTypesAction_label = &Ecore Primitive Types
+_UI_GenerateEcorePrimitiveTypesActionCommand_label = Generate Ecore Primitive Types into Model {0}
+_UI_GenerateJavaPrimitiveTypesAction_label = &Java Primitive Types
+_UI_GenerateJavaPrimitiveTypesActionCommand_label = Generate Java Primitive Types into Model {0}
+_UI_GenerateUML2PrimitiveTypesAction_label = &UML2 Primitive Types
+_UI_GenerateUML2PrimitiveTypesActionCommand_label = Generate UML2 Primitive Types into Model {0}
+
+_UI_ExternalizeLabelsAction_label = &Externalize Labels
+
+_UI_ExternalizeKeywordsAction_label = &Externalize Keywords
+
+_UI_GenerateBasicStereotypesAction_label = &Basic Stereotypes
+_UI_GenerateBasicStereotypesActionCommand_label = Generate Basic Stereotypes into Profile {0}
+_UI_GenerateIntermediateStereotypesAction_label = &Intermediate Stereotypes
+_UI_GenerateIntermediateStereotypesActionCommand_label = Generate Intermediate Stereotypes into Profile {0}
+_UI_GenerateCompleteStereotypesAction_label = &Complete Stereotypes
+_UI_GenerateCompleteStereotypesActionCommand_label = Generate Complete Stereotypes into Profile {0}
+_UI_GenerateEcoreStereotypesAction_label = &Ecore Stereotypes
+_UI_GenerateEcoreStereotypesActionCommand_label = Generate Ecore Stereotypes into Profile {0}
+
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/plugin.xml b/deprecated/examples/org.eclipse.uml2.examples.ui/plugin.xml
index a51bc9b..dd00b5a 100644
--- a/deprecated/examples/org.eclipse.uml2.examples.ui/plugin.xml
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/plugin.xml
@@ -12,7 +12,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: plugin.xml,v 1.14 2005/04/06 19:59:55 khussey Exp $
+ * $Id: plugin.xml,v 1.15 2005/04/14 17:32:07 khussey Exp $
*/
-->
@@ -44,184 +44,328 @@
targetID="org.eclipse.uml2.presentation.UML2EditorID"
id="org.eclipse.uml2.examples.UML2EditorContribution">
<menu
- label="%_UI_ElementMenu_label"
+ label="%_UI_StereotypeMenu_label"
path="org.eclipse.uml2MenuID/additions"
- id="org.eclipse.uml2.examples.ui.ElementMenuID">
+ id="org.eclipse.uml2.examples.ui.StereotypeMenuID">
<separator name="additions"/>
</menu>
+ <action
+ label="%_UI_CreateExtensionAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.CreateExtensionAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.StereotypeMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.CreateExtensionAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Stereotype">
+ </objectClass>
+ </enablement>
+ </action>
<menu
- label="%_UI_ExtensionMenu_label"
+ label="%_UI_ProfileMenu_label"
path="org.eclipse.uml2MenuID/additions"
- id="org.eclipse.uml2.examples.ui.ExtensionMenuID">
+ id="org.eclipse.uml2.examples.ui.ProfileMenuID">
<separator name="additions"/>
</menu>
+ <action
+ label="%_UI_ReferenceMetaclassAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ReferenceMetaclassAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.ReferenceMetaclassAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Profile">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_ExternalizeKeywordsAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ExternalizeKeywordsAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.ExternalizeKeywordsAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Profile">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_DefineProfileAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.DefineProfileAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.DefineProfileAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Profile">
+ </objectClass>
+ </enablement>
+ </action>
+ <menu
+ label="%_UI_GenerateMenu_label"
+ path="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/additions"
+ id="org.eclipse.uml2.examples.ui.GenerateProfileMenuID">
+ <separator name="additions"/>
+ </menu>
+ <action
+ label="%_UI_GenerateEcoreStereotypesAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.GenerateEcoreStereotypesAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/org.eclipse.uml2.examples.ui.GenerateProfileMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.GenerateEcoreStereotypesAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Profile">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_GenerateCompleteStereotypesAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.GenerateCompleteStereotypesAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/org.eclipse.uml2.examples.ui.GenerateProfileMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.GenerateCompleteStereotypesAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Profile">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_GenerateIntermediateStereotypesAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.GenerateIntermediateStereotypesAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/org.eclipse.uml2.examples.ui.GenerateProfileMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.GenerateIntermediateStereotypesAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Profile">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_GenerateBasicStereotypesAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.GenerateBasicStereotypesAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/org.eclipse.uml2.examples.ui.GenerateProfileMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.GenerateBasicStereotypesAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Profile">
+ </objectClass>
+ </enablement>
+ </action>
<menu
label="%_UI_PackageMenu_label"
path="org.eclipse.uml2MenuID/additions"
id="org.eclipse.uml2.examples.ui.PackageMenuID">
<separator name="additions"/>
</menu>
+ <action
+ label="%_UI_UnapplyProfileAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.UnapplyProfileAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.PackageMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.UnapplyProfileAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Package">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_MergePackageAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.MergePackageAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.PackageMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.MergePackageAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Package">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_ImportPrimitiveTypeAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ImportPrimitiveTypeAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.PackageMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.ImportPrimitiveTypeAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Package">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_ExternalizeLabelsAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ExternalizeLabelsAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.PackageMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.ExternalizeLabelsAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Package">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_ApplyProfileAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ApplyProfileAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.PackageMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.ApplyProfileAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Package">
+ </objectClass>
+ </enablement>
+ </action>
<menu
- label="%_UI_ProfileMenu_label"
+ label="%_UI_ModelMenu_label"
path="org.eclipse.uml2MenuID/additions"
- id="org.eclipse.uml2.examples.ui.ProfileMenuID">
+ id="org.eclipse.uml2.examples.ui.ModelMenuID">
<separator name="additions"/>
- </menu>
- <menu
- label="%_UI_StereotypeMenu_label"
- path="org.eclipse.uml2MenuID/additions"
- id="org.eclipse.uml2.examples.ui.StereotypeMenuID">
- <separator name="additions"/>
- </menu>
- <action
- label="%_UI_ApplyProfileAction_label"
- class="org.eclipse.uml2.examples.ui.actions.ApplyProfileAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.ApplyProfileAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Package">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_ApplyStereotypeAction_label"
- class="org.eclipse.uml2.examples.ui.actions.ApplyStereotypeAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.StereotypeMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.ApplyStereotypeAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Element">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_CreateExtensionAction_label"
- class="org.eclipse.uml2.examples.ui.actions.CreateExtensionAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ExtensionMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.CreateExtensionAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Stereotype">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_DefineProfileAction_label"
- class="org.eclipse.uml2.examples.ui.actions.DefineProfileAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.DefineProfileAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Profile">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_ImportPrimitiveTypeAction_label"
- class="org.eclipse.uml2.examples.ui.actions.ImportPrimitiveTypeAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.PackageMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.ImportPrimitiveTypeAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Package">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_MergePackageAction_label"
- class="org.eclipse.uml2.examples.ui.actions.MergePackageAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.PackageMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.MergePackageAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Package">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_ReferenceMetaclassAction_label"
- class="org.eclipse.uml2.examples.ui.actions.ReferenceMetaclassAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.ReferenceMetaclassAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Profile">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_UnapplyProfileAction_label"
- class="org.eclipse.uml2.examples.ui.actions.UnapplyProfileAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ProfileMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.UnapplyProfileAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Package">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_UnapplyStereotypeAction_label"
- class="org.eclipse.uml2.examples.ui.actions.UnapplyStereotypeAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.StereotypeMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.UnapplyStereotypeAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Element">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_DestroyElementAction_label"
- class="org.eclipse.uml2.examples.ui.actions.DestroyElementAction"
- menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ElementMenuID/additions"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.DestroyElementAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Element">
- </objectClass>
- </enablement>
- </action>
- <action
- label="%_UI_ConvertToEcoreAction_label"
- class="org.eclipse.uml2.examples.ui.actions.ConvertToEcoreAction"
- menubarPath="org.eclipse.uml2MenuID/additions-end"
- enablesFor="1"
- id="org.eclipse.uml2.examples.uiConvertToEcoreAction">
- <enablement>
- <objectClass
- name="org.eclipse.uml2.Package">
- </objectClass>
- </enablement>
- </action>
- </editorContribution>
- <editorContribution
- targetID="org.eclipse.emf.ecore.presentation.EcoreEditorID"
- id="org.eclipse.uml2.examples.ui.EcoreEditorContribution">
- <action
- label="%_UI_ConvertFromEcoreAction_label"
- class="org.eclipse.uml2.examples.ui.actions.ConvertFromEcoreAction"
- menubarPath="org.eclipse.emf.ecoreMenuID/additions-end"
- enablesFor="1"
- id="org.eclipse.uml2.examples.ui.ConvertFromEcoreAction">
- <enablement>
- <objectClass
- name="org.eclipse.emf.ecore.EPackage">
- </objectClass>
- </enablement>
- </action>
- </editorContribution>
- </extension>
+ </menu>
+ <action
+ label="%_UI_ConvertToModelLibraryAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ConvertToModelLibraryAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ModelMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.ConvertToModelLibraryAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Model">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_ConvertToMetamodelAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ConvertToMetamodelAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ModelMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.ConvertToMetamodelAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Model">
+ </objectClass>
+ </enablement>
+ </action>
+ <menu
+ label="%_UI_GenerateMenu_label"
+ path="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ModelMenuID/additions"
+ id="org.eclipse.uml2.examples.ui.GenerateModelMenuID">
+ <separator name="additions"/>
+ </menu>
+ <action
+ label="%_UI_GenerateUML2PrimitiveTypesAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.GenerateUML2PrimitiveTypesAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ModelMenuID/org.eclipse.uml2.examples.ui.GenerateModelMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.GenerateUML2PrimitiveTypesAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Model">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_GenerateJavaPrimitiveTypesAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.GenerateJavaPrimitiveTypesAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ModelMenuID/org.eclipse.uml2.examples.ui.GenerateModelMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.GenerateJavaPrimitiveTypesAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Model">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_GenerateEcorePrimitiveTypesAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.GenerateEcorePrimitiveTypesAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ModelMenuID/org.eclipse.uml2.examples.ui.GenerateModelMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.GenerateEcorePrimitiveTypesAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Model">
+ </objectClass>
+ </enablement>
+ </action>
+ <menu
+ label="%_UI_ElementMenu_label"
+ path="org.eclipse.uml2MenuID/additions"
+ id="org.eclipse.uml2.examples.ui.ElementMenuID">
+ <separator name="additions"/>
+ </menu>
+ <action
+ label="%_UI_UnapplyStereotypeAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.UnapplyStereotypeAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ElementMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.UnapplyStereotypeAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Element">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_DestroyElementAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.DestroyElementAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ElementMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.DestroyElementAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Element">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_ApplyStereotypeAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ApplyStereotypeAction"
+ menubarPath="org.eclipse.uml2MenuID/org.eclipse.uml2.examples.ui.ElementMenuID/additions"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.ApplyStereotypeAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Element">
+ </objectClass>
+ </enablement>
+ </action>
+ <action
+ label="%_UI_ConvertToEcoreAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ConvertToEcoreAction"
+ menubarPath="org.eclipse.uml2MenuID/additions-end"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.uiConvertToEcoreAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.uml2.Package">
+ </objectClass>
+ </enablement>
+ </action>
+ </editorContribution>
+ <editorContribution
+ targetID="org.eclipse.emf.ecore.presentation.EcoreEditorID"
+ id="org.eclipse.uml2.examples.ui.EcoreEditorContribution">
+ <action
+ label="%_UI_ConvertFromEcoreAction_label"
+ class="org.eclipse.uml2.examples.ui.actions.ConvertFromEcoreAction"
+ menubarPath="org.eclipse.emf.ecoreMenuID/additions-end"
+ enablesFor="1"
+ id="org.eclipse.uml2.examples.ui.ConvertFromEcoreAction">
+ <enablement>
+ <objectClass
+ name="org.eclipse.emf.ecore.EPackage">
+ </objectClass>
+ </enablement>
+ </action>
+ </editorContribution>
+ </extension>
</plugin>
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ConvertModelAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ConvertModelAction.java
new file mode 100644
index 0000000..472fc94
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ConvertModelAction.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: ConvertModelAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.uml2.Element;
+import org.eclipse.uml2.Profile;
+import org.eclipse.uml2.Stereotype;
+import org.eclipse.uml2.util.UML2Util;
+
+/**
+ *
+ */
+public abstract class ConvertModelAction
+ extends UML2CommandAction {
+
+ protected Profile applyProfile(org.eclipse.uml2.Package package_, String uri) {
+ Profile profile = (Profile) UML2Util.load(package_.eResource()
+ .getResourceSet(), URI.createURI(uri));
+
+ if (null != profile && !package_.isApplied(profile)) {
+ package_.apply(profile);
+ }
+
+ return profile;
+ }
+
+ protected boolean applyStereotype(Element element, Stereotype stereotype) {
+
+ if (null != stereotype && !element.isApplied(stereotype)) {
+ element.apply(stereotype);
+
+ return true;
+ }
+
+ return false;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ConvertToMetamodelAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ConvertToMetamodelAction.java
new file mode 100644
index 0000000..cdd7418
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ConvertToMetamodelAction.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: ConvertToMetamodelAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.uml2.Model;
+import org.eclipse.uml2.PackageableElement;
+import org.eclipse.uml2.Profile;
+import org.eclipse.uml2.Stereotype;
+import org.eclipse.uml2.VisibilityKind;
+import org.eclipse.uml2.edit.util.ChangeCommand;
+import org.eclipse.uml2.examples.ui.ExamplesUIPlugin;
+import org.eclipse.uml2.util.UML2Resource;
+import org.eclipse.uml2.util.UML2Switch;
+
+/**
+ *
+ */
+public class ConvertToMetamodelAction
+ extends ConvertModelAction {
+
+ protected static final String STEREOTYPE_NAME__METACLASS = "Metaclass"; //$NON-NLS-1$
+
+ protected static final String STEREOTYPE_NAME__METAMODEL = "Metamodel"; //$NON-NLS-1$
+
+ /*
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ if (1 == collection.size()
+ && Model.class.isInstance(collection.toArray()[0])) {
+
+ final Model model = (Model) collection.toArray()[0];
+
+ return new ChangeCommand(editingDomain, new Runnable() {
+
+ public void run() {
+ Profile completeProfile = applyProfile(model,
+ UML2Resource.COMPLETE_PROFILE_URI);
+
+ if (null != completeProfile) {
+ applyStereotype(model, completeProfile
+ .getOwnedStereotype(STEREOTYPE_NAME__METAMODEL));
+ }
+
+ Profile basicProfile = applyProfile(model,
+ UML2Resource.BASIC_PROFILE_URI);
+
+ if (null != basicProfile) {
+ final Stereotype metaclassStereotype = basicProfile
+ .getOwnedStereotype(STEREOTYPE_NAME__METACLASS);
+
+ new UML2Switch() {
+
+ public Object caseClass(
+ org.eclipse.uml2.Class class_) {
+ applyStereotype(class_, metaclassStereotype);
+
+ return defaultCase(class_);
+ }
+
+ public Object casePackage(
+ org.eclipse.uml2.Package package_) {
+ return defaultCase(package_);
+ }
+
+ public Object casePackageableElement(
+ PackageableElement packageableElement) {
+ packageableElement
+ .setVisibility(VisibilityKind.PRIVATE_LITERAL);
+
+ return defaultCase(packageableElement);
+ }
+
+ public Object defaultCase(EObject eObject) {
+
+ for (Iterator eContents = eObject.eContents()
+ .iterator(); eContents.hasNext();) {
+
+ doSwitch((EObject) eContents.next());
+ }
+
+ return this;
+ }
+ }.doSwitch(model);
+ }
+ }
+ }, ExamplesUIPlugin.getDefault().getString(
+ "_UI_ConvertToMetamodelActionCommand_label", //$NON-NLS-1$
+ new Object[]{getLabelProvider().getText(model)}));
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ConvertToModelLibraryAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ConvertToModelLibraryAction.java
new file mode 100644
index 0000000..62dc00e
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ConvertToModelLibraryAction.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: ConvertToModelLibraryAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.uml2.Model;
+import org.eclipse.uml2.Profile;
+import org.eclipse.uml2.edit.util.ChangeCommand;
+import org.eclipse.uml2.examples.ui.ExamplesUIPlugin;
+import org.eclipse.uml2.util.UML2Resource;
+
+/**
+ *
+ */
+public class ConvertToModelLibraryAction
+ extends ConvertModelAction {
+
+ protected static final String STEREOTYPE_NAME__MODEL_LIBRARY = "ModelLibrary"; //$NON-NLS-1$
+
+ /*
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ if (1 == collection.size()
+ && Model.class.isInstance(collection.toArray()[0])) {
+
+ final Model model = (Model) collection.toArray()[0];
+
+ return new ChangeCommand(editingDomain, new Runnable() {
+
+ public void run() {
+ Profile basicProfile = applyProfile(model,
+ UML2Resource.BASIC_PROFILE_URI);
+
+ if (null != basicProfile) {
+ applyStereotype(model, basicProfile
+ .getOwnedStereotype(STEREOTYPE_NAME__MODEL_LIBRARY));
+ }
+ }
+ }, ExamplesUIPlugin.getDefault().getString(
+ "_UI_ConvertToModelLibraryActionCommand_label", //$NON-NLS-1$
+ new Object[]{getLabelProvider().getText(model)}));
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ExternalizeKeywordsAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ExternalizeKeywordsAction.java
new file mode 100644
index 0000000..2636f24
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ExternalizeKeywordsAction.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: ExternalizeKeywordsAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.IdentityCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.uml2.Profile;
+import org.eclipse.uml2.Stereotype;
+import org.eclipse.uml2.util.UML2Switch;
+import org.eclipse.uml2.util.UML2Util;
+
+/**
+ *
+ */
+public class ExternalizeKeywordsAction
+ extends PropertiesAction {
+
+ /*
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ return 1 == collection.size()
+ && Profile.class.isInstance(collection.toArray()[0])
+ ? (Command) IdentityCommand.INSTANCE
+ : (Command) UnexecutableCommand.INSTANCE;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+
+ if (UnexecutableCommand.INSTANCE != command) {
+ final Profile profile = (Profile) collection.toArray()[0];
+
+ final PrintWriter propertiesWriter = getPropertiesWriter(profile);
+
+ new UML2Switch() {
+
+ public Object caseStereotype(Stereotype stereotype) {
+ String qualifiedName = stereotype.getQualifiedName();
+
+ if (!isEmpty(qualifiedName)) {
+ propertiesWriter.println(getPropertiesKey(
+ UML2Util.EMPTY_STRING, qualifiedName)
+ + PROPERTIES_SEPARATOR + stereotype.getKeyword());
+ }
+
+ return super.caseStereotype(stereotype);
+ }
+
+ public Object defaultCase(EObject eObject) {
+
+ for (Iterator eContents = eObject.eContents().iterator(); eContents
+ .hasNext();) {
+
+ doSwitch((EObject) eContents.next());
+ }
+
+ return super.defaultCase(eObject);
+ }
+
+ }.doSwitch(profile);
+ }
+ }
+}
\ No newline at end of file
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ExternalizeLabelsAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ExternalizeLabelsAction.java
new file mode 100644
index 0000000..25327e5
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/ExternalizeLabelsAction.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: ExternalizeLabelsAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.io.PrintWriter;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.IdentityCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.uml2.NamedElement;
+import org.eclipse.uml2.util.UML2Switch;
+
+/**
+ *
+ */
+public class ExternalizeLabelsAction
+ extends PropertiesAction {
+
+ /*
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ return 1 == collection.size()
+ && org.eclipse.uml2.Package.class
+ .isInstance(collection.toArray()[0])
+ ? (Command) IdentityCommand.INSTANCE
+ : (Command) UnexecutableCommand.INSTANCE;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+
+ if (UnexecutableCommand.INSTANCE != command) {
+ final org.eclipse.uml2.Package package_ = (org.eclipse.uml2.Package) collection
+ .toArray()[0];
+
+ final PrintWriter propertiesWriter = getPropertiesWriter(package_);
+
+ new UML2Switch() {
+
+ public Object caseNamedElement(NamedElement namedElement) {
+ String qualifiedName = namedElement.getQualifiedName();
+
+ if (!isEmpty(qualifiedName)) {
+ propertiesWriter.println(getPropertiesKey("_label_",
+ qualifiedName)
+ + PROPERTIES_SEPARATOR
+ + format(capName(namedElement.getLabel()), " ",
+ null, false));
+ }
+
+ return super.caseNamedElement(namedElement);
+ }
+
+ public Object defaultCase(EObject eObject) {
+
+ for (Iterator eContents = eObject.eContents().iterator(); eContents
+ .hasNext();) {
+
+ doSwitch((EObject) eContents.next());
+ }
+
+ return super.defaultCase(eObject);
+ }
+
+ }.doSwitch(package_);
+
+ propertiesWriter.close();
+ }
+ }
+}
\ No newline at end of file
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateBasicStereotypesAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateBasicStereotypesAction.java
new file mode 100644
index 0000000..3671b43
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateBasicStereotypesAction.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: GenerateBasicStereotypesAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.uml2.Profile;
+import org.eclipse.uml2.Stereotype;
+import org.eclipse.uml2.UML2Package;
+import org.eclipse.uml2.edit.util.ChangeCommand;
+import org.eclipse.uml2.examples.ui.ExamplesUIPlugin;
+
+/**
+ *
+ */
+public class GenerateBasicStereotypesAction
+ extends GenerateProfileAction {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ if (1 == collection.size()
+ && Profile.class.isInstance(collection.toArray()[0])) {
+
+ final Profile profile = (Profile) collection.toArray()[0];
+
+ return new ChangeCommand(editingDomain, new Runnable() {
+
+ public void run() {
+ Stereotype auxiliaryStereotype = generateOwnedStereotype(
+ profile, "Auxiliary", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class classMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getClass_());
+ generateExtension(auxiliaryStereotype, classMetaclass,
+ false);
+
+ Stereotype buildComponentStereotype = generateOwnedStereotype(
+ profile, "BuildComponent", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class componentMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getComponent());
+ generateExtension(buildComponentStereotype,
+ componentMetaclass, false);
+
+ Stereotype createStereotype = generateOwnedStereotype(
+ profile, "Create", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class behavioralFeatureMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getBehavioralFeature());
+ org.eclipse.uml2.Class usageMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getUsage());
+ generateExtension(createStereotype,
+ behavioralFeatureMetaclass, false);
+ generateExtension(createStereotype, usageMetaclass, false);
+
+ Stereotype callStereotype = generateOwnedStereotype(
+ profile, "Call", false); //$NON-NLS-1$
+ generateExtension(callStereotype, usageMetaclass, false);
+
+ Stereotype deriveStereotype = generateOwnedStereotype(
+ profile, "Derive", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class abstractionMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getAbstraction());
+ generateExtension(deriveStereotype, abstractionMetaclass,
+ false);
+
+ Stereotype destroyStereotype = generateOwnedStereotype(
+ profile, "Destroy", false); //$NON-NLS-1$
+ generateExtension(destroyStereotype,
+ behavioralFeatureMetaclass, false);
+
+ Stereotype focusStereotype = generateOwnedStereotype(
+ profile, "Focus", false); //$NON-NLS-1$
+ generateExtension(focusStereotype, classMetaclass, false);
+
+ Stereotype frameworkStereotype = generateOwnedStereotype(
+ profile, "Framework", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class packageMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getPackage());
+ generateExtension(frameworkStereotype, packageMetaclass,
+ false);
+
+ Stereotype implementStereotype = generateOwnedStereotype(
+ profile, "Implement", false); //$NON-NLS-1$
+ generateExtension(implementStereotype, componentMetaclass,
+ false);
+
+ Stereotype implementationClassStereotype = generateOwnedStereotype(
+ profile, "ImplementationClass", false); //$NON-NLS-1$
+ generateExtension(implementationClassStereotype,
+ classMetaclass, false);
+
+ Stereotype instantiateStereotype = generateOwnedStereotype(
+ profile, "Instantiate", false); //$NON-NLS-1$
+ generateExtension(instantiateStereotype, usageMetaclass,
+ false);
+
+ Stereotype metaclassStereotype = generateOwnedStereotype(
+ profile, "Metaclass", false); //$NON-NLS-1$
+ generateExtension(metaclassStereotype, classMetaclass,
+ false);
+
+ Stereotype modelLibraryStereotype = generateOwnedStereotype(
+ profile, "ModelLibrary", false); //$NON-NLS-1$
+ generateExtension(modelLibraryStereotype, packageMetaclass,
+ false);
+
+ Stereotype refineStereotype = generateOwnedStereotype(
+ profile, "Refine", false); //$NON-NLS-1$
+ generateExtension(refineStereotype, abstractionMetaclass,
+ false);
+
+ Stereotype responsibilityStereotype = generateOwnedStereotype(
+ profile, "Responsibility", false); //$NON-NLS-1$
+ generateExtension(responsibilityStereotype, usageMetaclass,
+ false);
+
+ Stereotype scriptStereotype = generateOwnedStereotype(
+ profile, "Script", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class artifactMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getArtifact());
+ generateExtension(scriptStereotype, artifactMetaclass,
+ false);
+
+ Stereotype sendStereotype = generateOwnedStereotype(
+ profile, "Send", false); //$NON-NLS-1$
+ generateExtension(sendStereotype, usageMetaclass, false);
+
+ Stereotype traceStereotype = generateOwnedStereotype(
+ profile, "Trace", false); //$NON-NLS-1$
+ generateExtension(traceStereotype, abstractionMetaclass,
+ false);
+
+ Stereotype typeStereotype = generateOwnedStereotype(
+ profile, "Type", false); //$NON-NLS-1$
+ generateExtension(typeStereotype, classMetaclass, false);
+
+ Stereotype utilityStereotype = generateOwnedStereotype(
+ profile, "Utility", false); //$NON-NLS-1$
+ generateExtension(utilityStereotype, classMetaclass, false);
+ }
+ }, ExamplesUIPlugin.getDefault().getString(
+ "_UI_GenerateBasicStereotypesActionCommand_label", //$NON-NLS-1$
+ new Object[]{getLabelProvider().getText(profile)}));
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateCompleteStereotypesAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateCompleteStereotypesAction.java
new file mode 100644
index 0000000..4f13fb7
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateCompleteStereotypesAction.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: GenerateCompleteStereotypesAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.uml2.Profile;
+import org.eclipse.uml2.Stereotype;
+import org.eclipse.uml2.UML2Package;
+import org.eclipse.uml2.edit.util.ChangeCommand;
+import org.eclipse.uml2.examples.ui.ExamplesUIPlugin;
+
+/**
+ *
+ */
+public class GenerateCompleteStereotypesAction
+ extends GenerateProfileAction {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ if (1 == collection.size()
+ && Profile.class.isInstance(collection.toArray()[0])) {
+
+ final Profile profile = (Profile) collection.toArray()[0];
+
+ return new ChangeCommand(editingDomain, new Runnable() {
+
+ public void run() {
+ Stereotype metamodelStereotype = generateOwnedStereotype(
+ profile, "Metamodel", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class modelMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getModel());
+ generateExtension(metamodelStereotype, modelMetaclass,
+ false);
+
+ Stereotype systemModelStereotype = generateOwnedStereotype(
+ profile, "SystemModel", false); //$NON-NLS-1$
+ generateExtension(systemModelStereotype, modelMetaclass,
+ false);
+ }
+ }, ExamplesUIPlugin.getDefault().getString(
+ "_UI_GenerateCompleteStereotypesActionCommand_label", //$NON-NLS-1$
+ new Object[]{getLabelProvider().getText(profile)}));
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateEcorePrimitiveTypesAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateEcorePrimitiveTypesAction.java
new file mode 100644
index 0000000..07f2e88
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateEcorePrimitiveTypesAction.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: GenerateEcorePrimitiveTypesAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.util.EcoreSwitch;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.uml2.Model;
+import org.eclipse.uml2.edit.util.ChangeCommand;
+import org.eclipse.uml2.examples.ui.ExamplesUIPlugin;
+
+/**
+ *
+ */
+public class GenerateEcorePrimitiveTypesAction
+ extends GenerateModelAction {
+
+ /*
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ if (1 == collection.size()
+ && Model.class.isInstance(collection.toArray()[0])) {
+
+ final Model model = (Model) collection.toArray()[0];
+
+ return new ChangeCommand(editingDomain, new Runnable() {
+
+ public void run() {
+
+ new EcoreSwitch() {
+
+ public Object caseEDataType(EDataType eDataType) {
+ return generateOwnedPrimitiveType(model, eDataType
+ .getName());
+ }
+
+ public Object caseEEnum(EEnum eEnum) {
+ return eEnum;
+ }
+
+ public Object defaultCase(EObject eObject) {
+
+ for (Iterator eContents = eObject.eContents()
+ .iterator(); eContents.hasNext();) {
+
+ doSwitch((EObject) eContents.next());
+ }
+
+ return eObject;
+ }
+ }.doSwitch(EcorePackage.eINSTANCE);
+ }
+ }, ExamplesUIPlugin.getDefault().getString(
+ "_UI_GenerateEcorePrimitiveTypesActionCommand_label",
+ new Object[]{getLabelProvider().getText(model)})); //$NON-NLS-1$
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateEcoreStereotypesAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateEcoreStereotypesAction.java
new file mode 100644
index 0000000..c18980a
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateEcoreStereotypesAction.java
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: GenerateEcoreStereotypesAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.uml2.Enumeration;
+import org.eclipse.uml2.PrimitiveType;
+import org.eclipse.uml2.Profile;
+import org.eclipse.uml2.Stereotype;
+import org.eclipse.uml2.UML2Package;
+import org.eclipse.uml2.edit.util.ChangeCommand;
+import org.eclipse.uml2.examples.ui.ExamplesUIPlugin;
+
+/**
+ *
+ */
+public class GenerateEcoreStereotypesAction
+ extends GenerateProfileAction {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ if (1 == collection.size()
+ && Profile.class.isInstance(collection.toArray()[0])) {
+
+ final Profile profile = (Profile) collection.toArray()[0];
+
+ return new ChangeCommand(editingDomain, new Runnable() {
+
+ public void run() {
+ Stereotype ePackageStereotype = generateOwnedStereotype(
+ profile, "EPackage", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class packageMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getPackage());
+ generateExtension(ePackageStereotype, packageMetaclass,
+ false);
+ PrimitiveType stringPrimitiveType = getImportedUML2PrimitiveType(
+ profile, "String"); //$NON-NLS-1$
+ generateOwnedAttribute(ePackageStereotype, "packageName", //$NON-NLS-1$
+ stringPrimitiveType, 0, 1);
+ generateOwnedAttribute(ePackageStereotype, "nsPrefix", //$NON-NLS-1$
+ stringPrimitiveType, 0, 1);
+ generateOwnedAttribute(ePackageStereotype, "nsURI", //$NON-NLS-1$
+ stringPrimitiveType, 0, 1);
+ generateOwnedAttribute(ePackageStereotype, "basePackage", //$NON-NLS-1$
+ stringPrimitiveType, 0, 1);
+ generateOwnedAttribute(ePackageStereotype, "prefix", //$NON-NLS-1$
+ stringPrimitiveType, 0, 1);
+
+ Stereotype eNamedElementStereotype = generateOwnedStereotype(
+ profile, "ENamedElement", true); //$NON-NLS-1$
+ generateOwnedAttribute(eNamedElementStereotype, "xmlName", //$NON-NLS-1$
+ stringPrimitiveType, 0, 1);
+
+ Stereotype eClassifierStereotype = generateOwnedStereotype(
+ profile, "EClassifier", true); //$NON-NLS-1$
+ generateGeneralization(eClassifierStereotype,
+ eNamedElementStereotype);
+ generateOwnedAttribute(eClassifierStereotype,
+ "instanceClassName", stringPrimitiveType, 0, 1); //$NON-NLS-1$
+
+ Stereotype extendStereotype = generateOwnedStereotype(
+ profile, "Extend", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class generalizationMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getGeneralization());
+ generateExtension(extendStereotype,
+ generalizationMetaclass, false);
+
+ Enumeration contentKindEnumeration = generateOwnedEnumeration(
+ profile, "ContentKind"); //$NON-NLS-1$
+ generateOwnedLiteral(contentKindEnumeration, "Unspecified"); //$NON-NLS-1$
+ generateOwnedLiteral(contentKindEnumeration, "Empty"); //$NON-NLS-1$
+ generateOwnedLiteral(contentKindEnumeration, "Simple"); //$NON-NLS-1$
+ generateOwnedLiteral(contentKindEnumeration, "Mixed"); //$NON-NLS-1$
+ generateOwnedLiteral(contentKindEnumeration, "ElementOnly"); //$NON-NLS-1$
+
+ Stereotype eClassStereotype = generateOwnedStereotype(
+ profile, "EClass", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class classMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getClass_());
+ org.eclipse.uml2.Class interfaceMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getInterface());
+ generateExtension(eClassStereotype, classMetaclass, false);
+ generateExtension(eClassStereotype, interfaceMetaclass,
+ false);
+ generateGeneralization(eClassStereotype,
+ eClassifierStereotype);
+ generateOwnedAttribute(eClassStereotype, "className", //$NON-NLS-1$
+ stringPrimitiveType, 0, 1);
+ generateOwnedAttribute(eClassStereotype, "xmlContentKind", //$NON-NLS-1$
+ contentKindEnumeration, 0, 1);
+
+ Stereotype eDataTypeStereotype = generateOwnedStereotype(
+ profile, "EDataType", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class primitiveTypeMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getPrimitiveType());
+ generateExtension(eDataTypeStereotype,
+ primitiveTypeMetaclass, false);
+ generateGeneralization(eDataTypeStereotype,
+ eClassifierStereotype);
+ generateOwnedAttribute(eDataTypeStereotype, "dataTypeName", //$NON-NLS-1$
+ stringPrimitiveType, 0, 1);
+
+ Stereotype eEnumStereotype = generateOwnedStereotype(
+ profile, "EEnum", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class enumerationMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getEnumeration());
+ generateExtension(eEnumStereotype, enumerationMetaclass,
+ false);
+ generateGeneralization(eEnumStereotype,
+ eNamedElementStereotype);
+ generateOwnedAttribute(eEnumStereotype, "enumName", //$NON-NLS-1$
+ stringPrimitiveType, 0, 1);
+
+ Stereotype eEnumLiteralStereotype = generateOwnedStereotype(
+ profile, "EEnumLiteral", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class enumerationLiteralMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getEnumerationLiteral());
+ generateExtension(eEnumLiteralStereotype,
+ enumerationLiteralMetaclass, false);
+ generateGeneralization(eEnumLiteralStereotype,
+ eNamedElementStereotype);
+ generateOwnedAttribute(eEnumLiteralStereotype,
+ "enumLiteralName", stringPrimitiveType, 0, 1); //$NON-NLS-1$
+
+ Stereotype eOperationStereotype = generateOwnedStereotype(
+ profile, "EOperation", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class operationMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getOperation());
+ generateExtension(eOperationStereotype, operationMetaclass,
+ false);
+ generateOwnedAttribute(eOperationStereotype,
+ "operationName", stringPrimitiveType, 0, 1); //$NON-NLS-1$
+
+ Stereotype eParameterStereotype = generateOwnedStereotype(
+ profile, "EParameter", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class parameterMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getParameter());
+ generateExtension(eParameterStereotype, parameterMetaclass,
+ false);
+ generateOwnedAttribute(eParameterStereotype,
+ "parameterName", stringPrimitiveType, 0, 1); //$NON-NLS-1$
+
+ Enumeration featureKindEnumeration = generateOwnedEnumeration(
+ profile, "FeatureKind"); //$NON-NLS-1$
+ generateOwnedLiteral(featureKindEnumeration, "Unspecified"); //$NON-NLS-1$
+ generateOwnedLiteral(featureKindEnumeration, "Simple"); //$NON-NLS-1$
+ generateOwnedLiteral(featureKindEnumeration, "Attribute"); //$NON-NLS-1$
+ generateOwnedLiteral(featureKindEnumeration, "Element"); //$NON-NLS-1$
+
+ Enumeration visibilityKindEnumeration = generateOwnedEnumeration(
+ profile, "VisibilityKind"); //$NON-NLS-1$
+ generateOwnedLiteral(visibilityKindEnumeration,
+ "Unspecified"); //$NON-NLS-1$
+ generateOwnedLiteral(visibilityKindEnumeration, "None"); //$NON-NLS-1$
+ generateOwnedLiteral(visibilityKindEnumeration, "ReadOnly"); //$NON-NLS-1$
+ generateOwnedLiteral(visibilityKindEnumeration, "ReadWrite"); //$NON-NLS-1$
+ generateOwnedLiteral(visibilityKindEnumeration,
+ "ReadOnlyUnsettable"); //$NON-NLS-1$
+ generateOwnedLiteral(visibilityKindEnumeration,
+ "ReadWriteUnsettable"); //$NON-NLS-1$
+
+ Stereotype eStructuralFeatureStereotype = generateOwnedStereotype(
+ profile, "EStructuralFeature", true); //$NON-NLS-1$
+ generateGeneralization(eStructuralFeatureStereotype,
+ eNamedElementStereotype);
+ PrimitiveType booleanPrimitiveType = getImportedUML2PrimitiveType(
+ profile, "Boolean"); //$NON-NLS-1$
+ generateOwnedAttribute(eStructuralFeatureStereotype,
+ "isTransient", booleanPrimitiveType, 0, 1); //$NON-NLS-1$
+ generateOwnedAttribute(eStructuralFeatureStereotype,
+ "isVolatile", booleanPrimitiveType, 0, 1); //$NON-NLS-1$
+ generateOwnedAttribute(eStructuralFeatureStereotype,
+ "isUnsettable", booleanPrimitiveType, 0, 1); //$NON-NLS-1$
+ generateOwnedAttribute(eStructuralFeatureStereotype,
+ "xmlNamespace", booleanPrimitiveType, 0, 1); //$NON-NLS-1$
+ generateOwnedAttribute(eStructuralFeatureStereotype,
+ "xmlFeatureKind", booleanPrimitiveType, 0, 1); //$NON-NLS-1$
+ generateOwnedAttribute(eStructuralFeatureStereotype,
+ "visibility", booleanPrimitiveType, 0, 1); //$NON-NLS-1$
+
+ Stereotype eAttributeStereotype = generateOwnedStereotype(
+ profile, "EAttribute", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class propertyMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getProperty());
+ generateExtension(eAttributeStereotype, propertyMetaclass,
+ false);
+ generateGeneralization(eAttributeStereotype,
+ eStructuralFeatureStereotype);
+ generateOwnedAttribute(eAttributeStereotype,
+ "attributeName", stringPrimitiveType, 0, 1); //$NON-NLS-1$
+ generateOwnedAttribute(eAttributeStereotype,
+ "isID", booleanPrimitiveType, 0, 1); //$NON-NLS-1$
+
+ Stereotype eReferenceStereotype = generateOwnedStereotype(
+ profile, "EReference", false); //$NON-NLS-1$
+ generateExtension(eReferenceStereotype, propertyMetaclass,
+ false);
+ generateGeneralization(eReferenceStereotype,
+ eStructuralFeatureStereotype);
+ generateOwnedAttribute(eReferenceStereotype,
+ "referenceName", stringPrimitiveType, 0, 1); //$NON-NLS-1$
+ generateOwnedAttribute(eReferenceStereotype,
+ "isResolveProxies", booleanPrimitiveType, 0, 1) //$NON-NLS-1$
+ .setBooleanDefault(true);
+ }
+ }, ExamplesUIPlugin.getDefault().getString(
+ "_UI_GenerateEcoreStereotypesActionCommand_label", //$NON-NLS-1$
+ new Object[]{getLabelProvider().getText(profile)}));
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateIntermediateStereotypesAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateIntermediateStereotypesAction.java
new file mode 100644
index 0000000..792847b
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateIntermediateStereotypesAction.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: GenerateIntermediateStereotypesAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.uml2.Profile;
+import org.eclipse.uml2.Stereotype;
+import org.eclipse.uml2.UML2Package;
+import org.eclipse.uml2.edit.util.ChangeCommand;
+import org.eclipse.uml2.examples.ui.ExamplesUIPlugin;
+
+/**
+ *
+ */
+public class GenerateIntermediateStereotypesAction
+ extends GenerateProfileAction {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ if (1 == collection.size()
+ && Profile.class.isInstance(collection.toArray()[0])) {
+
+ final Profile profile = (Profile) collection.toArray()[0];
+
+ return new ChangeCommand(editingDomain, new Runnable() {
+
+ public void run() {
+ Stereotype documentStereotype = generateOwnedStereotype(
+ profile, "Document", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class artifactMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getArtifact());
+ generateExtension(documentStereotype, artifactMetaclass,
+ false);
+
+ Stereotype entityStereotype = generateOwnedStereotype(
+ profile, "Entity", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class componentMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getComponent());
+ generateExtension(entityStereotype, componentMetaclass,
+ false);
+
+ Stereotype executableStereotype = generateOwnedStereotype(
+ profile, "Executable", false); //$NON-NLS-1$
+ generateExtension(executableStereotype, artifactMetaclass,
+ false);
+
+ Stereotype fileStereotype = generateOwnedStereotype(
+ profile, "File", false); //$NON-NLS-1$
+ generateExtension(fileStereotype, artifactMetaclass, false);
+
+ Stereotype libraryStereotype = generateOwnedStereotype(
+ profile, "Library", false); //$NON-NLS-1$
+ generateExtension(libraryStereotype, artifactMetaclass,
+ false);
+
+ Stereotype procesStereotype = generateOwnedStereotype(
+ profile, "Process", false); //$NON-NLS-1$
+ generateExtension(procesStereotype, componentMetaclass,
+ false);
+
+ Stereotype realizationStereotype = generateOwnedStereotype(
+ profile, "Realization", false); //$NON-NLS-1$
+ org.eclipse.uml2.Class classifierMetaclass = getReferencedUML2Metaclass(
+ profile, UML2Package.eINSTANCE.getClassifier());
+ generateExtension(realizationStereotype,
+ classifierMetaclass, false);
+
+ Stereotype serviceStereotype = generateOwnedStereotype(
+ profile, "Service", false); //$NON-NLS-1$
+ generateExtension(serviceStereotype, componentMetaclass,
+ false);
+
+ Stereotype sourceStereotype = generateOwnedStereotype(
+ profile, "Source", false); //$NON-NLS-1$
+ generateExtension(sourceStereotype, artifactMetaclass,
+ false);
+
+ Stereotype specificationStereotype = generateOwnedStereotype(
+ profile, "Specification", false); //$NON-NLS-1$
+ generateExtension(specificationStereotype,
+ classifierMetaclass, false);
+
+ Stereotype subsystemStereotype = generateOwnedStereotype(
+ profile, "Subsystem", false); //$NON-NLS-1$
+ generateExtension(subsystemStereotype, componentMetaclass,
+ false);
+ }
+ }, ExamplesUIPlugin.getDefault().getString(
+ "_UI_GenerateIntermediateStereotypesActionCommand_label", //$NON-NLS-1$
+ new Object[]{getLabelProvider().getText(profile)}));
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateJavaPrimitiveTypesAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateJavaPrimitiveTypesAction.java
new file mode 100644
index 0000000..77f11b9
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateJavaPrimitiveTypesAction.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: GenerateJavaPrimitiveTypesAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.uml2.Model;
+import org.eclipse.uml2.edit.util.ChangeCommand;
+import org.eclipse.uml2.examples.ui.ExamplesUIPlugin;
+
+/**
+ *
+ */
+public class GenerateJavaPrimitiveTypesAction
+ extends GenerateModelAction {
+
+ /*
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ if (1 == collection.size()
+ && Model.class.isInstance(collection.toArray()[0])) {
+
+ final Model model = (Model) collection.toArray()[0];
+
+ return new ChangeCommand(editingDomain, new Runnable() {
+
+ public void run() {
+ generateOwnedPrimitiveType(model, "boolean"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "byte"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "char"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "double"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "float"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "int"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "long"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "short"); //$NON-NLS-1$
+ }
+ }, ExamplesUIPlugin.getDefault().getString(
+ "_UI_GenerateJavaPrimitiveTypesActionCommand_label", //$NON-NLS-1$
+ new Object[]{getLabelProvider().getText(model)}));
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateModelAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateModelAction.java
new file mode 100644
index 0000000..f4f3fb8
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateModelAction.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: GenerateModelAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.PrimitiveType;
+import org.eclipse.uml2.util.UML2Util;
+
+/**
+ *
+ */
+public class GenerateModelAction
+ extends UML2CommandAction {
+
+ protected PrimitiveType generateOwnedPrimitiveType(
+ org.eclipse.uml2.Package package_, final String name) {
+ PrimitiveType primitiveType = (PrimitiveType) UML2Util.findEObject(
+ package_.getOwnedTypes(), new UML2Util.EObjectMatcher() {
+
+ public boolean matches(EObject eObject) {
+ return eObject instanceof PrimitiveType
+ && ((PrimitiveType) eObject).getName().equals(name);
+ }
+ });
+
+ return null == primitiveType
+ ? package_.createOwnedPrimitiveType(name)
+ : primitiveType;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateProfileAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateProfileAction.java
new file mode 100644
index 0000000..1b84bb2
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateProfileAction.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: GenerateProfileAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.uml2.Classifier;
+import org.eclipse.uml2.Enumeration;
+import org.eclipse.uml2.EnumerationLiteral;
+import org.eclipse.uml2.Extension;
+import org.eclipse.uml2.ExtensionEnd;
+import org.eclipse.uml2.Generalization;
+import org.eclipse.uml2.Model;
+import org.eclipse.uml2.PrimitiveType;
+import org.eclipse.uml2.Profile;
+import org.eclipse.uml2.Property;
+import org.eclipse.uml2.Stereotype;
+import org.eclipse.uml2.Type;
+import org.eclipse.uml2.VisibilityKind;
+import org.eclipse.uml2.util.UML2Resource;
+import org.eclipse.uml2.util.UML2Util;
+
+/**
+ *
+ */
+public abstract class GenerateProfileAction
+ extends UML2CommandAction {
+
+ protected PrimitiveType getImportedUML2PrimitiveType(
+ org.eclipse.uml2.Package package_, String name) {
+ Model uml2PrimitiveTypes = (Model) UML2Util.load(package_.eResource()
+ .getResourceSet(), URI
+ .createURI(UML2Resource.UML2_PRIMITIVE_TYPES_LIBRARY_URI));
+ PrimitiveType primitiveType = (PrimitiveType) uml2PrimitiveTypes
+ .getOwnedType(name);
+
+ if (!package_.getImportedMembers().contains(primitiveType)) {
+ package_
+ .importElement(VisibilityKind.PUBLIC_LITERAL, primitiveType);
+ }
+
+ return primitiveType;
+ }
+
+ protected org.eclipse.uml2.Class getReferencedUML2Metaclass(
+ Profile profile, EClass eClass) {
+ Model uml2Metamodel = (Model) UML2Util.load(profile.eResource()
+ .getResourceSet(), URI.createURI(UML2Resource.UML2_METAMODEL_URI));
+ org.eclipse.uml2.Class metaclass = (org.eclipse.uml2.Class) uml2Metamodel
+ .getOwnedType(eClass.getName());
+
+ if (!profile.getReferencedMetaclasses().contains(metaclass)) {
+ profile.referenceMetaclass(metaclass);
+ }
+
+ return metaclass;
+ }
+
+ protected Stereotype generateOwnedStereotype(Profile profile, String name,
+ boolean isAbstract) {
+ Stereotype stereotype = profile.getOwnedStereotype(name);
+
+ if (null == stereotype) {
+ stereotype = profile.createOwnedStereotype(name, isAbstract);
+ } else {
+ stereotype.setIsAbstract(isAbstract);
+ }
+
+ return stereotype;
+ }
+
+ protected Extension generateExtension(Stereotype stereotype,
+ org.eclipse.uml2.Class metaclass, boolean required) {
+ Extension extension = metaclass.getExtension(metaclass.getName() + '_'
+ + stereotype.getName());
+
+ if (null == extension) {
+ extension = stereotype.createExtension(metaclass, required);
+ } else {
+ ((ExtensionEnd) extension.getOwnedEnds().get(0))
+ .setLowerBound(required
+ ? 1
+ : 0);
+ }
+
+ return extension;
+ }
+
+ protected Generalization generateGeneralization(
+ Classifier specificClassifier, final Classifier generalClassifier) {
+ Generalization generalization = (Generalization) UML2Util.findEObject(
+ specificClassifier.getGeneralizations(),
+ new UML2Util.EObjectMatcher() {
+
+ public boolean matches(EObject eObject) {
+ return generalClassifier == ((Generalization) eObject)
+ .getGeneral();
+ }
+ });
+
+ return null == generalization
+ ? specificClassifier.createGeneralization(generalClassifier)
+ : generalization;
+ }
+
+ protected Property generateOwnedAttribute(org.eclipse.uml2.Class class_,
+ String name, Type type, int lowerBound, int upperBound) {
+ Property ownedAttribute = class_.getOwnedAttribute(name);
+
+ if (null == ownedAttribute) {
+ ownedAttribute = class_.createOwnedAttribute(name, type,
+ lowerBound, upperBound);
+ } else {
+ ownedAttribute.setType(type);
+ ownedAttribute.setUpperBound(upperBound);
+ ownedAttribute.setLowerBound(lowerBound);
+ }
+
+ return ownedAttribute;
+ }
+
+ protected Enumeration generateOwnedEnumeration(
+ org.eclipse.uml2.Package package_, final String name) {
+ Enumeration enumeration = (Enumeration) UML2Util.findEObject(package_
+ .getOwnedTypes(), new UML2Util.EObjectMatcher() {
+
+ public boolean matches(EObject eObject) {
+ return eObject instanceof Enumeration
+ && ((Enumeration) eObject).getName().equals(name);
+ }
+ });
+
+ return null == enumeration
+ ? package_.createOwnedEnumeraton(name)
+ : enumeration;
+ }
+
+ protected EnumerationLiteral generateOwnedLiteral(Enumeration enumeration,
+ String name) {
+ EnumerationLiteral enumerationLiteral = enumeration
+ .getOwnedLiteral(name);
+
+ return null == enumerationLiteral
+ ? enumeration.createOwnedLiteral(name)
+ : enumerationLiteral;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateUML2PrimitiveTypesAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateUML2PrimitiveTypesAction.java
new file mode 100644
index 0000000..d4e6329
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/GenerateUML2PrimitiveTypesAction.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: GenerateUML2PrimitiveTypesAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.util.Collection;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.uml2.Model;
+import org.eclipse.uml2.edit.util.ChangeCommand;
+import org.eclipse.uml2.examples.ui.ExamplesUIPlugin;
+
+/**
+ *
+ */
+public class GenerateUML2PrimitiveTypesAction
+ extends GenerateModelAction {
+
+ /*
+ * @see org.eclipse.emf.edit.ui.action.CommandAction#createActionCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.util.Collection)
+ */
+ protected Command createActionCommand(EditingDomain editingDomain,
+ Collection collection) {
+
+ if (1 == collection.size()
+ && Model.class.isInstance(collection.toArray()[0])) {
+
+ final Model model = (Model) collection.toArray()[0];
+
+ return new ChangeCommand(editingDomain, new Runnable() {
+
+ public void run() {
+ generateOwnedPrimitiveType(model, "Boolean"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "Integer"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "String"); //$NON-NLS-1$
+ generateOwnedPrimitiveType(model, "UnlimitedNatural"); //$NON-NLS-1$
+ }
+ }, ExamplesUIPlugin.getDefault().getString(
+ "_UI_GenerateUML2PrimitiveTypesActionCommand_label", //$NON-NLS-1$
+ new Object[]{getLabelProvider().getText(model)}));
+ }
+
+ return UnexecutableCommand.INSTANCE;
+ }
+
+}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/PropertiesAction.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/PropertiesAction.java
new file mode 100644
index 0000000..3a697de
--- /dev/null
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/actions/PropertiesAction.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: PropertiesAction.java,v 1.1 2005/04/14 17:32:07 khussey Exp $
+ */
+package org.eclipse.uml2.examples.ui.actions;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.uml2.util.UML2Resource;
+
+/**
+ *
+ */
+public abstract class PropertiesAction
+ extends UML2CommandAction {
+
+ protected static final String PROPERTIES_SEPARATOR = " = "; //$NON-NLS-1$
+
+ protected static boolean isEmpty(String string) {
+ return null == string || 0 == string.length();
+ }
+
+ protected static String format(String name, String separator,
+ String prefix, boolean includePrefix) {
+
+ List parsedName = new ArrayList();
+
+ if (prefix != null) {
+
+ if (name.startsWith(prefix)) {
+ name = name.substring(prefix.length());
+ }
+
+ if (includePrefix) {
+ parsedName = parseName(prefix, '_');
+ }
+ }
+
+ if (name.length() != 0) {
+ parsedName.addAll(parseName(name, '_'));
+ }
+
+ StringBuffer result = new StringBuffer();
+
+ for (Iterator nameIter = parsedName.iterator(); nameIter.hasNext();) {
+ String nameComponent = (String) nameIter.next();
+
+ result.append(result.length() == 0
+ ? nameComponent
+ : capName(nameComponent));
+
+ if (nameIter.hasNext() && nameComponent.length() > 1) {
+ result.append(separator);
+ }
+ }
+
+ return result.length() == 0 && prefix != null
+ ? prefix
+ : result.toString();
+ }
+
+ protected static List parseName(String sourceName, char sourceSeparator) {
+ List result = new ArrayList();
+ StringBuffer currentWord = new StringBuffer();
+
+ int length = sourceName.length();
+ boolean lastIsLower = false;
+
+ for (int index = 0; index < length; index++) {
+ char curChar = sourceName.charAt(index);
+
+ if (Character.isUpperCase(curChar)
+ || (!lastIsLower && Character.isDigit(curChar))
+ || curChar == sourceSeparator) {
+
+ if (lastIsLower || curChar == sourceSeparator) {
+ result.add(currentWord.toString());
+ currentWord = new StringBuffer();
+ }
+
+ lastIsLower = false;
+ } else {
+
+ if (!lastIsLower) {
+ int currentWordLength = currentWord.length();
+
+ if (currentWordLength > 1) {
+ char lastChar = currentWord.charAt(--currentWordLength);
+ currentWord.setLength(currentWordLength);
+
+ result.add(currentWord.toString());
+
+ currentWord = new StringBuffer();
+ currentWord.append(lastChar);
+ }
+ }
+
+ lastIsLower = true;
+ }
+
+ if (curChar != sourceSeparator) {
+ currentWord.append(curChar);
+ }
+ }
+
+ result.add(currentWord.toString());
+
+ return result;
+ }
+
+ protected static String capName(String name) {
+ return name.length() == 0
+ ? name
+ : (name.substring(0, 1).toUpperCase() + name.substring(1));
+ }
+
+ protected static StringBuffer appendValidIdentifier(
+ StringBuffer validIdentifier, String name) {
+
+ if (!isEmpty(name)) {
+ char char_0 = name.charAt(0);
+
+ if (Character.isJavaIdentifierStart(char_0)) {
+ validIdentifier.append(char_0);
+ } else {
+ validIdentifier.append('_');
+
+ if (Character.isJavaIdentifierPart(char_0)) {
+ validIdentifier.append(char_0);
+ }
+ }
+
+ for (int i = 1; i < name.length(); ++i) {
+ char char_i = name.charAt(i);
+
+ if (Character.isJavaIdentifierPart(char_i)) {
+ validIdentifier.append(char_i);
+ }
+ }
+ }
+
+ return validIdentifier;
+ }
+
+ protected static String getValidIdentifier(String name) {
+ return appendValidIdentifier(new StringBuffer(), name).toString();
+ }
+
+ protected static String getPropertiesKey(String prefix, String string) {
+ return prefix + getValidIdentifier(string.replace(':', '_'));
+ }
+
+ protected static PrintWriter getPropertiesWriter(
+ org.eclipse.uml2.Package package_) {
+
+ Resource resource = package_.eResource();
+ ResourceSet resourceSet = resource.getResourceSet();
+
+ URI uri = resource.getURI().trimFileExtension().appendFileExtension(
+ UML2Resource.PROPERTIES_FILE_EXTENSION);
+
+ List properties = new ArrayList();
+
+ LineNumberReader lineNumberReader = null;
+
+ try {
+ lineNumberReader = new LineNumberReader(new InputStreamReader(
+ resourceSet.getURIConverter().createInputStream(uri)));
+
+ for (String line = lineNumberReader.readLine(); null != line; line = lineNumberReader
+ .readLine()) {
+
+ properties.add(line);
+ }
+ } catch (Exception e) {
+ // ignore
+ } finally {
+
+ try {
+
+ if (null != lineNumberReader) {
+ lineNumberReader.close();
+ }
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+
+ PrintWriter printWriter = null;
+
+ try {
+ printWriter = new PrintWriter(resourceSet.getURIConverter()
+ .createOutputStream(uri), true);
+
+ if (!properties.isEmpty()) {
+
+ for (Iterator i = properties.iterator(); i.hasNext();) {
+ printWriter.println((String) i.next());
+ }
+
+ printWriter.println();
+ }
+ } catch (IOException ioe) {
+ // ignore
+ }
+
+ return printWriter;
+ }
+}
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Class.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Class.java
index 268a26b..1b5a630 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Class.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Class.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: Class.java,v 1.14 2005/04/04 20:11:16 khussey Exp $
+ * $Id: Class.java,v 1.15 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2;
@@ -360,6 +360,25 @@
*/
public boolean isMetaclass();
+ /**
+ * Creates a property with the specified name, type, lower bound, and upper
+ * bound as an owned attribute of this class.
+ *
+ * @param name
+ * The name for the owned attribute.
+ * @param type
+ * The type for the owned attribute.
+ * @param lowerBound
+ * The lower bound for the owned attribute.
+ * @param upperBound
+ * The upper bound for the owned attribute.
+ * @return The new property.
+ * @exception IllegalArgumentException
+ * If either of the bounds is invalid.
+ */
+ Property createOwnedAttribute(String name, Type type, int lowerBound,
+ int upperBound);
+
// <!-- end-custom-operations -->
} // Class
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Component.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Component.java
index 09839c3..dbf9c0d 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Component.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Component.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: Component.java,v 1.7 2005/04/04 20:11:14 khussey Exp $
+ * $Id: Component.java,v 1.8 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2;
@@ -225,4 +225,58 @@
*/
EList getClientDependencies();
+ // <!-- begin-custom-operations -->
+
+ /**
+ * Creates a(n) (abstract) class with the specified name as an owned member
+ * of this component.
+ *
+ * @param name
+ * The name for the owned class.
+ * @param isAbstract
+ * Whether the owned class should be abstract.
+ * @return The new class.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ org.eclipse.uml2.Class createOwnedClass(String name, boolean isAbstract);
+
+ /**
+ * Creates an enumeration with the specified name as an owned member of this
+ * component.
+ *
+ * @param name
+ * The name for the owned enumeration.
+ * @return The new enumeration.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ Enumeration createOwnedEnumeraton(String name);
+
+ /**
+ * Creates a package with the specified name as an owned member of this
+ * component.
+ *
+ * @param name
+ * The name for the owned package.
+ * @return The new package.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ org.eclipse.uml2.Package createOwnedPackage(String name);
+
+ /**
+ * Creates a primitive type with the specified name as an owned member of
+ * this component.
+ *
+ * @param name
+ * The name for the owned primitive type.
+ * @return The new primitive type.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ PrimitiveType createOwnedPrimitiveType(String name);
+
+ // <!-- end-custom-operations -->
+
} // Component
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/DataType.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/DataType.java
index 976ed10..d425fd4 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/DataType.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/DataType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: DataType.java,v 1.6 2005/04/04 20:11:14 khussey Exp $
+ * $Id: DataType.java,v 1.7 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2;
@@ -178,4 +178,27 @@
*/
EList getFeatures();
+ // <!-- begin-custom-operations -->
+
+ /**
+ * Creates a property with the specified name, type, lower bound, and upper
+ * bound as an owned attribute of this data type.
+ *
+ * @param name
+ * The name for the owned attribute.
+ * @param type
+ * The type for the owned attribute.
+ * @param lowerBound
+ * The lower bound for the owned attribute.
+ * @param upperBound
+ * The upper bound for the owned attribute.
+ * @return The new property.
+ * @exception IllegalArgumentException
+ * If either of the bounds is invalid.
+ */
+ Property createOwnedAttribute(String name, Type type, int lowerBound,
+ int upperBound);
+
+ // <!-- end-custom-operations -->
+
} // DataType
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Enumeration.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Enumeration.java
index 062e894..9a0c523 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Enumeration.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Enumeration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: Enumeration.java,v 1.6 2005/04/04 20:11:14 khussey Exp $
+ * $Id: Enumeration.java,v 1.7 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2;
@@ -97,4 +97,20 @@
*/
EList getOwnedMembers();
+ // <!-- begin-custom-operations -->
+
+ /**
+ * Creates an enumeration literal with the specified name as an owned
+ * literal of this enumeration.
+ *
+ * @param name
+ * The name for the owned literal.
+ * @return The new enumeration literal.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ EnumerationLiteral createOwnedLiteral(String name);
+
+ // <!-- end-custom-operations -->
+
} // Enumeration
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Interface.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Interface.java
index f9237b0..ffbb1ed 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Interface.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Interface.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: Interface.java,v 1.7 2005/04/04 20:11:14 khussey Exp $
+ * $Id: Interface.java,v 1.8 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2;
@@ -322,4 +322,27 @@
*/
EList getRedefinedElements();
+ // <!-- begin-custom-operations -->
+
+ /**
+ * Creates a property with the specified name, type, lower bound, and upper
+ * bound as an owned attribute of this interface.
+ *
+ * @param name
+ * The name for the owned attribute.
+ * @param type
+ * The type for the owned attribute.
+ * @param lowerBound
+ * The lower bound for the owned attribute.
+ * @param upperBound
+ * The upper bound for the owned attribute.
+ * @return The new property.
+ * @exception IllegalArgumentException
+ * If either of the bounds is invalid.
+ */
+ Property createOwnedAttribute(String name, Type type, int lowerBound,
+ int upperBound);
+
+ // <!-- end-custom-operations -->
+
} // Interface
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Package.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Package.java
index 30f949e..ff79d5c 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Package.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Package.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: Package.java,v 1.12 2005/04/04 20:11:16 khussey Exp $
+ * $Id: Package.java,v 1.13 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2;
@@ -353,7 +353,7 @@
* @return <code>true</code> if the profile is applied to this package;
* <code>false</code> otherwise.
*/
- public boolean isApplied(Profile profile);
+ boolean isApplied(Profile profile);
/**
* Retrieves the set of all profiles that are applied to this package,
@@ -361,7 +361,7 @@
*
* @return The profiles applied to the package.
*/
- public Set getAllAppliedProfiles();
+ Set getAllAppliedProfiles();
/**
* Applies the current version of the specified profile to this package; if
@@ -375,7 +375,7 @@
* If the profile is not defined or its current version is
* already applied.
*/
- public void apply(Profile profile);
+ void apply(Profile profile);
/**
* Unapplies the specified profile from this package.
@@ -385,7 +385,7 @@
* @throws IllegalArgumentException
* If the profile is not applied to this package.
*/
- public void unapply(Profile profile);
+ void unapply(Profile profile);
/**
* Retrieves the version of the specified profile that is applied to this
@@ -396,7 +396,57 @@
* @return The version of the profile, or <code>null</code> if not
* applied.
*/
- public String getAppliedVersion(Profile profile);
+ String getAppliedVersion(Profile profile);
+
+ /**
+ * Creates a package with the specified name as a nested package of this
+ * package.
+ *
+ * @param name
+ * The name for the nested package.
+ * @return The new package.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ org.eclipse.uml2.Package createNestedPackage(String name);
+
+ /**
+ * Creates a(n) (abstract) class with the specified name as an owned member
+ * of this package.
+ *
+ * @param name
+ * The name for the owned class.
+ * @param isAbstract
+ * Whether the owned class should be abstract.
+ * @return The new class.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ org.eclipse.uml2.Class createOwnedClass(String name, boolean isAbstract);
+
+ /**
+ * Creates an enumeration with the specified name as an owned member of this
+ * package.
+ *
+ * @param name
+ * The name for the owned enumeration.
+ * @return The new enumeration.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ Enumeration createOwnedEnumeraton(String name);
+
+ /**
+ * Creates a primitive type with the specified name as an owned member of
+ * this package.
+ *
+ * @param name
+ * The name for the owned primitive type.
+ * @return The new primitive type.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ PrimitiveType createOwnedPrimitiveType(String name);
// <!-- end-custom-operations -->
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Profile.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Profile.java
index b0b7512..a338343 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Profile.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/Profile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: Profile.java,v 1.6 2005/04/04 20:11:14 khussey Exp $
+ * $Id: Profile.java,v 1.7 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2;
@@ -128,59 +128,62 @@
/**
* Determines whether this profile is defined.
*
- * @return <code>true</code> if this profile is defined; <code>false</code>
- * otherwise.
+ * @return <code>true</code> if this profile is defined;
+ * <code>false</code> otherwise.
*/
- public boolean isDefined();
+ boolean isDefined();
/**
* Retrieves the version of this profile.
*
* @return The version of this profile, or <code>null</code> if undefined.
*/
- public String getVersion();
+ String getVersion();
/**
* Defines this profile by (re)creating Ecore representations of its current
* contents and incrementing its version.
*
- * @throws IllegalArgumentException If this profile has no name.
+ * @throws IllegalArgumentException
+ * If this profile has no name.
*/
- public void define();
+ void define();
/**
* Retrieves the set of metaclasses referenced by this profile.
*
* @return The metaclasses referenced by this profile.
*/
- public Set getReferencedMetaclasses();
+ Set getReferencedMetaclasses();
/**
* References the specified metaclass in this profile with private
* visibility.
*
- * @param class_ The metaclass to reference.
- * @exception IllegalArgumentException If this profile already references
- * the metaclass.
+ * @param class_
+ * The metaclass to reference.
+ * @exception IllegalArgumentException
+ * If this profile already references the metaclass.
*/
- public void referenceMetaclass(org.eclipse.uml2.Class class_);
+ void referenceMetaclass(org.eclipse.uml2.Class class_);
/**
* Retrieves the set of metamodels referenced by this profile.
*
* @return The metamodels referenced by this profile.
*/
- public Set getReferencedMetamodels();
+ Set getReferencedMetamodels();
/**
* References the specified metamodel in this profile with private
* visibility.
*
- * @param model The metamodel to reference.
- * @exception IllegalArgumentException If this profile already references
- * the metamodel.
+ * @param model
+ * The metamodel to reference.
+ * @exception IllegalArgumentException
+ * If this profile already references the metamodel.
*/
- public void referenceMetamodel(Model model);
+ void referenceMetamodel(Model model);
/**
* Creates and returns an instance of (the Ecore representation of) the
@@ -194,8 +197,22 @@
* If the classifier is not defined in this profile or cannot
* be instantiated.
*/
- public EObject create(Classifier classifier);
+ EObject create(Classifier classifier);
+ /**
+ * Creates a(n) (abstract) stereotype with the specified name as an owned
+ * stereotype of this profile.
+ *
+ * @param name
+ * The name for the owned stereotype.
+ * @param isAbstract
+ * Whether the owned stereotype should be abstract.
+ * @return The new stereotype.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ Stereotype createOwnedStereotype(String name, boolean isAbstract);
+
// <!-- end-custom-operations -->
} // Profile
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ClassImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ClassImpl.java
index 0d00ca7..09a6441 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ClassImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ClassImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ClassImpl.java,v 1.25 2005/04/04 20:11:13 khussey Exp $
+ * $Id: ClassImpl.java,v 1.26 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -47,9 +47,11 @@
import org.eclipse.uml2.StructuredClassifier;
import org.eclipse.uml2.TemplateParameter;
import org.eclipse.uml2.TemplateSignature;
+import org.eclipse.uml2.Type;
import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.VisibilityKind;
import org.eclipse.uml2.internal.operation.ClassOperations;
+import org.eclipse.uml2.internal.operation.TypeOperations;
/**
* <!-- begin-user-doc -->
@@ -1459,6 +1461,18 @@
return ClassOperations.isMetaclass(this);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Class#createOwnedAttribute(java.lang.String,
+ * org.eclipse.uml2.Type, int, int)
+ */
+ public Property createOwnedAttribute(String name, Type type,
+ int lowerBound, int upperBound) {
+ return TypeOperations.createOwnedAttribute(this, name, type,
+ lowerBound, upperBound);
+ }
+
// <!-- end-custom-operations -->
} //ClassImpl
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ComponentImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ComponentImpl.java
index 9c822b5..9767eb3 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ComponentImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ComponentImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ComponentImpl.java,v 1.21 2005/04/04 20:11:13 khussey Exp $
+ * $Id: ComponentImpl.java,v 1.22 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -34,15 +34,18 @@
import org.eclipse.uml2.CollaborationOccurrence;
import org.eclipse.uml2.Component;
import org.eclipse.uml2.Dependency;
+import org.eclipse.uml2.Enumeration;
import org.eclipse.uml2.Interface;
import org.eclipse.uml2.PackageableElement;
import org.eclipse.uml2.Port;
+import org.eclipse.uml2.PrimitiveType;
import org.eclipse.uml2.Realization;
import org.eclipse.uml2.StringExpression;
import org.eclipse.uml2.TemplateParameter;
import org.eclipse.uml2.TemplateSignature;
import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.VisibilityKind;
+import org.eclipse.uml2.internal.operation.ComponentOperations;
import org.eclipse.uml2.internal.util.SubsetEObjectContainmentWithInverseEList;
import org.eclipse.uml2.internal.util.SupersetEObjectWithInverseResolvingEList;
@@ -1087,4 +1090,46 @@
return result.toString();
}
+ // <!-- begin-custom-operations -->
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Component#createOwnedClass(java.lang.String,
+ * boolean)
+ */
+ public org.eclipse.uml2.Class createOwnedClass(String name,
+ boolean isAbstract) {
+ return ComponentOperations.createOwnedClass(this, name, isAbstract);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Component#createOwnedEnumeraton(java.lang.String)
+ */
+ public Enumeration createOwnedEnumeraton(String name) {
+ return ComponentOperations.createOwnedEnumeration(this, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Component#createOwnedPackage(java.lang.String)
+ */
+ public org.eclipse.uml2.Package createOwnedPackage(String name) {
+ return ComponentOperations.createOwnedPackage(this, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Component#createOwnedPrimitiveType(java.lang.String)
+ */
+ public PrimitiveType createOwnedPrimitiveType(String name) {
+ return ComponentOperations.createOwnedPrimitiveType(this, name);
+ }
+
+ // <!-- end-custom-operations -->
+
} //ComponentImpl
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/DataTypeImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/DataTypeImpl.java
index ae7c8c1..c6b0ce1 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/DataTypeImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/DataTypeImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: DataTypeImpl.java,v 1.16 2005/04/04 20:11:12 khussey Exp $
+ * $Id: DataTypeImpl.java,v 1.17 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -35,8 +35,10 @@
import org.eclipse.uml2.StringExpression;
import org.eclipse.uml2.TemplateParameter;
import org.eclipse.uml2.TemplateSignature;
+import org.eclipse.uml2.Type;
import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.VisibilityKind;
+import org.eclipse.uml2.internal.operation.TypeOperations;
/**
* <!-- begin-user-doc -->
@@ -744,4 +746,14 @@
return eDynamicIsSet(eFeature);
}
+ // <!-- begin-custom-operations -->
+
+ public Property createOwnedAttribute(String name, Type type,
+ int lowerBound, int upperBound) {
+ return TypeOperations.createOwnedAttribute(this, name, type,
+ lowerBound, upperBound);
+ }
+
+ // <!-- end-custom-operations -->
+
} //DataTypeImpl
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/EnumerationImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/EnumerationImpl.java
index 7a4698a..49dfe4a 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/EnumerationImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/EnumerationImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: EnumerationImpl.java,v 1.16 2005/04/04 20:11:12 khussey Exp $
+ * $Id: EnumerationImpl.java,v 1.17 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -35,6 +35,7 @@
import org.eclipse.uml2.TemplateSignature;
import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.VisibilityKind;
+import org.eclipse.uml2.internal.operation.EnumerationOperations;
/**
* <!-- begin-user-doc -->
@@ -653,4 +654,17 @@
return eDynamicIsSet(eFeature);
}
+ // <!-- begin-custom-operations -->
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Enumeration#createOwnedLiteral(java.lang.String)
+ */
+ public EnumerationLiteral createOwnedLiteral(String name) {
+ return EnumerationOperations.createOwnedLiteral(this, name);
+ }
+
+ // <!-- end-custom-operations -->
+
} //EnumerationImpl
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/InterfaceImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/InterfaceImpl.java
index 09f25cf..209f1b0 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/InterfaceImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/InterfaceImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: InterfaceImpl.java,v 1.16 2005/04/04 20:11:13 khussey Exp $
+ * $Id: InterfaceImpl.java,v 1.17 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -39,8 +39,10 @@
import org.eclipse.uml2.StringExpression;
import org.eclipse.uml2.TemplateParameter;
import org.eclipse.uml2.TemplateSignature;
+import org.eclipse.uml2.Type;
import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.VisibilityKind;
+import org.eclipse.uml2.internal.operation.TypeOperations;
/**
* <!-- begin-user-doc -->
@@ -1026,4 +1028,14 @@
return eDynamicIsSet(eFeature);
}
+ // <!-- begin-custom-operations -->
+
+ public Property createOwnedAttribute(String name, Type type,
+ int lowerBound, int upperBound) {
+ return TypeOperations.createOwnedAttribute(this, name, type,
+ lowerBound, upperBound);
+ }
+
+ // <!-- end-custom-operations -->
+
} //InterfaceImpl
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PackageImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PackageImpl.java
index dea9064..a224926 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PackageImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/PackageImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: PackageImpl.java,v 1.22 2005/04/04 20:11:13 khussey Exp $
+ * $Id: PackageImpl.java,v 1.23 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -35,12 +35,14 @@
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.uml2.Element;
+import org.eclipse.uml2.Enumeration;
import org.eclipse.uml2.NamedElement;
import org.eclipse.uml2.Namespace;
import org.eclipse.uml2.PackageImport;
import org.eclipse.uml2.PackageMerge;
import org.eclipse.uml2.PackageableElement;
import org.eclipse.uml2.ParameterableElement;
+import org.eclipse.uml2.PrimitiveType;
import org.eclipse.uml2.Profile;
import org.eclipse.uml2.ProfileApplication;
import org.eclipse.uml2.StringExpression;
@@ -49,6 +51,7 @@
import org.eclipse.uml2.Type;
import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.VisibilityKind;
+import org.eclipse.uml2.internal.operation.PackageOperations;
import org.eclipse.uml2.internal.operation.ProfileOperations;
import org.eclipse.uml2.internal.util.SubsetEObjectEList;
import org.eclipse.uml2.internal.util.SupersetEObjectContainmentWithInverseEList;
@@ -1091,11 +1094,11 @@
ProfileOperations.apply(profile, this);
}
- private static Method GET_ALL_APPLIED_PROFILES_METHOD = null;
+ private static Method GET_ALL_APPLIED_PROFILES = null;
static {
try {
- GET_ALL_APPLIED_PROFILES_METHOD = PackageImpl.class.getMethod(
+ GET_ALL_APPLIED_PROFILES = PackageImpl.class.getMethod(
"getAllAppliedProfiles", null); //$NON-NLS-1$
} catch (Exception e) {
// ignore
@@ -1109,12 +1112,12 @@
*/
public Set getAllAppliedProfiles() {
Set allAppliedProfiles = (Set) getCacheAdapter().get(eResource(), this,
- GET_ALL_APPLIED_PROFILES_METHOD);
+ GET_ALL_APPLIED_PROFILES);
if (null == allAppliedProfiles) {
allAppliedProfiles = ProfileOperations.getAllAppliedProfiles(this);
- getCacheAdapter().put(eResource(), this,
- GET_ALL_APPLIED_PROFILES_METHOD, allAppliedProfiles);
+ getCacheAdapter().put(eResource(), this, GET_ALL_APPLIED_PROFILES,
+ allAppliedProfiles);
}
return allAppliedProfiles;
@@ -1147,6 +1150,43 @@
return ProfileOperations.getAppliedVersion(profile, this);
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Package#createNestedPackage(java.lang.String)
+ */
+ public org.eclipse.uml2.Package createNestedPackage(String name) {
+ return PackageOperations.createNestedPackage(this, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Package#createOwnedClass(java.lang.String, boolean)
+ */
+ public org.eclipse.uml2.Class createOwnedClass(String name,
+ boolean isAbstract) {
+ return PackageOperations.createOwnedClass(this, name, isAbstract);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Package#createOwnedEnumeraton(java.lang.String)
+ */
+ public Enumeration createOwnedEnumeraton(String name) {
+ return PackageOperations.createOwnedEnumeration(this, name);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Package#createOwnedPrimitiveType(java.lang.String)
+ */
+ public PrimitiveType createOwnedPrimitiveType(String name) {
+ return PackageOperations.createOwnedPrimitiveType(this, name);
+ }
+
// <!-- end-custom-operations -->
} //PackageImpl
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ProfileImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ProfileImpl.java
index 2cf7a7c..25393ea 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ProfileImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/ProfileImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ProfileImpl.java,v 1.17 2005/04/04 20:11:12 khussey Exp $
+ * $Id: ProfileImpl.java,v 1.18 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -617,11 +617,11 @@
ProfileOperations.define(this);
}
- private static Method GET_REFERENCED_METACLASSES_METHOD = null;
+ private static Method GET_REFERENCED_METACLASSES = null;
static {
try {
- GET_REFERENCED_METACLASSES_METHOD = ProfileImpl.class.getMethod(
+ GET_REFERENCED_METACLASSES = ProfileImpl.class.getMethod(
"getReferencedMetaclasses", null); //$NON-NLS-1$
} catch (Exception e) {
// ignore
@@ -635,23 +635,23 @@
*/
public Set getReferencedMetaclasses() {
Set referencedMetaclasses = (Set) getCacheAdapter().get(eResource(),
- this, GET_REFERENCED_METACLASSES_METHOD);
+ this, GET_REFERENCED_METACLASSES);
if (null == referencedMetaclasses) {
referencedMetaclasses = ProfileOperations
.getReferencedMetaclasses(this);
getCacheAdapter().put(eResource(), this,
- GET_REFERENCED_METACLASSES_METHOD, referencedMetaclasses);
+ GET_REFERENCED_METACLASSES, referencedMetaclasses);
}
return referencedMetaclasses;
}
- private static Method GET_REFERENCED_METAMODELS_METHOD = null;
+ private static Method GET_REFERENCED_METAMODELS = null;
static {
try {
- GET_REFERENCED_METAMODELS_METHOD = ProfileImpl.class.getMethod(
+ GET_REFERENCED_METAMODELS = ProfileImpl.class.getMethod(
"getReferencedMetamodels", null); //$NON-NLS-1$
} catch (Exception e) {
// ignore
@@ -665,13 +665,13 @@
*/
public Set getReferencedMetamodels() {
Set referencedMetamodels = (Set) getCacheAdapter().get(eResource(),
- this, GET_REFERENCED_METAMODELS_METHOD);
+ this, GET_REFERENCED_METAMODELS);
if (null == referencedMetamodels) {
referencedMetamodels = ProfileOperations
.getReferencedMetamodels(this);
- getCacheAdapter().put(eResource(), this,
- GET_REFERENCED_METAMODELS_METHOD, referencedMetamodels);
+ getCacheAdapter().put(eResource(), this, GET_REFERENCED_METAMODELS,
+ referencedMetamodels);
}
return referencedMetamodels;
@@ -721,6 +721,16 @@
public EObject create(Classifier classifier) {
return ProfileOperations.create(this, classifier);
}
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Profile#createOwnedStereotype(java.lang.String,
+ * boolean)
+ */
+ public Stereotype createOwnedStereotype(String name, boolean isAbstract) {
+ return ProfileOperations.createOwnedStereotype(this, name, isAbstract);
+ }
// <!-- end-custom-operations -->
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/StateMachineImpl.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/StateMachineImpl.java
index 1e1cca4..fca3798 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/StateMachineImpl.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/impl/StateMachineImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: StateMachineImpl.java,v 1.20 2005/04/04 20:11:13 khussey Exp $
+ * $Id: StateMachineImpl.java,v 1.21 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.impl;
@@ -35,14 +35,17 @@
import org.eclipse.uml2.BehavioralFeature;
import org.eclipse.uml2.BehavioredClassifier;
import org.eclipse.uml2.CollaborationOccurrence;
+import org.eclipse.uml2.Property;
import org.eclipse.uml2.Pseudostate;
import org.eclipse.uml2.Region;
import org.eclipse.uml2.StateMachine;
import org.eclipse.uml2.StringExpression;
import org.eclipse.uml2.TemplateParameter;
import org.eclipse.uml2.TemplateSignature;
+import org.eclipse.uml2.Type;
import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.VisibilityKind;
+import org.eclipse.uml2.internal.operation.TypeOperations;
/**
* <!-- begin-user-doc -->
@@ -1120,4 +1123,20 @@
return eDynamicIsSet(eFeature);
}
+ // <!-- begin-custom-operations -->
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.uml2.Class#createOwnedAttribute(java.lang.String,
+ * org.eclipse.uml2.Type, int, int)
+ */
+ public Property createOwnedAttribute(String name, Type type,
+ int lowerBound, int upperBound) {
+ return TypeOperations.createOwnedAttribute(this, name, type,
+ lowerBound, upperBound);
+ }
+
+ // <!-- end-custom-operations -->
+
} //StateMachineImpl
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ComponentOperations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ComponentOperations.java
new file mode 100644
index 0000000..b65319e
--- /dev/null
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ComponentOperations.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: ComponentOperations.java,v 1.1 2005/04/14 17:30:57 khussey Exp $
+ */
+package org.eclipse.uml2.internal.operation;
+
+import org.eclipse.uml2.Component;
+import org.eclipse.uml2.Enumeration;
+import org.eclipse.uml2.PrimitiveType;
+import org.eclipse.uml2.UML2Package;
+
+/**
+ * A static utility class that provides operations related to components.
+ */
+public final class ComponentOperations
+ extends UML2Operations {
+
+ /**
+ * Constructs a new Component Operations. This constructor should never be
+ * called because this is a static utility class.
+ */
+ private ComponentOperations() {
+ super();
+ }
+
+ /**
+ * Creates a(n) (abstract) class with the specified name as an owned member
+ * of the specified component.
+ *
+ * @param component
+ * The component in which to create the owned class.
+ * @param name
+ * The name for the owned class.
+ * @param isAbstract
+ * Whether the owned class should be abstract.
+ * @return The new class.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static org.eclipse.uml2.Class createOwnedClass(Component component,
+ String name, boolean isAbstract) {
+
+ if (null == component) {
+ throw new IllegalArgumentException(String.valueOf(component));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ org.eclipse.uml2.Class ownedClass = (org.eclipse.uml2.Class) component
+ .createOwnedMember(UML2Package.eINSTANCE.getClass_());
+ ownedClass.setName(name);
+ ownedClass.setIsAbstract(isAbstract);
+ return ownedClass;
+ }
+
+ /**
+ * Creates an enumeration with the specified name as an owned member of the
+ * specified component.
+ *
+ * @param component
+ * The component in which to create the owned enumeration.
+ * @param name
+ * The name for the owned enumeration.
+ * @return The new enumeration.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static Enumeration createOwnedEnumeration(Component component,
+ String name) {
+
+ if (null == component) {
+ throw new IllegalArgumentException(String.valueOf(component));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ Enumeration ownedEnumeration = (Enumeration) component
+ .createOwnedMember(UML2Package.eINSTANCE.getEnumeration());
+ ownedEnumeration.setName(name);
+ return ownedEnumeration;
+ }
+
+ /**
+ * Creates a package with the specified name as an owned member of the
+ * specified component.
+ *
+ * @param component
+ * The component in which to create the owned package.
+ * @param name
+ * The name for the owned package.
+ * @return The new package.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static org.eclipse.uml2.Package createOwnedPackage(
+ Component component, String name) {
+
+ if (null == component) {
+ throw new IllegalArgumentException(String.valueOf(component));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ org.eclipse.uml2.Package ownedPackage = (org.eclipse.uml2.Package) component
+ .createOwnedMember(UML2Package.eINSTANCE.getPackage());
+ ownedPackage.setName(name);
+ return ownedPackage;
+ }
+
+ /**
+ * Creates a primitive type with the specified name as an owned member of
+ * the specified component.
+ *
+ * @param component
+ * The component in which to create the owned primitive type.
+ * @param name
+ * The name for the owned primitive type.
+ * @return The new primitive type.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static PrimitiveType createOwnedPrimitiveType(Component component,
+ String name) {
+
+ if (null == component) {
+ throw new IllegalArgumentException(String.valueOf(component));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ PrimitiveType ownedPrimitiveType = (PrimitiveType) component
+ .createOwnedMember(UML2Package.eINSTANCE.getPrimitiveType());
+ ownedPrimitiveType.setName(name);
+ return ownedPrimitiveType;
+ }
+
+}
\ No newline at end of file
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/EnumerationOperations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/EnumerationOperations.java
new file mode 100644
index 0000000..607c0de
--- /dev/null
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/EnumerationOperations.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - initial API and implementation
+ *
+ * $Id: EnumerationOperations.java,v 1.1 2005/04/14 17:30:57 khussey Exp $
+ */
+package org.eclipse.uml2.internal.operation;
+
+import org.eclipse.uml2.Enumeration;
+import org.eclipse.uml2.EnumerationLiteral;
+import org.eclipse.uml2.UML2Package;
+
+/**
+ * A static utility class that provides operations related to enumerations.
+ */
+public final class EnumerationOperations
+ extends UML2Operations {
+
+ /**
+ * Constructs a new Enumeration Operations. This constructor should never be
+ * called because this is a static utility class.
+ */
+ private EnumerationOperations() {
+ super();
+ }
+
+ /**
+ * Creates an enumeration literal with the specified name as an owned
+ * literal of the specified enumeration.
+ *
+ * @param enumeration
+ * The enumeration in which to create the owned literal.
+ * @param name
+ * The name for the owned literal.
+ * @return The new enumeration literal.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static EnumerationLiteral createOwnedLiteral(
+ Enumeration enumeration, String name) {
+
+ if (null == enumeration) {
+ throw new IllegalArgumentException(String.valueOf(enumeration));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ EnumerationLiteral ownedLiteral = enumeration
+ .createOwnedLiteral(UML2Package.eINSTANCE.getEnumerationLiteral());
+ ownedLiteral.setName(name);
+ return ownedLiteral;
+ }
+
+}
\ No newline at end of file
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/PackageOperations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/PackageOperations.java
index ffa94a0..6a7f234 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/PackageOperations.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/PackageOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: PackageOperations.java,v 1.8 2005/03/15 18:44:46 khussey Exp $
+ * $Id: PackageOperations.java,v 1.9 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.internal.operation;
@@ -22,9 +22,12 @@
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.uml2.Element;
import org.eclipse.uml2.ElementImport;
+import org.eclipse.uml2.Enumeration;
import org.eclipse.uml2.NamedElement;
import org.eclipse.uml2.PackageImport;
import org.eclipse.uml2.PackageableElement;
+import org.eclipse.uml2.PrimitiveType;
+import org.eclipse.uml2.UML2Package;
import org.eclipse.uml2.UML2Plugin;
import org.eclipse.uml2.VisibilityKind;
import org.eclipse.uml2.util.UML2Validator;
@@ -33,7 +36,7 @@
* A static utility class that provides operations related to packages.
*/
public final class PackageOperations
- extends UML2Operations {
+ extends UML2Operations {
/**
* Constructs a new Package Operations. This constructor should never be
@@ -172,7 +175,7 @@
/**
* If an element that is owned by a package has visibility, it is public or
* private.
- *
+ *
*/
public static boolean validateElementsPublicOrPrivate(
org.eclipse.uml2.Package package_, DiagnosticChain diagnostics,
@@ -216,4 +219,123 @@
return result;
}
+ /**
+ * Creates a package with the specified name as a nested package of the
+ * specified package.
+ *
+ * @param package_
+ * The package in which to create the nested package.
+ * @param name
+ * The name for the nested package.
+ * @return The new package.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static org.eclipse.uml2.Package createNestedPackage(
+ org.eclipse.uml2.Package package_, String name) {
+
+ if (null == package_) {
+ throw new IllegalArgumentException(String.valueOf(package_));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ org.eclipse.uml2.Package nestedPackage = (org.eclipse.uml2.Package) package_
+ .createOwnedMember(UML2Package.eINSTANCE.getPackage());
+ nestedPackage.setName(name);
+ return nestedPackage;
+ }
+
+ /**
+ * Creates a(n) (abstract) class with the specified name as an owned member
+ * of the specified package.
+ *
+ * @param package_
+ * The package in which to create the owned class.
+ * @param name
+ * The name for the owned class.
+ * @param isAbstract
+ * Whether the owned class should be abstract.
+ * @return The new class.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static org.eclipse.uml2.Class createOwnedClass(
+ org.eclipse.uml2.Package package_, String name, boolean isAbstract) {
+
+ if (null == package_) {
+ throw new IllegalArgumentException(String.valueOf(package_));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ org.eclipse.uml2.Class ownedClass = (org.eclipse.uml2.Class) package_
+ .createOwnedMember(UML2Package.eINSTANCE.getClass_());
+ ownedClass.setName(name);
+ ownedClass.setIsAbstract(isAbstract);
+ return ownedClass;
+ }
+
+ /**
+ * Creates an enumeration with the specified name as an owned member of the
+ * specified package.
+ *
+ * @param package_
+ * The package in which to create the owned enumeration.
+ * @param name
+ * The name for the owned enumeration.
+ * @return The new enumeration.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static Enumeration createOwnedEnumeration(
+ org.eclipse.uml2.Package package_, String name) {
+
+ if (null == package_) {
+ throw new IllegalArgumentException(String.valueOf(package_));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ Enumeration ownedEnumeration = (Enumeration) package_
+ .createOwnedMember(UML2Package.eINSTANCE.getEnumeration());
+ ownedEnumeration.setName(name);
+ return ownedEnumeration;
+ }
+
+ /**
+ * Creates a primitive type with the specified name as an owned member of
+ * the specified package.
+ *
+ * @param package_
+ * The package in which to create the owned primitive type.
+ * @param name
+ * The name for the owned primitive type.
+ * @return The new primitive type.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static PrimitiveType createOwnedPrimitiveType(
+ org.eclipse.uml2.Package package_, String name) {
+
+ if (null == package_) {
+ throw new IllegalArgumentException(String.valueOf(package_));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ PrimitiveType ownedPrimitiveType = (PrimitiveType) package_
+ .createOwnedMember(UML2Package.eINSTANCE.getPrimitiveType());
+ ownedPrimitiveType.setName(name);
+ return ownedPrimitiveType;
+ }
+
}
\ No newline at end of file
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java
index 4384fa1..01ecd47 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/ProfileOperations.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: ProfileOperations.java,v 1.19 2005/04/12 20:28:13 khussey Exp $
+ * $Id: ProfileOperations.java,v 1.20 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.internal.operation;
@@ -1433,4 +1433,36 @@
}.doSwitch(classifier);
}
+ /**
+ * Creates a(n) (abstract) stereotype with the specified name as an owned
+ * stereotype of the specified profile.
+ *
+ * @param profile
+ * The profile in which to create the owned stereotype.
+ * @param name
+ * The name for the owned stereotype.
+ * @param isAbstract
+ * Whether the owned stereotype should be abstract.
+ * @return The new stereotype.
+ * @exception IllegalArgumentException
+ * If the name is empty.
+ */
+ public static Stereotype createOwnedStereotype(Profile profile,
+ String name, boolean isAbstract) {
+
+ if (null == profile) {
+ throw new IllegalArgumentException(String.valueOf(profile));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ Stereotype ownedStereotype = (Stereotype) profile
+ .createOwnedMember(UML2Package.eINSTANCE.getStereotype());
+ ownedStereotype.setName(name);
+ ownedStereotype.setIsAbstract(isAbstract);
+ return ownedStereotype;
+ }
+
}
\ No newline at end of file
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/TypeOperations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/TypeOperations.java
index 1f45dc3..f04c5f8 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/TypeOperations.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/TypeOperations.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,13 +8,14 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: TypeOperations.java,v 1.3 2005/03/15 18:44:46 khussey Exp $
+ * $Id: TypeOperations.java,v 1.4 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.internal.operation;
import org.eclipse.uml2.AggregationKind;
import org.eclipse.uml2.Artifact;
import org.eclipse.uml2.Association;
+import org.eclipse.uml2.AssociationClass;
import org.eclipse.uml2.DataType;
import org.eclipse.uml2.Interface;
import org.eclipse.uml2.MultiplicityElement;
@@ -29,11 +30,11 @@
* A static utility class that provides operations related to types.
*/
public final class TypeOperations
- extends UML2Operations {
+ extends UML2Operations {
/**
- * Constructs a new Type Operations. This constructor should never be
- * called because this is a static utility class.
+ * Constructs a new Type Operations. This constructor should never be called
+ * because this is a static utility class.
*/
private TypeOperations() {
super();
@@ -84,7 +85,11 @@
AggregationKind end2Aggregation, String end2Name,
int end2LowerBound, int end2UpperBound) {
- if (null == type1 || null == type1.getPackage()) {
+ validateTypeAndBounds(type1, end1LowerBound, end1UpperBound);
+
+ validateTypeAndBounds(type2, end2LowerBound, end2UpperBound);
+
+ if (null == type1.getPackage()) {
throw new IllegalArgumentException(String.valueOf(type1));
}
@@ -96,19 +101,6 @@
throw new IllegalArgumentException(String.valueOf(end1Aggregation));
}
- if (0 > end1LowerBound) {
- throw new IllegalArgumentException(String.valueOf(end1LowerBound));
- }
-
- if (MultiplicityElement.UNLIMITED_UPPER_BOUND != end1UpperBound
- && (0 == end1UpperBound || end1LowerBound > end1UpperBound)) {
- throw new IllegalArgumentException(String.valueOf(end1UpperBound));
- }
-
- if (null == type2) {
- throw new IllegalArgumentException(String.valueOf(type2));
- }
-
if (end2IsNavigable && null == getOwnedAttributes(type2)) {
throw new IllegalArgumentException(String.valueOf(type2));
}
@@ -117,16 +109,6 @@
throw new IllegalArgumentException(String.valueOf(end2Aggregation));
}
- if (0 > end2LowerBound) {
- throw new IllegalArgumentException(String.valueOf(end2LowerBound));
- }
-
- if (MultiplicityElement.UNLIMITED_UPPER_BOUND != end2UpperBound
- && (0 == end2UpperBound || end2LowerBound > end2UpperBound)) {
-
- throw new IllegalArgumentException(String.valueOf(end2UpperBound));
- }
-
Association association = (Association) type1.getPackage()
.createOwnedMember(UML2Package.eINSTANCE.getAssociation());
@@ -142,48 +124,119 @@
protected static Property createAssociationEnd(Association association,
Type type, boolean isNavigable, AggregationKind aggregation,
String name, int lowerBound, int upperBound, Type otherEndType) {
- Property associationEnd = isNavigable
- ? (Property) new UML2Switch() {
-
- public Object caseArtifact(Artifact object) {
- return object.createOwnedAttribute(UML2Package.eINSTANCE
- .getProperty());
- }
-
- public Object caseDataType(DataType object) {
- return object.createOwnedAttribute(UML2Package.eINSTANCE
- .getProperty());
- }
-
- public Object caseInterface(Interface object) {
- return object.createOwnedAttribute(UML2Package.eINSTANCE
- .getProperty());
- }
-
- public Object caseSignal(Signal object) {
- return object.createOwnedAttribute(UML2Package.eINSTANCE
- .getProperty());
- }
-
- public Object caseStructuredClassifier(
- StructuredClassifier object) {
- return object.createOwnedAttribute(UML2Package.eINSTANCE
- .getProperty());
- }
- }.doSwitch(type) : association.createOwnedEnd(UML2Package.eINSTANCE
- .getProperty());
+ Property associationEnd = createOwnedProperty(isNavigable
+ ? type
+ : association, name, otherEndType, lowerBound, upperBound);
if (isNavigable) {
association.getMemberEnds().add(associationEnd);
}
- associationEnd.setType(otherEndType);
associationEnd.setAggregation(aggregation);
- associationEnd.setName(name);
- associationEnd.setUpperBound(upperBound);
- associationEnd.setLowerBound(lowerBound);
return associationEnd;
}
+ protected static void validateTypeAndBounds(Type type, int lowerBound,
+ int upperBound) {
+
+ if (null == type) {
+ throw new IllegalArgumentException(String.valueOf(type));
+ }
+
+ if (0 > lowerBound) {
+ throw new IllegalArgumentException(String.valueOf(lowerBound));
+ }
+
+ if (MultiplicityElement.UNLIMITED_UPPER_BOUND != upperBound
+ && (0 == upperBound || lowerBound > upperBound)) {
+
+ throw new IllegalArgumentException(String.valueOf(upperBound));
+ }
+ }
+
+ protected static Property createOwnedProperty(Type type, String name,
+ Type propertyType, int lowerBound, int upperBound) {
+ Property ownedProperty = (Property) new UML2Switch() {
+
+ public Object caseArtifact(Artifact artifact) {
+ return artifact.createOwnedAttribute(UML2Package.eINSTANCE
+ .getProperty());
+ }
+
+ public Object caseAssociation(Association association) {
+ return association.createOwnedEnd(UML2Package.eINSTANCE
+ .getProperty());
+ }
+
+ public Object caseAssociationClass(AssociationClass associationClass) {
+ return associationClass
+ .createOwnedAttribute(UML2Package.eINSTANCE.getProperty());
+ }
+
+ public Object caseDataType(DataType dataType) {
+ return dataType.createOwnedAttribute(UML2Package.eINSTANCE
+ .getProperty());
+ }
+
+ public Object caseInterface(Interface interface_) {
+ return interface_.createOwnedAttribute(UML2Package.eINSTANCE
+ .getProperty());
+ }
+
+ public Object caseSignal(Signal signal) {
+ return signal.createOwnedAttribute(UML2Package.eINSTANCE
+ .getProperty());
+ }
+
+ public Object caseStructuredClassifier(
+ StructuredClassifier structuredClassifier) {
+ return structuredClassifier
+ .createOwnedAttribute(UML2Package.eINSTANCE.getProperty());
+ }
+ }.doSwitch(type);
+
+ ownedProperty.setName(name);
+ ownedProperty.setType(propertyType);
+ ownedProperty.setUpperBound(upperBound);
+ ownedProperty.setLowerBound(lowerBound);
+
+ return ownedProperty;
+ }
+
+ /**
+ * Creates a property with the specified type, name, lower bound, and upper
+ * bound as an owned attribute of the specified type.
+ *
+ * @param type
+ * The type in which to create the owned attribute.
+ * @param name
+ * The name for the owned attribute.
+ * @param attributeType
+ * The type for the owned attribute.
+ * @param lowerBound
+ * The lower bound for the owned attribute.
+ * @param upperBound
+ * The upper bound for the owned attribute.
+ * @return The new property.
+ * @exception IllegalArgumentException
+ * If either of the bounds is invalid.
+ */
+ public static Property createOwnedAttribute(Type type, String name,
+ Type attributeType, int lowerBound, int upperBound) {
+
+ if (null == type || null == getOwnedAttributes(type)) {
+ throw new IllegalArgumentException(String.valueOf(type));
+ }
+
+ if (isEmpty(name)) {
+ throw new IllegalArgumentException(String.valueOf(name));
+ }
+
+ validateTypeAndBounds(attributeType, lowerBound, upperBound);
+
+ return createOwnedProperty(type, name, attributeType, lowerBound,
+ upperBound);
+ }
+
}
\ No newline at end of file
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/UML2Operations.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/UML2Operations.java
index 79ce087..bea3444 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/UML2Operations.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/internal/operation/UML2Operations.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UML2Operations.java,v 1.18 2005/04/06 19:59:37 khussey Exp $
+ * $Id: UML2Operations.java,v 1.19 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.internal.operation;
@@ -240,11 +240,6 @@
}
/**
- * The standard extension for properties files.
- */
- protected static final String PROPERTIES_FILE_EXTENSION = "properties"; //$NON-NLS-1$
-
- /**
* The default URI converter for resource bundle look-ups.
*/
private static final URIConverter DEFAULT_URI_CONVERTER = new URIConverterImpl();
@@ -298,14 +293,15 @@
if (language.length() > 0) {
baseSegment += ('_' + language);
resourceBundleURIs.add(0, baseURI.appendSegment(baseSegment)
- .appendFileExtension(PROPERTIES_FILE_EXTENSION));
+ .appendFileExtension(UML2Resource.PROPERTIES_FILE_EXTENSION));
String country = locale.getCountry();
if (country.length() > 0) {
baseSegment += ('_' + country);
- resourceBundleURIs.add(0, baseURI.appendSegment(baseSegment)
- .appendFileExtension(PROPERTIES_FILE_EXTENSION));
+ resourceBundleURIs.add(0,
+ baseURI.appendSegment(baseSegment).appendFileExtension(
+ UML2Resource.PROPERTIES_FILE_EXTENSION));
String variant = locale.getVariant();
@@ -313,7 +309,7 @@
baseSegment += ('_' + variant);
resourceBundleURIs.add(0, baseURI
.appendSegment(baseSegment).appendFileExtension(
- PROPERTIES_FILE_EXTENSION));
+ UML2Resource.PROPERTIES_FILE_EXTENSION));
}
}
}
@@ -340,7 +336,7 @@
String baseSegment = uri.trimFileExtension().lastSegment();
resourceBundleURIs.add(baseURI.appendSegment(baseSegment)
- .appendFileExtension(PROPERTIES_FILE_EXTENSION));
+ .appendFileExtension(UML2Resource.PROPERTIES_FILE_EXTENSION));
if (null != locale) {
Locale defaultLocale = Locale.getDefault();
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/UML2Resource.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/UML2Resource.java
index ccfa9d5..44837c3 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/UML2Resource.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/UML2Resource.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UML2Resource.java,v 1.7 2005/03/15 20:27:50 khussey Exp $
+ * $Id: UML2Resource.java,v 1.8 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.util;
@@ -93,4 +93,9 @@
public static final String ECORE_PROFILE_URI = PROFILES_PATHMAP
+ "Ecore." + PROFILE_FILE_EXTENSION; //$NON-NLS-1$
+ /**
+ * The standard extension for properties files.
+ */
+ public static final String PROPERTIES_FILE_EXTENSION = "properties"; //$NON-NLS-1$
+
}
diff --git a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/UML2Util.java b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/UML2Util.java
index f795ed3..64ca319 100644
--- a/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/UML2Util.java
+++ b/deprecated/plugins/org.eclipse.uml2/src/org/eclipse/uml2/util/UML2Util.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UML2Util.java,v 1.11 2005/04/12 17:46:00 khussey Exp $
+ * $Id: UML2Util.java,v 1.12 2005/04/14 17:30:57 khussey Exp $
*/
package org.eclipse.uml2.util;
@@ -3397,7 +3397,7 @@
}
- protected static interface EObjectMatcher {
+ public static interface EObjectMatcher {
public boolean matches(EObject eObject);
@@ -4777,7 +4777,7 @@
/**
* The empty string.
*/
- protected static final String EMPTY_STRING = ""; //$NON-NLS-1$
+ public static final String EMPTY_STRING = ""; //$NON-NLS-1$
protected static final String LINE_SEPARATOR = System.getProperties()
.getProperty("line.separator"); //$NON-NLS-1$
@@ -4872,11 +4872,11 @@
: thisObject.equals(thatObject);
}
- protected static boolean isEmpty(String string) {
+ public static boolean isEmpty(String string) {
return null == string || 0 == string.length();
}
- protected static EObject findEObject(Collection eObjects,
+ public static EObject findEObject(Collection eObjects,
EObjectMatcher filter) {
for (Iterator i = eObjects.iterator(); i.hasNext();) {