Java Code Examples for org.eclipse.emf.ecore.EPackage#getName()
The following examples show how to use
org.eclipse.emf.ecore.EPackage#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EmfModelsTest.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
public void check(final EPackage ePack) { String _name = ePack.getName(); String _plus = ("Checking EPackage \'" + _name); String _plus_1 = (_plus + "\'"); EmfModelsTest.LOGGER.info(_plus_1); final Consumer<EClassifier> _function = (EClassifier it) -> { if ((it instanceof EClass)) { this.check(((EClass)it)); } }; ePack.getEClassifiers().forEach(_function); String _name_1 = ePack.getName(); String _plus_2 = ("EPackage \'" + _name_1); String _plus_3 = (_plus_2 + "\' passed."); EmfModelsTest.LOGGER.info(_plus_3); }
Example 2
Source File: TypeJudgment.java From n4js with Eclipse Public License 1.0 | 5 votes |
private TypeRef doApply(RuleEnvironment G, TypableElement element) { if (element == null) { return unknown(); } final EPackage elementPkg = element.eClass().getEPackage(); if (elementPkg == TypesPackage.eINSTANCE) { return new TypeJudgmentSwitchForTypes(G).doSwitch(element); } else if (elementPkg == N4JSPackage.eINSTANCE) { return new TypeJudgmentSwitchForASTNodes(G).doSwitch(element); } else { throw new IllegalStateException("element belongs to unsupported EPackage: " + elementPkg.getName()); } }
Example 3
Source File: XtextProposalProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override protected String getDisplayString(EObject element, String proposal, String shortName) { if (element instanceof AbstractMetamodelDeclaration) { AbstractMetamodelDeclaration decl = (AbstractMetamodelDeclaration) element; if (!Strings.isEmpty(decl.getAlias())) return decl.getAlias(); } else if (element instanceof EPackage) { EPackage pack = (EPackage) element; return pack.getName() + " - " + pack.getNsURI(); } return super.getDisplayString(element, proposal, shortName); }
Example 4
Source File: GrammarGeneratorTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private void checkGeneratedGrammarIsValid(List<String> ePackageURIs) throws IOException { for (String nsURI : ePackageURIs) { System.out.print(nsURI); EPackage ePackage = EPackage.Registry.INSTANCE.getEPackage(nsURI); XtextProjectInfo xtextProjectInfo = new XtextProjectInfo(); Set<EPackage> ePackages = new HashSet<EPackage>(); if (!addImportedEPackages(ePackage, ePackages)) { System.out.println("...skipping"); } else { List<EPackageInfo> ePackageInfos = Lists.newArrayList(Iterables.transform(ePackages, new Function<EPackage, EPackageInfo>() { @Override public EPackageInfo apply(EPackage from) { return new EPackageInfo(from, URI.createURI(from.getNsURI()), null, null, null); } })); xtextProjectInfo.getEcore2Xtext().getEPackageInfos().addAll(ePackageInfos); String languageName = "org.eclipse.xtext.xtext.ui.tests." + ePackage.getName(); xtextProjectInfo.getLanguage().setName(languageName); String grammarFileName = languageName.replaceAll("\\.", "/") + ".xtext"; String xtextGrammar = createGrammar(xtextProjectInfo).toString(); ResourceSet resourceSet = new XtextResourceSet(); Resource xtextResource = resourceSet.createResource(URI.createFileURI(grammarFileName)); xtextResource.load(new StringInputStream(xtextGrammar), null); checkErrors(ePackage, xtextResource, xtextGrammar); if (!WARNING_PACKAGE_NS_URIS.contains(ePackage.getNsURI())) { assertTrue("Warnings in grammar for " + ePackage.getNsURI(), xtextResource.getWarnings().isEmpty()); } System.out.println(" ...OK"); } } }
Example 5
Source File: ValidatorFragment2.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
protected String getGeneratedEPackageName(final EPackage pack) { StringConcatenation _builder = new StringConcatenation(); String _runtimeBasePackage = this._xtextGeneratorNaming.getRuntimeBasePackage(this.getGrammar()); _builder.append(_runtimeBasePackage); _builder.append("."); String _name = pack.getName(); _builder.append(_name); _builder.append("."); String _firstUpper = StringExtensions.toFirstUpper(pack.getName()); _builder.append(_firstUpper); _builder.append("Package"); return _builder.toString(); }
Example 6
Source File: SchemaChecker.java From BIMserver with GNU Affero General Public License v3.0 | 5 votes |
private void comparePackage(EPackage package1, EPackage package2) throws SchemaCompareException { if (!package1.getName().equals(package2.getName())) { throw new SchemaCompareException("Schema package names not the same"); } if (package1.getEClassifiers().size() != package2.getEClassifiers().size()) { throw new SchemaCompareException("Not the same amount of classifiers in package " + package1.getName()); } Iterator<EClassifier> classifierIterator1 = package1.getEClassifiers().iterator(); Iterator<EClassifier> classifierIterator2 = package2.getEClassifiers().iterator(); while (classifierIterator1.hasNext()) { EClassifier classifier1 = classifierIterator1.next(); EClassifier classifier2 = classifierIterator2.next(); compareClassifier(classifier1, classifier2); } }
Example 7
Source File: EcoreQualifiedNameProvider.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
protected String name(EPackage ePackage) { return ePackage.getName(); }
Example 8
Source File: JavaValidatorFragment.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public String getGeneratedEPackageName(Grammar g, Naming n, EPackage pack) { return getBasePackage(g, n) + "." + pack.getName() + "." + Strings.toFirstUpper(pack.getName()) + "Package"; }
Example 9
Source File: ValidatorNaming.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public String getGeneratedEPackageName(EPackage pack) { return naming.basePackageRuntime(grammar) + "." + pack.getName() + "." + StringExtensions.toFirstUpper(pack.getName()) + "Package"; }
Example 10
Source File: EMFGeneratorFragment.java From xtext-extras with Eclipse Public License 2.0 | 4 votes |
public String getGeneratedEPackageName(Grammar g, EPackage pack) { return getBasePackage(g) + "." + pack.getName() + "." + Strings.toFirstUpper(pack.getName()) + "Package"; }
Example 11
Source File: EcoreQualifiedNameProvider.java From xtext-core with Eclipse Public License 2.0 | 4 votes |
protected String name(EPackage ePackage) { return ePackage.getName(); }