本文整理汇总了Java中org.eclipse.emf.ecore.EPackage.getESuperPackage方法的典型用法代码示例。如果您正苦于以下问题:Java EPackage.getESuperPackage方法的具体用法?Java EPackage.getESuperPackage怎么用?Java EPackage.getESuperPackage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.ecore.EPackage
的用法示例。
在下文中一共展示了EPackage.getESuperPackage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getnsURIMapping
import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
protected static HashMap<String, String> getnsURIMapping(IExecutionContext context) {
HashMap<String, String> nsURIMapping = new HashMap<String, String>();
final String langQuery = "lang=";
String melangeQuery = context.getRunConfiguration().getExecutedModelAsMelangeURI().query();
if (melangeQuery != null && !melangeQuery.isEmpty() && melangeQuery.contains(langQuery)) {
String targetLanguage = melangeQuery.substring(melangeQuery.indexOf(langQuery) + langQuery.length());
if (targetLanguage.contains("&")) {
targetLanguage = targetLanguage.substring(0, targetLanguage.indexOf("&"));
}
String targetLanguageNsURI = MelangeRegistry.INSTANCE.getLanguageByIdentifier(targetLanguage).getUri();
// simply open the original model file in a separate ResourceSet
// and ask its root element class nsURI
Object o = EMFResource.getFirstContent(context.getRunConfiguration().getExecutedModelURI());
if (o instanceof EObject) {
EPackage rootPackage = ((EObject) o).eClass().getEPackage();
while (rootPackage.getESuperPackage() != null) {
rootPackage = rootPackage.getESuperPackage();
}
nsURIMapping.put(rootPackage.getNsURI(), targetLanguageNsURI);
}
}
return nsURIMapping;
}
示例2: idFromPackage
import org.eclipse.emf.ecore.EPackage; //导入方法依赖的package包/类
/**
* Generates an Id for the given Ecore package
* @param pkg Package to generate Id for
* @return The Id
*/
public static Id idFromPackage(EPackage pkg) {
Id nsId = Id.ROOT;
if (pkg.getESuperPackage() != null) {
nsId = idFromPackage(pkg.getESuperPackage());
}
return Id.getId(nsId, Name.getName(pkg.getName()));
}