Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Extend file(Perform getEStructuralFeature)
Extend file [message #533347] Thu, 13 May 2010 13:36 Go to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 263
Registered: March 2010
Senior Member

Hi,

I write this function on a extend file but its uncomplete:

Quote:

String typeSet(String s):
JAVA getEStructuralFeature(java.lang.String)
;


i want to check if an element "type" in my metamodel got a name,
so i need to have access to the element and to test if the name isnt null, by using just an en Extend files

mahmoud

Re: Extend file [message #533373 is a reply to message #533347] Thu, 13 May 2010 15:04 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6546
Registered: July 2009
Senior Member
Hello,

what is your actual question? what is your metamodel like? can you explain more details?

If You want to use a java extension you have to specify the fully qualified classname before the method name.

If you use ECore as MetaModel you could test the ecore:EClass for the name feature as follows: this.eStructuralFeatures.select(e|e.name == "name").size == 1

~Christian

[Updated on: Thu, 13 May 2010 15:34]

Report message to a moderator

Re: Extend file [message #533491 is a reply to message #533373] Fri, 14 May 2010 09:00 Go to previous messageGo to next message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 263
Registered: March 2010
Senior Member

Hi Christian,

I have a metamodel like a class diagram, and i want to check if an attribute got a type, i used before :

t
Quote:

context class::attribute error '' need a type" :
]his.type.name !=null



and i want to perform the same validation using an eStructuralFeatures

mahmoud
Re: Extend file [message #533497 is a reply to message #533491] Fri, 14 May 2010 09:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 6546
Registered: July 2009
Senior Member
hello,

still don't understand why this is a problem

context EStructuralFeature ERROR "EStructural features must have a type with a name" :
	this.eType.name != null;


EMF Docs might help http://download.eclipse.org/modeling/emf/emf/javadoc/2.5.0/o rg/eclipse/emf/ecore/package-summary.html#details

Regards Christian

[Updated on: Fri, 14 May 2010 09:44]

Report message to a moderator

Re: Extend file [message #533594 is a reply to message #533497] Fri, 14 May 2010 16:33 Go to previous message
Elhamlaoui Mahmoud is currently offline Elhamlaoui MahmoudFriend
Messages: 263
Registered: March 2010
Senior Member

H Christian,

soory its my fault, i have my own metamodel, with its elements (but it still an ecore),i have some element that i used to access directlly but now, i want to used some ecore functions.

i nedd to do this :
Quote:

context Entities::Attribute ERROR "msg" :
this.eClass().getEstructuralFeature("type").name!=null;



Entities : its my Epackage.

mahmoud

Previous Topic:<Xtend> How to delete a UseCase from a list
Next Topic:[XPAND/XTEND] defining aliases
Goto Forum:
  


Current Time: Fri Dec 19 07:15:03 GMT 2014

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

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