xtext2 domainmodel example: no types in contentassist [message #692101] |
Sun, 03 July 2011 15:12 |
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 |
|
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
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
[Updated on: Sun, 03 July 2011 15:25] Report message to a moderator
|
|
|
|
|
|
Re: xtext2 domainmodel example: no types in contentassist [message #692107 is a reply to message #692106] |
Sun, 03 July 2011 15:42 |
|
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
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03887 seconds