Examples of FeatureMap


Examples of org.eclipse.emf.ecore.util.FeatureMap

    EClass docEClass = ExtendedMetaData.INSTANCE.getDocumentRoot(testPackage);
    EObject doc = EcoreUtil.create(docEClass);
    resource.getContents().add(doc);
   
    EStructuralFeature docMixedFeature = ExtendedMetaData.INSTANCE.getMixedFeature(docEClass);
    FeatureMap docMixed = (FeatureMap) doc.eGet(docMixedFeature);
    AnyType test = (AnyType) EcoreUtil.create(XMLTypePackage.Literals.ANY_TYPE);
    docMixed.add(ExtendedMetaData.INSTANCE.demandFeature("urn:test", "test", true), test);
    SimpleAnyType subTest1 = (SimpleAnyType) EcoreUtil.create(XMLTypePackage.Literals.SIMPLE_ANY_TYPE);
    test.getMixed().add(ExtendedMetaData.INSTANCE.demandFeature("urn:test", "subTest", true), subTest1);
    subTest1.setInstanceType(XMLTypePackage.Literals.STRING);
    subTest1.setValue("subTest1");
    SimpleAnyType subTest2 = (SimpleAnyType) EcoreUtil.create(XMLTypePackage.Literals.SIMPLE_ANY_TYPE);
View Full Code Here

Examples of org.eclipse.emf.ecore.util.FeatureMap

      FeatureChange featureChange = (FeatureChange)fIter.next();
      featureChange.apply(oldDataObject);
      EStructuralFeature feature = featureChange.getFeature();
      if (FeatureMapUtil.isFeatureMap(feature))
      {
        FeatureMap featureMap = (FeatureMap) oldDataObject.eGet(feature);
        for (int index = featureMap.size(); index != 0;)
          if (isContainmentReference(featureMap.getEStructuralFeature(--index)))
            featureMap.setValue(index, getOldDataObject((DataObject) featureMap.getValue(index)));
      }
      else if (isContainmentReference(feature))
      {
        Object value = oldDataObject.eGet(feature);
        if (feature.isMany())
View Full Code Here

Examples of org.eclipse.emf.ecore.util.FeatureMap

                copyReference(eReference, eObject, copyEObject);
              }
            }
            else if (FeatureMapUtil.isFeatureMap(eStructuralFeature))
            {
              FeatureMap featureMap = (FeatureMap)eObject.eGet(eStructuralFeature);
              FeatureMap copyFeatureMap = (FeatureMap)copyEObject.eGet(getTarget(eStructuralFeature));
              int copyFeatureMapSize = copyFeatureMap.size();
              for (int k = 0, featureMapSize = featureMap.size(); k < featureMapSize; ++k)
              {
                EStructuralFeature feature = featureMap.getEStructuralFeature(k);
                if (feature instanceof EReference)
                {
                  Object referencedEObject = featureMap.getValue(k);
                  Object copyReferencedEObject = get(referencedEObject);
                  if (copyReferencedEObject == null && referencedEObject != null)
                  {
                    EReference reference = (EReference)feature;
                    if (!useOriginalReferences || reference.isContainment() || reference.getEOpposite() != null)
                    {
                      continue;
                    }
                    copyReferencedEObject = referencedEObject;
                  }
                  // If we can't add it, it must aleady be in the list so find it and move it to the end.
                  //
                  if (!copyFeatureMap.add(feature, copyReferencedEObject))
                  {
                    for (int l = 0; l < copyFeatureMapSize; ++l)
                    {
                      if (copyFeatureMap.getEStructuralFeature(l) == feature && copyFeatureMap.getValue(l) == copyReferencedEObject)
                      {
                        copyFeatureMap.move(copyFeatureMap.size() - 1, l);
                        --copyFeatureMapSize;
                        break;
                      }
                    }
                  }
                }
                else
                {
                  copyFeatureMap.add(featureMap.get(k));
                }
              }
            }
          }
        }
View Full Code Here

Examples of org.eclipse.emf.ecore.util.FeatureMap

    {
      documentRoot = (EObject)resource.getContents().get(0);
      EClass documentRootClass = documentRoot.eClass();
      if ("".equals(extendedMetaData.getName(documentRootClass))) //TODO efficient way to check this? Maybe DataObject.getContainer should also check this?
      {
        FeatureMap featureMap = (FeatureMap)documentRoot.eGet(documentRootClass.getEStructuralFeature(0)); // get mixed feature
        int size = featureMap.size();
        for (int index = 0; index < size; index++)
        {
          EStructuralFeature feature = featureMap.getEStructuralFeature(index);
          boolean isText =
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__TEXT ||
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__CDATA ||   
            feature == XMLTypePackage.Literals.XML_TYPE_DOCUMENT_ROOT__COMMENT;
          if (!isText)
          {
            if (feature instanceof EReference)
            {
              rootObject = (EObject)featureMap.getValue(index);
              documentRoot.eUnset(feature);
            }
            else //EAttribute
            {
              rootObject = (EObject)SDOUtil.createDataTypeWrapper((Type)feature.getEType(), featureMap.getValue(index));
            }
            rootElement = feature;
            break;
          }
        } //for
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.