Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » MagicDraw reading UML Profiles(Problems resolving referenced elements at the end of the same file )
MagicDraw reading UML Profiles [message #1754490] Sat, 18 February 2017 17:34 Go to next message
Michael Sausmikat is currently offline Michael SausmikatFriend
Messages: 3
Registered: February 2017
Junior Member
Hello,

I have some problems with the procedure to generate code from MagicDraw.
My steps:
- Export UML File from Magic Draw (Eclipse UML (v5.x) XMI-File)
- This generates the following files
my-model.uml
UML_Standard_Profile.Dependency_Matrix_Profile.profile.uml
UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.profile.uml
UML_Standard_Profile.MagicDraw_Profile.profile.uml
UML_Standard_Profile.MagicDraw_Profile.Traceability_customization.profile.uml
UML_Standard_Profile.Validation_Profile.profile.uml
- Start my Acceleo project to read this model and generate some code

I get the following Exception:
Exception in thread "main" java.lang.NullPointerException
at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSettingDelegate(EStructuralFeatureImpl.java:845)

===================
After analyzing
===================
The problem ist the generated order/sequence in some of the Profile-Files.
Example given:
UML_Standard_Profile.MagicDraw_Profile.DSL_Customization.profile.uml
<?xml----
<xmi----
<eClassifiers----
<eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtbfX4EeaOTqhRM7JmKw" name="allowedDragAndDrops" ordered="false" lowerBound="1" upperBound="-1" eType="_r0GtefX4EeaOTqhRM7JmKw"/>
</eClassifiers----
<eClassifiers xmi:type="ecore:EClass" xmi:id="_r0GtefX4EeaOTqhRM7JmKw" name="DragAndDropSpecification">
</eClassifiers----


if I change the order/sequence in the file to
<?xml----
<xmi----
<eClassifiers xmi:type="ecore:EClass" xmi:id="_r0GtefX4EeaOTqhRM7JmKw" name="DragAndDropSpecification">
</eClassifiers----
<eClassifiers----
<eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtbfX4EeaOTqhRM7JmKw" name="allowedDragAndDrops" ordered="false" lowerBound="1" upperBound="-1" eType="_r0GtefX4EeaOTqhRM7JmKw"/>
</eClassifiers----

everything runs perfect.

But this file is always 'new generated' and there is no possibility to manipulate the profile-files.

My question:
Is there a possibility to pre load all eClassifiers and than read the elements inside the eClassifiers or to change the loading sequence?

Thank you very much for some hints.
Re: MagicDraw reading UML Profiles [message #1754685 is a reply to message #1754490] Tue, 21 February 2017 14:40 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6460
Registered: July 2009
Senior Member
Hi

I think that you will find that setting XMLResource.OPTION_DEFER_IDREF_RESOLUTION in your load options is the secret. Arguably this is an uncostly option that solves real problems so it should always be set. Acceleo should probably set it automatically.

Regards

Ed Willink
Re: MagicDraw reading UML Profiles [message #1754696 is a reply to message #1754685] Tue, 21 February 2017 16:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30466
Registered: July 2009
Senior Member
The problem might well be the opposite. Given there isn't much of a stack trace shown, I can only guess that it might well be the case that something (in the same resource) is using the the profile to create instances before the profile fully loaded and resolved, i.e., before the cross references have been set. Deferring when cross reference are set to be even later might be even more of a problem... But I can only guess...
Re: MagicDraw reading UML Profiles [message #1754741 is a reply to message #1754696] Tue, 21 February 2017 21:27 Go to previous messageGo to next message
Michael Sausmikat is currently offline Michael SausmikatFriend
Messages: 3
Registered: February 2017
Junior Member
I get 2 kind of exceptions
First one:
Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSettingDelegate(EStructuralFeatureImpl.java:845)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate(BasicEObjectImpl.java:1565)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicIsSet(BasicEObjectImpl.java:1275)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObjectImpl.java:1257)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObjectImpl.java:1241)
	at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.hasNext(EContentsEList.java:437)
	at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.next(EContentsEList.java:595)
	at org.eclipse.emf.ecore.util.EcoreUtil$CrossReferencer.handleCrossReference(EcoreUtil.java:1794)
	at org.eclipse.emf.ecore.util.ECrossReferenceAdapter$InverseCrossReferencer.add(ECrossReferenceAdapter.java:216)
	at org.eclipse.emf.ecore.util.ECrossReferenceAdapter.setTarget(ECrossReferenceAdapter.java:770)
	at org.eclipse.emf.ecore.util.ECrossReferenceAdapter.setTarget(ECrossReferenceAdapter.java:752)
	at org.eclipse.uml2.common.util.CacheAdapter.setTarget(CacheAdapter.java:360)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapterList.didAdd(BasicNotifierImpl.java:121)
	at org.eclipse.emf.common.util.BasicEList.addUnique(BasicEList.java:443)
	at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:341)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl$EAdapterList.add(BasicNotifierImpl.java:200)
	at org.eclipse.uml2.common.util.CacheAdapter.addAdapter(CacheAdapter.java:278)
	at org.eclipse.uml2.common.util.CacheAdapter.addAdapter(CacheAdapter.java:302)
	at org.eclipse.emf.ecore.util.ECrossReferenceAdapter.handleContainment(ECrossReferenceAdapter.java:660)
	at org.eclipse.emf.ecore.util.ECrossReferenceAdapter.selfAdapt(ECrossReferenceAdapter.java:568)
	at org.eclipse.uml2.common.util.CacheAdapter.selfAdapt(CacheAdapter.java:582)
	at org.eclipse.emf.ecore.util.ECrossReferenceAdapter.notifyChanged(ECrossReferenceAdapter.java:502)
	at org.eclipse.uml2.common.util.CacheAdapter.notifyChanged(CacheAdapter.java:386)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.dispatchNotification(NotifyingListImpl.java:261)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:294)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processTopObject(XMLHandler.java:1520)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1372)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1504)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1026)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:82)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1008)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:719)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:190)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2579)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(XMLHandler.java:2458)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1335)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1504)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1026)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:82)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1008)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:719)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:190)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2579)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(XMLHandler.java:2458)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1335)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1504)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1026)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:82)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1008)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:719)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:190)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
	at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1297)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
	at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:391)
	at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:356)
	at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:488)
	at de.msw.model.gen.main.Generate.<init>(Generate.java:90)
	at de.msw.model.gen.main.Generate.main(Generate.java:144)

For the following model part
        <eClassifiers xmi:type="ecore:EClass" xmi:id="_r0GtLfX4EeaOTqhRM7JmKw" name="Customization">
          <eAnnotations xmi:id="_r0GtLvX4EeaOTqhRM7JmKw" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_11_5EAPbeta_be00301_1148632817486_155219_3"/>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtL_X4EeaOTqhRM7JmKw" name="typesForTarget" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtMfX4EeaOTqhRM7JmKw" name="typesForSource" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtM_X4EeaOTqhRM7JmKw" name="representationText" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtNfX4EeaOTqhRM7JmKw" name="keyword" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtN_X4EeaOTqhRM7JmKw" name="allowedRelationships" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtOfX4EeaOTqhRM7JmKw" name="disallowedRelationships" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtO_X4EeaOTqhRM7JmKw" name="hideMetatype" ordered="false" lowerBound="1" defaultValueLiteral="true">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//Boolean"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtPfX4EeaOTqhRM7JmKw" name="customizationTarget" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtP_X4EeaOTqhRM7JmKw" name="applyToSource" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Stereotype"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtQfX4EeaOTqhRM7JmKw" name="applyToTarget" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Stereotype"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtQ_X4EeaOTqhRM7JmKw" name="superTypes" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Element"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtRfX4EeaOTqhRM7JmKw" name="base_Class" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtR_X4EeaOTqhRM7JmKw" name="standardExpertConfiguration" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtSfX4EeaOTqhRM7JmKw" name="suggestedOwnedTypes" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtS_X4EeaOTqhRM7JmKw" name="hiddenOwnedTypes" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtTfX4EeaOTqhRM7JmKw" name="suggestedOwnedDiagrams" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtT_X4EeaOTqhRM7JmKw" name="hiddenOwnedDiagrams" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtUfX4EeaOTqhRM7JmKw" name="inShortcutMenu" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Property"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtU_X4EeaOTqhRM7JmKw" name="showPropertiesWhenNotApplied" ordered="false" lowerBound="1" defaultValueLiteral="true">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//Boolean"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtVfX4EeaOTqhRM7JmKw" name="quickApplyingFor" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtV_X4EeaOTqhRM7JmKw" name="usedUMLProperties" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtWfX4EeaOTqhRM7JmKw" name="possibleOwners" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtW_X4EeaOTqhRM7JmKw" name="multiLineTextProperties" ordered="false" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Property"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtXfX4EeaOTqhRM7JmKw" name="category" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtX_X4EeaOTqhRM7JmKw" name="checkSpelling" ordered="false" unique="false" upperBound="-1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtYfX4EeaOTqhRM7JmKw" name="defaultShapeSize" lowerBound="2" upperBound="2">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtY_X4EeaOTqhRM7JmKw" name="doNotSuggestAsType" ordered="false" lowerBound="1" defaultValueLiteral="false">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//Boolean"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtZfX4EeaOTqhRM7JmKw" name="helpID" ordered="false">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtZ_X4EeaOTqhRM7JmKw" name="preferredMetatype" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtafX4EeaOTqhRM7JmKw" name="showPropertiesWhenNotAppliedLimitedByProfileApplication" ordered="false" defaultValueLiteral="true">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//Boolean"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0Gta_X4EeaOTqhRM7JmKw" name="showPropertiesWhenNotAppliedLimitedByElementType" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Classifier"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtbfX4EeaOTqhRM7JmKw" name="allowedDragAndDrops" ordered="false" lowerBound="1" upperBound="-1" eType="_r0GtefX4EeaOTqhRM7JmKw"/>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0Gtb_X4EeaOTqhRM7JmKw" name="abbreviation" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtcfX4EeaOTqhRM7JmKw" name="additionalContent" ordered="false" eType="_r0Gth_X4EeaOTqhRM7JmKw"/>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0Gtc_X4EeaOTqhRM7JmKw" name="subElementContentsIncluded" ordered="false" eType="_r0GtnfX4EeaOTqhRM7JmKw" defaultValueLiteral="All"/>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtdfX4EeaOTqhRM7JmKw" name="doNotSuggestNameAutoCompletion" ordered="false" lowerBound="1" defaultValueLiteral="true">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//Boolean"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0Gtd_X4EeaOTqhRM7JmKw" name="symbolStandardExpertConfiguration" ordered="false" lowerBound="1" upperBound="-1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
        </eClassifiers>
        <eClassifiers xmi:type="ecore:EClass" xmi:id="_r0GtefX4EeaOTqhRM7JmKw" name="DragAndDropSpecification">
          <eAnnotations xmi:id="_r0GtevX4EeaOTqhRM7JmKw" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_17_0_2_903028d_1341238576589_798230_2132"/>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0Gte_X4EeaOTqhRM7JmKw" name="sourceElement" ordered="false">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GtffX4EeaOTqhRM7JmKw" name="propertyActionResult" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0Gtf_X4EeaOTqhRM7JmKw" name="base_Class" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtgfX4EeaOTqhRM7JmKw" name="relationActionResult" ordered="false">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Class"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0Gtg_X4EeaOTqhRM7JmKw" name="representationText" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//String"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0GthfX4EeaOTqhRM7JmKw" name="appendMode" ordered="false" unique="false" lowerBound="1" defaultValueLiteral="true">
            <eType xmi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/5.0.0/Types#//Boolean"/>
          </eStructuralFeatures>
        </eClassifiers>

Second one:
Exception in thread "main" java.lang.ClassCastException: org.eclipse.emf.ecore.impl.EAttributeImpl cannot be cast to org.eclipse.emf.ecore.EReference
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setAttribValue(XMLHandler.java:2755)
	at org.eclipse.emf.ecore.xmi.impl.SAXXMIHandler.handleObjectAttribs(SAXXMIHandler.java:79)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectFromFactory(XMLHandler.java:2229)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1366)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1504)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1026)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:82)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1008)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:719)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:190)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
	at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2579)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(XMLHandler.java:2458)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1335)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1504)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1026)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:82)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1008)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:719)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:190)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getPackageForURI(XMLHandler.java:2579)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.getFactoryForPrefix(XMLHandler.java:2458)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createObjectByType(XMLHandler.java:1335)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.createTopObject(XMLHandler.java:1504)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.processElement(XMLHandler.java:1026)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.processElement(XMIHandler.java:82)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:1008)
	at org.eclipse.emf.ecore.xmi.impl.XMLHandler.startElement(XMLHandler.java:719)
	at org.eclipse.emf.ecore.xmi.impl.XMIHandler.startElement(XMIHandler.java:190)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
	at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2786)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:649)
	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:333)
	at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
	at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:261)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1297)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.getResource(ResourceSetImpl.java:406)
	at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:391)
	at org.eclipse.acceleo.common.utils.ModelUtils.load(ModelUtils.java:356)
	at org.eclipse.acceleo.engine.service.AbstractAcceleoGenerator.initialize(AbstractAcceleoGenerator.java:488)
	at de.msw.model.gen.main.Generate.<init>(Generate.java:90)
	at de.msw.model.gen.main.Generate.main(Generate.java:144)

For the following model part
        <eClassifiers xmi:type="ecore:EClass" xmi:id="_r0Gtr_X4EeaOTqhRM7JmKw" name="grouped">
          <eAnnotations xmi:id="_r0GtsPX4EeaOTqhRM7JmKw" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_11_5EAPbeta_be00301_1148642764910_998510_268"/>
          <eStructuralFeatures xmi:type="ecore:EReference" xmi:id="_r0GtsfX4EeaOTqhRM7JmKw" name="base_Property" ordered="false" lowerBound="1">
            <eType xmi:type="ecore:EClass" href="http://www.eclipse.org/uml2/5.0.0/UML#//Property"/>
          </eStructuralFeatures>
          <eStructuralFeatures xmi:type="ecore:EAttribute" xmi:id="_r0Gts_X4EeaOTqhRM7JmKw" name="group" ordered="false" lowerBound="1" eType="_r0GttfX4EeaOTqhRM7JmKw" defaultValueLiteral="General"/>
        </eClassifiers>
        <eClassifiers xmi:type="ecore:EEnum" xmi:id="_r0GttfX4EeaOTqhRM7JmKw" name="CustomizationGroupNames">
          <eAnnotations xmi:id="_r0GttvX4EeaOTqhRM7JmKw" source="http://www.eclipse.org/uml2/2.0.0/UML" references="_11_5_be00301_1151668147214_220172_349"/>
          <eLiterals xmi:id="_r0Gtt_X4EeaOTqhRM7JmKw" name="Connection Rules"/>
          <eLiterals xmi:id="_r0GtuPX4EeaOTqhRM7JmKw" name="Model Initialization" value="1"/>
          <eLiterals xmi:id="_r0GtufX4EeaOTqhRM7JmKw" name="Properties" value="2"/>
          <eLiterals xmi:id="_r0GtuvX4EeaOTqhRM7JmKw" name="OwnedElements" value="3"/>
          <eLiterals xmi:id="_r0Gtu_X4EeaOTqhRM7JmKw" name="General" value="4"/>
          <eLiterals xmi:id="_r0GtvPX4EeaOTqhRM7JmKw" name="Naming" value="5"/>
          <eLiterals xmi:id="_r0GtvfX4EeaOTqhRM7JmKw" name="Symbol" value="6"/>
          <eLiterals xmi:id="_r0GtvvX4EeaOTqhRM7JmKw" name="Content" value="7"/>
        </eClassifiers>


It is always the same, I change the order and it is OK
Re: MagicDraw reading UML Profiles [message #1754749 is a reply to message #1754685] Tue, 21 February 2017 22:57 Go to previous messageGo to next message
Michael Sausmikat is currently offline Michael SausmikatFriend
Messages: 3
Registered: February 2017
Junior Member
XMLResource.OPTION_DEFER_IDREF_RESOLUTION was the problem.
It took me some time to set it correctly.
Thank you very much

[Updated on: Tue, 21 February 2017 23:01]

Report message to a moderator

Re: MagicDraw reading UML Profiles [message #1801570 is a reply to message #1754749] Tue, 22 January 2019 17:37 Go to previous messageGo to next message
Stefan Röhrig is currently offline Stefan RöhrigFriend
Messages: 2
Registered: March 2018
Junior Member
I'm facing the same problem.

I tried to set the option in Generate.java like this:
    /**
     * This can be used to update the resource set's package registry with all needed EPackages.
     * 
     * @param resourceSet
     *            The resource set which registry has to be updated.
     * @generated NOT
     */
    @Override
    public void registerPackages(ResourceSet resourceSet) {
        
    	// Added by SRG
    	resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, Boolean.TRUE);

        super.registerPackages(resourceSet);
        if (!isInWorkspace(org.eclipse.uml2.uml.UMLPackage.class)) {
            resourceSet.getPackageRegistry().put(org.eclipse.uml2.uml.UMLPackage.eINSTANCE.getNsURI(), org.eclipse.uml2.uml.UMLPackage.eINSTANCE);
        }

but it doesn't solve the problem.
Did you try to load the profiles explicitly?
I didn't recognize how to do that.

Thanks for your help.
Re: MagicDraw reading UML Profiles [message #1801634 is a reply to message #1801570] Thu, 24 January 2019 04:38 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30466
Registered: July 2009
Senior Member
I have no idea what Generate.java is, and I have no idea how UML2's profiles work. Perhaps better to ask on the UML2 forum about UML:

https://www.eclipse.org/forums/index.php/f/117/
Re: MagicDraw reading UML Profiles [message #1801648 is a reply to message #1801634] Thu, 24 January 2019 06:16 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6460
Registered: July 2009
Senior Member
Hi

You do not need to SPAM irrelevant groups. You asked the question more informatively wrt Acceleo on the M2T group... I repeat my answer.

MagicDraw problems should be asked on a MagicDraw forum.

getSettingDelegate problems are usually due to bad registrations. I suggest you ensure that MagicDraw registers in the same way as Papyrus.

Regards

Ed Willink
Previous Topic:EMF Serialization of collection
Next Topic:What happened to EMF Index
Goto Forum:
  


Current Time: Mon Sep 23 11:25:38 GMT 2019

Powered by FUDForum. Page generated in 0.01576 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top