Package org.eclipse.emf.common.util

Examples of org.eclipse.emf.common.util.EList


     * @return concatenated string
     */
    public static String getComment(final Element element)
    {
        String commentString = "";
        EList comments = element.getOwnedComments();

        for (Iterator iterator = comments.iterator(); iterator.hasNext();)
        {
            final Comment comment = (Comment)iterator.next();
            if (!commentString.equalsIgnoreCase(""))
            {
                commentString = commentString + "\n\n";
View Full Code Here


   * <!-- end-user-doc -->
   * @generated NOT
   */
  public List getChangedDataObjects()
  {
    EList result = new UniqueEList.FastCompare(getDeletedObjects());
    result.addAll(getObjectsToDetach());
    for (Iterator i = getObjectChanges().iterator(); i.hasNext(); )
    {
      Map.Entry entry = (Map.Entry)i.next();
      result.add(entry.getKey());
    }
    return result;
  }
View Full Code Here

    EAnnotation eannot = aEClass.getEAnnotation("http://uima.apache.org");
    if (eannot != null) {
      type.setDescription((String) eannot.getDetails().get("description"));
    }
    // set supertype
    EList supertypes = aEClass.getESuperTypes();
    if (supertypes.isEmpty()) // supertype not defined in the Ecore model
    {
      if (aOptions.get(OPTION_CREATE_ANNOTATION_SUBTYPES) == Boolean.FALSE) {
        type.setSupertypeName(CAS.TYPE_NAME_TOP);
      } else {
        // if this class has "begin" and "end" attributes of type EInt, make it a subtype of
        // annotation
        EStructuralFeature begin = aEClass.getEStructuralFeature("begin");
        EStructuralFeature end = aEClass.getEStructuralFeature("end");
        if (begin != null && end != null && begin.getEType() == EcorePackage.eINSTANCE.getEInt()
                && end.getEType() == EcorePackage.eINSTANCE.getEInt()) {
          type.setSupertypeName(CAS.TYPE_NAME_ANNOTATION);
        } else {
          type.setSupertypeName(CAS.TYPE_NAME_TOP);
        }
      }
    } else {
      EClass supertype = (EClass) supertypes.get(0);
      // if the supertype is EObject, translate that to uima.cas.TOP
      if (supertype.equals(EcorePackage.eINSTANCE.getEObject())) {
        type.setSupertypeName(CAS.TYPE_NAME_TOP);
      }
      // otherwise translate the name according to our conventions
      String uimaSupertypeName = getUimaTypeName(supertype, false, aOptions);
      type.setSupertypeName(uimaSupertypeName);

      // if there are multiple supertypes, the first one is arbitrarily chosen
      // as the single supertype for the UIMA type. Other features are copied-down.
      if (supertypes.size() > 1) {
        System.err.println("Warning: EClass " + aEClass.getName()
                + " defines multiple supertypes. " + "The UIMA supertype will be "
                + type.getSupertypeName()
                + "; features inherited from other supertypes will be copied down.");
      }
    }
    // set features
    EList eFeatures = aEClass.getEStructuralFeatures();
    Iterator iter = eFeatures.iterator();
    List uimaFeatures = new ArrayList();
    while (iter.hasNext()) {
      EStructuralFeature eFeat = (EStructuralFeature) iter.next();
      FeatureDescription uimaFeat = eStructuralFeature2UimaFeature(eFeat, aOptions);
      uimaFeatures.add(uimaFeat);
    }
    // copy down features from additional supertypes
    for (int i = 1; i < supertypes.size(); i++) {
      EClass copyFrom = (EClass) supertypes.get(i);
      EList copyFeatures = copyFrom.getEStructuralFeatures();
      Iterator iter2 = copyFeatures.iterator();
      while (iter2.hasNext()) {
        EStructuralFeature eFeat = (EStructuralFeature) iter2.next();
        // do not copy if this feature is a duplicate of one defined on the class
        // or inherited from its primary supertype
        EList locallyDefinedFeatures = aEClass.getEStructuralFeatures();
        EList firstSupertypesFeatures = ((EClass) supertypes.get(0)).getEAllStructuralFeatures();
        if (!containsNamedElement(locallyDefinedFeatures, eFeat.getName())
                && !containsNamedElement(firstSupertypesFeatures, eFeat.getName())) {
          FeatureDescription uimaFeat = eStructuralFeature2UimaFeature(eFeat, aOptions);
          uimaFeatures.add(uimaFeat);
        }
View Full Code Here

    EAnnotation eannot = aEEnum.getEAnnotation("http://uima.apache.org");
    if (eannot != null) {
      type.setDescription((String) eannot.getDetails().get("description"));
    }
    // set allowed values
    EList literals = aEEnum.getELiterals();
    AllowedValue[] vals = new AllowedValue[literals.size()];
    for (int i = 0; i < literals.size(); i++) {
      EEnumLiteral literal = (EEnumLiteral) literals.get(i);
      vals[i] = uimaFactory.createAllowedValue();
      vals[i].setString(literal.getName());
      EAnnotation literalAnnot = literal.getEAnnotation("http://uima.apache.org");
      if (literalAnnot != null) {
        vals[i].setDescription((String) literalAnnot.getDetails().get("description"));
View Full Code Here

   * <!-- end-user-doc -->
   * @generated NOT
   */
  public List getChangedDataObjects()
  {
    EList result = new UniqueEList.FastCompare(getDeletedObjects());
    result.addAll(getObjectsToDetach());
    for (Iterator i = getObjectChanges().iterator(); i.hasNext(); )
    {
      Map.Entry entry = (Map.Entry)i.next();
      result.add(entry.getKey());
    }
    return result;
  }
View Full Code Here

        if (resolves.isEmpty()) {
            // Identifier lookup is being inconsistent; this often happens when code trips up over
            // converting URLs to and from Files
            throw new IOException("Could not find " + layerResourceID + " in local catalog");
        }
        EList resources = new EDataTypeUniqueEList(IGeoResource.class, this,
                ProjectPackage.LAYER__GEO_RESOURCES);
        LayerResource preferredResource = null;
        for (IResolve resolve : resolves) {
            if (resolve instanceof IGeoResource) {
                LayerResource layerResource = new LayerResource((LayerImpl) layer,
                        (IGeoResource) resolve);
                if (resolve.getID().equals(layerResourceID)) {
                    resources.add(0, layerResource);
                } else {
                    resources.add(layerResource);
                }
                if (resolve == resource) {
                    preferredResource = layerResource;
                }
            }
View Full Code Here

            }
        }
        if (IMap.class.isAssignableFrom(adapter)) {
            return getMap();
        }
        EList adapters = eAdapters();
        if (adapters instanceof SynchronizedEList) {
            ((SynchronizedEList) adapters).lock();
        }
        try {
            for (Iterator i = adapters.iterator(); i.hasNext();) {
                Object o = i.next();
                if (adapter.isAssignableFrom(o.getClass()))
                    return o;
            }
        } finally {
View Full Code Here

                if (notification.getFeatureID(ContextModel.class) != ProjectPackage.CONTEXT_MODEL__LAYERS)
                    return;

                // we need to tell the map item provider that the layers have changed.
                ContextModel model = (ContextModel) notifier;
                EList adapters = model.getMap().eAdapters();
                for (Object object : adapters) {
                    if (object instanceof MapItemProvider) {
                        MapItemProvider mapItemProvider = ((MapItemProvider) object);
                        //                        mapItemProvider.updateChildList(notification);
                        mapItemProvider.getChildFetcher().notifyChanged();
View Full Code Here

    public void setUp() throws Exception {
        ProjectRegistry registry = ProjectPlugin.getPlugin().getProjectRegistry();
        List<Project> projects = registry.getProjects();
        registry.getProjects().removeAll(projects);
       
        EList list=registry.eResource().getResourceSet().getResources();
        Set<Resource> toRemove=new HashSet<Resource>();
        for (Iterator iter = list.iterator(); iter.hasNext();) {
            Resource element = (Resource) iter.next();
            if( element!=registry.eResource() ){
                element.unload();
                toRemove.add(element);
            }
View Full Code Here

  }
 
  @Ignore
  @Test
    public void testSaveAndLoad() throws Exception {
    EList list=project.eResource().getResourceSet().getResources();
   
    for (Iterator iter = list.iterator(); iter.hasNext();) {
      Resource element = (Resource) iter.next();
            try{
                element.save(null);
            }catch (Exception e) {
            }
View Full Code Here

TOP

Related Classes of org.eclipse.emf.common.util.EList

Copyright © 2018 www.massapicom. 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.