configtool/com.nokia.S60CT.CenRep.edit/src/resourceProvider/CRepResourceSetItemProvider.java
changeset 0 30eb2d538f02
equal deleted inserted replaced
-1:000000000000 0:30eb2d538f02
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 package resourceProvider;
       
    19 
       
    20 import java.util.ArrayList;
       
    21 import java.util.Collection;
       
    22 import java.util.Iterator;
       
    23 import java.util.List;
       
    24 
       
    25 import org.eclipse.emf.common.notify.AdapterFactory;
       
    26 import org.eclipse.emf.ecore.resource.Resource;
       
    27 import org.eclipse.emf.ecore.resource.ResourceSet;
       
    28 import org.eclipse.emf.edit.provider.resource.ResourceSetItemProvider;
       
    29 
       
    30 public class CRepResourceSetItemProvider extends ResourceSetItemProvider {
       
    31 
       
    32 	private ResourceSet resourceSet=null;
       
    33 	
       
    34 	public CRepResourceSetItemProvider(AdapterFactory arg0) {
       
    35 		super(arg0);
       
    36 	}
       
    37 	
       
    38 	public Collection getChildren(Object object)
       
    39 	  {
       
    40 	    List children = new ArrayList();
       
    41 		this.resourceSet = (ResourceSet)object;
       
    42 	    for(Iterator iResource =resourceSet.getResources().iterator();iResource.hasNext();){
       
    43 	    	Resource resource =(Resource)iResource.next();
       
    44 	    	if(!resource.getContents().isEmpty())
       
    45 	    		children.add(resource.getContents().get(0));
       
    46 	    }
       
    47 		return children;
       
    48 	  }
       
    49 }