Skip to main content



      Home
Home » Modeling » TMF (Xtext) » QualifiedNameValueConverter related query(QualifiedNameValueConverter related query)
icon5.gif  QualifiedNameValueConverter related query [message #1691394] Mon, 06 April 2015 23:15 Go to next message
Eclipse UserFriend
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

[Updated on: Mon, 06 April 2015 23:16] by Moderator

Re: QualifiedNameValueConverter related query [message #1691397 is a reply to message #1691394] Tue, 07 April 2015 00:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

what do you mean by "conversion digits are getting removed after a . (dot)"
icon5.gif  Re: QualifiedNameValueConverter related query [message #1691400 is a reply to message #1691397] Tue, 07 April 2015 00:19 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: QualifiedNameValueConverter related query [message #1691401 is a reply to message #1691397] Tue, 07 April 2015 00:21 Go to previous messageGo to next message
Eclipse UserFriend
btw why not implementing your own org.eclipse.xtext.conversion.impl.QualifiedNameValueConverter or not using QualifiedNameValueConverter if it does not fit?

[Updated on: Tue, 07 April 2015 00:22] by Moderator

Re: QualifiedNameValueConverter related query [message #1691402 is a reply to message #1691401] Tue, 07 April 2015 00:41 Go to previous messageGo to next message
Eclipse UserFriend
Hi Christian,

U mean to say by overriding toValue() method ?


Regards,
Arshad
Re: QualifiedNameValueConverter related query [message #1691403 is a reply to message #1691402] Tue, 07 April 2015 00:41 Go to previous message
Eclipse UserFriend
No,

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

[Updated on: Tue, 07 April 2015 00:42] by Moderator

Previous Topic:XText -&gt; Help Required
Next Topic:Xbase DetailPane factory interferes with my variables view
Goto Forum:
  


Current Time: Sat Jul 12 14:04:10 EDT 2025

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

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

Back to the top