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


Java Registry.getEPackage方法代码示例

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


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

示例1: testExternalFormOfEReference

import org.eclipse.emf.ecore.EPackage.Registry; //导入方法依赖的package包/类
@Test public void testExternalFormOfEReference() throws Exception {
	Registry registry = EPackage.Registry.INSTANCE;
	Set<String> uris = Sets.newHashSet(registry.keySet());
	for (String string : uris) {
		EPackage ePackage = registry.getEPackage(string);
		TreeIterator<Object> iterator = EcoreUtil.getAllProperContents(ePackage, true);
		while (iterator.hasNext()) {
			Object next = iterator.next();
			if (next instanceof EReference) {
				EReference ref = (EReference) next;
				String externalForm = EcoreUtil2.toExternalForm(ref);
				assertEquals(ref.toString() + " - " + externalForm, ref, EcoreUtil2.getEReferenceFromExternalForm(registry,externalForm));
			}
		}
	}
}
 
开发者ID:eclipse,项目名称:xtext-core,代码行数:17,代码来源:EcoreUtil2Test.java

示例2: getEClass

import org.eclipse.emf.ecore.EPackage.Registry; //导入方法依赖的package包/类
private static EClass getEClass(final String metamodelUri, final String typeName,
		final Registry packageRegistry) {
	final EPackage pkg = packageRegistry.getEPackage(metamodelUri);
	if (pkg == null) {
		throw new NoSuchElementException(String.format(
				"Could not find EPackage with URI '%s' in the registry",
				metamodelUri));
	}

	final EClassifier eClassifier = pkg.getEClassifier(typeName);
	if (!(eClassifier instanceof EClass)) {
		throw new NoSuchElementException(String.format(
				"Received an element of type '%s', which is not an EClass",
				eClassifier));
	}
	final EClass eClass = (EClass) eClassifier;
	return eClass;
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:19,代码来源:HawkResourceImpl.java

示例3: getEClass

import org.eclipse.emf.ecore.EPackage.Registry; //导入方法依赖的package包/类
private static EClass getEClass(final String metamodelUri, final String typeName,
		final Registry packageRegistry) {
	final EPackage pkg = packageRegistry.getEPackage(metamodelUri);
	if (pkg == null) {
		throw new NoSuchElementException(String.format(
				"Could not find EPackage with URI '%s' in the registry %s",
				metamodelUri, packageRegistry));
	}

	final EClassifier eClassifier = pkg.getEClassifier(typeName);
	if (!(eClassifier instanceof EClass)) {
		throw new NoSuchElementException(String.format(
				"Received an element of type '%s', which is not an EClass",
				eClassifier));
	}
	final EClass eClass = (EClass) eClassifier;
	return eClass;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:19,代码来源:LocalHawkResourceImpl.java

示例4: getAllEClasses

import org.eclipse.emf.ecore.EPackage.Registry; //导入方法依赖的package包/类
/**
 * Iterates over all registered EPackages in order to retrieve all available
 * EClasses, excluding abstract classes and interfaces, and returns them as
 * a Set.
 * 
 * @return a set of all EClasses that are contained in registered EPackages
 * @see Registry
 */
public List<EClass> getAllEClasses() {
	if (allEClasses == null) {
		allEClasses = new ArrayList<EClass>();
		Registry registry = EPackage.Registry.INSTANCE;
		// for all registered EPackages
		for (Entry<String, Object> entry : new LinkedHashSet<Entry<String, Object>>(registry.entrySet())) {
			EPackage ePackage = registry.getEPackage(entry.getKey());
			for (EClass eClass : getAllEClasses(ePackage)) {
				// no abstracts or interfaces
				if (canHaveInstance(eClass)) {
					allEClasses.add(eClass);
				}
			}
		}
	}
	return allEClasses;
}
 
开发者ID:edgarmueller,项目名称:emfstore-rest,代码行数:26,代码来源:ModelMutatorUtil.java

示例5: getAllRootEPackages

import org.eclipse.emf.ecore.EPackage.Registry; //导入方法依赖的package包/类
/**
 * Returns all EPackages on the root level that are currently registered in
 * the registry.
 * 
 * @return a Set of all root EPackages
 * @see Registry
 */
public  Set<EPackage> getAllRootEPackages() {
	// were the root packages computed before?
	if (rootModelPackages != null) {
		return rootModelPackages;
	}
	rootModelPackages = new LinkedHashSet<EPackage>();
	Registry registry = EPackage.Registry.INSTANCE;

	for (Entry<String, Object> entry : registry.entrySet()) {
		EPackage ePackage = registry.getEPackage(entry.getKey());
		// is the current EPackage a root package?
		if (ePackage.getESuperPackage() == null) {
			rootModelPackages.add(ePackage);
		}
	}
	return rootModelPackages;
}
 
开发者ID:diverse-project,项目名称:k3,代码行数:25,代码来源:ModelGeneratorUtil.java

示例6: getAllEClasses

import org.eclipse.emf.ecore.EPackage.Registry; //导入方法依赖的package包/类
/**
 * Iterates over all registered EPackages in order to retrieve all available
 * EClasses, excluding abstract classes and interfaces, and returns them as
 * a Set.
 * 
 * @return a set of all EClasses that are contained in registered EPackages
 * @see Registry
 */
public  List<EClass> getAllEClasses() {
	// were all EClasses computed before?
	if (allEClasses != null) {
		return allEClasses;
	}
	allEClasses = new LinkedList<EClass>();
	Registry registry = EPackage.Registry.INSTANCE;
	// for all registered EPackages
	for (Entry<String, Object> entry : registry.entrySet()) {
		EPackage ePackage = registry.getEPackage(entry.getKey());
		for (EClass eClass : getAllEClasses(ePackage)) {
			// no abstracts or interfaces
			if (canHaveInstance(eClass)) {
				allEClasses.add(eClass);
			}
		}
	}
	return allEClasses;
}
 
开发者ID:diverse-project,项目名称:k3,代码行数:28,代码来源:ModelGeneratorUtil.java

示例7: modelElementAddition

import org.eclipse.emf.ecore.EPackage.Registry; //导入方法依赖的package包/类
@Override
public void modelElementAddition(VcsCommitItem s, IHawkObject element, IGraphNode elementNode, boolean isTransient) {
	// new model elements are assumed to be roots unless proven otherwise
	if (isTransient) return;

	final IHawkClassifier type = element.getType();
	final Registry packageRegistry = resource.getResourceSet().getPackageRegistry();
	final EPackage ePackage = packageRegistry.getEPackage(type.getPackageNSURI());
	final EClass eClass = (EClass)ePackage.getEClassifier(type.getName());
	addedRootNodes.put(elementNode, eClass);
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:12,代码来源:LocalHawkResourceUpdater.java


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