use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testManyUnique_context.
@Test
public void testManyUnique_context() {
List<ENamedElement> elements = new ArrayList<>();
for (int i = 0; i < MANY; i++) {
EClass c = createEClass();
c.setName("i" + i);
elements.add(c);
}
maxCallCount = 0;
helper.checkUniqueNames(new LocalUniqueNameContext(elements, this), this);
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testManyUnique.
@SuppressWarnings("deprecation")
@Test
public void testManyUnique() {
List<ENamedElement> elements = new ArrayList<>();
for (int i = 0; i < MANY; i++) {
EClass c = createEClass();
c.setName("i" + i);
elements.add(c);
}
maxCallCount = 0;
helper.checkUniqueNames(Scopes.scopedElementsFor(elements), this, this);
}
use of org.eclipse.emf.ecore.ENamedElement in project tdi-studio-se by Talend.
the class BusinessElementTypes method getElement.
/**
* Returns 'type' of the ecore object associated with the hint.
*
* @generated
*/
public static ENamedElement getElement(IAdaptable hint) {
Object type = hint.getAdapter(IElementType.class);
if (elements == null) {
elements = new IdentityHashMap();
elements.put(BusinessProcess_79, BusinessPackage.eINSTANCE.getBusinessProcess());
elements.put(ActionBusinessItem_1001, BusinessPackage.eINSTANCE.getActionBusinessItem());
elements.put(TerminalBusinessItem_1002, BusinessPackage.eINSTANCE.getTerminalBusinessItem());
elements.put(DocumentBusinessItem_1003, BusinessPackage.eINSTANCE.getDocumentBusinessItem());
elements.put(DatabaseBusinessItem_1004, BusinessPackage.eINSTANCE.getDatabaseBusinessItem());
elements.put(ListBusinessItem_1005, BusinessPackage.eINSTANCE.getListBusinessItem());
elements.put(DataBusinessItem_1006, BusinessPackage.eINSTANCE.getDataBusinessItem());
elements.put(InputBusinessItem_1007, BusinessPackage.eINSTANCE.getInputBusinessItem());
elements.put(DecisionBusinessItem_1008, BusinessPackage.eINSTANCE.getDecisionBusinessItem());
elements.put(ActorBusinessItem_1009, BusinessPackage.eINSTANCE.getActorBusinessItem());
elements.put(EllipseBusinessItem_1010, BusinessPackage.eINSTANCE.getEllipseBusinessItem());
elements.put(GearBusinessItem_1011, BusinessPackage.eINSTANCE.getGearBusinessItem());
elements.put(BusinessItemRelationship_3001, BusinessPackage.eINSTANCE.getBusinessItemRelationship());
elements.put(DirectionalBusinessItemRelationship_3002, BusinessPackage.eINSTANCE.getDirectionalBusinessItemRelationship());
elements.put(BidirectionalBusinessItemRelationship_3003, BusinessPackage.eINSTANCE.getBidirectionalBusinessItemRelationship());
}
return (ENamedElement) elements.get(type);
}
use of org.eclipse.emf.ecore.ENamedElement in project n4js by eclipse.
the class OrderedEmfFormatter method refToStr.
private static void refToStr(EObject obj, EReference ref, String indent, Appendable buf) throws Exception {
Object o = obj.eGet(ref);
if (o instanceof EObject) {
EObject eo = (EObject) o;
if (eo instanceof ENamedElement)
buf.append("'").append(((ENamedElement) eo).getName()).append("' ");
buf.append("ref: ");
getURI(obj, eo, buf);
return;
}
if (o instanceof Collection<?>) {
String innerIndent = indent + INDENT;
buf.append("[");
int counter = 0;
Collection<?> coll = (Collection<?>) o;
for (Iterator<?> i = coll.iterator(); i.hasNext(); ) {
Object item = i.next();
if (counter == 0)
buf.append('\n');
buf.append(innerIndent);
printInt(counter++, coll.size(), buf);
buf.append(": ");
getURI(obj, (EObject) item, buf);
if (i.hasNext())
buf.append(",\n");
else
buf.append('\n').append(indent);
}
buf.append("]");
return;
}
buf.append("?????");
}
use of org.eclipse.emf.ecore.ENamedElement in project xtext-core by eclipse.
the class NamesAreUniqueValidationHelperTest method testCreatedErrors_06_context.
@Test
public void testCreatedErrors_06_context() {
maxCallCount = 1;
ImmutableList<ENamedElement> elements = ImmutableList.of(createEPackage(), createEDataType(), createEPackage());
for (ENamedElement classifier : elements) {
classifier.setName("Same");
}
try {
helper.checkUniqueNames(new LocalUniqueNameContext(elements, this), this);
fail("cancellation expected");
} catch (OperationCanceledError e) {
}
assertEquals(1, callCount);
}
Aggregations