|
Re: CTRL+SPACE action [message #1063214 is a reply to message #1063181] |
Wed, 12 June 2013 16:37 |
|
Hi,
once more your grammar is incomplete.
let us asume it looks like
Model:
fields+=Field*
views+=View*;
Field:
"Field" name=ID
;
View returns View:
'View'
name=QualifiedName
'{'
'guID' '=' guID=STRING
'displayName' '=' displayName=STRING
('description' '=' description=STRING)?
('fields' '=' ownedViewField+=ViewField (','ownedViewField+=ViewField)*)?
'}';
ViewField returns ViewField:
(field= [Field|QualifiedName]);
QualifiedName: ID ("." ID)*;
then the Proposal Provider could look like (written in Xtend):
class MyDslProposalProvider extends AbstractMyDslProposalProvider {
override completeViewField_Field(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val view = EcoreUtil2::getContainerOfType(model, typeof(View))
val names = view.ownedViewField.map[vw|vw.field?.name].filter[v|v!=null].toList
println (names)
lookupCrossReference(assignment.terminal as CrossReference, context, acceptor, [
IEObjectDescription d | names.contains(d.qualifiedName.toString)
])
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Re: CTRL+SPACE action [message #1063253 is a reply to message #1063216] |
Wed, 12 June 2013 20:34 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi Christian,
I will try it but not comes anything in the View's fields (val names = view.ownedViewField.map[vw|vw.field?.name].filter[v|v!=null].toList comes null)
and my finally grammar:
Content returns Content:'{'
'ct' name=QualifiedName
application=WebApplication
'}'
WebApplication returns WebApplication:
'WebApplication' name=Qualifiedname
ownColection+=Collection (ownColection+=Collection)*'}'
Collection returns Collection:'{'
'Collection' name=QualifiedName
ownWeb=Web '}'
Web returns Web:
'Web'
name=QualifiedName
'{'(lists+=Liste (lists+=Liste)*)?
(webs+=Web (webs+=Web)*)?
'}'
Liste returns Liste:
'Liste'
name=QualifiedName
'{'(cttype+=CType (cttype+=CType)*)?
(ownedView+=View (ownedView+=View)*)?
'}'
View returns View:
'View'
name=QualifiedName
'{''type' '=' type= ViewType
('fields' '=' ownedViewField+=ViewField (','ownedViewField+=ViewField)*)?
'}';
ViewField returns ViewField:
(field= [Field|QualifiedName]);
Field returns Field:
LookUp | Boolean
Field returns Field:
LookUp | BooleanField
;
CType returns CType:
'CType'
name=QualifiedName
'{' ('parent' '=' parentContentType=[ContentType|QualifiedName])?
'fields' '{'
(ownedField+=Field (ownedField+=Field)*)?
'}'
'}';
LookUp returns LookUp:
'LookUp'
name=QualifiedName
'{' 'text' name=STRING '}'
QualifiedName :
ID('.'ID)*
;
best regards
[Updated on: Wed, 12 June 2013 20:44] Report message to a moderator
|
|
|
|
Re: CTRL+SPACE action [message #1063269 is a reply to message #1063265] |
Wed, 12 June 2013 21:35 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi Christian,
I remove some rules in the grammar.I do it simplify .
Fistly :!names.contains(d.qualifiedName.toString) not understand it :( I use DefaultDeclarativeQualifiedNameProvider :retuns all field names :This warning can be switched off on the Team > Git > Confirmations and Warnings preference page.
******text
******created
******createdBy
******contentTYPE
******numberfield
******bool
@Inject
IQualifiedNameConverter qnc;
QualifiedName qualifiedName(Field f) {
System.out.println("******"+f.getName());
return qnc.toQualifiedName(f.getName());
}
Secondly :I want to say with (it but not comes in the View's fields ) :When I enter CTRL+SPACE,does not come nothing in the View's fields attribute. :(:(:(I used below code
override completeViewField_Field(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val view = EcoreUtil2::getContainerOfType(model, typeof(View))
println ("viewwwww"+view)
val names = view.ownedViewField.map[vw|vw.field?.name].filter[v|v!=null].toList
println ("namessss"+names)
lookupCrossReference(assignment.terminal as CrossReference, context, acceptor, [
IEObjectDescription d | names.contains(d.qualifiedName.toString)
])
}
really ,I am very confised :( Hence I allready duplicate name check with NamesAreUniqueValidator.My aim is:remove fields that has same type and same name in the View's ownedFields
(such as There are two Lookup field ,must get one lookupfield)
[Updated on: Wed, 12 June 2013 21:39] Report message to a moderator
|
|
|
|
|
|
|
Re: CTRL+SPACE action [message #1063274 is a reply to message #1063273] |
Wed, 12 June 2013 21:51 |
|
here is my current version
class MyDslProposalProvider extends AbstractMyDslProposalProvider {
override completeViewField_Field(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val view = EcoreUtil2::getContainerOfType(model, typeof(View))
val names = view.ownedViewField.map[vw|vw.field?.name].filter[v|v!=null].toList
println (names)
lookupCrossReference(assignment.terminal as CrossReference, context, acceptor, [
IEObjectDescription d | println(d.qualifiedName);!names.contains(d.qualifiedName.toString)
])
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Re: CTRL+SPACE action [message #1063278 is a reply to message #1063274] |
Wed, 12 June 2013 21:59 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi,
I tried this code .my result is below screenshot. gets all field
Christian Dietrich wrote on Wed, 12 June 2013 17:51here is my current version
class MyDslProposalProvider extends AbstractMyDslProposalProvider {
override completeViewField_Field(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val view = EcoreUtil2::getContainerOfType(model, typeof(View))
val names = view.ownedViewField.map[vw|vw.field?.name].filter[v|v!=null].toList
println (names)
lookupCrossReference(assignment.terminal as CrossReference, context, acceptor, [
IEObjectDescription d | println(d.qualifiedName);!names.contains(d.qualifiedName.toString)
])
}
}
|
|
|
|
|
|
|
|
Re: CTRL+SPACE action [message #1063294 is a reply to message #1063278] |
Wed, 12 June 2013 22:36 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi,
I used this code and duplicate names are remove.
but I use for field qualifiedname : overridequalifiedname screenshot
@Inject
IQualifiedNameConverter qnc;
QualifiedName qualifiedName(Field f) {
System.out.println("******"+f.getName());
return qnc.toQualifiedName(f.getName());
}
if I do not use QualifiedName qualifiedName(Field f),result screenshot:withoutqualifiednameoverride:gets all field.
must I use IQualifiedNameConverter qnc?
junior developer wrote on Wed, 12 June 2013 17:59Hi,
I tried this code .my result is below screenshot. gets all field
Christian Dietrich wrote on Wed, 12 June 2013 17:51here is my current version
class MyDslProposalProvider extends AbstractMyDslProposalProvider {
override completeViewField_Field(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val view = EcoreUtil2::getContainerOfType(model, typeof(View))
val names = view.ownedViewField.map[vw|vw.field?.name].filter[v|v!=null].toList
println (names)
lookupCrossReference(assignment.terminal as CrossReference, context, acceptor, [
IEObjectDescription d | println(d.qualifiedName);!names.contains(d.qualifiedName.toString)
])
}
}
[Updated on: Wed, 12 June 2013 22:39] Report message to a moderator
|
|
|
|
|
|
|
Re: CTRL+SPACE action [message #1063538 is a reply to message #1063408] |
Thu, 13 June 2013 11:50 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi Christian,
now,My problem is qualifiedname.
I used qualifiedname :
public class QNP extends DefaultDeclarativeQualifiedNameProvider{
QualifiedName qualifiedName(Field f) {
System.out.println("++++++++++++++++++++++++"+f.getName());
return qualifiedName(f.getName());
}
}
Result:
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.creaated
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.lookuppp
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.creaated
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.lookuppp
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.creaated
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.lookuppp
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.creaated
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.lookuppp
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.contentTYPE
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.text
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.created
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.createdBy
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.contentTYPE
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.numberfield
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.bool
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.text
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.creaated
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.createdBy
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.contentTYPE
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.lookup1
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.creaated
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.lookuppp
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.contentTYPE
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.text
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.created
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.createdBy
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.contentTYPE
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.numberfield
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.bool
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.text
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.creaated
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.createdBy
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.contentTYPE
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.lookup1
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.creaated
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.lookuppp
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.contentTYPE
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.text
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.created
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.createdBy
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.contentTYPE
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.numberfield
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype1.bool
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.text
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.creaated
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.createdBy
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.contentTYPE
contentmodel.webapp.sitecall1.rootweb.customlist1.contenttype2.lookup1
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.creaated
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.lookuppp
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.contentTYPE
++++++++++++++++++++++++text
++++++++++++++++++++++++created
++++++++++++++++++++++++createdBy
++++++++++++++++++++++++contentTYPE
++++++++++++++++++++++++numberfield
++++++++++++++++++++++++bool
++++++++++++++++++++++++text
++++++++++++++++++++++++creaated
++++++++++++++++++++++++createdBy
++++++++++++++++++++++++contentTYPE
++++++++++++++++++++++++lookup1
++++++++++++++++++++++++title
++++++++++++++++++++++++creaated
++++++++++++++++++++++++createdBy
++++++++++++++++++++++++contentTYPE
++++++++++++++++++++++++lookuppp
++++++++++++++++++++++++title
++++++++++++++++++++++++created
++++++++++++++++++++++++createdBy
++++++++++++++++++++++++contentTYPE
++++++++++++++++++++++++title
++++++++++++++++++++++++created
++++++++++++++++++++++++createdBy
++++++++++++++++++++++++contentTYPE
Hence if I used this code in the DefaultDeclarativeQualifiedNameProvider
public class QNP extends DefaultDeclarativeQualifiedNameProvider{
@Inject
IQualifiedNameConverter qnc;
QualifiedName qualifiedName(Field f) {
return qnc.toQualifiedName(f.getName());
}
}
my below code works :
class MyDsl2ProposalProvider extends AbstractMyDsl2ProposalProvider {
override completeViewField_Field(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val view = EcoreUtil2::getContainerOfType(model, typeof(View))
val names = view.ownedViewField.map[vw|vw.field?.name].filter[v|v!=null].toList
println (names)
lookupCrossReference(assignment.terminal as CrossReference, context, acceptor, [
IEObjectDescription d | println(d.qualifiedName);!names.contains(d.qualifiedName)
])
}
|
|
|
|
|
|
|
|
Re: CTRL+SPACE action [message #1063652 is a reply to message #1063635] |
Thu, 13 June 2013 15:23 |
|
Hi,
where is the rest of the stacktrace.
the following works for me
class MyDslProposalProvider extends AbstractMyDslProposalProvider {
@Inject extension IQualifiedNameProvider
override completeViewField_Field(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
val view = EcoreUtil2::getContainerOfType(model, typeof(View))
val names = view.ownedViewField.map[vw|vw.field?.fullyQualifiedName?.toString].filter[v|v!=null].toList
println (names)
lookupCrossReference(assignment.terminal as CrossReference, context, acceptor, [
IEObjectDescription d | println(d.qualifiedName);!names.contains(d.qualifiedName.toString)
])
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Re: CTRL+SPACE action [message #1063704 is a reply to message #1063702] |
Thu, 13 June 2013 19:37 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi Christian
I solved http://www.eclipse.org/forums/index.php/t/488676/-> this topic's problem.Hence My grammar hierarch and scop same in this project (zip)http://www.eclipse.org/forums/index.php/t/488676/->
My onlly problem qualifiedname and below post(this thread).
My aim is :I dont get duplicate name and same type field in the View's ViewField.(fields).and I want to gets field with qualifiedname.
Hence,I do not use my util class,I share it above.I hope I explain my problem
if I use qualifiedname ,My result is below screenshot.I can't use x.y.z now
junior developer wrote on Thu, 13 June 2013 15:09Hi Christian,
I try it but gets all field :(
val view = EcoreUtil2::getContainerOfType(model, typeof(View))
val names = view.ownedViewField.map[vw|vw.field?.fullyQualifiedName?.toString].filter[v|v!=null].toList
println ("viewfielddddddddddddddd"+names)
lookupCrossReference(assignment.terminal as CrossReference, context, acceptor, [
IEObjectDescription d | println(d.qualifiedName);!names.contains(d.qualifiedName.toString)
])
}
println ("viewfielddddddddddddddd"+names) result : gets all field ,I do not solved my problem still
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.creaated
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.lookuppp
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.creaated
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contentype3.lookuppp
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.contenttype4.contentTYPE
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.title
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.created
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.createdBy
contentmodel.webapp.sitecall2.lookupfield.web2.ctlist2.CT4.contentTYPE
-
Attachment: 11111.png
(Size: 42.10KB, Downloaded 260 times)
[Updated on: Thu, 13 June 2013 19:41] Report message to a moderator
|
|
|
Re: CTRL+SPACE action [message #1063707 is a reply to message #1063704] |
Thu, 13 June 2013 19:43 |
|
Hi,
my problem is: i do not understand your problem.
i do not have a complete grammar. i do not have a test model.
from your posts i do not see what is the output of the println ("viewfielddddddddddddddd"+names)
and what is the output of the println(d.qualifiedName);
viewfielddddddddddddddd should give you all used names.
println(d.qualifiedName) should give you all names that you want to filter agains used names
if i have a model
CType ctx
{
fields {
bf a bf b bf c
}
}
View v1 {
fields
=
}
i get a b and c
if i have
CType ctx
{
fields {
bf a bf b bf c
}
}
View v1 {
fields
= ctx.c,
}
i get a and b
so it looks working to me
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Re: CTRL+SPACE action [message #1063710 is a reply to message #1063708] |
Thu, 13 June 2013 19:56 |
|
here is my scoping (it may different in your case since i had to create the missing grammar myself.
class MyDslScopeProvider extends org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider {
@Inject IQualifiedNameProvider qnp
def IScope scope_ViewField_field(View ctx, EReference ref) {
Scopes::scopeFor(ctx.type.type.ownedField, qnp, IScope::NULLSCOPE)
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Re: CTRL+SPACE action [message #1063746 is a reply to message #1063743] |
Fri, 14 June 2013 05:35 |
|
P.S:
if i understood your problem. the following works for me.
please note: it does not cover:
- endless parent recursion - you may have to make it save in this regards
class MyDsl6ScopeProvider extends AbstractDeclarativeScopeProvider {
@Inject IQualifiedNameProvider qnp
def IScope scope_ViewField_field(Function v, EReference ref) {
Scopes::scopeFor(v.type.map[fields].flatten, qnp, IScope::NULLSCOPE)
}
def List<Field> getFields(Type t) {
val res = <Field>newArrayList()
res.addAll(t.ownedField)
if (t.parentType != null) {
res.addAll(getFields(t.parentType))
}
res
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
|
|
Re: CTRL+SPACE action [message #1063785 is a reply to message #1063783] |
Fri, 14 June 2013 08:54 |
|
???????
have a look at the code you are calling
org.eclipse.xtext.scoping.Scopes.scopeFor(Iterable<? extends T>, Function<T, QualifiedName>, IScope)
=> it should be clear what todo
have a look at the printlines. have a look what the code does.
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Re: CTRL+SPACE action [message #1063810 is a reply to message #1063785] |
Fri, 14 June 2013 11:02 |
junior developer Messages: 354 Registered: January 2013 |
Senior Member |
|
|
Hi,
I want to use my qualifiedname .I want to qualifiedname starts from the Method.
public class MQNP extends DefaultDeclarativeQualifiedNameProvider{
public static QualifiedName returnQualifiedNameOfElement(EObject object) {
String qualifiedName = "";
ArrayList<String> names = new ArrayList<String>();
while (object.eContainer() != null && !(object.eContainer() instanceof Collection)) {
if (object.eContainer() instanceof ContentextUnit)
names.add(((ContentextUnit) object.eContainer()).getName());
object = object.eContainer();
}
for (int i = names.size() - 1; i >= 0; i--) {
qualifiedName += names.get(i) + ".";
}
return QualifiedName.create(qualifiedName);
}
}
and I inject it in the scope class:
public class MyScoping extends AbstractDeclarativeScopeProvider {
//@Inject IQualifiedNameProvider qnp;
@Inject MQNP myqualified;
IScope scope_Type_parentType(final Type ctx, EReference r) {
final ArrayList<Type> possiblecontenttype = org.xtext.example.mydsl6.myDsl6.util.ContentTypeUtil.getPossibleParentContentType(ctx);
//final ArrayList<Field> possiblefieldview = ViewUtil.possibleFieldForViewField(ctx) ;
//final ArrayList<Field> possiblefield = LookUpUtil.returnSourceContentTypeNotLookUpFields(ctx);
return Scopes.scopeFor( possiblecontenttype, myqualified, IScope.NULLSCOPE);
}
my util class I shared before it :
public class ContentTypeUtil {
public static boolean isContentTypeParentOk(Type contentSource, Type contentTarget){
if(contentSource.equals(contentTarget)){
return false;
}
return true;
}
public static ArrayList<Type> getPossibleParentContentType(Type content){
Method web = ((Method)((Function)content.eContainer()).eContainer());
while(web.eContainer().eClass().getName().equals("Web")){
web = (Method) web.eContainer();
}
ArrayList<Type> allContentTypes = new ArrayList<>();
allContentTypes = returnAllContentTypeFromGivenWeb(web, allContentTypes);
allContentTypes.remove(content);
return allContentTypes;
}
public static ArrayList<Type> returnAllContentTypeFromGivenWeb(Method rootWeb, ArrayList<Type> returnAllContentTypesFromWeb){
EList<Function> ownedLists = rootWeb.getList();
for (Iterator<Function> iterator = ownedLists.iterator(); iterator.hasNext() {
Function customList = (Function) iterator.next();
EList<Type> ownedContentTypes = customList.getType();
for (Iterator<Type> iterator2 = ownedContentTypes.iterator(); iterator2
.hasNext() {
Type contentType = (Type) iterator2.next();
returnAllContentTypesFromWeb.add(contentType);
}
}
EList<Method> ownedWebs = rootWeb.getOwnmethod();
for (Iterator<Method> iterator = ownedWebs.iterator(); iterator.hasNext() {
Method web = (Method) iterator.next();
returnAllContentTypeFromGivenWeb(web, returnAllContentTypesFromWeb);
}
return returnAllContentTypesFromWeb;
}
}
[Updated on: Fri, 14 June 2013 11:03] Report message to a moderator
|
|
|
Re: CTRL+SPACE action [message #1063815 is a reply to message #1063810] |
Fri, 14 June 2013 11:14 |
|
SO what about simply fixing the nameprovider then?
public class MyQNP extends DefaultDeclarativeQualifiedNameProvider {
@Inject IQualifiedNameConverter qnc;
QualifiedName qualifiedName(Function f) {
return qnc.toQualifiedName(f.getName());
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Re: CTRL+SPACE action [message #1063826 is a reply to message #1063825] |
Fri, 14 June 2013 11:55 |
|
Sorry i cannot reproduce that
public class MyQNP extends DefaultDeclarativeQualifiedNameProvider {
@Inject IQualifiedNameConverter qnc;
QualifiedName qualifiedName(Function f) {
return qnc.toQualifiedName(f.getName());
}
}
class MyDsl6ScopeProvider extends AbstractDeclarativeScopeProvider {
@Inject IQualifiedNameProvider qnp
def IScope scope_ViewField_field(Function v, EReference ref) {
Scopes::scopeFor(v.type.map[fields].flatten, qnp, IScope::NULLSCOPE)
}
def List<Field> getFields(Type t) {
val res = <Field>newArrayList()
res.addAll(t.ownedField)
if (t.parentType != null) {
res.addAll(getFields(t.parentType))
}
res
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Re: CTRL+SPACE action [message #1063842 is a reply to message #1063839] |
Fri, 14 June 2013 12:46 |
|
Sorry i have no ideas on Xtext/GMF Integration so i cannot give any advice in this direction.
returnQualifiedNameOfElement will not help you if nobody calls it.
you have either to fulfil the contract of DefaultDeclarativeNameProvider or IQualifiedNameProvider
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Re: CTRL+SPACE action [message #1063934 is a reply to message #1063924] |
Sun, 16 June 2013 09:07 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
You need to traverse up the eContainer() of the Function F to get to the
Method M1, and the eContainer() of that Method to get to Method M.
You'll need to cast the returned value from eContainer() to the correct
type. From that information you can compose a qualified name.
On 16/06/2013 12:02 AM, junior developer wrote:
>
> Hi Christian,
>
> I start my qualifiedname with Method .but My Method rule is
> recursive.hence if I define one Method ,below code (return
> qnc.toQualifiedName(f.getName())) return second Method name.How can I
> solved this.
> I want to fields =M. M1.F.T1.created for every referenced name.
> such as :
>
>
>
> method M {
> method M1{
> function F {
> type T {
> fields {
> Text text {
>
> displayName = "displayName" property =
> "Property"
> }
> Text created {
> displayName = "displayName" property =
> "Property"
> }
> Text createdby {
> displayName = "displayName" property =
> "Property"
> }
> LookUp Look {
> type = T showField = created
> }
>
> } }type T1 {
>
> fields {
> Text created {
> displayName = "displayName" property =
> "Property"
> }
> Text createdby {
> displayName = "displayName" property =
> "Property"
> }
> Text created {
> displayName=" ewfg" property= "Property"
> }
> }
> }View V {
> type = "Type" fields = M1.F.T1.created
> }
> }
>
>
>
>
> Best Regards,
> Christian Dietrich wrote on Fri, 14 June 2013 07:55
>> Sorry i cannot reproduce that
>>
>> public class MyQNP extends DefaultDeclarativeQualifiedNameProvider {
>>
>> @Inject IQualifiedNameConverter qnc;
>>
>> QualifiedName qualifiedName(Function f) {
>> return qnc.toQualifiedName(f.getName());
>> }
>> }
>>
>> class MyDsl6ScopeProvider extends AbstractDeclarativeScopeProvider {
>>
>> @Inject IQualifiedNameProvider qnp
>>
>> def IScope scope_ViewField_field(Function v, EReference ref) {
>> Scopes::scopeFor(v.type.map[fields].flatten, qnp,
>> IScope::NULLSCOPE)
>> }
>>
>> def List<Field> getFields(Type t) {
>> val res = <Field>newArrayList()
>> res.addAll(t.ownedField)
>> if (t.parentType != null) {
>> res.addAll(getFields(t.parentType))
>> }
>> res
>> }
>>
>> }
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
|
|