Skip to main content
Jump to: navigation, search

Difference between revisions of "Xtext Project Plan/Features/FragmentProvider"

(New page: Each EObject contained in a Resource can be identified by a so called 'fragment'. A fragment is a part of an EMF URI and needs to be unique per resource. The generic XMI resource shipped w...)
 
 
Line 3: Line 3:
 
The generic XMI resource shipped with EMF provides a generic path-like computation of fragments. It is also common and possible to use UUIDs.
 
The generic XMI resource shipped with EMF provides a generic path-like computation of fragments. It is also common and possible to use UUIDs.
  
However with a textual concrete syntax we want to be able to compute fragments out of the given information. We don't want to force people to use UUIDs or relative generic pathes, in order to do cross linking.
+
However with a textual concrete syntax we want to be able to compute fragments out of the given information. We don't want to force people to use UUIDs or relative generic pathes, in order to do [[Xtext_Project_Plan/Features/CrossReferencing | cross-referencing]].
 
Therefore one can contribute a so called IFragmentProvider per language.
 
Therefore one can contribute a so called IFragmentProvider per language.
  

Latest revision as of 02:29, 28 July 2008

Each EObject contained in a Resource can be identified by a so called 'fragment'. A fragment is a part of an EMF URI and needs to be unique per resource. The generic XMI resource shipped with EMF provides a generic path-like computation of fragments. It is also common and possible to use UUIDs.

However with a textual concrete syntax we want to be able to compute fragments out of the given information. We don't want to force people to use UUIDs or relative generic pathes, in order to do cross-referencing. Therefore one can contribute a so called IFragmentProvider per language.

interface IFragmentProvider extends ILanguageService {
    String getFragment(EObject obj);
}


There is a default provider registered for the xtext builtin language, wich can be easily overwritten. The default implementation just returns the "name" value if it exists and is unique, otherwise it delegates to the path-like fragments computation known from XMI resources.

Back to the top