|
|
|
|
Re: Read Xtext resource as EMF resource [message #1065180 is a reply to message #1065163] |
Mon, 24 June 2013 15:51 |
serhat gezgin Messages: 243 Registered: January 2013 Location: Izmir |
Senior Member |
|
|
i dont get an error but my changes nor occur on deneme.user file why dont undestand?
my whole code is ; (just creating SitePermission but this element dont shown in deneme.user file)
ResourceSet rs = new ResourceSetImpl();
SitePermission sitePermission= null;
Resource resource = rs.getResource(
URI.createURI(userFile.toURI().toString()), true);
UserModel eobject = (UserModel) resource.getContents().get(0);
UserPackage.eINSTANCE.eClass();
// Retrieve the default factory singleton
UserFactory factory = UserFactory.eINSTANCE;
// SitePermission
SitePermission sitePermission = factory.createSitePermission();
sitePermission.setName(name);
//Other changes
userModel.getSitePermissions().add(sitePermission);
HashMap saveOptions = new HashMap();
saveOptions.put(XtextResource.OPTION_FORMAT, Boolean.TRUE);
try {
resource.save(new FileOutputStream("deneme.user"), saveOptions);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
[Updated on: Mon, 24 June 2013 18:26] Report message to a moderator
|
|
|
|
Re: Read Xtext resource as EMF resource [message #1065196 is a reply to message #1065194] |
Mon, 24 June 2013 18:07 |
serhat gezgin Messages: 243 Registered: January 2013 Location: Izmir |
Senior Member |
|
|
Hi,
i use 2 project one is User xtext Project, second is my content GMF project on GMF project when web created (on CreateWebCommand) above code triggered and on User file SitePermission element added. and Web element reference to it. (i have 2 file one is content another is user)
when i do this
i have got this error
Save Failed
No EObjectDescription could be found in Scope Web.sitePermission for UserModel.sitePermissions[0]->SitePermission'Serhat'
Semantic Object: ContentModel'CM'.ownedWeb->Web'fsdg'
Do you have any idea why the reference and element cannot be found on file please ?
[Updated on: Mon, 24 June 2013 18:28] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: Read Xtext resource as EMF resource [message #1065208 is a reply to message #1065207] |
Mon, 24 June 2013 19:35 |
serhat gezgin Messages: 243 Registered: January 2013 Location: Izmir |
Senior Member |
|
|
Hi
I have user project and its grammer is;
UserModel returns UserModel:
('sitePermissions' '{' sitePermissions+=SitePermission (sitePermissions+=SitePermission)* '}' )?
;
SitePermission returns SitePermission:
'sitePermission' name = QualifiedName '{'
'webGUID' '=' webGUID=STRING
'}'
;
and I have content project and its grammer is;
ContentModel returns ContentModel:
'ContentModel'
name=QualifiedName
'{'
'webApplicaitonName' '=' webApplicataionName = STRING
'siteCollectionName' '=' siteCollectionName = STRING
('description' '=' description=STRING)?
ownedWeb=Web
'}';
Web returns Web:
'Web'
name=QualifiedName
'{'
'sitePermission' '=' sitePermission = [user::SitePermission|QualifiedName]
('Webs' '{' ownedWeb+=Web (ownedWeb+=Web)* '}' )?
'}';
I can create 2 project well and they work greate. (i follow http://christiandietrich.wordpress.com/2012/08/07/xtext-referencing-elements-of-one-dsl-from-another-dsl/)
But i just want to on contents Diagram project (XText and GMF project shares Contents EMF classes (ex ContentPackage, ContentFactory ..)) when Web created i must add a SitePermission element to created.user file
and i must do this on content xtext project too when web created i must add SitePermission to created.user file too
can i explain more ?
Regards
[Updated on: Mon, 24 June 2013 20:09] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04935 seconds