Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » QualifiedNameValueConverter related query(QualifiedNameValueConverter related query)
icon5.gif  QualifiedNameValueConverter related query [message #1691394] Tue, 07 April 2015 03:15 Go to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
HI All,

I have a grammar snippet as:

MyID:
	ID((".")ID)*
;


Few examples for this grammar would be: myName1.myAddress1, myName2.myAddress2.pin.

I have written a value conversion rule for this by injecting QualifiedNameValueConverter and returning the value. It works in all the sense.

Now, I have updated my grammar to:

MyID:
	ID((".")(INTRULE)?ID)*
;

INTRULE:
(INT)*
;


Now, Few examples for this grammar would be: myName1.2myAddress1, myName2.4myAddress2.pin.

i.e. after a . (dot) I need a digit. The grammar works well in the editor. But because of this QualifiedNameValueConverter conversion digits are getting removed after a . (dot).


Any suggestions here ?



Thanks in advance Smile


Arshad

[Updated on: Tue, 07 April 2015 03:16]

Report message to a moderator

Re: QualifiedNameValueConverter related query [message #1691397 is a reply to message #1691394] Tue, 07 April 2015 04:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13882
Registered: July 2009
Senior Member
Hi,

what do you mean by "conversion digits are getting removed after a . (dot)"


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
icon5.gif  Re: QualifiedNameValueConverter related query [message #1691400 is a reply to message #1691397] Tue, 07 April 2015 04:19 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Christian,

I have my converter code as:

@Inject
	private QualifiedNameValueConverter qnValueConverter;


@ValueConverter(rule = "MyID")
	public IValueConverter<String> converterMyID() {
		return qnValueConverter;
	}


If I have a element like myName1.2myAddress1 then this converter removes 2 from it and returns as myName1.myAddress1 and the same value will be used everywhere even if myName1.2myAddress1 is present in my editor.

Regards,
Arshad


Arshad
Re: QualifiedNameValueConverter related query [message #1691401 is a reply to message #1691397] Tue, 07 April 2015 04:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13882
Registered: July 2009
Senior Member
btw why not implementing your own org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter or not using QualifiedNameValueConverter if it does not fit?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 07 April 2015 04:22]

Report message to a moderator

Re: QualifiedNameValueConverter related query [message #1691402 is a reply to message #1691401] Tue, 07 April 2015 04:41 Go to previous messageGo to next message
Arshad Adavani is currently offline Arshad AdavaniFriend
Messages: 163
Registered: July 2013
Location: Bangalore
Senior Member
Hi Christian,

U mean to say by overriding toValue() method ?


Regards,
Arshad


Arshad
Re: QualifiedNameValueConverter related query [message #1691403 is a reply to message #1691402] Tue, 07 April 2015 04:41 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13882
Registered: July 2009
Senior Member
No,

i mean write your own IValueConverter Class and implement toValue and toString.
or by subclassing and override the relevant methods


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 07 April 2015 04:42]

Report message to a moderator

Previous Topic:problems with Xtext 2.8 and Xcore 1.3.0
Next Topic:Xbase DetailPane factory interferes with my variables view
Goto Forum:
  


Current Time: Wed Apr 14 12:01:05 GMT 2021

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

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

Back to the top