use of org.eclipse.emf.ecore.EClassifier in project BIMserver by opensourceBIM.
the class AttributeCondition method getEClassRequirements.
@Override
public void getEClassRequirements(Set<EClass> classRequirements) {
EClass eClass = attribute.getEContainingClass();
classRequirements.add(eClass);
for (EClassifier subClass : eClass.getEPackage().getEClassifiers()) {
if (subClass instanceof EClass && eClass.isSuperTypeOf((EClass) subClass)) {
classRequirements.add((EClass) subClass);
}
}
}
use of org.eclipse.emf.ecore.EClassifier in project BIMserver by opensourceBIM.
the class Schema method addEPackage.
public void addEPackage(EPackage ePackage) {
packages.put(ePackage.getName(), ePackage);
changes.add(new NewPackageChange(ePackage));
Set<EClass> newClasses = new HashSet<>();
for (EClassifier eClassifier : ePackage.getEClassifiers()) {
if (eClassifier instanceof EClass) {
newClasses.add((EClass) eClassifier);
}
}
addEClasses(ePackage, newClasses);
}
use of org.eclipse.emf.ecore.EClassifier in project BIMserver by opensourceBIM.
the class Schema method initIndirectSubClasses.
private void initIndirectSubClasses(EClass eClass) {
HashSet<EClass> set = new HashSet<EClass>();
indirectSubClasses.put(eClass, set);
set.add(eClass);
for (EClassifier eClassifier : eClass.getEPackage().getEClassifiers()) {
if (eClassifier instanceof EClass) {
EClass e = (EClass) eClassifier;
if (eClass.isSuperTypeOf(e)) {
set.add(e);
}
}
}
}
use of org.eclipse.emf.ecore.EClassifier in project Malai by arnobl.
the class InstrumentModelWizard method getInitialObjectNames.
/**
* Returns the names of the types that can be created as the root object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected Collection<String> getInitialObjectNames() {
if (initialObjectNames == null) {
initialObjectNames = new ArrayList<String>();
for (EClassifier eClassifier : instrumentPackage.getEClassifiers()) {
if (eClassifier instanceof EClass) {
EClass eClass = (EClass) eClassifier;
if (!eClass.isAbstract()) {
initialObjectNames.add(eClass.getName());
}
}
}
Collections.sort(initialObjectNames, CommonPlugin.INSTANCE.getComparator());
}
return initialObjectNames;
}
use of org.eclipse.emf.ecore.EClassifier in project xtext-eclipse by eclipse.
the class XtextProposalProvider method appendReturnType.
protected boolean appendReturnType(final AbstractRule overrideMe, final Grammar grammar, StringBuilder newRuleFragment) {
if (overrideMe instanceof ParserRule && ((ParserRule) overrideMe).isWildcard()) {
newRuleFragment.append(" *");
// no need to add an import to the grammar
return true;
} else {
EClassifier classifier = overrideMe.getType().getClassifier();
final EPackage classifierPackage = classifier.getEPackage();
boolean foundPack = false;
for (AbstractMetamodelDeclaration metamodel : grammar.getMetamodelDeclarations()) {
EPackage available = metamodel.getEPackage();
if (classifierPackage == available) {
EDataType eString = GrammarUtil.findEString(grammar);
if (eString == null)
eString = EcorePackage.Literals.ESTRING;
if (classifier != eString && (!Strings.isEmpty(metamodel.getAlias()) || !classifier.getName().equals(overrideMe.getName()))) {
newRuleFragment.append(" returns ");
if (!Strings.isEmpty(metamodel.getAlias())) {
newRuleFragment.append(metamodel.getAlias()).append("::");
}
newRuleFragment.append(classifier.getName());
}
foundPack = true;
break;
}
}
if (!foundPack) {
EDataType eString = GrammarUtil.findEString(grammar);
if (eString == null)
eString = EcorePackage.Literals.ESTRING;
if (classifier == eString) {
for (AbstractMetamodelDeclaration mm : GrammarUtil.allMetamodelDeclarations(grammar)) {
if (mm.getEPackage() == classifierPackage) {
foundPack = true;
break;
}
}
}
if (!foundPack) {
newRuleFragment.append(" returns ");
newRuleFragment.append(classifierPackage.getName());
newRuleFragment.append("::");
newRuleFragment.append(classifier.getName());
}
}
return foundPack;
}
}
Aggregations