Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jwt-dev] Importing to JWT Custom Aspect Properties

Hi Eric

Le 27/04/2011 18:08, Eric Phetteplace a écrit :
Property myCustomPropertyInstance = AspectManager.INSTANCE.getAspectInstance(modelElement, myCustomPropertyAspect)
can not cast aspect instance to property.
I just have an ecore file, without any related classes, so there's nothing for me to cast to.

I figure I need to do one or the other:

1) generate the aspect subclasses, based on the ecore file (how to do that?  bit of a noob).
You don't need to do that, custom Properties provide their own model and generated Property.class precisely to avoid that.
IF you are using an org.eclipse.jwt.we.conf.property.Property (which extends AspectInstance) and not a java.lang.util one ;)

2) access the ecore properties somehow through the aspect instance.  In debug, and API, I don't see how to do that, but I figure it's possible?
That's dynamic EMF, I talk about it also in the aspects wiki, but you don't need that either, IF you've designed your model as explained at
http://wiki.eclipse.org/JWT_Metamodel_Extension#Setting_up_simple_.28key-value.29_additional_model_extensions
and configured your project as shown in the sample at http://dev.eclipse.org/svnroot/soa/org.eclipse.jwt/trunk/examples/

Regards,
Marc

Eric

On Wed, Apr 27, 2011 at 11:48 AM, Marc Dutoo <marc.dutoo@xxxxxxxxxxx> wrote:
Hi Eric

Cast on which class, at which point ?

Regards,
Marc


Le 27/04/2011 17:47, Eric Phetteplace a écrit :
Hmm, this part doesn't seem to work:

// and

Property myCustomPropertyInstance = AspectManager.INSTANCE.getAspectInstance(modelElement, myCustomPropertyAspect)
// or (if multiple or not autocreated)

Property myCustomPropertyInstance = AspectManager.INSTANCE.createAndAddAspectInstance(myCustomPropertyAspect, modelElement)

 
// set the value
myCustomPropertyInstance.setValue("wizard value");


Class cast exception.

I'm poking through the samples, but I'm not finding anything yet.

Any ideas?

Thanks,

Eric




Back to the top