[121037] Adding converter options to process annotation details.
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/dialogs/Ecore2UML2ConverterOptionsDialog.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/dialogs/Ecore2UML2ConverterOptionsDialog.java
index 01e7cf7..f4ebba9 100644
--- a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/dialogs/Ecore2UML2ConverterOptionsDialog.java
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/dialogs/Ecore2UML2ConverterOptionsDialog.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: Ecore2UML2ConverterOptionsDialog.java,v 1.1 2005/04/06 19:59:55 khussey Exp $
+ * $Id: Ecore2UML2ConverterOptionsDialog.java,v 1.2 2005/12/16 03:54:51 khussey Exp $
*/
package org.eclipse.uml2.examples.ui.dialogs;
@@ -57,5 +57,10 @@
UML2Util.Ecore2UML2Converter.OPTION__UNION_ANNOTATIONS,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__PROCESS}, UML2Util.OPTION__PROCESS);
+
+ createOptionArea(parent,
+ UML2Util.Ecore2UML2Converter.OPTION__ANNOTATION_DETAILS,
+ new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
+ UML2Util.OPTION__PROCESS}, UML2Util.OPTION__IGNORE);
}
}
diff --git a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/dialogs/UML22EcoreConverterOptionsDialog.java b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/dialogs/UML22EcoreConverterOptionsDialog.java
index 37ea061..fd1167b 100644
--- a/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/dialogs/UML22EcoreConverterOptionsDialog.java
+++ b/deprecated/examples/org.eclipse.uml2.examples.ui/src/org/eclipse/uml2/examples/ui/dialogs/UML22EcoreConverterOptionsDialog.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UML22EcoreConverterOptionsDialog.java,v 1.5 2005/09/29 18:06:16 khussey Exp $
+ * $Id: UML22EcoreConverterOptionsDialog.java,v 1.6 2005/12/16 03:54:51 khussey Exp $
*/
package org.eclipse.uml2.examples.ui.dialogs;
@@ -42,50 +42,65 @@
UML2Util.UML22EcoreConverter.OPTION__ECORE_TAGGED_VALUES,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__PROCESS}, UML2Util.OPTION__PROCESS);
+
createOptionArea(parent,
UML2Util.UML22EcoreConverter.OPTION__DERIVED_FEATURES,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__PROCESS}, UML2Util.OPTION__PROCESS);
+
createOptionArea(parent,
UML2Util.UML22EcoreConverter.OPTION__DUPLICATE_FEATURE_INHERITANCE,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__DISCARD, UML2Util.OPTION__PROCESS},
UML2Util.OPTION__PROCESS);
+
createOptionArea(parent,
UML2Util.UML22EcoreConverter.OPTION__DUPLICATE_FEATURES,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__DISCARD, UML2Util.OPTION__PROCESS},
UML2Util.OPTION__PROCESS);
+
createOptionArea(
parent,
UML2Util.UML22EcoreConverter.OPTION__DUPLICATE_OPERATION_INHERITANCE,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__DISCARD, UML2Util.OPTION__PROCESS},
UML2Util.OPTION__PROCESS);
+
createOptionArea(parent,
UML2Util.UML22EcoreConverter.OPTION__DUPLICATE_OPERATIONS,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__DISCARD, UML2Util.OPTION__PROCESS},
UML2Util.OPTION__PROCESS);
+
createOptionArea(parent,
UML2Util.UML22EcoreConverter.OPTION__REDEFINING_OPERATIONS,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__PROCESS}, UML2Util.OPTION__PROCESS);
+
createOptionArea(parent,
UML2Util.UML22EcoreConverter.OPTION__REDEFINING_PROPERTIES,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__PROCESS}, UML2Util.OPTION__PROCESS);
+
createOptionArea(parent,
UML2Util.UML22EcoreConverter.OPTION__SUBSETTING_PROPERTIES,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__PROCESS}, UML2Util.OPTION__PROCESS);
+
createOptionArea(parent,
UML2Util.UML22EcoreConverter.OPTION__UNION_PROPERTIES,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__PROCESS}, UML2Util.OPTION__PROCESS);
+
createOptionArea(parent,
UML2Util.UML22EcoreConverter.OPTION__SUPER_CLASS_ORDER,
new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
UML2Util.OPTION__PROCESS}, UML2Util.OPTION__PROCESS);
+
+ createOptionArea(parent,
+ UML2Util.UML22EcoreConverter.OPTION__ANNOTATION_DETAILS,
+ new String[]{UML2Util.OPTION__IGNORE, UML2Util.OPTION__REPORT,
+ UML2Util.OPTION__PROCESS}, UML2Util.OPTION__PROCESS);
}
}
diff --git a/deprecated/plugins/org.eclipse.uml2.ecore.importer/plugin.properties b/deprecated/plugins/org.eclipse.uml2.ecore.importer/plugin.properties
index bee7f98..5546d59 100644
--- a/deprecated/plugins/org.eclipse.uml2.ecore.importer/plugin.properties
+++ b/deprecated/plugins/org.eclipse.uml2.ecore.importer/plugin.properties
@@ -55,6 +55,7 @@
# ====================================================================
_UI_SuperClassOrder_label = Super Class Order
+_UI_AnnotationDetails_label = Annotation Details
_UI_IgnoreAll_label = Ignore All
_UI_ProcessAll_label = Process All
diff --git a/deprecated/plugins/org.eclipse.uml2.ecore.importer/src/org/eclipse/uml2/ecore/importer/UML2Importer.java b/deprecated/plugins/org.eclipse.uml2.ecore.importer/src/org/eclipse/uml2/ecore/importer/UML2Importer.java
index e40b0d0..e3a27ad 100644
--- a/deprecated/plugins/org.eclipse.uml2.ecore.importer/src/org/eclipse/uml2/ecore/importer/UML2Importer.java
+++ b/deprecated/plugins/org.eclipse.uml2.ecore.importer/src/org/eclipse/uml2/ecore/importer/UML2Importer.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UML2Importer.java,v 1.18 2005/12/14 17:02:49 khussey Exp $
+ * $Id: UML2Importer.java,v 1.19 2005/12/16 03:55:15 khussey Exp $
*/
package org.eclipse.uml2.ecore.importer;
@@ -28,18 +28,20 @@
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.DiagnosticException;
+import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Monitor;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.converter.ConverterPlugin;
+import org.eclipse.emf.converter.util.ConverterUtil;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.importer.ModelImporter;
-import org.eclipse.emf.converter.ConverterPlugin;
-import org.eclipse.emf.converter.util.ConverterUtil;
-
import org.eclipse.uml2.Element;
import org.eclipse.uml2.Stereotype;
import org.eclipse.uml2.UML2Package;
+import org.eclipse.uml2.codegen.ecore.genmodel.GenModelPackage;
+import org.eclipse.uml2.codegen.ecore.genmodel.util.UML2GenModelUtil;
import org.eclipse.uml2.util.UML2Resource;
import org.eclipse.uml2.util.UML2Util;
@@ -95,6 +97,7 @@
genModel.setImporterID(getID());
}
+
return genModel;
}
@@ -104,11 +107,12 @@
List locationURIs = getModelLocationURIs();
if (locationURIs.isEmpty()) {
- diagnostic = new BasicDiagnostic(Diagnostic.ERROR, ConverterPlugin.ID,
- ConverterUtil.ACTION_DEFAULT, UML2ImporterPlugin.INSTANCE
+ diagnostic = new BasicDiagnostic(Diagnostic.ERROR,
+ ConverterPlugin.ID, ConverterUtil.ACTION_DEFAULT,
+ UML2ImporterPlugin.INSTANCE
.getString("_UI_SpecifyAValidUML2Model_message"), null); //$NON-NLS-1$
} else {
- monitor.beginTask("", 2); //$NON-NLS-1$
+ monitor.beginTask("", 2); //$NON-NLS-1$
monitor.subTask(UML2ImporterPlugin.INSTANCE.getString(
"_UI_Loading_message", new Object[]{locationURIs})); //$NON-NLS-1$
@@ -194,8 +198,7 @@
return diagnostic;
}
- public void adjustEPackage(Monitor monitor,
- EPackage ePackage) {
+ public void adjustEPackage(Monitor monitor, EPackage ePackage) {
EPackageImportInfo ePackageInfo = getEPackageImportInfo(ePackage);
String name = ePackage.getName();
@@ -224,10 +227,12 @@
super.adjustGenModel(monitor);
URI genModelURI = createFileURI(getGenModelPath().toString());
+ GenModel genModel = getGenModel();
+ EList foreignModel = genModel.getForeignModel();
for (Iterator i = getModelLocationURIs().iterator(); i.hasNext();) {
- getGenModel().getForeignModel().add(
- makeRelative((URI) i.next(), genModelURI).toString());
+ foreignModel.add(makeRelative((URI) i.next(), genModelURI)
+ .toString());
}
}
@@ -236,8 +241,9 @@
super.loadOriginalGenModel(genModelURI);
StringBuffer text = new StringBuffer();
+ GenModel originalGenModel = getOriginalGenModel();
- for (Iterator i = getOriginalGenModel().getForeignModel().iterator(); i
+ for (Iterator i = originalGenModel.getForeignModel().iterator(); i
.hasNext();) {
String value = (String) i.next();
@@ -250,6 +256,17 @@
}
setModelLocation(text.toString().trim());
+
+ getOptions().putAll(
+ UML2GenModelUtil.getGenAnnotation(originalGenModel,
+ GenModelPackage.eNS_URI, true).getDetails().map());
+ }
+
+ public void prepareGenModelAndEPackages(Monitor monitor) {
+ super.prepareGenModelAndEPackages(monitor);
+
+ UML2GenModelUtil.getGenAnnotation(genModel, GenModelPackage.eNS_URI,
+ true).getDetails().putAll(getOptions());
}
}
\ No newline at end of file
diff --git a/deprecated/plugins/org.eclipse.uml2.ecore.importer/src/org/eclipse/uml2/ecore/importer/ui/UML2DetailPage.java b/deprecated/plugins/org.eclipse.uml2.ecore.importer/src/org/eclipse/uml2/ecore/importer/ui/UML2DetailPage.java
index 78158e6..00ce3fe 100644
--- a/deprecated/plugins/org.eclipse.uml2.ecore.importer/src/org/eclipse/uml2/ecore/importer/ui/UML2DetailPage.java
+++ b/deprecated/plugins/org.eclipse.uml2.ecore.importer/src/org/eclipse/uml2/ecore/importer/ui/UML2DetailPage.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UML2DetailPage.java,v 1.8 2005/12/14 17:02:49 khussey Exp $
+ * $Id: UML2DetailPage.java,v 1.9 2005/12/16 03:55:15 khussey Exp $
*/
package org.eclipse.uml2.ecore.importer.ui;
@@ -68,7 +68,7 @@
}
protected void addOptionControl(Composite parent, String text,
- final String option, String[] choices, String initialChoice) {
+ final String option, String[] choices, String defaultChoice) {
Label label = new Label(parent, SWT.LEFT);
{
@@ -96,7 +96,14 @@
}
});
- combo.setText(initialChoice);
+ Map options = getUML2Importer().getOptions();
+ String choice = (String) options.get(option);
+
+ if (null == choice) {
+ options.put(option, choice = defaultChoice);
+ }
+
+ combo.setText(choice);
}
}
@@ -197,6 +204,12 @@
UML2Util.UML22EcoreConverter.OPTION__SUPER_CLASS_ORDER,
new String[]{ignoreChoiceLabel, reportChoiceLabel,
processChoiceLabel}, processChoiceLabel);
+ addOptionControl(group,
+ UML2ImporterPlugin.INSTANCE
+ .getString("_UI_AnnotationDetails_label"), //$NON-NLS-1$
+ UML2Util.UML22EcoreConverter.OPTION__ANNOTATION_DETAILS,
+ new String[]{ignoreChoiceLabel, reportChoiceLabel,
+ processChoiceLabel}, processChoiceLabel);
Composite composite = new Composite(group, SWT.NONE);
{
diff --git a/deprecated/plugins/org.eclipse.uml2/plugin.properties b/deprecated/plugins/org.eclipse.uml2/plugin.properties
index b16a1ca..364da6e 100644
--- a/deprecated/plugins/org.eclipse.uml2/plugin.properties
+++ b/deprecated/plugins/org.eclipse.uml2/plugin.properties
@@ -7,7 +7,7 @@
# Contributors:
# IBM - initial API and implementation
#
-# $Id: plugin.properties,v 1.24 2005/10/19 19:44:48 khussey Exp $
+# $Id: plugin.properties,v 1.25 2005/12/16 03:55:08 khussey Exp $
# NLS_MESSAGEFORMAT_VAR
@@ -130,3 +130,9 @@
_UI_UML22EcoreConverter_ProcessSuperClassOrder_diagnostic = Re-ordered the super classes of class ''{0}'' for optimal code generation.
_UI_UML22EcoreConverter_ReportSuperClassOrder_diagnostic = The super classes of class ''{0}'' should be re-ordered for optimal code generation.
+
+_UI_UML22EcoreConverter_ProcessAnnotationDetails_diagnostic = Annotated model element ''{0}'' with details from source ''{1}''.
+_UI_UML22EcoreConverter_ReportAnnotationDetails_diagnostic = Model element ''{0}'' should be annotated with details from source ''{1}''.
+
+_UI_Ecore2UML2Converter_ProcessAnnotationDetails_diagnostic = Annotated element ''{0}'' with details from source ''{1}''.
+_UI_Ecore2UML2Converter_ReportAnnotationDetails_diagnostic = Element ''{0}'' should be annotated with details from source ''{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 380ef87..5ced4c6 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.52 2005/12/15 20:01:25 khussey Exp $
+ * $Id: UML2Util.java,v 1.53 2005/12/16 03:55:08 khussey Exp $
*/
package org.eclipse.uml2.util;
@@ -29,6 +29,7 @@
import org.eclipse.emf.common.util.Diagnostic;
import org.eclipse.emf.common.util.DiagnosticChain;
import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.EMap;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.UniqueEList;
import org.eclipse.emf.common.util.WrappedException;
@@ -149,6 +150,8 @@
public static final String OPTION__UNION_ANNOTATIONS = "UNION_ANNOTATIONS"; //$NON-NLS-1$
+ public static final String OPTION__ANNOTATION_DETAILS = "ANNOTATION_DETAILS"; //$NON-NLS-1$
+
private static final int DIAGNOSTIC_CODE_OFFSET = 3000;
public static final int ECORE_TAGGED_VALUE = DIAGNOSTIC_CODE_OFFSET + 1;
@@ -159,6 +162,8 @@
public static final int UNION_ANNOTATION = DIAGNOSTIC_CODE_OFFSET + 4;
+ public static final int ANNOTATION_DETAILS = DIAGNOSTIC_CODE_OFFSET + 4;
+
protected final Map eModelElementToElementMap = new HashMap();
protected Collection ePackages = null;
@@ -268,8 +273,13 @@
((BehavioredClassifier) classifier)
.createImplementation((Interface) doSwitch(eSuperType));
} else {
- classifier
- .createGeneralization((Classifier) doSwitch(eSuperType));
+ Classifier generalClassifier = (Classifier) doSwitch(eSuperType);
+
+ if (null != generalClassifier
+ && !classifier.allParents().contains(generalClassifier)) {
+
+ classifier.createGeneralization(generalClassifier);
+ }
}
}
@@ -1246,6 +1256,72 @@
}
}
+ protected void processAnnotationDetails(final Map options,
+ final DiagnosticChain diagnostics, final Map context) {
+
+ for (Iterator entries = eModelElementToElementMap.entrySet()
+ .iterator(); entries.hasNext();) {
+
+ final Map.Entry entry = (Map.Entry) entries.next();
+ Element element = (Element) entry.getValue();
+
+ if (null != element) {
+ EModelElement eModelElement = (EModelElement) entry
+ .getKey();
+
+ for (Iterator eAnnotations = eModelElement
+ .getEAnnotations().iterator(); eAnnotations.hasNext();) {
+
+ EAnnotation eAnnotation = (EAnnotation) eAnnotations
+ .next();
+ EMap details = eAnnotation.getDetails();
+
+ if (!details.isEmpty()) {
+
+ if (OPTION__PROCESS.equals(options
+ .get(OPTION__ANNOTATION_DETAILS))) {
+
+ if (null != diagnostics) {
+ diagnostics
+ .add(new BasicDiagnostic(
+ Diagnostic.INFO,
+ UML2Validator.DIAGNOSTIC_SOURCE,
+ ANNOTATION_DETAILS,
+ UML2Plugin.INSTANCE
+ .getString(
+ "_UI_Ecore2UML2Converter_ProcessAnnotationDetails_diagnostic", //$NON-NLS-1$
+ getMessageSubstitutions(
+ context, element,
+ eAnnotation.getSource())),
+ new Object[]{element}));
+ }
+
+ getEAnnotation(element,
+ eAnnotation.getSource(), true).getDetails()
+ .putAll(details.map());
+ } else if (OPTION__REPORT.equals(options
+ .get(OPTION__ANNOTATION_DETAILS))
+ && null != diagnostics) {
+
+ diagnostics
+ .add(new BasicDiagnostic(
+ Diagnostic.WARNING,
+ UML2Validator.DIAGNOSTIC_SOURCE,
+ ANNOTATION_DETAILS,
+ UML2Plugin.INSTANCE
+ .getString(
+ "_UI_Ecore2UML2Converter_ReportAnnotationDetails_diagnostic", //$NON-NLS-1$
+ getMessageSubstitutions(
+ context, element,
+ eAnnotation.getSource())),
+ new Object[]{element}));
+ }
+ }
+ }
+ }
+ }
+ }
+
protected void processOptions(EPackage ePackage, final Map options,
final DiagnosticChain diagnostics, final Map context) {
@@ -1268,9 +1344,12 @@
}
if (!OPTION__IGNORE.equals(options.get(OPTION__UNION_ANNOTATIONS))) {
-
processUnionAnnotations(options, diagnostics, context);
}
+
+ if (!OPTION__IGNORE.equals(options.get(OPTION__ANNOTATION_DETAILS))) {
+ processAnnotationDetails(options, diagnostics, context);
+ }
}
/*
@@ -1393,6 +1472,8 @@
public static final String OPTION__SUPER_CLASS_ORDER = "SUPER_CLASS_ORDER"; //$NON-NLS-1$
+ public static final String OPTION__ANNOTATION_DETAILS = "ANNOTATION_DETAILS"; //$NON-NLS-1$
+
private static final int DIAGNOSTIC_CODE_OFFSET = 2000;
public static final int ECORE_TAGGED_VALUE = DIAGNOSTIC_CODE_OFFSET + 1;
@@ -1417,6 +1498,8 @@
public static final int SUPER_CLASS_ORDER = DIAGNOSTIC_CODE_OFFSET + 11;
+ public static final int ANNOTATION_DETAILS = DIAGNOSTIC_CODE_OFFSET + 12;
+
protected final Map elementToEModelElementMap = new HashMap();
protected Collection packages = null;
@@ -1465,8 +1548,9 @@
eType = EcorePackage.eINSTANCE.getELong();
} else if ("Java::short".equals(qualifiedName)) { //$NON-NLS-1$
eType = EcorePackage.eINSTANCE.getEShort();
- } else if (qualifiedName.startsWith("Ecore::")){ //$NON-NLS-1$
- eType = EcorePackage.eINSTANCE.getEClassifier(type.getName());
+ } else if (qualifiedName.startsWith("Ecore::")) { //$NON-NLS-1$
+ eType = EcorePackage.eINSTANCE.getEClassifier(type
+ .getName());
}
}
@@ -3841,13 +3925,12 @@
for (ListIterator li = superClasses.listIterator(); li
.hasNext();) {
+
Object superClass = li.next();
eSuperTypes
.move(li.previousIndex(), superClass);
}
-
- }
- if (OPTION__REPORT.equals(options
+ } else if (OPTION__REPORT.equals(options
.get(OPTION__SUPER_CLASS_ORDER))
&& null != diagnostics) {
@@ -3867,6 +3950,71 @@
}
}
+ protected void processAnnotationDetails(final Map options,
+ final DiagnosticChain diagnostics, final Map context) {
+
+ for (Iterator entries = elementToEModelElementMap.entrySet()
+ .iterator(); entries.hasNext();) {
+
+ final Map.Entry entry = (Map.Entry) entries.next();
+ EModelElement eModelElement = (EModelElement) entry.getValue();
+
+ if (null != eModelElement) {
+ Element element = (Element) entry.getKey();
+
+ for (Iterator eAnnotations = element.getEAnnotations()
+ .iterator(); eAnnotations.hasNext();) {
+
+ EAnnotation eAnnotation = (EAnnotation) eAnnotations
+ .next();
+ EMap details = eAnnotation.getDetails();
+
+ if (!details.isEmpty()) {
+
+ if (OPTION__PROCESS.equals(options
+ .get(OPTION__ANNOTATION_DETAILS))) {
+
+ if (null != diagnostics) {
+ diagnostics
+ .add(new BasicDiagnostic(
+ Diagnostic.INFO,
+ UML2Validator.DIAGNOSTIC_SOURCE,
+ ANNOTATION_DETAILS,
+ UML2Plugin.INSTANCE
+ .getString(
+ "_UI_UML22EcoreConverter_ProcessAnnotationDetails_diagnostic", //$NON-NLS-1$
+ getMessageSubstitutions(
+ context, eModelElement,
+ eAnnotation.getSource())),
+ new Object[]{eModelElement}));
+ }
+
+ getEAnnotation(eModelElement,
+ eAnnotation.getSource(), true).getDetails()
+ .putAll(details.map());
+ } else if (OPTION__REPORT.equals(options
+ .get(OPTION__ANNOTATION_DETAILS))
+ && null != diagnostics) {
+
+ diagnostics
+ .add(new BasicDiagnostic(
+ Diagnostic.WARNING,
+ UML2Validator.DIAGNOSTIC_SOURCE,
+ ANNOTATION_DETAILS,
+ UML2Plugin.INSTANCE
+ .getString(
+ "_UI_UML22EcoreConverter_ReportAnnotationDetails_diagnostic", //$NON-NLS-1$
+ getMessageSubstitutions(
+ context, eModelElement,
+ eAnnotation.getSource())),
+ new Object[]{eModelElement}));
+ }
+ }
+ }
+ }
+ }
+ }
+
protected void processOptions(Map options, DiagnosticChain diagnostics,
Map context) {
@@ -3929,6 +4077,10 @@
if (!OPTION__IGNORE.equals(options.get(OPTION__SUPER_CLASS_ORDER))) {
processSuperClassOrder(options, diagnostics, context);
}
+
+ if (!OPTION__IGNORE.equals(options.get(OPTION__ANNOTATION_DETAILS))) {
+ processAnnotationDetails(options, diagnostics, context);
+ }
}
/*
@@ -6395,6 +6547,13 @@
OPTION__IGNORE);
}
+ if (!options
+ .containsKey(UML22EcoreConverter.OPTION__ANNOTATION_DETAILS)) {
+
+ options.put(UML22EcoreConverter.OPTION__ANNOTATION_DETAILS,
+ OPTION__IGNORE);
+ }
+
return convertToEcore(package_, options, null, null);
}
@@ -6473,6 +6632,13 @@
OPTION__REPORT);
}
+ if (!options
+ .containsKey(UML22EcoreConverter.OPTION__ANNOTATION_DETAILS)) {
+
+ options.put(UML22EcoreConverter.OPTION__ANNOTATION_DETAILS,
+ OPTION__REPORT);
+ }
+
return new UML22EcoreConverter().convert(Collections
.singleton(package_), options, diagnostics, context);
}
diff --git a/plugins/org.eclipse.uml2.codegen.ecore/src/org/eclipse/uml2/codegen/ecore/genmodel/util/UML2GenModelUtil.java b/plugins/org.eclipse.uml2.codegen.ecore/src/org/eclipse/uml2/codegen/ecore/genmodel/util/UML2GenModelUtil.java
index bb024c2..62c12c9 100644
--- a/plugins/org.eclipse.uml2.codegen.ecore/src/org/eclipse/uml2/codegen/ecore/genmodel/util/UML2GenModelUtil.java
+++ b/plugins/org.eclipse.uml2.codegen.ecore/src/org/eclipse/uml2/codegen/ecore/genmodel/util/UML2GenModelUtil.java
@@ -8,20 +8,26 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UML2GenModelUtil.java,v 1.9 2005/12/06 19:06:43 khussey Exp $
+ * $Id: UML2GenModelUtil.java,v 1.10 2005/12/16 03:55:13 khussey Exp $
*/
package org.eclipse.uml2.codegen.ecore.genmodel.util;
import java.util.Collections;
import java.util.List;
+import org.eclipse.emf.codegen.ecore.genmodel.GenAnnotation;
+import org.eclipse.emf.codegen.ecore.genmodel.GenBase;
import org.eclipse.emf.codegen.ecore.genmodel.GenClass;
import org.eclipse.emf.codegen.ecore.genmodel.GenFeature;
import org.eclipse.emf.codegen.ecore.genmodel.GenModel;
+import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory;
import org.eclipse.emf.codegen.ecore.genmodel.GenOperation;
import org.eclipse.emf.codegen.ecore.genmodel.GenPackage;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.EOperation;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcoreFactory;
import org.eclipse.uml2.codegen.ecore.genmodel.GenCacheAdapterScope;
/**
@@ -33,6 +39,28 @@
super();
}
+ // GenBase utilities
+
+ public static GenAnnotation createGenAnnotation(GenBase genBase,
+ String source) {
+ GenAnnotation genAnnotation = GenModelFactory.eINSTANCE
+ .createGenAnnotation();
+
+ genAnnotation.setSource(source);
+ genAnnotation.setGenBase(genBase);
+
+ return genAnnotation;
+ }
+
+ public static GenAnnotation getGenAnnotation(GenBase genBase,
+ String source, boolean createOnDemand) {
+ GenAnnotation genAnnotation = genBase.getGenAnnotation(source);
+
+ return genAnnotation == null && createOnDemand
+ ? createGenAnnotation(genBase, source)
+ : genAnnotation;
+ }
+
// GenModel utilities
public static String getInvariantPrefix(GenModel genModel) {
diff --git a/plugins/org.eclipse.uml2.common/src/org/eclipse/uml2/common/util/UML2Util.java b/plugins/org.eclipse.uml2.common/src/org/eclipse/uml2/common/util/UML2Util.java
index 1cbb4bd..8c38343 100644
--- a/plugins/org.eclipse.uml2.common/src/org/eclipse/uml2/common/util/UML2Util.java
+++ b/plugins/org.eclipse.uml2.common/src/org/eclipse/uml2/common/util/UML2Util.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM - initial API and implementation
*
- * $Id: UML2Util.java,v 1.5 2005/12/15 22:47:49 khussey Exp $
+ * $Id: UML2Util.java,v 1.6 2005/12/16 03:54:53 khussey Exp $
*/
package org.eclipse.uml2.common.util;
@@ -443,7 +443,6 @@
protected static EAnnotation createEAnnotation(EModelElement eModelElement,
String source) {
-
EAnnotation eAnnotation = EcoreFactory.eINSTANCE.createEAnnotation();
eAnnotation.setSource(source);
@@ -454,7 +453,6 @@
protected static EAnnotation getEAnnotation(EModelElement eModelElement,
String source, boolean createOnDemand) {
-
EAnnotation eAnnotation = eModelElement.getEAnnotation(source);
return eAnnotation == null && createOnDemand