|
Re: Strange behavior when class with name EPackage is used [message #506056 is a reply to message #505950] |
Tue, 05 January 2010 17:20 |
Ed Merks 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> /**<br>
* <!-- begin-user-doc --><br>
* <!-- end-user-doc --><br>
* @generated<br>
*/<br>
public EPackage getDerivedContainedEPackage() {<br>
// TODO: implement this method to return the 'Derived Contained
EPackage' containment reference<br>
// Ensure that you remove @generated or mark it @generated NOT<br>
throw new UnsupportedOperationException();<br>
}<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>
<?xml version="1.0" encoding="UTF-8"?>
<br>
<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>>
<br>
<component>
<br>
<rootPackage>
<br>
<subPackage/>
<br>
</rootPackage>
<br>
</component>
<br>
</xocl:XProject>
<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 |
Philipp Kutter 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
|
|
|
Powered by
FUDForum. Page generated in 0.03423 seconds