• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java LazyURIEncoder类的典型用法和代码示例

java 1次浏览

本文整理汇总了Java中org.eclipse.xtext.linking.lazy.LazyURIEncoder的典型用法代码示例。如果您正苦于以下问题:Java LazyURIEncoder类的具体用法?Java LazyURIEncoder怎么用?Java LazyURIEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

LazyURIEncoder类属于org.eclipse.xtext.linking.lazy包,在下文中一共展示了LazyURIEncoder类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getOrCreateURIEncoder

点赞 2

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
protected LazyURIEncoder getOrCreateURIEncoder() {
	Resource resource = getState().getResource();
	if (resource instanceof LazyLinkingResource) {
		return ((LazyLinkingResource) resource).getEncoder();
	}
	return new LazyURIEncoder();
}
 

开发者ID:eclipse,
项目名称:xtext-extras,
代码行数:8,
代码来源:ErrorTreeAppendable.java

示例2: createResourceDescription

点赞 2

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
protected IResourceDescription createResourceDescription(Resource testResource) {
	DefaultResourceDescriptionStrategy strategy = new DefaultResourceDescriptionStrategy();
	strategy.setQualifiedNameProvider(new IQualifiedNameProvider.AbstractImpl() {
		@Override
		public QualifiedName getFullyQualifiedName(EObject obj) {
			String name = SimpleAttributeResolver.NAME_RESOLVER.apply(obj);
			return (name != null) ? QualifiedName.create(name) : null;
		}
	});
	strategy.setLazyURIEncoder(new LazyURIEncoder());
	IResourceDescription resourceDescription = new DefaultResourceDescription(testResource, strategy);
	return resourceDescription;
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:14,
代码来源:DefaultReferenceDescriptionTest.java

示例3: getGuiceBindingsRt

点赞 2

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
@Override
public Set<Binding> getGuiceBindingsRt(final Grammar grammar) {
  final Set<Binding> bindings = super.getGuiceBindingsRt(grammar);
  final BindFactory factory = new BindFactory();
  factory.addTypeToType(IContainer.Manager.class.getName(), "com.avaloq.tools.ddk.xtext.builder.CachingStateBasedContainerManager");
  factory.addTypeToType(LazyLinkingResource.class.getName(), LazyLinkingResource2.class.getName());
  factory.addTypeToType(LazyURIEncoder.class.getName(), FastLazyURIEncoder.class.getName());
  final Set<Binding> result = factory.getBindings();
  result.addAll(bindings);
  return result;
}
 

开发者ID:dsldevkit,
项目名称:dsl-devkit,
代码行数:12,
代码来源:BuilderIntegrationFragment.java

示例4: getURIString

点赞 2

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
/**
 * Returns a string representation of the given object's URI. For objects contained by the given resource the object's {@link Resource#getURIFragment(EObject)
 * URI fragment} will be returned. For objects in other resources the {@link EcoreUtil#getURI(EObject) full URI} will be returned with an exclamation mark as
 * prefix.
 *
 * @param obj
 *          object to get URI string for
 * @param context
 *          resource being serialized, must not be {@code null}
 * @return URI string or {@code null} if the object is {@code null}, a lazy-linking proxy, or not a proxy but contained in a resource
 */
protected static String getURIString(final EObject obj, final Resource context) {
  if (obj == null) {
    return null;
  }
  Resource resource = obj.eResource();
  if (resource == null) {
    if (obj.eIsProxy()) {
      URI proxyURI = ((InternalEObject) obj).eProxyURI();
      return proxyURI.fragment().startsWith(LazyURIEncoder.XTEXT_LINK) ? null : '!' + proxyURI.toString();
    }
    return null;
  }
  return resource == context ? getURIFragmentPath(obj, context) : '!' + resource.getURI().toString() + '#' + resource.getURIFragment(obj); // NOPMD
}
 

开发者ID:dsldevkit,
项目名称:dsl-devkit,
代码行数:26,
代码来源:DirectLinkingResourceStorageWritable.java

示例5: setLazyURIEncoder

点赞 2

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
/** @since 2.0 */
public void setLazyURIEncoder(LazyURIEncoder uriEncoder) {
	this.uriEncoder = uriEncoder;
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:5,
代码来源:DefaultResourceDescriptionStrategy.java

示例6: getLazyURIEncoder

点赞 2

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
/** @since 2.0 */
public LazyURIEncoder getLazyURIEncoder() {
	return uriEncoder;
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:5,
代码来源:DefaultResourceDescriptionStrategy.java

示例7: configureUseIndexFragmentsForLazyLinking

点赞 2

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
/**
 * @since 2.7
 */
public void configureUseIndexFragmentsForLazyLinking(com.google.inject.Binder binder) {
	binder.bind(Boolean.TYPE).annotatedWith(Names.named(LazyURIEncoder.USE_INDEXED_FRAGMENTS_BINDING)).toInstance(Boolean.TRUE);
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:7,
代码来源:DefaultRuntimeModule.java

示例8: configureUseIndexFragmentsForLazyLinking

点赞 2

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
@Override
public void configureUseIndexFragmentsForLazyLinking(Binder binder) {
	binder.bind(Boolean.TYPE).annotatedWith(Names.named(LazyURIEncoder.USE_INDEXED_FRAGMENTS_BINDING)).toInstance(Boolean.FALSE);
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:5,
代码来源:Bug419429RuntimeModule.java

示例9: testLazyLinkingProxyReferences

点赞 2

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
/** @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=330812 */
@Test public void testLazyLinkingProxyReferences() {
	URI resourceUri = URI.createPlatformResourceURI("test.ecore", true);
	LazyURIEncoder lazyURIEncoder = new LazyURIEncoder();

	ResourceSet resourceSet = new ResourceSetImpl();
	Resource testResource = resourceSet.createResource(resourceUri);

	EPackage ePackage = EcoreFactory.eINSTANCE.createEPackage();
	ePackage.setName("test");
	ePackage.setNsPrefix("test");
	ePackage.setNsURI("test");
	testResource.getContents().add(ePackage);

	EClass eClass = EcoreFactory.eINSTANCE.createEClass();
	eClass.setName("Test");
	ePackage.getEClassifiers().add(eClass);

	EClass multiRefType = EcoreFactory.eINSTANCE.createEClass();
	((InternalEObject) multiRefType).eSetProxyURI(EcoreUtil.getURI(EcorePackage.Literals.EPACKAGE));
	eClass.getESuperTypes().add(multiRefType);

	EClass multiRefType2 = EcoreFactory.eINSTANCE.createEClass();
	URI dummyProxyUri = resourceUri.appendFragment(lazyURIEncoder.encode(eClass, EcorePackage.Literals.ECLASS__ESUPER_TYPES, null));
	((InternalEObject) multiRefType2).eSetProxyURI(dummyProxyUri);
	eClass.getESuperTypes().add(multiRefType2);

	EAttribute nameAttribute = EcoreFactory.eINSTANCE.createEAttribute();
	nameAttribute.setName("name");
	eClass.getEStructuralFeatures().add(nameAttribute);
	EDataType singleRefType = EcoreFactory.eINSTANCE.createEDataType();
	((InternalEObject) singleRefType).eSetProxyURI(EcoreUtil.getURI(EcorePackage.Literals.ESTRING));
	nameAttribute.setEType(singleRefType);

	assertTrue(multiRefType.eIsProxy());
	assertTrue(multiRefType2.eIsProxy());
	assertTrue(lazyURIEncoder.isCrossLinkFragment(testResource, EcoreUtil.getURI(multiRefType2).fragment()));
	assertTrue(singleRefType.eIsProxy());

	IResourceDescription resourceDescription = createResourceDescription(testResource);
	Iterable<IReferenceDescription> referenceDescriptions = resourceDescription.getReferenceDescriptions();
	assertEquals("Unexpected additional resources were loaded", 1, resourceSet.getResources().size());
	assertEquals("Unexpected reference was exported", 3, Iterables.size(referenceDescriptions));

	IReferenceDescription referenceDescription = Iterables.get(referenceDescriptions, 0);
	assertEquals(0, referenceDescription.getIndexInList());
	assertEquals(EcoreUtil.getURI(eClass), referenceDescription.getSourceEObjectUri());
	assertEquals(EcorePackage.Literals.ECLASS__ESUPER_TYPES, referenceDescription.getEReference());
	assertEquals(EcoreUtil.getURI(EcorePackage.Literals.EPACKAGE), referenceDescription.getTargetEObjectUri());

	referenceDescription = Iterables.get(referenceDescriptions, 1);
	assertEquals(-1, referenceDescription.getIndexInList());
	assertEquals(EcoreUtil.getURI(nameAttribute.getEGenericType()), referenceDescription.getSourceEObjectUri());
	assertEquals(EcorePackage.Literals.EGENERIC_TYPE__ECLASSIFIER, referenceDescription.getEReference());
	assertEquals(EcoreUtil.getURI(EcorePackage.Literals.ESTRING), referenceDescription.getTargetEObjectUri());

	referenceDescription = Iterables.get(referenceDescriptions, 2);
	assertEquals(-1, referenceDescription.getIndexInList());
	assertEquals(EcoreUtil.getURI(eClass.getEGenericSuperTypes().get(0)), referenceDescription.getSourceEObjectUri());
	assertEquals(EcorePackage.Literals.EGENERIC_TYPE__ECLASSIFIER, referenceDescription.getEReference());
	assertEquals(EcoreUtil.getURI(EcorePackage.Literals.EPACKAGE), referenceDescription.getTargetEObjectUri());
}
 

开发者ID:eclipse,
项目名称:xtext-core,
代码行数:63,
代码来源:DefaultReferenceDescriptionTest.java

示例10: getLazyURIEncoder

点赞 1

import org.eclipse.xtext.linking.lazy.LazyURIEncoder; //导入依赖的package包/类
/**
 * Returns the {@link LazyURIEncoder} used for the context language.
 *
 * @return {@link LazyURIEncoder} instance, never {@code null}
 */
protected LazyURIEncoder getLazyURIEncoder() {
  return uriEncoder;
}
 

开发者ID:dsldevkit,
项目名称:dsl-devkit,
代码行数:9,
代码来源:DefaultCrossReferenceHelper.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)