Search in sources :

Example 6 with IScope

use of org.eclipse.xtext.scoping.IScope 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();
}
Also used : EClass(org.eclipse.emf.ecore.EClass) QualifiedName(org.eclipse.xtext.naming.QualifiedName) IScope(org.eclipse.xtext.scoping.IScope) IEObjectDescription(org.eclipse.xtext.resource.IEObjectDescription)

Aggregations

IScope (org.eclipse.xtext.scoping.IScope)6 UIComponentMemberDeclaration (org.applause.lang.applauseDsl.UIComponentMemberDeclaration)2 DDLStatement (com.robotoworks.mechanoid.db.sqliteModel.DDLStatement)1 SelectCoreExpression (com.robotoworks.mechanoid.db.sqliteModel.SelectCoreExpression)1 SelectSource (com.robotoworks.mechanoid.db.sqliteModel.SelectSource)1 SelectStatement (com.robotoworks.mechanoid.db.sqliteModel.SelectStatement)1 SingleSourceSelectStatement (com.robotoworks.mechanoid.db.sqliteModel.SingleSourceSelectStatement)1 SingleSourceTable (com.robotoworks.mechanoid.db.sqliteModel.SingleSourceTable)1 TableDefinition (com.robotoworks.mechanoid.db.sqliteModel.TableDefinition)1 Attribute (org.applause.lang.applauseDsl.Attribute)1 DataSource (org.applause.lang.applauseDsl.DataSource)1 DataSourceAccessMethod (org.applause.lang.applauseDsl.DataSourceAccessMethod)1 DataSourceCall (org.applause.lang.applauseDsl.DataSourceCall)1 ListItemCellDeclaration (org.applause.lang.applauseDsl.ListItemCellDeclaration)1 EClass (org.eclipse.emf.ecore.EClass)1 EObject (org.eclipse.emf.ecore.EObject)1 QualifiedName (org.eclipse.xtext.naming.QualifiedName)1 IEObjectDescription (org.eclipse.xtext.resource.IEObjectDescription)1