Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Strange behavior when class with name EPackage is used
Strange behavior when class with name EPackage is used [message #505950] Tue, 05 January 2010 15:50 Go to next message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060107010800050304020203
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hi.
My first strange EMF behavior since ages... ;-)

I am using the EMF version of Galileo 3.5.1.

If you generate from the attached .ecore a normal EMF Editor,
then you can create an XProject containing an XComponent, containing an
XRootPackage.

Then you creat an XSubPackage, and it is NOT shown in the editor, but
exists in the resource:

<?xml version="1.0" encoding="UTF-8"?>
<xocl:XProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:xocl="http://www.langlets.org/xocl">
<component>
<rootPackage>
<subPackage/>
</rootPackage>
</component>
</xocl:XProject>


The problem goes away when the package ElocalCore with the classes
ENamedElement and EPackage is removed....

All the best for 2010!

Philipp

--------------060107010800050304020203
Content-Type: text/xml;
name="Xocl.ecore"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="Xocl.ecore"

<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="xocl"
nsURI="http://www.langlets.org/xocl" nsPrefix="xocl">
<eAnnotations source="http://www.xocl.org/OCL">
<details key="rootConstraint" value="trg.name='XProject'"/>
</eAnnotations>
<eClassifiers xsi:type="ecore:EClass" name="XNamedElement" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="businessName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="camelCaseLower" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
changeable="false" volatile="true" transient="true" derived="true">
<eAnnotations source="http://www.xocl.org/OCL">
<details key="derive" value="'cclTODO_'.concat(businessName)"/>
</eAnnotations>
</eStructuralFeatures>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="camelCaseUpper" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
changeable="false" volatile="true" transient="true" derived="true">
<eAnnotations source="http://www.xocl.org/OCL">
<details key="derive" value="'CCUtodo_'.concat(businessName)"/>
</eAnnotations>
</eStructuralFeatures>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XProject" eSuperTypes="#//XNamedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="implementRootPackage" eType="#//XRootPackage"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="component" upperBound="-1"
eType="#//XComponent" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="knownPackage" upperBound="-1"
eType="#//XPackage"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XComponent" eSuperTypes="#//XNamedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="domainType" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="domainMiddleName" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="rootPackage" upperBound="-1"
eType="#//XRootPackage" containment="true" eOpposite="#//XRootPackage/containingComponent"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="derivedBundleName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
changeable="false" volatile="true" transient="true" derived="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XPackage" abstract="true" eSuperTypes="#//XNamedElement">
<eStructuralFeatures xsi:type="ecore:EReference" name="subPackage" upperBound="-1"
eType="#//XSubPackage" containment="true" eOpposite="#//XSubPackage/containingPackage"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="derivedPackageName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
changeable="false" volatile="true" transient="true" derived="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="derivedNsURI" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
changeable="false" volatile="true" transient="true" derived="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="derivedNsPrefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
changeable="false" volatile="true" transient="true" derived="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XRootPackage" eSuperTypes="#//XPackage">
<eStructuralFeatures xsi:type="ecore:EReference" name="derivedContainedEPackage"
lowerBound="1" eType="#//ElocalCore/EPackage" changeable="false" volatile="true"
transient="true" derived="true" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="containingComponent" lowerBound="1"
eType="#//XComponent" eOpposite="#//XComponent/rootPackage"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="XSubPackage" eSuperTypes="#//XPackage">
<eStructuralFeatures xsi:type="ecore:EReference" name="derivedEcorePackage" lowerBound="1"
eType="#//ElocalCore/EPackage" changeable="false" volatile="true" transient="true"
derived="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="containingPackage" lowerBound="1"
eType="#//XPackage" eOpposite="#//XPackage/subPackage"/>
</eClassifiers>
<eSubpackages name="ElocalCore" nsURI="http://www.langlets.org/ecore" nsPrefix="ecorelocal">
<eClassifiers xsi:type="ecore:EClass" name="EPackage" eSuperTypes="#//ElocalCore/ENamedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="nsURI" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="nsPrefix" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="eSubpackages" upperBound="-1"
eType="#//ElocalCore/EPackage" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ENamedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
</eSubpackages>
</ecore:EPackage>

--------------060107010800050304020203--
Re: Strange behavior when class with name EPackage is used [message #506056 is a reply to message #505950] Tue, 05 January 2010 17:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050209080409020002000804
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Philipp,

How did you implement methods like this in XRootPackageImpl?

/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EPackage getDerivedContainedEPackage() {
// TODO: implement this method to return the 'Derived
Contained EPackage' containment reference
// Ensure that you remove @generated or mark it @generated NOT
throw new UnsupportedOperationException();
}



Philipp Kutter wrote:
> Hi.
> My first strange EMF behavior since ages... ;-)
>
> I am using the EMF version of Galileo 3.5.1.
>
> If you generate from the attached .ecore a normal EMF Editor,
> then you can create an XProject containing an XComponent, containing
> an XRootPackage.
>
> Then you creat an XSubPackage, and it is NOT shown in the editor, but
> exists in the resource:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xocl:XProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xocl="http://www.langlets.org/xocl">
> <component>
> <rootPackage>
> <subPackage/>
> </rootPackage>
> </component>
> </xocl:XProject>
>
>
> The problem goes away when the package ElocalCore with the classes
> ENamedElement and EPackage is removed....
>
> All the best for 2010!
>
> Philipp

--------------050209080409020002000804
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Philipp,<br>
<br>
How did you implement methods like this in XRootPackageImpl?<br>
<blockquote>&nbsp;&nbsp;&nbsp; /**<br>
&nbsp;&nbsp;&nbsp; &nbsp;* &lt;!-- begin-user-doc --&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;* &lt;!-- end-user-doc --&gt;<br>
&nbsp;&nbsp;&nbsp; &nbsp;* @generated<br>
&nbsp;&nbsp;&nbsp; &nbsp;*/<br>
&nbsp;&nbsp;&nbsp; public EPackage getDerivedContainedEPackage() {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // TODO: implement this method to return the 'Derived Contained
EPackage' containment reference<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // Ensure that you remove @generated or mark it @generated NOT<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; throw new UnsupportedOperationException();<br>
&nbsp;&nbsp;&nbsp; }<br>
</blockquote>
<br>
<br>
Philipp Kutter wrote:
<blockquote cite="mid:hhvn66$qam$1@build.eclipse.org" type="cite">Hi.
<br>
My first strange EMF behavior since ages... ;-)
<br>
<br>
I am using the EMF version of Galileo 3.5.1.
<br>
<br>
If you generate from the attached .ecore a normal EMF Editor,
<br>
then you can create an XProject containing an XComponent, containing an
XRootPackage.
<br>
<br>
Then you creat an XSubPackage, and it is NOT shown in the editor, but
exists in the resource:
<br>
<br>
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
<br>
&lt;xocl:XProject xmi:version="2.0" xmlns:xmi=<a class="moz-txt-link-rfc2396E" href="http://www.omg.org/XMI">"http://www.omg.org/XMI"</a>
xmlns:xocl=<a class="moz-txt-link-rfc2396E" href="http://www.langlets.org/xocl">"http://www.langlets.org/xocl"</a>&gt;
<br>
&nbsp; &lt;component&gt;
<br>
&nbsp;&nbsp;&nbsp; &lt;rootPackage&gt;
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;subPackage/&gt;
<br>
&nbsp;&nbsp;&nbsp; &lt;/rootPackage&gt;
<br>
&nbsp; &lt;/component&gt;
<br>
&lt;/xocl:XProject&gt;
<br>
<br>
<br>
The problem goes away when the package ElocalCore with the classes
ENamedElement and EPackage is removed....
<br>
<br>
All the best for 2010!
<br>
<br>
Philipp
<br>
</blockquote>
</body>
</html>

--------------050209080409020002000804--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Strange behavior when class with name EPackage is used [message #506815 is a reply to message #506056] Sun, 10 January 2010 15:18 Go to previous message
Philipp Kutter is currently offline Philipp KutterFriend
Messages: 306
Registered: July 2009
Senior Member
Ed.
As below. And of course the error went away, once I implemented it...

Regards, Philipp

public EPackage getDerivedContainedEPackage() {
/**
* @OCL let res:Tuple(name:String)=Tuple{name='EdAnswer'} in res
* @templateTag GGFT01
*/
EClass eClass = (XoclPackage.Literals.XROOT_PACKAGE);
EStructuralFeature eFeature =
XoclPackage.Literals.XROOT_PACKAGE__DERIVED_CONTAINED_EPACKA GE;

if (derivedContainedEPackageDeriveOCL == null) {
Helper helper = OCL_ENV.createOCLHelper();
helper.setAttributeContext(eClass, eFeature);

String derive = XoclEmfUtil.findDeriveAnnotationText(eFeature,
eClass());

try {
derivedContainedEPackageDeriveOCL = helper.createQuery(derive);
} catch (ParserException e) {
return null;
} finally {
XoclErrorHandler.handleQueryProblems(XoclPackage.PLUGIN_ID,
derive, helper.getProblems(), eClass, eFeature);
}
}

Query query = OCL_ENV.createQuery(derivedContainedEPackageDeriveOCL);
try {
XoclErrorHandler.enterContext(XoclPackage.PLUGIN_ID, query);

XoclEvaluator xoclEval = new XoclEvaluator(this, cachedValues);
EPackage result = (EPackage) xoclEval.evaluateElement(eFeature,
query);

if (result instanceof BasicEObjectImpl) {
((BasicEObjectImpl) result)
.eBasicSetContainer(
this,
InternalEObject.EOPPOSITE_FEATURE_BASE
- XoclPackage.XROOT_PACKAGE__DERIVED_CONTAINED_EPACKAGE,
null);
}

return result;

} catch (Throwable e) {
XoclErrorHandler.handleException(e);
return null;
} finally {
XoclErrorHandler.leaveContext();
}
}



Ed Merks wrote:
> Philipp,
>
> How did you implement methods like this in XRootPackageImpl?
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public EPackage getDerivedContainedEPackage() {
> // TODO: implement this method to return the 'Derived
> Contained EPackage' containment reference
> // Ensure that you remove @generated or mark it @generated NOT
> throw new UnsupportedOperationException();
> }
>
>
>
> Philipp Kutter wrote:
>> Hi.
>> My first strange EMF behavior since ages... ;-)
>>
>> I am using the EMF version of Galileo 3.5.1.
>>
>> If you generate from the attached .ecore a normal EMF Editor,
>> then you can create an XProject containing an XComponent, containing
>> an XRootPackage.
>>
>> Then you creat an XSubPackage, and it is NOT shown in the editor, but
>> exists in the resource:
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xocl:XProject xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:xocl="http://www.langlets.org/xocl">
>> <component>
>> <rootPackage>
>> <subPackage/>
>> </rootPackage>
>> </component>
>> </xocl:XProject>
>>
>>
>> The problem goes away when the package ElocalCore with the classes
>> ENamedElement and EPackage is removed....
>>
>> All the best for 2010!
>>
>> Philipp
Previous Topic:Resource URIs for FeatureMaps
Next Topic:Re: Cross Document References persistence with Translator
Goto Forum:
  


Current Time: Thu Apr 25 16:57:19 GMT 2024

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

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

Back to the top