Skip to main content
Jump to: navigation, search

Xtext Project Plan/Features/FragmentProvider

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