本文整理汇总了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;
}
示例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;
}