Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » X-Text Linking Services(Provide link for object's, without fully qualified name during cross-reference.)
X-Text Linking Services [message #1766977] Thu, 29 June 2017 08:32 Go to next message
Sagnick Banerjee is currently offline Sagnick BanerjeeFriend
Messages: 2
Registered: June 2017
Junior Member
I am trying to provide link for object without fully qualified name, during cross reference.
Example

Class-A:
Contains,
Employee as [Object]

Main Class:
Normally, if you want to call Employee object in Main class you need to do:
ClassA.Employee

Instead I am trying to provide the link to
Employee
itself, without its class name.

Note:
I do not have import option and dependency tab in my working ide.

Let, me know if some-body knows how to do it.
Re: X-Text Linking Services [message #1767011 is a reply to message #1766977] Thu, 29 June 2017 13:55 Go to previous messageGo to next message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

You would have to adjust your scope provider to provide these simple names instead of qualified names. Question is how you determine which namespace should be imported.

I suggest to read the scoping documentation carefully first and look at this presentation:
https://de.slideshare.net/holgerschill/deep-dive-into-xtext-scoping-local-and-global-scopes-explained

The most trivial solution to allow only simple names. This might work for your use case first, but in real projects there are just a few cases where this is a good idea. In this case bind the SimpleNameProvider as IQualifiedNameProvider

MyRuntimeModule:
	override bindIQualifiedNameProvider() {
		org.eclipse.xtext.naming.SimpleNameProvider
	}

Re: X-Text Linking Services [message #1767020 is a reply to message #1767011] Thu, 29 June 2017 14:48 Go to previous messageGo to next message
Sagnick Banerjee is currently offline Sagnick BanerjeeFriend
Messages: 2
Registered: June 2017
Junior Member
Thanks for the reply. I will read the scoping documentation.
But, in my case I have duplicate name.
Example:
Class A:
Contains Employee object.
Class B:
Also contains Employee object.
Main Class:
I wrote Employee, in this case I want to stop link and provide error.
Is it possible in XText to stop linking services in case I have duplicate object and user has not provided fully qualified name?
Re: X-Text Linking Services [message #1767021 is a reply to message #1767020] Thu, 29 June 2017 14:53 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 762
Registered: July 2009
Location: Dortmund, Germany
Senior Member

No and this does not make sense. If a name is ambiguous and you have to qualify it then you have to provide a qualified name. Using SimpleNameProvider is the wrong choice then.

Instead you will have to create a proper scope with the names of the class that is the context.

You will have to customize your scope provider.
Previous Topic:Class not found exception in packaged plug-in. Xtext file .ui generate
Next Topic:Generalization of Numbers
Goto Forum:
  


Current Time: Fri Mar 29 04:42:45 GMT 2024

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

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

Back to the top