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

You're welcome, keep me in touch.

And a warm welcome to the JWT community !

Regards,
Marc


Le 26/04/2011 14:29, Eric Phetteplace a écrit :
Great, thanks!

From studying the code, this all looks familiar.  I'll try this out in a few hours.

Eric

On Tue, Apr 26, 2011 at 5:46 AM, Marc Dutoo <marc.dutoo@xxxxxxxxxxx> wrote:
Hi Eric

You're right, some links have not been updated since we migrated to the SOA top level project ! I'm doing that right now.

In the meantime, I think you have to use AspectManager (in http://dev.eclipse.org/svnroot/soa/org.eclipse.jwt/trunk/we/jwt-we-conf-model/src/org/eclipse/jwt/we/conf/model/aspects/  ) which is the entry point to aspects, including custom properties, and
* if you didn't do it yet, define a profile describing on which model elements you want which custom properties (see the wiki at http://wiki.eclipse.org/JWT_Metamodel_Extension )
* activate this profile on your model (see http://wiki.eclipse.org/JWT_Metamodel_Extension#How_to_have_a_profile_activated_on_every_new_workflow )
* set the custom properties you want on the model elements they decorate, and finally save it all :

   // look for your custom property aspect
   List<Aspect> aspects = getAspects(EObject modelElement)
   Property myCustomPropertyAspect = null;
   String myCustomPropertyAspectId = "my.aspect.id"
   for (Aspect aspect : aspects) {
      if (myCustomPropertyAspectId.equals(aspect.getId())) {
         myCustomPropertyAspect = (Property) aspect;
      }
   }

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");

   // don't forget to save the model at the end of the wizard, that will also save the custom properties
  

& you can have a look at :
* ManageActivatedProfilesUI.java which uses AspectManager in http://dev.eclipse.org/svnroot/soa/org.eclipse.jwt/trunk/we/jwt-we-conf-model.edit/src/org/eclipse/jwt/we/conf/edit/ui/
* the logging sample in http://dev.eclipse.org/svnroot/soa/org.eclipse.jwt/trunk/examples/

Regards,
Marc


Le 25/04/2011 17:41, Eric Phetteplace a écrit :
Hello,

I created an Import Wizard, based on the CreationWizard and WizardHelper classes.  It parses a non-OO file and generates a JWT model and diagram.  It works well.  I also defined my own  properties via aspect, and I can save custom properties, too (using the diagram editor, after the wizard finishes).

I'd like to save the custom properties during the wizard, and I'm trying to figure out how to programmatically set the custom properties.  I figure it should be fairly easy.  With a lot of the javadoc being boilerplate, I'm struggling to understand what I should do.

I tried looking for jwt-we-conf-model.editor-tests in SVN, but I couldn't find it.

Do you have any suggestions on how to do this? 

Thanks,

Eric

_______________________________________________ jwt-dev mailing list jwt-dev@eclipse.orgttps://dev.eclipse.org/mailman/listinfo/jwt-dev




Back to the top