Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » CTRL+SPACE action
CTRL+SPACE action [message #1063181] Wed, 12 June 2013 14:41 Go to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi all,

I want to remove duplicat names and same type in the View 's fields.How can I do this.I want to use my util class.
related part for this topic :http://www.eclipse.org/forums/index.php/m/1063178/#msg_1063178
Could you help me
My grammar is below :

View returns View:
'View'
name=QualifiedName
'{'
'guID' '=' guID=STRING
'displayName' '=' displayName=STRING
('description' '=' description=STRING)?
'type' '=' type= ViewType
('fields' '=' ownedViewField+=ViewField (','ownedViewField+=ViewField)*)?
'}';

ViewField returns ViewField:
(field= [Field|QualifiedName]);
my util class is below :


public static ArrayList<Field> possibleFieldForViewField(View view){
ArrayList<Field> uniqueFields = returnUniqueParenListFields(view);
EList<ViewField> ownedViewFields = view.getOwnedViewField();
for (Iterator<ViewField> iterator = ownedViewFields.iterator(); iterator.hasNext();) {
			ViewField viewField = (ViewField) iterator.next();
			Field alreadyAddedField = viewField.getField();
			
			for(int i = 0; i < uniqueFields.size(); i++){
				Field field = uniqueFields.get(i);
				if(field.eClass().getName().equals(alreadyAddedField.eClass().getName()) && field.getName().equals(alreadyAddedField.getName())){
uniqueFields.remove(i);
				}
			}
		}
		
		return uniqueFields;
	}
}
public static ArrayList<Field> returnUniqueParenListFields(View view){
		ArrayList<Field> allFields = returnAllParenListFields(view);
		
		for(int i = 0; i < allFields.size(); i++){
			Field field1 = allFields.get(i);
			
			for(int j = i+1; j < allFields.size(); j++){
				Field field2 = allFields.get(j);
				
				if(field1.eClass().getName().equals(field2.eClass().getName()) && field1.getName().equals(field2.getName())){
allFields.remove(j);
					
				}
			}
		}	
		return allFields;	
	}
public static ArrayList<Field> returnAllParenListFields(View view){
		ArrayList<Field> allFields = new ArrayList<>();
		CustomList parentList = (CustomList) view.eContainer();
		
		EList<ContentType> ownedContentTypes = parentList.getOwnedContentType();
		for (Iterator<ContentType> iterator = ownedContentTypes.iterator(); iterator
				.hasNext();) {
			ContentType contentType = (ContentType) iterator.next();
			EList<Field> fields = contentType.getOwnedField();
			for (Iterator<Field> iterator2 = fields.iterator(); iterator2.hasNext();) {
				Field field = (Field) iterator2.next();
				allFields.add(field);
			}
		}
		
		return allFields;
	}
	



Re: CTRL+SPACE action [message #1063214 is a reply to message #1063181] Wed, 12 June 2013 16:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
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 #1063216 is a reply to message #1063214] Wed, 12 June 2013 16:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Please NOTE: you will need a validator for duplicates as well since this only adapts proposals.

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 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
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 #1063265 is a reply to message #1063253] Wed, 12 June 2013 21:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
first there was a typo in my post, you should have found that

!names.contains(d.qualifiedName.toString)


should be the closure


what do you mean by

it but not comes in the View's fields 
;(

and the grammar is not copy and pasteable Sad( And a sample model is missing Sad((
the fields have no name so they cannot be cross refd

and i do NOT get duplicate ownedFields proposed. ;((((

of course i had to fix the qualified name problem first (nameprovider or grammar+pp provider)

public class MyQNP extends DefaultDeclarativeQualifiedNameProvider{
	
	@Inject
	IQualifiedNameConverter qnc;

	QualifiedName qualifiedName(Field f) {
		System.out.println(f.getName());
		return qnc.toQualifiedName(f.getName());
	}
	
}


=> it always help to try things with a hello word example to get problems split

i never know what your current "hü oder hott" status is


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063269 is a reply to message #1063265] Wed, 12 June 2013 21:35 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
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 :(Sad 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 :(Sad 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 #1063270 is a reply to message #1063269] Wed, 12 June 2013 21:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi I fear without binary sharing you complete code (zip) I can only
guess and not help

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063271 is a reply to message #1063269] Wed, 12 June 2013 21:40 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
BTW I wanted to to replace

names.contains(d.qualifiedName.toString

With

! names.contains(d.qualifiedName.toString

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063272 is a reply to message #1063270] Wed, 12 June 2013 21:47 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian,

I can send an email ,I do not share all project Sad
Re: CTRL+SPACE action [message #1063273 is a reply to message #1063272] Wed, 12 June 2013 21:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi as I said: simplyfy it to a hello world example.
What do the prints in the proposalprovidet result in?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063274 is a reply to message #1063273] Wed, 12 June 2013 21:51 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
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 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi,
I tried this code .my result is below screenshot. gets all field Sad




Christian Dietrich wrote on Wed, 12 June 2013 17: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)
		])
	}
}

  • Attachment: screennn1.png
    (Size: 25.22KB, Downloaded 193 times)
Re: CTRL+SPACE action [message #1063280 is a reply to message #1063278] Wed, 12 June 2013 22:03 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Sorry once more you are mixing up 1000 things

this code filters duplicates.i dont see duplicates ?!?
it does not take care about the scope of all possibilites.
(this was a different thread !?!)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063283 is a reply to message #1063280] Wed, 12 June 2013 22:14 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi ,

oke ,it do now .sorry ,did not realize Sad I understand noww thanks for replly.
Now I will do second constraints.I remove same type .I can do it in AbstractMyDslProposalProvider?

Re: CTRL+SPACE action [message #1063286 is a reply to message #1063283] Wed, 12 June 2013 22:19 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
I ask one question.

I must do this for qualifiedname : if I override qualifiedname ,not do it .certainly ,I must do ?

@Inject
IQualifiedNameConverter qnc;

QualifiedName qualifiedName(Field f) {
System.out.println("******"+f.getName());
return qnc.toQualifiedName(f.getName());
}
Re: CTRL+SPACE action [message #1063287 is a reply to message #1063283] Wed, 12 June 2013 22:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
What do you mean with that? Can you give an example. Did you have a
look at my answer to your other post

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063289 is a reply to message #1063286] Wed, 12 June 2013 22:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Don't know your scoping so can't say.

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063294 is a reply to message #1063278] Wed, 12 June 2013 22:36 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
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:59
Hi,
I tried this code .my result is below screenshot. gets all field Sad




Christian Dietrich wrote on Wed, 12 June 2013 17: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)
		])
	}
}

[Updated on: Wed, 12 June 2013 22:39]

Report message to a moderator

Re: CTRL+SPACE action [message #1063297 is a reply to message #1063294] Wed, 12 June 2013 22:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Or you have to adapt the filter logic so that it uses qualified names
for the already applied fields

(By asking iqualifiednsmeprovider for the name instead field?.name

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063298 is a reply to message #1063297] Wed, 12 June 2013 22:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
P.s. once more: use the debugger to find out what happens

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063407 is a reply to message #1063297] Thu, 13 June 2013 06:21 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian,

I do not understand this post.I cant use qualifiedname.

Christian Dietrich wrote on Wed, 12 June 2013 18:43
Or you have to adapt the filter logic so that it uses qualified names
for the already applied fields

(By asking iqualifiednsmeprovider for the name instead field?.name

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de

Re: CTRL+SPACE action [message #1063408 is a reply to message #1063407] Thu, 13 June 2013 06:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
If you don't use qualified names what do the printlns say?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063538 is a reply to message #1063408] Thu, 13 June 2013 11:50 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
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 #1063547 is a reply to message #1063538] Thu, 13 June 2013 11:58 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
vw.field?.name

Adds simple name

Inject Iqualifiednameprovider.
Ask it for the fields name.
Add the qualified name to the list

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063581 is a reply to message #1063547] Thu, 13 June 2013 12:58 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian ,

I try this code but not remove duplicate fields Sad
I remove this class

public class QNP extends DefaultDeclarativeQualifiedNameProvider{
/* @Inject
IQualifiedNameConverter qnc;

QualifiedName qualifiedName(Field f) {

return qnc.toQualifiedName(f.getName());
}*/
}





class MyDsl2ProposalProvider extends AbstractMyDsl2ProposalProvider {
	 @Inject extension IQualifiedNameProvider //add now
	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].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 #1063585 is a reply to message #1063581] Thu, 13 June 2013 13:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi do you want qualified names or not. It is always difficult to
find it out.

If you want them why did you post the name provider. If not why did
you change the proposal provider

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063610 is a reply to message #1063585] Thu, 13 June 2013 13:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Btw it should be vw.field?.fullyQualifiedName.toString

else you would compare äpfel with birnen


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063635 is a reply to message #1063610] Thu, 13 June 2013 14:51 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian,

I want to Qualifiedname .I tried it

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)
])

but I receive an error .

at org.eclipse.xtext.ui.editor.contentassist.AbstractContentProposalProvider$DefaultContentAssistProcessorSwitch.caseAssignment(AbstractContentProposalProvider.java:66)
at org.eclipse.xtext.ui.editor.contentassist.AbstractContentProposalProvider$DefaultContentAssistProcessorSwitch.caseAssignment(AbstractContentProposalProvider.java:1)
at org.eclipse.xtext.util.XtextSwitch.doSwitch(XtextSwitch.java:164)
at org.eclipse.xtext.util.XtextSwitch.doSwitch(XtextSwitch.java:70)
at org.eclipse.xtext.util.XtextSwitch.doSwitch(XtextSwitch.java:58)
Re: CTRL+SPACE action [message #1063652 is a reply to message #1063635] Thu, 13 June 2013 15:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
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 #1063702 is a reply to message #1063652] Thu, 13 June 2013 19:09 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian,

I try it but gets all field :(Sad

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

Re: CTRL+SPACE action [message #1063703 is a reply to message #1063702] Thu, 13 June 2013 19:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

you still do not get it:

this thread is about duplicates. it is NOT about visibility. do ou geht duplicates or not? i do not get duplicates!
i do not know your visibility semanctic. maybe
you are confusing this thread with http://www.eclipse.org/forums/index.php/t/488676/




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 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
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 Sad

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:09
Hi Christian,

I try it but gets all field :(Sad

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 242 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 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
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 #1063708 is a reply to message #1063703] Thu, 13 June 2013 19:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
btw from your screenshot: there are no duplicated since you have referenced zero fields so far.

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 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
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 #1063724 is a reply to message #1063710] Thu, 13 June 2013 21:09 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian ,

I load my grammar ,I added View and ownedfield.
I load sample model screenshot.

My aim is : remove fields that has same name and same type ( such as text and lookup) for View's ownedfield
******gets onnly function's fields (function is upper from the View).hence Screenshot :

View V 's fields get onnly function F's defined fields (text ,lookup):
I load "myexample" screenshot .I marked yellow wanted field (get these fields)

Hence "type" has a "parent" tahat is a type.this type's fields must get.

I hope ,I explain my problem Sad

Re: CTRL+SPACE action [message #1063743 is a reply to message #1063724] Fri, 14 June 2013 04:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
HI,

why is your scoping empty if this is about scoping and not about duplicates

and please share a model that i can copy and paste.
i dont want to create a own one.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 14 June 2013 04:57]

Report message to a moderator

Re: CTRL+SPACE action [message #1063746 is a reply to message #1063743] Fri, 14 June 2013 05:35 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
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 #1063769 is a reply to message #1063746] Fri, 14 June 2013 07:55 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian,

Below code is works thaks for help really,

I do not understand this :v.type.map[fields].flatten

and How can I remove same type and same name .I use this code for remove duplicate name and same type. How can I do this

my util class.I can use this class in the scop class:

public static ArrayList<Field> returnUniqueParenListFields(View view){
		ArrayList<Field> allFields = returnAllParenListFields(view);
		
		for(int i = 0; i < allFields.size(); i++){
			Field field1 = allFields.get(i);
			
			for(int j = i+1; j < allFields.size(); j++){
				Field field2 = allFields.get(j);
			
				if(field1.eClass().getName().equals(field2.eClass().getName()) && field1.getName().equals(field2.getName())){
					allFields.remove(j);
					
				}
			}
		}	
		return allFields;	
	}






Christian Dietrich wrote on Fri, 14 June 2013 01: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
	}

}
Re: CTRL+SPACE action [message #1063773 is a reply to message #1063769] Fri, 14 June 2013 07:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Have a look at Xtend doku

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063774 is a reply to message #1063769] Fri, 14 June 2013 08:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
BTW I still do not understand 'same type and name'

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063783 is a reply to message #1063773] Fri, 14 June 2013 08:48 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian,

I will see it.

but I ask one question:

my qualified name stat with Type.I want to use my qualifiednameprovider :util class below.I want to use this class in the DefaultDeclarativeQualifiedNameProvider.

I try but not works Sad


public class QualifiedNameUtil {
	public static String returnQualifiedNameOfElement(EObject object) {
		String qualifiedName = "";
		ArrayList<String> names = new ArrayList<String>();
		while (object.eContainer() != null && !(object.eContainer() instanceof Collection)) {
			if (object.eContainer() instanceof ContextUnit)
				names.add(((ContextUnit) object.eContainer()).getName());
				object = object.eContainer();
		}

		for (int i = names.size() - 1; i >= 0; i--) {
			qualifiedName += names.get(i) + ".";
		}

		return qualifiedName;
	}
}
	


Re: CTRL+SPACE action [message #1063785 is a reply to message #1063783] Fri, 14 June 2013 08:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
???????

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 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
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()Wink {
Function customList = (Function) iterator.next();
EList<Type> ownedContentTypes = customList.getType();

for (Iterator<Type> iterator2 = ownedContentTypes.iterator(); iterator2
.hasNext()Wink {
Type contentType = (Type) iterator2.next();
returnAllContentTypesFromWeb.add(contentType);
}
}

EList<Method> ownedWebs = rootWeb.getOwnmethod();

for (Iterator<Method> iterator = ownedWebs.iterator(); iterator.hasNext()Wink {
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 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
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 #1063820 is a reply to message #1063815] Fri, 14 June 2013 11:20 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
btw why are you now posting on scope_Type_parentType
i thought we were talking about scope_ViewField_field
can we please solve one problem at a time.
i never know on which problem you are talking in one of your posts.


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063825 is a reply to message #1063820] Fri, 14 June 2013 11:51 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian,
ok,sorry.We can talk one problem.
I want to usequalifidname everywhere.My util class ,I post it.My aim is use it hence I want to start qualifiedname from Method .MQNP class is not work :(Sad I want to use it for qualifiedname.I do not want to start with Context.

such as :

parent = CT.A.collection.M.F.T1 :I do not want
I am wanted :M.F.T1
such as :
View V {
type = "Type" fields =M.F.T.text
}



context CT  {
	Application A {
		Collection  collection {
			method M {
				function F {
					type T { parent = CT.A.collection.M.F.T1
						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 =CT.A.collection.M.F.T.text
					}
				} function F1 {
					type T2 {  parent =CT.A.collection.M.F.T
						fields {
							Text created {
								displayName = "displayName" property = "Property"
							}
						   Text created {
							
								displayName = "displayName" property = "Property"
						}
						Text look2{
							displayName = "displayName" property = "Property"}	
							
							Text text2{
							displayName = "displayName" property = "Property"}	
						}
					}type  T3 {
						fields {
							Text t3333 {
								displayName = "displayName" property = "Property"}
								
								Text t3333 {
								displayName = "displayName" property = "Property"}
								
								Text text2 {
								displayName = "displayName" property = "Property"
							}
						}
						
					}
					
					
					View Viweww {
						type = "Type"  fields =CT.A.collection.M.F1.T3.t3333
						}
				} 
			}
		}
		
	}
}

Re: CTRL+SPACE action [message #1063826 is a reply to message #1063825] Fri, 14 June 2013 11:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
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 #1063827 is a reply to message #1063826] Fri, 14 June 2013 11:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
P.S: i thinks this will never lead to an end so i think its best to stop it now from my side.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: CTRL+SPACE action [message #1063839 is a reply to message #1063827] Fri, 14 June 2013 12:38 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian ,

I solved my qualifiedname problem with return qnc.toQualifiedName(f.getName());
but I do not use my util class :(Sad.My aim is start with in the Method for this code provide in the GMF part.so I want to use it .I want to explain it onlly.

public class MQNP extends DefaultDeclarativeQualifiedNameProvider{
public static QualifiedName returnQualifiedNameOfElement(Function 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 = (Function) object.eContainer();
}

for (int i = names.size() - 1; i >= 0; i--) {
qualifiedName += names.get(i) + ".";
}

return QualifiedName.create(qualifiedName);
}
}
Re: CTRL+SPACE action [message #1063842 is a reply to message #1063839] Fri, 14 June 2013 12:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
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 #1063858 is a reply to message #1063842] Fri, 14 June 2013 14:27 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Christian,

I will create a new topic for qualifiedname.

I want to call returnQualifiedNameOfElement for View's ownedfields and Lookup's Showfield.
Re: CTRL+SPACE action [message #1063924 is a reply to message #1063826] Sat, 15 June 2013 22:02 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member

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
	}

}
Re: CTRL+SPACE action [message #1063934 is a reply to message #1063924] Sun, 16 June 2013 09:07 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
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/
Re: CTRL+SPACE action [message #1063941 is a reply to message #1063934] Sun, 16 June 2013 11:16 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Ed,

I write qualifiedname util class for my GMF project.Now I want to use it in the Xtext part.but I do not use it .My aim is use this class in the qualifiednameprovider class.

public class QualifiedNameUtil {
	public static String returnQualifiedNameOfElement(EObject object) {
		String qualifiedName = "";
		ArrayList<String> names = new ArrayList<String>();
		while (object.eContainer() != null && !(object.eContainer() instanceof SiteCollection)) {
			if (object.eContainer() instanceof ContentUnit)
				names.add(((ContentUnit) object.eContainer()).getName());
				object = object.eContainer();
		}

		for (int i = names.size() - 1; i >= 0; i--) {
			qualifiedName += names.get(i) + ".";
		}

		return qualifiedName;
	}
}



besr regards
Re: CTRL+SPACE action [message #1063944 is a reply to message #1063941] Sun, 16 June 2013 13:10 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Your question was about something that as nested Method and function
instances. I see nothing in this code that deals with such cases. I
don't even see how the code you show below produces a name that doesn't
end with a ".". Shouldn't you use a StringBuilder for composing a string?

On 16/06/2013 1:16 PM, junior developer wrote:
> Hi Ed,
>
> I write qualifiedname util class for my GMF project.Now I want to use
> it in the Xtext part.but I do not use it .My aim is use this class in
> the qualifiednameprovider class.
>
>
> public class QualifiedNameUtil {
> public static String returnQualifiedNameOfElement(EObject object) {
> String qualifiedName = "";
> ArrayList<String> names = new ArrayList<String>();
> while (object.eContainer() != null && !(object.eContainer()
> instanceof SiteCollection)) {
> if (object.eContainer() instanceof ContentUnit)
> names.add(((ContentUnit) object.eContainer()).getName());
> object = object.eContainer();
> }
>
> for (int i = names.size() - 1; i >= 0; i--) {
> qualifiedName += names.get(i) + ".";
> }
>
> return qualifiedName;
> }
> }
>
>
>
> besr regards


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: CTRL+SPACE action [message #1063948 is a reply to message #1063944] Sun, 16 June 2013 13:50 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Ed,

I think ,I can not use my util class.

I write a code now but recursive Method part .I cant do this part.I don t traverse in the Method
Below code result is :

View Viweww {
type = "Type" fields =M.F1.T2.created }
I dont get M1 Sad


QualifiedName qualifiedName( Function object) {
		String qualifiedName = "";
		ArrayList<String> names = new ArrayList<String>();
		Method w = (Method) object.eContainer();
		System.out.println(w);
		
		if( w.eContainer() instanceof Web){
		    Method w1 =(Method) w.eContainer();
		    
		System.out.println(w1);
		return QualifiedName.create(w1.getName(),object.getName()) ;
		}else		
		return QualifiedName.create(w.getName(),object.getName()) ;
	}
	



and I try this (below) code result :View Viweww {
type = "Type" fields = M.M1.F1.T2.created}
}

I am wanted is this,but I receive an error :(Sad couldun't resolve reference .What is the my error Sad


QualifiedName qualifiedName( Function object) {
String qualifiedName = "";
ArrayList<String> names = new ArrayList<String>();
Method w = (Method) object.eContainer();
System.out.println(w);

if( w.eContainer() instanceof Method){
Method w1 =(Web) w.eContainer();
qualifiedName = w1.getName().concat(".").concat(w.getName()) ;
System.out.println(w1);
return QualifiedName.create(w1.getName().concat(".").concat(w.getName()),object.getName()) ;
}else

return QualifiedName.create(w.getName(),object.getName()) ;
}

[Updated on: Sun, 16 June 2013 14:13]

Report message to a moderator

Re: CTRL+SPACE action [message #1063951 is a reply to message #1063948] Sun, 16 June 2013 15:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Clearly if you call create name with only two arguments you won't get a
qualified name with three parts.

On 16/06/2013 3:50 PM, junior developer wrote:
> Hi Ed,
>
> I think ,I can not use my util class.
>
> I write a code now but recursive Method part .I cant do this part.I
> don t traverse in the Method
> Below code result is :
>
> View Viweww {
> type = "Type" fields =M.F1.T2.created }
> I dont get M1 :(
>
>
>
> QualifiedName qualifiedName( Function object) {
> String qualifiedName = "";
> ArrayList<String> names = new ArrayList<String>();
> Method w = (Method) object.eContainer();
> System.out.println(w);
>
> if( w.eContainer() instanceof Web){
> Method w1 =(Method) w.eContainer();
> System.out.println(w1);
> return QualifiedName.create(w1.getName(),object.getName()) ;
> }else
> return QualifiedName.create(w.getName(),object.getName()) ;
> }
>
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: CTRL+SPACE action [message #1063952 is a reply to message #1063951] Sun, 16 June 2013 15:41 Go to previous messageGo to next message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi Ed,

Hence I must to use one retun qualifiedname ?

in addition,I want to ask one question.I use different qualifiedname for different object,such as,I want to use two kind of qualifiedname in my project

[Updated on: Sun, 16 June 2013 15:46]

Report message to a moderator

Re: CTRL+SPACE action [message #1063956 is a reply to message #1063952] Sun, 16 June 2013 18:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
If you want a three part name, you'll have to specify all three parts,
which you're not doing.

I find it incredible that you can drag on a thread like this endlessly.
And no, creating a new thread doesn't help. It's really as if you need
someone else to do the work for you. Even the most basic things you
spelled out in excruciating detail. In the end, no one has the patience
for such things, though I must say Christian is incredibly patient (or
rather persistent).


On 16/06/2013 5:41 PM, junior developer wrote:
> Hi Ed,
>
> Hence I must to use one retun qualifiedname ?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: CTRL+SPACE action [message #1064040 is a reply to message #1063956] Mon, 17 June 2013 11:42 Go to previous message
junior developer is currently offline junior developerFriend
Messages: 354
Registered: January 2013
Senior Member
Hi,

I will create a new topic.I know far too long.I solved my problem and then I have another problem so I ask my question previously topic.Thank you

Best regards
Previous Topic:Accessing enum literals in Generator
Next Topic:Refactoring with importedNamespace and qualified name
Goto Forum:
  


Current Time: Thu Mar 28 13:43:29 GMT 2024

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

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

Back to the top