Java 类org.eclipse.xtext.scoping.impl.ImportScope 实例源码

项目:CooperateModelingEnvironment    文件:ClsCooperateSimpleScopeProviderTest.java   
@SuppressWarnings("unchecked")
private static List<ImportNormalizer> getNormalizers(IScope scope)
        throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
    assertNotNull(scope);
    assertThat(scope, is(instanceOf(ImportScope.class)));

    ImportScope importScope = (ImportScope) scope;
    Field normalizersField = scope.getClass().getDeclaredField("normalizers");
    normalizersField.setAccessible(true);

    Object normalizers = normalizersField.get(importScope);
    assertThat(normalizers, is(instanceOf(List.class)));

    assertThat((List<?>) normalizers, everyItem(is(instanceOf(ImportNormalizer.class))));
    return (List<ImportNormalizer>) normalizers;
}
项目:CooperateModelingEnvironment    文件:UseCaseCooperateSimpleScopeProviderTest.java   
@SuppressWarnings("unchecked")
private static List<ImportNormalizer> getNormalizers(IScope scope)
        throws NoSuchFieldException, SecurityException, IllegalArgumentException, IllegalAccessException {
    assertNotNull(scope);
    assertThat(scope, is(instanceOf(ImportScope.class)));

    ImportScope importScope = (ImportScope) scope;
    Field normalizersField = scope.getClass().getDeclaredField("normalizers");
    normalizersField.setAccessible(true);

    Object normalizers = normalizersField.get(importScope);
    assertThat(normalizers, is(instanceOf(List.class)));

    assertThat((List<?>) normalizers, everyItem(is(instanceOf(ImportNormalizer.class))));
    return (List<ImportNormalizer>) normalizers;
}
项目: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);
}
项目:xtext-extras    文件:XImportSectionNamespaceScopeProvider.java   
protected ImportScope createImportScope(IScope parent, List<ImportNormalizer> namespaceResolvers, ISelectable importFrom, EClass type, boolean ignoreCase) {
    if (importFrom == null)
        throw new NullPointerException("importFrom");

    return new ImportScope(namespaceResolvers, parent, importFrom, type, ignoreCase);
}