Package org.eclipse.emf.ecore

Examples of org.eclipse.emf.ecore.EObject.eClass()


    List contents = new ArrayList((eDataObject).eContents());
    for (int i = 0, size = contents.size(); i < size; ++i)
    {
      ((DataObject)contents.get(i)).delete();
    }
    EClass eClass = eDataObject.eClass();
    for (int i = 0, size = eClass.getFeatureCount(); i < size; ++i)
    {
      EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);
      if (eStructuralFeature.isChangeable() && !eStructuralFeature.isDerived() && !((Property)eStructuralFeature).isReadOnly())
      {
View Full Code Here


    protected static int matchingIndex(List eObjects, String attributeName, String attributeValue)
    {
      for (int i = 0, size = eObjects.size(); i < size; i++)
      {
        EObject eObject = (EObject)eObjects.get(i);
        EStructuralFeature feature = (EStructuralFeature)((Type)eObject.eClass()).getProperty(attributeName);
        // If feature is null, that means it could be an open feature.
        if (feature == null)
        {
          feature = (EStructuralFeature)DataObjectUtil.getOpenFeature(eObject, attributeName);
        }
View Full Code Here

      List<Object[]> parameters, Viewpoint structural,
      SortedMultiset<String> allExpressions) {
    Iterator<EObject> it = structural.eAllContents();
    while (it.hasNext()) {
      EObject underTest = it.next();
      for (EAttribute attr : underTest.eClass().getEAllAttributes()) {
        if (attr.getEType() == DescriptionPackage.eINSTANCE
            .getInterpretedExpression()) {
          Object expr = underTest.eGet(attr);
          if (expr instanceof String && ((String) expr).length() > 0) {
            parameters
View Full Code Here

    } else if (o instanceof EClass) {
      EClass eClass = (EClass) o;
      imageName = imageNameFrom(eClass);
    } else if (o instanceof EObject) {
      EObject modelObject = (EObject) o;
      imageName = imageNameFrom(modelObject.eClass());
    }
    String imageFileName = null;
    if (imageName != null) {
      imageFileName = imageFileName(imageName);
    }
View Full Code Here

      // EReference reference = (EReference) featureIterator.feature();
      // reference.getEOpposite() seems to return the wrong EReference for target
      // so we iterate over all references in Target to find, and delete, all references
      // to object
     
      for (EReference ref : target.eClass().getEAllReferences()) {
        if (ref.isMany()) {
          // it's a list (assumed)
          EList<Object> resolved = (EList<Object>) target.eGet(ref);
          if (resolved.contains(object)) {
            // delete the reference
View Full Code Here

   
    // make sure that if we test for something that isn't an edge, it does
    // throw an exception.
    try {
      EObject node = getNonEdgeNode();
      assertFalse("Node was actually an edge", getEdgeTypes().containsKey(node.eClass().getName()));
      GetShortcuts.getSourceElement(node, true);
      fail("Should have failed for a non-edge node");
    } catch (IllegalArgumentException e) {
      // expected
    }
View Full Code Here

   
    // make sure that if we test for something that isn't an edge, it does
    // throw an exception.
    try {
      EObject node = getNonEdgeNode();
      assertFalse("Node was actually an edge", getEdgeTypes().containsKey(node.eClass().getName()));
      GetShortcuts.getTargetElement(node, true);
      fail("Should have failed for a non-edge node");
    } catch (IllegalArgumentException e) {
      // expected
    }
View Full Code Here

    if (monitor.isCanceled())
      return Status.CANCEL_STATUS;
   
    // check instance
    if (!(model instanceof GMFConfiguration)) {
      return errorStatus("Loaded model was not an instance of GMFConfiguration: " + model.eClass().getName());
    }
   
    // check that container is a folder
    monitor.subTask("Generating source code");
    SimpleGMFCodeGenerator gen = new SimpleGMFCodeGenerator();
View Full Code Here

    EObject target = part.resolveSemanticElement();
    String suggestedName = suggestName(target);

    String fileExtension = getFileExtension(target);
    if (fileExtension == null) {
      return errorStatus("Cannot move the given object '" + target.eClass().getName() + "' into a separate file." );
    }

    String location = target.eResource().getURI().toPlatformString(true);
    IStructuredSelection selection = new StructuredSelection(ResourcesPlugin.getWorkspace().getRoot().findMember( location ));
View Full Code Here

     
      // now find unused features
      TreeIterator<EObject> it = root.eAllContents();
      while (it.hasNext()) {
        EObject e = it.next();
        EClass cls = e.eClass();
        // check all attributes
        for (EAttribute attr : cls.getEAllAttributes()) {
          // is it non-default?
          if (e.eGet(attr) != attr.getDefaultValue()) {
            // yes; remove it from the unused features (if it exists)
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.