/*****************************************************************************
* Copyright (c) 2010 CEA LIST.
*
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Patrick Tessier (CEA LIST) Patrick.tessier@cea.fr - Initial API and implementation
*
*****************************************************************************/
package org.eclipse.papyrus.uml.modelexplorer;
import java.util.ArrayList;
import java.util.Iterator;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.infra.core.resource.ModelSet;
import org.eclipse.papyrus.infra.core.resource.uml.UmlModel;
import org.eclipse.papyrus.infra.core.resource.uml.UmlUtils;
import org.eclipse.papyrus.infra.emf.providers.MoDiscoContentProvider;
import org.eclipse.uml2.uml.util.UMLUtil;
/**
* this is a specific content provider used to not display UML stereotype applications
*
* @deprecated Use {@link org.eclipse.papyrus.uml.tools.providers.UMLContentProvider} instead
*/
@Deprecated
public class UMLContentProvider extends MoDiscoContentProvider {
/**
* apex updated
*
* Return the initial values from the input.
* Input should be of type {@link UmlModel}.
*
* @see org.eclipse.gmt.modisco.infra.browser.uicore.CustomizableModelContentProvider#getRootElements(java.lang.Object)
*
* @param inputElement
* @return
*/
@Override
protected EObject[] getRootElements(ModelSet modelSet) {
UmlModel umlModel = (UmlUtils.getUmlModel(modelSet));
if(umlModel == null)
return null;
EList<EObject> contents = umlModel.getResource().getContents();
ArrayList<EObject> result = new ArrayList<EObject>();
Iterator<EObject> iterator = contents.iterator();
while(iterator.hasNext()) {
EObject eObject = iterator.next();
//functionality that comes from UML2 plugins
if(UMLUtil.getStereotype(eObject) == null) {
result.add(eObject);
}
}
return result.toArray(new EObject[result.size()]);
}
}