当前位置: 首页>>代码示例>>Java>>正文


Java IResourceDescriptions.getExportedObjectsByType方法代码示例

本文整理汇总了Java中org.eclipse.xtext.resource.IResourceDescriptions.getExportedObjectsByType方法的典型用法代码示例。如果您正苦于以下问题:Java IResourceDescriptions.getExportedObjectsByType方法的具体用法?Java IResourceDescriptions.getExportedObjectsByType怎么用?Java IResourceDescriptions.getExportedObjectsByType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.xtext.resource.IResourceDescriptions的用法示例。


在下文中一共展示了IResourceDescriptions.getExportedObjectsByType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findFieldReferences

import org.eclipse.xtext.resource.IResourceDescriptions; //导入方法依赖的package包/类
public List<Method> findFieldReferences(IResourceDescriptions descriptions, Class element){
	List<Method> usages = new ArrayList<Method>();
	Iterable<IEObjectDescription> exportedObjectsByType = descriptions.getExportedObjectsByType(element.eClass());
	final ArrayList<EObject> gather = new ArrayList<>();

	exportedObjectsByType.forEach((e) -> {
		EObject eObjectOrProxy = e.getEObjectOrProxy();
		EObject resolve = EcoreUtil.resolve(eObjectOrProxy, element);
		gather.add(resolve);
	});

	element.getFields().listIterator().forEachRemaining((a) -> {
		Collection<Setting> references = EcoreUtil.UsageCrossReferencer.find(a, gather);
		references.forEach((f) -> {
			usages.add((Method) f.getEObject().eContainer());
		});
	});
	return usages;
}
 
开发者ID:ioanaverebi,项目名称:Sparrow,代码行数:20,代码来源:CrossReferenceResolver.java

示例2: getLaunchObjects

import org.eclipse.xtext.resource.IResourceDescriptions; //导入方法依赖的package包/类
@Override
public Set<LcDslLaunchObject> getLaunchObjects() {
    IResourceDescriptions index = LcDslHelper.getInjector().getInstance(IResourceDescriptions.class);
    ResourceSet set = LcDslHelper.getInjector().getInstance(ResourceSet.class);

    Set<LcDslLaunchObject> result = new TreeSet<>();
    Iterable<IEObjectDescription> descs = index.getExportedObjectsByType(LcDslPackage.eINSTANCE.getLaunchConfig());
    for (IEObjectDescription obj : descs) {
        EObject lc = EcoreUtil2.resolve(obj.getEObjectOrProxy(), set);
        if (lc instanceof LaunchConfig) {
            LaunchConfig l = (LaunchConfig) lc;
            if (l.isAbstract()) {
                continue;
            }

            LcDslLaunchObject o = new LcDslLaunchObject((LaunchConfig) lc);
            if (o.getType() == null) { // unsupported type
                continue;
            }

            // only hide manual if there is no other object it would be (properly) hiding
            if (hideManual && l.isManual() && findLaunchConfiguration(o.getType(), generator.fullName(l)) == null) {
                continue;
            }

            result.add(o);
        }
    }

    return result;
}
 
开发者ID:mduft,项目名称:lcdsl,代码行数:32,代码来源:LcDslProvider.java


注:本文中的org.eclipse.xtext.resource.IResourceDescriptions.getExportedObjectsByType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。