Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext2 domainmodel example: no types in contentassist
xtext2 domainmodel example: no types in contentassist [message #692101] Sun, 03 July 2011 15:12 Go to next message
amazuzu  is currently offline amazuzu
Messages: 17
Registered: May 2011
Junior Member
Hi

What should I change in domain model example to see all available types in content assist when I about to define e.g entity property?


and second question. Statemachine example. I want to define state names as ID"::"ID, not as plain ID; how should I behave in such a case to see such names in content assist?

[Updated on: Sun, 03 July 2011 15:18]

Report message to a moderator

Re: xtext2 domainmodel example: no types in contentassist [message #692103 is a reply to message #692101] Sun, 03 July 2011 15:18 Go to previous messageGo to next message
Christian Dietrich is currently online Christian Dietrich
Messages: 6307
Registered: July 2009
Senior Member
Hi,

your first question i do not understand. what are you exactly doing and what is the problem. do you use a java project with Xtext nature added for the dmodel files?

to the second problem. Introduce a DataType Rule like

State:
	'state' name=SpecialId
		('actions' '{' actions+=[Command]+ '}')?
		transitions+=Transition*
	'end'
;

Transition:
	event=[Event] '=>' state=[State|SpecialId]
;

SpecialId: ID "::" ID;


Update: the missing IXtextBuilderParticipant should be no problem so far

~Christian

[Updated on: Sun, 03 July 2011 15:25]

Report message to a moderator

Re: xtext2 domainmodel example: no types in contentassist [message #692104 is a reply to message #692103] Sun, 03 July 2011 15:25 Go to previous messageGo to next message
amazuzu  is currently offline amazuzu
Messages: 17
Registered: May 2011
Junior Member
You've answered so fast, it's amazing thanks

About first quesion. I install xtext2 domainmodel example and create foo.dmodel
package org.foo.bar{
	
	
	entity Foo {
		 foo : Foo
	}
	
	entity Bar{
		bar: Bar
	}
}


then I want to change type of property bar via content assist. Why no content assist appears after "bar :" on ctlr-space?

Thanks
Re: xtext2 domainmodel example: no types in contentassist [message #692105 is a reply to message #692104] Sun, 03 July 2011 15:27 Go to previous messageGo to next message
Christian Dietrich is currently online Christian Dietrich
Messages: 6307
Registered: July 2009
Senior Member
Hi,

is the dmodel within a java project with xtext nature added?

~Christian
Re: xtext2 domainmodel example: no types in contentassist [message #692106 is a reply to message #692105] Sun, 03 July 2011 15:35 Go to previous messageGo to next message
amazuzu  is currently offline amazuzu
Messages: 17
Registered: May 2011
Junior Member
Oh, when I tried to create dmodel file in Java Project (in Eclipse launched from domain model example) i saw lot of exceptions like 'org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.OutOfMemoryError: PermGen space)'

Ok, any way, I don't need Java types. I need my own type system. Do you have an example of pure xtext2 DomainModel (without xtend, Java)?
Re: xtext2 domainmodel example: no types in contentassist [message #692107 is a reply to message #692106] Sun, 03 July 2011 15:42 Go to previous messageGo to next message
Christian Dietrich is currently online Christian Dietrich
Messages: 6307
Registered: July 2009
Senior Member
Hi,

the easiest way is to take the one of Xtext 1.0.x


DomainModel:
	elements+=AbstractElement*;

AbstractElement:
	PackageDeclaration | Type | Import;

Import:
	'import' importedNamespace=QualifiedNameWithWildCard;

PackageDeclaration:
	'package' name=QualifiedName '{'
		elements+=AbstractElement*
	'}';

Type:
	Entity | DataType;

DataType:
	'datatype' name=ID;

Entity:
	'entity' name=ID ('extends' superType=[Entity|QualifiedName])? '{'
		features+=Feature*
	'}';

Feature:
	StructuralFeature | Operation;

StructuralFeature:
	Attribute | Reference;

Attribute:
	name=ID ':' type=TypeRef;

Reference:
	'ref' name=ID ':' type=TypeRef ('opposite' opposite=[Reference])?;

Operation:
	visibility=Visibility? 'op' name=ID '(' (params+=Parameter (',' params+=Parameter)*)? ')' ':' type=TypeRef;

Parameter:
	name=ID type=TypeRef;

TypedElement:
	Feature | Parameter;

TypeRef:
	referenced=[Type|QualifiedName] multi?='*'?;

enum Visibility:
	public | private | protected;

QualifiedNameWithWildCard:
	QualifiedName '.*'?;

QualifiedName:
	ID ('.' ID)*;



~Christian
Re: xtext2 domainmodel example: no types in contentassist [message #692108 is a reply to message #692107] Sun, 03 July 2011 15:45 Go to previous messageGo to next message
Christian Dietrich is currently online Christian Dietrich
Messages: 6307
Registered: July 2009
Senior Member
Btw that no types are visible by default is a bug in my eyes. could you please file one into bugzilla.

~Christian
Re: xtext2 domainmodel example: no types in contentassist [message #692111 is a reply to message #692108] Sun, 03 July 2011 15:54 Go to previous message
amazuzu  is currently offline amazuzu
Messages: 17
Registered: May 2011
Junior Member
Thanks, sure. https://bugs.eclipse.org/bugs/show_bug.cgi?id=351027
Previous Topic:Slot 'models' is empty
Next Topic:reference with spaces.
Goto Forum:
  


Current Time: Sat Sep 20 14:14:51 GMT 2014

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

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