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


Java EcoreUtil2.getResourceSet方法代码示例

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


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

示例1: findKnownTopLevelType

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
protected JvmType findKnownTopLevelType(Class<?> rawType, Notifier context) {
	if (rawType.isArray()) {
		throw new IllegalArgumentException(rawType.getCanonicalName());
	}
	if (rawType.isPrimitive()) {
		throw new IllegalArgumentException(rawType.getName());
	}
	ResourceSet resourceSet = EcoreUtil2.getResourceSet(context);
	if (resourceSet == null) {
		return null;
	}
	Resource typeResource = resourceSet.getResource(URIHelperConstants.OBJECTS_URI.appendSegment(rawType.getName()), true);
	List<EObject> resourceContents = typeResource.getContents();
	if (resourceContents.isEmpty())
		return null;
	JvmType type = (JvmType) resourceContents.get(0);
	return type;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:19,代码来源:AbstractXbaseCompiler.java

示例2: findKnownType

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
protected JvmType findKnownType(Class<?> rawType, Notifier context) {
	if (rawType.isArray()) {
		throw new IllegalArgumentException(rawType.getCanonicalName());
	}
	if (rawType.isPrimitive()) {
		throw new IllegalArgumentException(rawType.getName());
	}		ResourceSet resourceSet = EcoreUtil2.getResourceSet(context);
	if (resourceSet == null) {
		return null;
	}
	Class<?> declaringClass = rawType.getDeclaringClass();
	if (declaringClass == null) {
		return findKnownTopLevelType(rawType, resourceSet);
	}
	JvmType result = (JvmType) resourceSet.getEObject(URIHelperConstants.OBJECTS_URI.appendSegment(declaringClass.getName()).appendFragment(rawType.getName()), true);
	return result;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:18,代码来源:AbstractXbaseCompiler.java

示例3: getJavaLangObjectTypeRef

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
protected JvmTypeReference getJavaLangObjectTypeRef(JvmType rawType, TypesFactory typesFactory) {
	ResourceSet rs = EcoreUtil2.getResourceSet(rawType);
	JvmParameterizedTypeReference refToObject = typesFactory.createJvmParameterizedTypeReference();
	if (rs != null) {
		EObject javaLangObject = rs.getEObject(javaLangObjectURI, true);
		if (javaLangObject instanceof JvmType) {
			JvmType objectDeclaration = (JvmType) javaLangObject;
			refToObject.setType(objectDeclaration);
			return refToObject;
		}
	}
	JvmGenericType proxy = typesFactory.createJvmGenericType();
	((InternalEObject)proxy).eSetProxyURI(javaLangObjectURI);
	refToObject.setType(proxy);
	return refToObject;
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:17,代码来源:XFunctionTypeRefImplCustom.java

示例4: findDeclaredType

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
/**
 * looks up a JVMType corresponding to the given {@link Class}. This method ignores any Jvm types created in non-
 * {@link TypeResource} in the given context's resourceSet, but goes straight to the Java-layer, using a
 * {@link IJvmTypeProvider}.
 * 
 * @return the JvmType with the same qualified name as the given {@link Class} object, or null if no such JvmType
 *         could be found using the context's resourceSet.
 */
public JvmType findDeclaredType(String typeName, Notifier context) {
	if (typeName == null)
		throw new NullPointerException("typeName");
	if (context == null)
		throw new NullPointerException("context");
	ResourceSet resourceSet = EcoreUtil2.getResourceSet(context);
	if (resourceSet == null)
		return null;
	// make sure a type provider is configured in the resource set. 
	IJvmTypeProvider typeProvider = typeProviderFactory.findOrCreateTypeProvider(resourceSet);
	try {
		final JvmType result = typeProvider.findTypeByName(typeName);
		return result;
	} catch (RuntimeException e) {
		operationCanceledManager.propagateAsErrorIfCancelException(e);
		log.info("Couldn't find JvmType for name '" + typeName + "' in context " + context, e);
		return null;
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:28,代码来源:TypeReferences.java

示例5: setContext

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Override
public void setContext(final Notifier ctx) {
  IResourceDescriptions _localDescriptions = this.getLocalDescriptions();
  final Procedure1<ResourceSetBasedResourceDescriptions> _function = (ResourceSetBasedResourceDescriptions it) -> {
    it.setContext(ctx);
    it.setData(null);
  };
  ObjectExtensions.<ResourceSetBasedResourceDescriptions>operator_doubleArrow(((ResourceSetBasedResourceDescriptions) _localDescriptions), _function);
  final ResourceSet resourceSet = EcoreUtil2.getResourceSet(ctx);
  this.setGlobalDescriptions(ChunkedResourceDescriptions.findInEmfObject(resourceSet));
  IProjectConfig _projectConfig = null;
  if (this.projectConfigProvider!=null) {
    _projectConfig=this.projectConfigProvider.getProjectConfig(resourceSet);
  }
  IWorkspaceConfig _workspaceConfig = null;
  if (_projectConfig!=null) {
    _workspaceConfig=_projectConfig.getWorkspaceConfig();
  }
  this.workspaceConfig = _workspaceConfig;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:21,代码来源:LiveShadowedChunkedResourceDescriptions.java

示例6: findAnnotationType

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
private JvmAnnotationType findAnnotationType(Class<? extends Annotation> type, Notifier context) {
	ResourceSet resourceSet = EcoreUtil2.getResourceSet(context);
	if (resourceSet == null)
		return null;
	IJvmTypeProvider typeProvider = typeProviderFactory.findOrCreateTypeProvider(resourceSet);
	try {
		final JvmType result = typeProvider.findTypeByName(type.getName());
		if (result instanceof JvmAnnotationType)
			return (JvmAnnotationType) result;
		return null;
	} catch (RuntimeException e) {
		return null;
	}
}
 
开发者ID:eclipse,项目名称:xtext-extras,代码行数:15,代码来源:AnnotationLookup.java

示例7: isIndexing

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
public boolean isIndexing(Notifier ctx) {
	ResourceSet set = EcoreUtil2.getResourceSet(ctx);
	if (set != null) {
		return EcoreUtil.getAdapter(set.eAdapters(), IndexingAdapter.INSTANCE) != null;
	}
	return false;
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:CompilerPhases.java

示例8: setIndexing

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
public void setIndexing(Notifier ctx, boolean isIndex) {
	ResourceSet set = EcoreUtil2.getResourceSet(ctx);
	if (isIndex) {
		set.eAdapters().add(IndexingAdapter.INSTANCE);
	} else {
		set.eAdapters().remove(IndexingAdapter.INSTANCE);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:9,代码来源:CompilerPhases.java

示例9: setContext

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Override
public void setContext(Notifier ctx) {
	this.resourceSet = EcoreUtil2.getResourceSet(ctx);
	if (resourceSet != null) {
		data = ResourceDescriptionsData.ResourceSetAdapter.findResourceDescriptionsData(resourceSet);
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:8,代码来源:ResourceSetBasedResourceDescriptions.java

示例10: setContext

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
/**
 * Set the context.
 * 
 * @param ctx
 *          The context
 */
@Override
public void setContext(final Notifier ctx) {
  super.setContext(ctx);
  final ResourceSet resourceSet = EcoreUtil2.getResourceSet(ctx);
  IResourceDescriptions adapter = (IResourceDescriptions) EcoreUtil2.getAdapter(resourceSet.eAdapters(), CurrentDescriptions.class);
  if (adapter instanceof IResourceDescriptions2) {
    delegate = (IResourceDescriptions2) adapter;
  } else {
    delegate = new ResourceDescriptions2(adapter);
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:18,代码来源:CurrentDescriptions2.java

示例11: setContext

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
@Override
public void setContext(Notifier ctx) {
	this.resourceSet = EcoreUtil2.getResourceSet(ctx);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:5,代码来源:EagerResourceSetBasedResourceDescriptions.java

示例12: get

import org.eclipse.xtext.EcoreUtil2; //导入方法依赖的package包/类
public static ResourceSetContext get(Notifier context) {
	ResourceSet resourceSet = EcoreUtil2.getResourceSet(context);
	return new ResourceSetContext(resourceSet);
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:5,代码来源:ResourceSetContext.java


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