Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc) » Urgent : How to Read the Ecore Model(Reading the Ecore Model)
| | | | |
Re: Urgent : How to Read the Ecore Model [message #872941 is a reply to message #872927] |
Thu, 17 May 2012 06:28 |
Sriram Ramanujam Messages: 7 Registered: May 2012 |
Junior Member |
|
|
Rather confusing you let me share my Project Objective :
Problem Statement:
I just need to Create Eclipse Plugin which should Read and Write the Ecore model programmatically.
From User point of View these are the following things that the PLUG IN should deliver:
i) User need to Create/Import the Ecore Model
ii) User can Select the Variation Points (He can select what are the classes or attributes.. etc., needed),
iii) After Selecting that My program should able to Write it back to the same model (Remove the UNCHECKED classes)
iv) Such that User can able to get the output which is derived from this variations.
For eg.,
i) If User has a model with some three classes such as X,Y,Z. (My Program should read that model with all three classes X,Y,Z)
ii) It Should allow the user to select the variations (If user selects X & Z only two classes if he dont need Y).
iii) Then my Program should write it back to model (final model will going give the output of the two classes 'X & Z' only; not 'Y')
Sources:
1) EMF, Eclipse Modeling Frame Work, 2nd Edition
2) Eclipse Forums, Google...
3) Eclipse Indigo Help..
QUESTIONS:
1) How/from where i want to start ?
2) What are the steps i want to take ?
3) though i was newbie i got structed up some where itseems, a small idea from experienced people will be more valuable for me !!
Thanks
--
Sriram R.
|
|
|
Re: Urgent : How to Read the Ecore Model [message #872964 is a reply to message #872935] |
Thu, 17 May 2012 07:30 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Sriram,
Comments below.
On 17/05/2012 8:07 AM, Sriram Ramanujam wrote:
> Thanks for your reply Ed Merks !!
> Let me explain it clearly...
>
> After writing Annotated Java code in Empty EMF Project by adding a
> Package "com.eclipse.epo2" and the corresponding classes to them. I
> generated the Model, by RIGHT Clicking the generated "epo2.genmodel"
> and with "generate all" Option.
>
> Now when you look at the Package explorer we will have four folders
> which look like
> com.eclipse.epo2 (3 Packages )
> com.eclipse.epo2.edit ( 1 package )
> com.eclipse.epo2.editor ( 1 Package)
> com.eclipse.epo2.tests (1 package)
Yes, that's the basic generator-produced structure.
> till this point i was fine.
> QUESTION 1:
>
> Now i just want know in which package i want to add this above
> mentioned code(in previous post) ?
That's up to you, and it depends on how you want your clients or your
downstream code to use it.
> Whether i want to add it to the .edit project (or) .editor project
> (or) .tests project or else with the model (i.e., com.eclipse.epo2) ??
I don't see how I can answer that for you. You can put it where you
like, where it makes sense for you. You can add hand written things to
any interface or any class, even to hand generated ones...
> QUESTION 2:
> If i want to write in any one of the package mentioned above..
> then
> in which package ?
> whether i want to create some new classes ?
> Or else i want to over ride in some of the existing classes ?
There's no context for me to give advice. In Ecore itself, we had wrote
the EcoreUtil class with many useful utilities for working with Ecore
models and for working with EObject, Resource, and ResourceSet... We
also added utilities to the generated classes, e.g.,
EClass.getEStructuralFeature(String) for finding a feature with a given
name...
> Thanks --
> Sriram R
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Urgent : How to Read the Ecore Model [message #872969 is a reply to message #872941] |
Thu, 17 May 2012 07:42 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Sriram,
Commetns below.
On 17/05/2012 8:28 AM, Sriram Ramanujam wrote:
> Rather confusing you let me share my Project Objective :
>
> Problem Statement:
> I just need to Create Eclipse Plugin which should Read and Write the
> Ecore model programmatically.
> From User point of View these are the following things that the PLUG
> IN should deliver:
> i) User need to Create/Import the Ecore Model
> ii) User can Select the Variation Points (He can select what are
> the classes or attributes.. etc., needed), iii) After Selecting
> that My program should able to Write it back to the same model (Remove
> the UNCHECKED classes)
> iv) Such that User can able to get the output which is derived from
> this variations.
It sounds like you need a decorator model to record this information and
write it to a separate resource (much like the GenModel in a *.genmodel
resource is a decorator for an Ecore model and has references back to
the original Ecore model).
>
> For eg., i) If User has a model with some three classes such as
> X,Y,Z. (My Program should read that model with all three classes X,Y,Z)
> ii) It Should allow the user to select the variations (If user
> selects X & Z only two classes if he dont need Y).
> iii) Then my Program should write it back to model (final model
> will going give the output of the two classes 'X & Z' only; not 'Y')
You don't really want to overwrite the original model you read in do
you? If so, you'd just edit the instances you read in and use
Resource.save to write it back out.
>
> Sources:
> 1) EMF, Eclipse Modeling Frame Work, 2nd Edition
> 2) Eclipse Forums, Google...
> 3) Eclipse Indigo Help..
>
>
> QUESTIONS: 1) How/from where i want to start ?
> 2) What are the steps i want to take ? 3) though i was newbie i got
> structed up some where itseems, a small idea from experienced people
> will be more valuable for me !!
> Thanks
> --
> Sriram R.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
| |
Re: Urgent : How to Read the Ecore Model [message #874776 is a reply to message #874660] |
Mon, 21 May 2012 14:25 |
Ed Merks Messages: 33217 Registered: July 2009 |
Senior Member |
|
|
Sriram,
No, there's no time for me to give detailed step-by-step procedures for
each person who needs help. You need to demonstrate some
self-sufficiency and ask more specific questions.
On 21/05/2012 12:25 PM, Sriram Ramanujam wrote:
> Ya you are correct... I Want to make a decorator model to record this
> information and write it to a separate resource.. I Dont want to
> overwrite on that, creating a new one will be fine ....
> How can i do that ? Can i get any code snippet and detailed step by
> step procedures are available ?
>
>
> Thanks --
> Sriram R.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Goto Forum:
Current Time: Mon Sep 23 20:33:23 GMT 2024
Powered by FUDForum. Page generated in 0.02847 seconds
|