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


Java EcoreUtil2.resolveLazyCrossReferences方法代码示例

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


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

示例1: computeReferenceDescriptions

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
protected List<IReferenceDescription> computeReferenceDescriptions() {
	final List<IReferenceDescription> referenceDescriptions = Lists.newArrayList();
	IAcceptor<IReferenceDescription> acceptor = new IAcceptor<IReferenceDescription>() {
		@Override
		public void accept(IReferenceDescription referenceDescription) {
			referenceDescriptions.add(referenceDescription);
		}
	};
	EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
	Map<EObject, IEObjectDescription> eObject2exportedEObjects = createEObject2ExportedEObjectsMap(getExportedObjects());
	TreeIterator<EObject> contents = EcoreUtil.getAllProperContents(this.resource, true);
	while (contents.hasNext()) {
		EObject eObject = contents.next();
		URI exportedContainerURI = findExportedContainerURI(eObject, eObject2exportedEObjects);
		if (!strategy.createReferenceDescriptions(eObject, exportedContainerURI, acceptor))
			contents.prune();
	}
	return referenceDescriptions;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:20,代码来源:DefaultResourceDescription.java

示例2: testgetReferenceDescriptions

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Test public void testgetReferenceDescriptions() throws Exception {
	with(new LangATestLanguageStandaloneSetup());
	XtextResource targetResource = getResource("type C", "bar.langatestlanguage");
	EObject typeC = targetResource.getContents().get(0).eContents().get(0);
	XtextResource resource = (XtextResource) targetResource.getResourceSet().createResource(URI.createURI("foo.langatestlanguage"));
	resource.load(new StringInputStream("type A extends C type B extends A"), null);
	EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
	IResourceDescription resDesc = resource.getResourceServiceProvider().getResourceDescriptionManager().getResourceDescription(resource);
	Iterable<IReferenceDescription> descriptions = resDesc.getReferenceDescriptions();
	Collection<IReferenceDescription> collection = Lists.newArrayList(descriptions);
	assertEquals(1,collection.size());
	IReferenceDescription refDesc = descriptions.iterator().next();
	Main m = (Main) resource.getParseResult().getRootASTElement();
	assertEquals(m.getTypes().get(0),resource.getResourceSet().getEObject(refDesc.getSourceEObjectUri(),false));
	assertEquals(typeC, resource.getResourceSet().getEObject(refDesc.getTargetEObjectUri(),false));
	assertEquals(-1,refDesc.getIndexInList());
	assertEquals(LangATestLanguagePackage.Literals.TYPE__EXTENDS,refDesc.getEReference());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:19,代码来源:DefaultReferenceDescriptionTest.java

示例3: testgetReferenceDescriptionForMultiValue

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Test public void testgetReferenceDescriptionForMultiValue() throws Exception {
	with(new LangATestLanguageStandaloneSetup());
	XtextResource targetResource = getResource("type C type D", "bar.langatestlanguage");
	EObject typeC = targetResource.getContents().get(0).eContents().get(0);
	EObject typeD = targetResource.getContents().get(0).eContents().get(1);
	XtextResource resource = (XtextResource) targetResource.getResourceSet().createResource(URI.createURI("foo.langatestlanguage"));
	resource.load(new StringInputStream("type A implements B,C,D type B"), null);
	EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
	IResourceDescription resDesc = resource.getResourceServiceProvider().getResourceDescriptionManager().getResourceDescription(resource);
	Iterable<IReferenceDescription> descriptions = resDesc.getReferenceDescriptions();
	Collection<IReferenceDescription> collection = Lists.newArrayList(descriptions);
	assertEquals(2,collection.size());
	Iterator<IReferenceDescription> iterator = descriptions.iterator();
	IReferenceDescription refDesc1 = iterator.next();
	IReferenceDescription refDesc2 = iterator.next();
	Main m = (Main) resource.getParseResult().getRootASTElement();
	assertEquals(m.getTypes().get(0),resource.getResourceSet().getEObject(refDesc1.getSourceEObjectUri(),false));
	assertEquals(typeC,resource.getResourceSet().getEObject(refDesc1.getTargetEObjectUri(),false));
	assertEquals(1,refDesc1.getIndexInList());
	assertEquals(LangATestLanguagePackage.Literals.TYPE__IMPLEMENTS,refDesc1.getEReference());
	assertEquals(m.getTypes().get(0),resource.getResourceSet().getEObject(refDesc2.getSourceEObjectUri(),false));
	assertEquals(typeD,resource.getResourceSet().getEObject(refDesc2.getTargetEObjectUri(),false));
	assertEquals(2,refDesc2.getIndexInList());
	assertEquals(LangATestLanguagePackage.Literals.TYPE__IMPLEMENTS,refDesc2.getEReference());
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:26,代码来源:DefaultReferenceDescriptionTest.java

示例4: computeReferenceDescriptions

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Override
protected List<IReferenceDescription> computeReferenceDescriptions() {
  final ImmutableList.Builder<IReferenceDescription> referenceDescriptions = ImmutableList.builder();
  EcoreUtil2.resolveLazyCrossReferences(getResource(), CancelIndicator.NullImpl);
  Map<EObject, IEObjectDescription> eObject2exportedEObjects = createEObject2ExportedEObjectsMap(getExportedObjects());
  TreeIterator<EObject> contents = EcoreUtil.getAllProperContents(getResource(), true);
  while (contents.hasNext()) {
    EObject eObject = contents.next();
    URI exportedContainerURI = findExportedContainerURI(eObject, eObject2exportedEObjects);
    if (!strategy.createReferenceDescriptions(eObject, exportedContainerURI, referenceDescriptions::add)) {
      contents.prune();
    }
  }
  if (strategy instanceof AbstractResourceDescriptionStrategy) {
    ((AbstractResourceDescriptionStrategy) strategy).createImplicitReferenceDescriptions(getResource(), referenceDescriptions::add);
  }
  return referenceDescriptions.build();
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:19,代码来源:ResourceDescription2.java

示例5: compile

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
/**
 * Compiles provided Script. Can replace backslashes with single quote (for windows command line issues)
 *
 * @param depRoot
 *            script to transpile
 * @param options
 *            the {@link GeneratorOption}s to use during compilation.
 * @param replaceQuotes
 *            should replace quotes (only for windows)
 * @return string representation of compilation result
 */
public String compile(Script depRoot, GeneratorOption[] options, boolean replaceQuotes) {
	final Resource resource = depRoot.eResource();
	EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
	final AbstractSubGenerator generator = getGeneratorForResource(resource);
	String compileResultStr = generator.getCompileResultAsText(depRoot, options);
	if (replaceQuotes) {
		// Windows Node.js has problems with " as it interprets it as ending of script to execute
		compileResultStr = compileResultStr.replace("\"", "'");
	}
	return compileResultStr;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:23,代码来源:XpectN4JSES5TranspilerHelper.java

示例6: getImportedNames

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Override
public Iterable<QualifiedName> getImportedNames() {
	EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
	ImportedNamesAdapter adapter = ImportedNamesAdapter.find(getResource());
	if (adapter != null) {
		ImmutableSet<QualifiedName> result = ImmutableSet.copyOf(adapter.getImportedNames());
		return result;
	}
	return Collections.emptySet();
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:11,代码来源:DefaultResourceDescription.java

示例7: doLinking

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
protected void doLinking() {
	doIndex();
	for (Resource resource : sources) {
		EcoreUtil2.resolveLazyCrossReferences(resource, CancelIndicator.NullImpl);
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:7,代码来源:CompilationTestHelper.java

示例8: resolveProxies

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
protected void resolveProxies(final Resource resource, final CancelIndicator monitor) {
	EcoreUtil2.resolveLazyCrossReferences(resource, monitor);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:4,代码来源:ResourceValidatorImpl.java


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