Java 类org.eclipse.xtext.scoping.Scopes 实例源码

项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCreatedErrors_01() {
    maxCallCount = 0;
    ImmutableList<EClass> classes = ImmutableList.of(
            createEClass(),
            createEClass()
    );
    for(EClass clazz: classes) {
        clazz.setName("Same");
    }
    expected.addAll(classes);
    helper.checkUniqueNames(
            Scopes.scopedElementsFor(classes), 
            this, this);
    assertEquals(classes.size(), callCount);
    assertTrue(expected.isEmpty());
}
项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCreatedErrors_02() {
    maxCallCount = 0;
    ImmutableList<EClassifier> classifiers = ImmutableList.of(
            createEClass(),
            createEDataType()
    );
    for(EClassifier classifier: classifiers) {
        classifier.setName("Same");
    }
    expected.addAll(classifiers);
    helper.checkUniqueNames(
            Scopes.scopedElementsFor(classifiers), 
            this, this);
    assertEquals(classifiers.size(), callCount);
    assertTrue(expected.isEmpty());
}
项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCreatedErrors_03() {
    maxCallCount = 0;
    ImmutableList<ENamedElement> elements = ImmutableList.of(
            createEClass(),
            createEDataType(),
            createEPackage()
    );
    for(ENamedElement classifier: elements) {
        classifier.setName("Same");
    }
    expected.addAll(elements.subList(0, 2));
    helper.checkUniqueNames(
            Scopes.scopedElementsFor(elements), 
            this, this);
    assertEquals(elements.size(), callCount);
    assertTrue(expected.isEmpty());
}
项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCreatedErrors_04() {
    maxCallCount = 0;
    ImmutableList<ENamedElement> elements = ImmutableList.of(
            createEClass(),
            createEDataType(),
            createEPackage(),
            createEPackage()
    );
    for(ENamedElement classifier: elements) {
        classifier.setName("Same");
    }
    expected.addAll(elements);
    helper.checkUniqueNames(
            Scopes.scopedElementsFor(elements), 
            this, this);
    assertEquals(elements.size(), callCount);
    assertTrue(expected.isEmpty());
}
项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCreatedErrors_05() {
    maxCallCount = 0;
    ImmutableList<ENamedElement> elements = ImmutableList.of(
            createEPackage(),
            createEDataType(),
            createEPackage()
    );
    for(ENamedElement classifier: elements) {
        classifier.setName("Same");
    }
    expected.add(elements.get(0));
    expected.add(elements.get(2));
    helper.checkUniqueNames(
            Scopes.scopedElementsFor(elements), 
            this, this);
    assertEquals(elements.size(), callCount);
    assertTrue(expected.isEmpty());
}
项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCreatedErrors_06() {
    maxCallCount = 1;
    ImmutableList<ENamedElement> elements = ImmutableList.of(
            createEPackage(),
            createEDataType(),
            createEPackage()
    );
    for(ENamedElement classifier: elements) {
        classifier.setName("Same");
    }
    try {
        helper.checkUniqueNames(
                Scopes.scopedElementsFor(elements), 
                this, this);
        fail("cancellation expected");
    } catch (OperationCanceledError e) {
    }
    assertEquals(1, callCount);
}
项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCreatedErrors_07() {
    maxCallCount = 0;
    ImmutableList<ENamedElement> elements = ImmutableList.of(
            createEPackage(),
            createEDataType(),
            EcoreFactory.eINSTANCE.createEEnumLiteral()
    );
    for(ENamedElement classifier: elements) {
        classifier.setName("Same");
    }
    expected.add(elements.get(0));
    expected.add(elements.get(2));
    helper.checkUniqueNames(
            Scopes.scopedElementsFor(elements), 
            this, this);
    assertEquals(elements.size(), callCount);
    assertTrue(expected.isEmpty());
}
项目:statecharts    文件:SGenScopeProvider.java   
@Override
public IScope getScope(EObject context, EReference reference) {
    if (reference == TypesPackage.Literals.TYPE_SPECIFIER__TYPE) {
        return Scopes.scopeFor(typeSystem.getConcreteTypes());
    }
    if (reference == ExpressionsPackage.Literals.ELEMENT_REFERENCE_EXPRESSION__REFERENCE) {
        return getElementReferenceScope(context);
    }
    if (reference.getName().equals("type")) {
        return scope_Type(context, reference);
    }
    if (reference.getName().equals("parameter")) {
        return scope_Parameter(context, reference);
    }
    if (reference.getName().equals("elementRef")) {
        return scope_GeneratorEntry_elementRef(context, reference);
    }
    return super.getScope(context, reference);
}
项目:statecharts    文件:STextScopeProvider.java   
/**
 * Returns the toplevel scope
 */
protected IScope getNamedTopLevelScope(final EObject context, EReference reference) {
    List<EObject> scopeCandidates = Lists.newArrayList();
    Statechart statechart = getStatechart(context);
    if (statechart == null)
        return IScope.NULLSCOPE;
    EList<Scope> scopes = statechart.getScopes();
    for (Scope scope : scopes) {
        if (scope instanceof InterfaceScope) {
            String name = ((InterfaceScope) scope).getName();
            if (name != null && name.trim().length() > 0) {
                scopeCandidates.add(scope);
            }
        }
    }
    return Scopes.scopeFor(scopeCandidates);
}
项目:RigidBodies    文件:RigidBodiesScopeProvider.java   
@Override
public IScope getScope(final EObject context, final EReference reference) {
  Class<? extends EObject> class_ = null;
  boolean _equals = Objects.equal(reference, RigidBodiesPackage.Literals.MATRIX_REF__MATRIX);
  if (_equals) {
    class_ = BaseMatrix.class;
  } else {
    boolean _equals_1 = Objects.equal(reference, RigidBodiesPackage.Literals.JOINT_TYPE_REFERENCE__REF);
    if (_equals_1) {
      class_ = JointType.class;
    } else {
      boolean _equals_2 = Objects.equal(reference, RigidBodiesPackage.Literals.REORIENT_REF__REF);
      if (_equals_2) {
        class_ = Reorientation.class;
      }
    }
  }
  boolean _notEquals = (!Objects.equal(class_, null));
  if (_notEquals) {
    EObject rootElement = EcoreUtil2.getRootContainer(context);
    List<? extends EObject> candidates = EcoreUtil2.getAllContentsOfType(rootElement, class_);
    return Scopes.scopeFor(candidates);
  } else {
    return super.getScope(context, reference);
  }
}
项目:CooperateModelingEnvironment    文件:CooperateImportedNamespaceAwareLocalScopeProvider.java   
@Override
protected ISelectable internalGetAllDescriptions(Resource resource) {
    Iterable<EObject> allContents = new Iterable<EObject>() {
        @Override
        public Iterator<EObject> iterator() {
            return EcoreUtil.getAllContents(resource, false);
        }
    };
    Iterable<IEObjectDescription> allDescriptions = Scopes.scopedElementsFor(allContents,
            this.getQualifiedNameProvider());

    Iterable<IEObjectDescription> allAliasedDescriptions = new Iterable<IEObjectDescription>() {
        @Override
        public Iterator<IEObjectDescription> iterator() {
            return Streams.stream(allDescriptions)
                    .map(CooperateImportedNamespaceAwareLocalScopeProvider::createAliasedDescription).iterator();
        }
    };

    return new MultimapBasedSelectable(allAliasedDescriptions);
}
项目:textram    文件:TextRAMScopeProvider.java   
public IScope scope_ClassifierMapping_toElement(final Aspect aspect, final EReference reference) {
  IScope _xblockexpression = null;
  {
    StructuralView _structuralView = aspect.getStructuralView();
    EList<Classifier> _classes = ((TStructuralView) _structuralView).getClasses();
    Iterable<Classifier> _filter = Iterables.<Classifier>filter(_classes, Classifier.class);
    final List<Classifier> res = IterableExtensions.<Classifier>toList(_filter);
    StructuralView _structuralView_1 = aspect.getStructuralView();
    EList<Type> _types = _structuralView_1.getTypes();
    Iterable<Classifier> _filter_1 = Iterables.<Classifier>filter(_types, Classifier.class);
    List<Classifier> _list = IterableExtensions.<Classifier>toList(_filter_1);
    res.addAll(_list);
    _xblockexpression = Scopes.scopeFor(res);
  }
  return _xblockexpression;
}
项目:smaccm    文件:AgreeScopeProvider.java   
IScope scope_NamedElement(AgreeContract ctx, EReference ref) {
    EObject container = ctx.eContainer().eContainer();
    while(container != null && !(container instanceof ComponentClassifier)){
        container = container.eContainer();
    }

    if(container != null && container instanceof ComponentImplementation){
        ComponentType compType = ((ComponentImplementation) container).getType();
        for (AnnexSubclause subclause : AnnexUtil.getAllAnnexSubclauses(compType, AgreePackage.eINSTANCE.getAgreeContractSubclause())) {
            if (subclause instanceof AgreeContractSubclause) {
                IScope scopeOfType = getScope(((AgreeContractSubclause) subclause).getContract(),
                        ref);
                return Scopes.scopeFor(getAllElementsFromSpecs(ctx.getSpecs()), scopeOfType);
            }
        }
    }
    return Scopes.scopeFor(getAllElementsFromSpecs(ctx.getSpecs()), getScope(ctx.eContainer(), ref));

}
项目:smaccm    文件:AgreeScopeProvider.java   
protected IScope scope_NamedElement(NestedDotID ctx, EReference ref) {
    Set<Element> components = getCorrespondingAadlElement(ctx, ref);
    EObject container = ctx.eContainer();

    //so this strange check make sure that we are
    //not trying to link inside of a RecordExpr
    //or a RecordUpdateExpr.  If we are then we
    //do not try to grab the containers scope otherwise
    //we will have a cyclic linking error
    while(!(container instanceof NestedDotID) &&
          !(container instanceof RecordExpr) &&
          !(container instanceof RecordUpdateExpr) &&
          !(container instanceof AgreeContract) &&
          !(container instanceof AadlPackage)){
        container = container.eContainer();
    }

    if(container instanceof NestedDotID 
      || container instanceof RecordExpr
      || container instanceof RecordUpdateExpr){
        return Scopes.scopeFor(components, IScope.NULLSCOPE);
    }else{
        return Scopes.scopeFor(components, getScope(ctx.eContainer(), ref));
    }

}
项目:n4js    文件:AbstractMemberScope.java   
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
    Iterable<? extends TMember> iMembers = Iterables.filter(getMembers(), new Predicate<TMember>() {

        @Override
        public boolean apply(TMember input) {
            return input.isStatic() == staticAccess;
        }
    });
    return Scopes.scopedElementsFor(iMembers);
}
项目:solidity-ide    文件:TypeSystemAwareScope.java   
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
    List<IEObjectDescription> result = Lists.newArrayList();
    Iterable<IEObjectDescription> iterable = Scopes.scopedElementsFor(
            EcoreUtil2.<EObject> getObjectsByType(typeSystem.getConcreteTypes(), eClass), qualifiedNameProvider);
    Iterables.addAll(result, iterable);
    return result;
}
项目:solidity-ide    文件:ElementReferenceScope.java   
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
    List<EObject> result = Lists.newArrayList();
    result.addAll(functionMembers());
    result.addAll(contractMembers());
    return Scopes.scopedElementsFor(result);
}
项目:xtext-extras    文件:XbaseImportedNamespaceScopeProvider.java   
protected ISelectable internalGetAllDescriptions(final Resource resource) {
    Iterable<EObject> allContents = new Iterable<EObject>(){
        @Override
        public Iterator<EObject> iterator() {
            return EcoreUtil.getAllContents(resource, false);
        }
    }; 
    Iterable<IEObjectDescription> allDescriptions = Scopes.scopedElementsFor(allContents, qualifiedNameProvider);
    return new MultimapBasedSelectable(allDescriptions);
}
项目:xtext-extras    文件:XImportSectionNamespaceScopeProvider.java   
protected ISelectable internalGetAllDescriptions(final Resource resource) {
    Iterable<EObject> allContents = new Iterable<EObject>(){
        @Override
        public Iterator<EObject> iterator() {
            return EcoreUtil.getAllContents(resource, false);
        }
    }; 
    Iterable<IEObjectDescription> allDescriptions = Scopes.scopedElementsFor(allContents, qualifiedNameProvider);
    return new MultimapBasedSelectable(allDescriptions);
}
项目:xtext-extras    文件:AbstractTypeScopeProvider.java   
public IScope createMemberScope(JvmType containerType, Predicate<JvmMember> filter, Function<JvmMember, QualifiedName> names, IScope outer) {
    if (containerType == null || containerType.eIsProxy())
        return outer;       
    if (containerType instanceof JvmDeclaredType) {
        IScope result = outer;
        List<JvmTypeReference> superTypes = ((JvmDeclaredType) containerType).getSuperTypes();
        for(JvmTypeReference superType: superTypes) {
            if (superType.getType() != null)
                result = createMemberScope(superType.getType(), filter, names, result);
        }
        List<JvmMember> members = ((JvmDeclaredType) containerType).getMembers();
        return Scopes.scopeFor(Iterables.filter(members, filter), names, result);
    }
    return outer;
}
项目:xtext-core    文件:SimpleLocalScopeProvider.java   
protected ISelectable getAllDescriptions(final Resource resource) {
    Iterable<EObject> allContents = new Iterable<EObject>(){
        @Override
        public Iterator<EObject> iterator() {
            return resource.getAllContents();
        }
    }; 
    Iterable<IEObjectDescription> allDescriptions = Scopes.scopedElementsFor(allContents, qualifiedNameProvider);
    return new MultimapBasedSelectable(allDescriptions);
}
项目:xtext-core    文件:ImportedNamespaceAwareLocalScopeProvider.java   
protected ISelectable internalGetAllDescriptions(final Resource resource) {
    Iterable<EObject> allContents = new Iterable<EObject>(){
        @Override
        public Iterator<EObject> iterator() {
            return EcoreUtil.getAllContents(resource, false);
        }
    }; 
    Iterable<IEObjectDescription> allDescriptions = Scopes.scopedElementsFor(allContents, qualifiedNameProvider);
    return new MultimapBasedSelectable(allDescriptions);
}
项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCancel_01() {
    maxCallCount = 1;
    try {
        helper.checkUniqueNames(
            Scopes.scopedElementsFor(ImmutableList.of(
                    createEClass(),
                    createEClass()
            )), 
            this, this);
        fail("should be canceled");
    } catch (OperationCanceledError e) {
    }
    assertEquals(maxCallCount, callCount);
}
项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCancel_02() {
    maxCallCount = 0;
    helper.checkUniqueNames(
            Scopes.scopedElementsFor(ImmutableList.of(
                    createEClass(),
                    createEClass()
            )), 
            this, this);
    assertEquals(2, callCount);
}
项目:xtext-core    文件:NamesAreUniqueValidationHelperTest.java   
@Test public void testCancel_03() {
    maxCallCount = 0;
    helper.checkUniqueNames(
            Scopes.scopedElementsFor(ImmutableList.of(
                    createEClass(),
                    createEClass()
            )), 
            null, this);
    assertEquals(0, callCount);
}
项目:xtext-core    文件:Bug311337TestLanguageRuntimeModule.java   
public IScope scope_Reference_refChild(NestedRef context,
        EReference ref) {
    EList<Child> childList = null;

    Child child = context.getLeft().getRefChild();
    childList = child.getLink().getChild();

    IScope newScope = Scopes.scopeFor(childList);
    return newScope;

}
项目:xtext-core    文件:Bug311337TestLanguageRuntimeModule.java   
public IScope scope_Reference_refChild(Reference context, EReference ref) {

            Definition localClass = null;
            EList<Child> childList = null;
            localClass = EcoreUtil2.getContainerOfType(context, Definition.class);  
            childList = localClass.getChild();

            IScope newScope = Scopes.scopeFor(childList);
            return newScope;
        }
项目:dsl-devkit    文件:CatalogFromExtensionPointScope.java   
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
  loadDefinitions();

  if (loadedModel == null) {
    return ImmutableList.of();
  }
  XtextResource resource = (XtextResource) loadedModel.eResource();
  IQualifiedNameProvider nameProvider = resource.getResourceServiceProvider().get(IQualifiedNameProvider.class);
  return Scopes.scopedElementsFor(ImmutableList.of(loadedModel), nameProvider);
}
项目:dsl-devkit    文件:CheckCfgScopeProvider.java   
@Override
public IScope getScope(final EObject context, final EReference reference) {
  if (reference == CheckcfgPackage.Literals.CONFIGURED_CHECK__CHECK) {
    // Note that context object can be either a configured check (if 'optional' keyword has been provided
    // so that a new instance is created and the configured catalog does not contain any configured checks
    // yet) or a configured catalog (in all other cases)
    final ConfiguredCatalog configuredCatalog = EcoreUtil2.getContainerOfType(context, ConfiguredCatalog.class);
    if (configuredCatalog == null || configuredCatalog.getCatalog() == null) {
      return IScope.NULLSCOPE;
    }
    CheckCatalog catalog = configuredCatalog.getCatalog();
    return Scopes.scopeFor(catalog.getAllChecks(), checkQualifiedNameProvider, IScope.NULLSCOPE);
  } else if (reference == CheckcfgPackage.Literals.CONFIGURED_PARAMETER__PARAMETER) {
    // a new list of FormalParameters to scope to
    EList<FormalParameter> parameters = ECollections.newBasicEList();
    final ConfiguredCheck configuredCheck = EcoreUtil2.getContainerOfType(context, ConfiguredCheck.class);
    if (configuredCheck != null) {
      // add FormalParameter definitions from linked check
      parameters.addAll(configuredCheck.getCheck().getFormalParameters());
    }
    // add inferred FormalParameters (properties)
    final CheckConfiguration checkConfiguration = EcoreUtil2.getContainerOfType(context, CheckConfiguration.class);
    parameters.addAll(checkConfiguration.getProperties());
    return Scopes.scopeFor(parameters, checkQualifiedNameProvider, IScope.NULLSCOPE);
  }
  return super.getScope(context, reference);
}
项目:statecharts    文件:STextNamesAreUniqueValidator.java   
/**
 * The default implementation checks only for objects that are exported via description strategy.
 * It should also check for uniqueness of internal elements. 
 */
@Override
public void doCheckUniqueNames(Resource resource, CancelIndicator cancelIndicator) {
    Iterable<EObject> iterable = () -> EcoreUtil.getAllContents(resource, true);
    List<EObject> candiatates = StreamSupport.stream(iterable.spliterator(), false)
            .filter((it) -> it instanceof NamedElement).collect(Collectors.toList());
    helper.checkUniqueNames(Scopes.scopedElementsFor(candiatates, fqnProvider), cancelIndicator, this);
}
项目:statecharts    文件:TypeSystemAwareScope.java   
@Override
protected Iterable<IEObjectDescription> getAllLocalElements() {
    List<IEObjectDescription> result = Lists.newArrayList();
    Iterable<IEObjectDescription> iterable = Scopes.scopedElementsFor(
            EcoreUtil2.<EObject> getObjectsByType(typeSystem.getConcreteTypes(), eClass),
            qualifiedNameProvider);
    Iterables.addAll(result, iterable);
    return result;
}
项目:statecharts    文件:STextScopeProvider.java   
public IScope scope_ActiveStateReferenceExpression_value(EObject context, EReference reference) {
    Statechart statechart = getStatechart(context);
    if (statechart == null)
        return IScope.NULLSCOPE;
    List<State> allStates = EcoreUtil2.getAllContentsOfType(statechart, State.class);
    IScope scope = Scopes.scopeFor(allStates, nameProvider, IScope.NULLSCOPE);
    return new ImportScope(getActiveStateNormalizer(context), scope,
            new EObjectDescriptionLookUp(Lists.newArrayList(scope.getAllElements())), reference.getEReferenceType(),
            false);
}
项目:statecharts    文件:STextScopeProvider.java   
public IScope scope_FeatureCall_feature(final FeatureCall context, EReference reference) {

        Predicate<IEObjectDescription> predicate = calculateFilterPredicate(context, reference);

        Expression owner = context.getOwner();
        EObject element = null;
        if (owner instanceof ElementReferenceExpression) {
            element = ((ElementReferenceExpression) owner).getReference();
        } else if (owner instanceof FeatureCall) {
            element = ((FeatureCall) owner).getFeature();
        } else {
            return getDelegate().getScope(context, reference);
        }

        IScope scope = IScope.NULLSCOPE;
        InferenceResult result = typeInferrer.infer(owner);
        Type ownerType = result != null ? result.getType() : null;

        if (element instanceof Scope) {
            scope = Scopes.scopeFor(((Scope) element).getDeclarations());
            return new FilteringScope(scope, predicate);
        }else if(ownerType != null){
            scope = Scopes.scopeFor(typeSystem.getPropertyExtensions(ownerType));
            scope = Scopes.scopeFor(typeSystem.getOperationExtensions(ownerType),scope);
        }

        if (ownerType instanceof ComplexType) {
            return addScopeForComplexType((ComplexType) ownerType, scope, predicate);
        }
        if (ownerType instanceof EnumerationType) {
            return addScopeForEnumType((EnumerationType) ownerType, scope, predicate);
        }
        return scope;
    }
项目:statecharts    文件:AbstractLibraryGlobalScopeProvider.java   
protected Iterable<IEObjectDescription> getDescriptions(Resource context, URI uri) {
    List<IEObjectDescription> result = Lists.newArrayList();
    ResourceSet set = context.getResourceSet();
    Resource resource = set.getResource(uri, true);
    IResourceServiceProvider resourceServiceProvider = serviceProviderRegistry.getResourceServiceProvider(uri);
    if (resourceServiceProvider == null) {
        Iterables.addAll(result, Scopes.scopedElementsFor(Lists.newArrayList(resource.getAllContents())));
    } else {
        IResourceDescription resourceDescription = resourceServiceProvider.getResourceDescriptionManager()
                .getResourceDescription(resource);
        Iterables.addAll(result, resourceDescription.getExportedObjects());
    }
    resource.unload();
    return result;
}
项目:PHDL    文件:PhdlScopeProvider.java   
public IScope scope_ConnectionAssign_ref(DesignElement d, EReference ref) {
    List<Connection> connections = new ArrayList<Connection>();
    List<DesignElement> elements = ((Design) d.eContainer()).getElements();
    for (DesignElement element : elements) {
        if (element instanceof Connection && elements.indexOf(element) < elements.indexOf(d))
            connections.add((Connection) element);
    }
    List<ConnectionName> names = new ArrayList<ConnectionName>();
    for (Connection connection : connections) {
        for (ConnectionName name : connection.getNames())
            names.add(name);
    }
    return Scopes.scopeFor(names);
}
项目:PHDL    文件:PhdlScopeProvider.java   
public IScope scope_ConnectionRef_ref(Design d, EReference ref) {
    List<Connection> connections = new ArrayList<Connection>();
    List<DesignElement> elements = d.getElements();
    for (DesignElement element : elements) {
        if (element instanceof Connection)
            connections.add((Connection) element);
    }
    List<ConnectionName> names = new ArrayList<ConnectionName>();
    for (Connection connection : connections) {
        for (ConnectionName name : connection.getNames())
            names.add(name);
    }
    return Scopes.scopeFor(names);
}
项目:PHDL    文件:PhdlScopeProvider.java   
public IScope scope_ConnectionRef_ref(DesignElement d, EReference ref) {
    List<Connection> connections = new ArrayList<Connection>();
    List<DesignElement> elements = ((Design) d.eContainer()).getElements();
    for (DesignElement element : elements) {
        if (element instanceof Connection && elements.indexOf(element) < elements.indexOf(d))
            connections.add((Connection) element);
    }
    List<ConnectionName> names = new ArrayList<ConnectionName>();
    for (Connection connection : connections) {
        for (ConnectionName name : connection.getNames())
            names.add(name);
    }
    return Scopes.scopeFor(names);
}
项目:PHDL    文件:PhdlScopeProvider.java   
public IScope scope_ConnectionRef_ref(Instance i, EReference ref) {
    List<Connection> connections = new ArrayList<Connection>();
    List<DesignElement> elements = ((Design) i.eContainer()).getElements();
    for (DesignElement element : elements) {
        if (element instanceof Connection && elements.indexOf(element) < elements.indexOf(i))
            connections.add((Connection) element);
    }
    List<ConnectionName> names = new ArrayList<ConnectionName>();
    for (Connection connection : connections) {
        for (ConnectionName name : connection.getNames())
            names.add(name);
    }
    return Scopes.scopeFor(names);
}
项目:PHDL    文件:PhdlScopeProvider.java   
public IScope scope_PinAssign_ref(Instance i, EReference ref) {
    List<EObject> pins = new ArrayList<EObject>();
    for (DeviceElement element : i.getDevice().getElements()) {
        if (element instanceof Pin)
            pins.add(element);
    }
    return Scopes.scopeFor(pins);
}
项目:PHDL    文件:PhdlScopeProvider.java   
public IScope scope_PortAssign_ref(Instance i, EReference ref) {
    if (i.isSubInst()) {
        List<ConnectionName> candidates = new ArrayList<ConnectionName>();
        for (DesignElement element : i.getSubDesign().getElements()) {
            if (element instanceof Connection && ((Connection) element).isPort())
                candidates.addAll(((Connection) element).getNames());
        }
        return Scopes.scopeFor(candidates);
    } else
        return null;
}