use of org.eclipse.xtext.naming.QualifiedName in project xtext-core by eclipse.
the class PortableURIs method createPortableFragmentDescription.
protected PortableURIs.PortableFragmentDescription createPortableFragmentDescription(final IEObjectDescription desc, final EObject target) {
final EObject possibleContainer = EcoreUtil.resolve(desc.getEObjectOrProxy(), target);
final String fragmentToTarget = this.getFragment(target, possibleContainer);
EClass _eClass = desc.getEClass();
QualifiedName _qualifiedName = desc.getQualifiedName();
return new PortableURIs.PortableFragmentDescription(_eClass, _qualifiedName, fragmentToTarget);
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-core by eclipse.
the class CrossReferenceSerializer method serializeCrossRef.
@Override
public String serializeCrossRef(EObject semanticObject, CrossReference crossref, EObject target, INode node, Acceptor errors) {
if ((target == null || target.eIsProxy()) && node != null)
return tokenUtil.serializeNode(node);
final EReference ref = GrammarUtil.getReference(crossref, semanticObject.eClass());
final IScope scope = scopeProvider.getScope(semanticObject, ref);
if (scope == null) {
if (errors != null)
errors.accept(diagnostics.getNoScopeFoundDiagnostic(semanticObject, crossref, target));
return null;
}
if (target != null && target.eIsProxy()) {
target = handleProxy(target, semanticObject, ref);
}
if (target != null && node != null) {
String text = linkingHelper.getCrossRefNodeAsString(node, true);
QualifiedName qn = qualifiedNameConverter.toQualifiedName(text);
URI targetURI = EcoreUtil2.getPlatformResourceOrNormalizedURI(target);
for (IEObjectDescription desc : scope.getElements(qn)) {
if (targetURI.equals(desc.getEObjectURI()))
return tokenUtil.serializeNode(node);
}
}
return getCrossReferenceNameFromScope(semanticObject, crossref, target, scope, errors);
}
use of org.eclipse.xtext.naming.QualifiedName in project coffeescript-eclipse by adamschmideg.
the class LinkingServiceWithNode method getLinkedObjects.
/**
* Basically a copy of super, only linkNode is remembered before calling getScope
*/
public List<EObject> getLinkedObjects(EObject context, EReference ref, INode node) throws IllegalNodeException {
final EClass requiredType = ref.getEReferenceType();
if (requiredType == null)
return Collections.<EObject>emptyList();
final String crossRefString = getCrossRefNodeAsString(node);
if (crossRefString != null && !crossRefString.equals("")) {
linkNode = node;
final IScope scope = getScope(context, ref);
linkNode = null;
QualifiedName qualifiedLinkName = qualifiedNameConverter.toQualifiedName(crossRefString);
IEObjectDescription eObjectDescription = scope.getSingleElement(qualifiedLinkName);
if (eObjectDescription != null)
return Collections.singletonList(eObjectDescription.getEObjectOrProxy());
}
return Collections.emptyList();
}
use of org.eclipse.xtext.naming.QualifiedName in project mechanoid by robotoworks.
the class XSqliteModelScopeProvider method scopeForTableDefinitionsBeforeStatement.
public IScope scopeForTableDefinitionsBeforeStatement(final DatabaseBlock db, final DDLStatement stmt, final boolean inclusive) {
ArrayList<TableDefinition> refs = ModelUtil.<TableDefinition>findPreviousStatementsOfType(db, stmt, TableDefinition.class, inclusive);
final HashMap<String, EObject> map = new HashMap<String, EObject>();
List<TableDefinition> _reverse = ListExtensions.<TableDefinition>reverse(refs);
for (final TableDefinition ref : _reverse) {
{
String _name = ref.getName();
boolean _equals = Objects.equal(_name, null);
if (_equals) {
return IScope.NULLSCOPE;
}
String _name_1 = ref.getName();
boolean _containsKey = map.containsKey(_name_1);
boolean _not = (!_containsKey);
if (_not) {
String _name_2 = ref.getName();
map.put(_name_2, ref);
}
}
}
Collection<EObject> _values = map.values();
final Function<EObject, QualifiedName> _function = new Function<EObject, QualifiedName>() {
public QualifiedName apply(final EObject it) {
return NameHelper.getName(((TableDefinition) it));
}
};
return Scopes.<EObject>scopeFor(_values, _function, IScope.NULLSCOPE);
}
use of org.eclipse.xtext.naming.QualifiedName in project xtext-xtend by eclipse.
the class LegacyKnownTypesScope method doGetDescriptions.
@Override
protected void doGetDescriptions(JvmType type, JvmType knownType, int index, List<IEObjectDescription> result) {
super.doGetDescriptions(type, knownType, index, result);
QualifiedName importName = importNames.get(index);
if (type == knownType && importName != null) {
result.add(EObjectDescription.create(QualifiedName.create(importName.getLastSegment()), type));
}
}
Aggregations