gt: 		for (Edge nextEdge : edges) {
context: package es.ucm.fdi.emf.model.ed2.diagram.navigator;
  
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.Collections;
  import java.util.HashMap;
  import java.util.LinkedList;
  
  import org.eclipse.core.resources.IFile;
  import org.eclipse.emf.common.util.URI;
  import org.eclipse.emf.ecore.EObject;
  import org.eclipse.emf.ecore.resource.Resource;
  import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
  import org.eclipse.emf.transaction.TransactionalEditingDomain;
  import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
  import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
  import org.eclipse.gmf.runtime.notation.Diagram;
  import org.eclipse.gmf.runtime.notation.Edge;
  import org.eclipse.gmf.runtime.notation.Node;
  import org.eclipse.gmf.runtime.notation.View;
  import org.eclipse.jface.viewers.Viewer;
  import org.eclipse.ui.IMemento;
  import org.eclipse.ui.navigator.ICommonContentExtensionSite;
  import org.eclipse.ui.navigator.ICommonContentProvider;
  
  import es.ucm.fdi.emf.model.ed2.diagram.edit.parts.ED2EditPart;
  import es.ucm.fdi.emf.model.ed2.diagram.edit.parts.ED2TreeElementsEditPart;
  import es.ucm.fdi.emf.model.ed2.diagram.edit.parts.LeafEditPart;
  import es.ucm.fdi.emf.model.ed2.diagram.edit.parts.ModelEditPart;
  import es.ucm.fdi.emf.model.ed2.diagram.edit.parts.NodeEditPart;
  import es.ucm.fdi.emf.model.ed2.diagram.edit.parts.NodeLeavesEditPart;
  import es.ucm.fdi.emf.model.ed2.diagram.edit.parts.NodeNodesEditPart;
  import es.ucm.fdi.emf.model.ed2.diagram.part.Ed2VisualIDRegistry;
  import es.ucm.fdi.emf.model.ed2.diagram.part.Messages;
  
  /**
   * @generated
   */
  public class Ed2NavigatorContentProvider implements ICommonContentProvider {
  
  	/**
  	 * @generated
  	 */
  	private static final Object[] EMPTY_ARRAY = new Object[0];
  
  	/**
  	 * @generated
  	 */
  	private Viewer myViewer;
  
  	/**
  	 * @generated
  	 */
  	private AdapterFactoryEditingDomain myEditingDomain;
  
  	/**
  	 * @generated
  	 */
  	private WorkspaceSynchronizer myWorkspaceSynchronizer;
  
  	/**
  	 * @generated
  	 */
  	private Runnable myViewerRefreshRunnable;
  
  	/**
  	 * @generated
  	 */
  	@SuppressWarnings({ "unchecked", "serial", "rawtypes" })
  	public Ed2NavigatorContentProvider() {
  		TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
  				.createEditingDomain();
  		myEditingDomain = (AdapterFactoryEditingDomain) editingDomain;
  		myEditingDomain.setResourceToReadOnlyMap(new HashMap() {
  			public Object get(Object key) {
  				if (!containsKey(key)) {
  					put(key, Boolean.TRUE);
  				}
  				return super.get(key);
  			}
  		});
  		myViewerRefreshRunnable = new Runnable() {
  			public void run() {
  				if (myViewer != null) {
  					myViewer.refresh();
  				}
  			}
  		};
  		myWorkspaceSynchronizer = new WorkspaceSynchronizer(editingDomain,
  				new WorkspaceSynchronizer.Delegate() {
  					public void dispose() {
  					}
  
  					public boolean handleResourceChanged(final Resource resource) {
  						unloadAllResources();
  						asyncRefresh();
  						return true;
  					}
  
  					public boolean handleResourceDeleted(Resource resource) {
  						unloadAllResources();
  						asyncRefresh();
  						return true;
  					}
  
  					public boolean handleResourceMoved(Resource resource,
  							final URI newURI) {
  						unloadAllResources();
  						asyncRefresh();
  						return true;
  					}
  				});
  	}
  
  	/**
  	 * @generated
  	 */
  	public void dispose() {
  		myWorkspaceSynchronizer.dispose();
  		myWorkspaceSynchronizer = null;
  		myViewerRefreshRunnable = null;
  		myViewer = null;
  		unloadAllResources();
  		((TransactionalEditingDomain) myEditingDomain).dispose();
  		myEditingDomain = null;
  	}
  
  	/**
  	 * @generated
  	 */
  	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
  		myViewer = viewer;
  	}
  
  	/**
  	 * @generated
  	 */
  	void unloadAllResources() {
  		for (Resource nextResource : myEditingDomain.getResourceSet()
  				.getResources()) {
  			nextResource.unload();
  		}
  	}
  
  	/**
  	 * @generated
  	 */
  	void asyncRefresh() {
  		if (myViewer != null && !myViewer.getControl().isDisposed()) {
  			myViewer.getControl().getDisplay()
  					.asyncExec(myViewerRefreshRunnable);
  		}
  	}
  
  	/**
  	 * @generated
  	 */
  	public Object[] getElements(Object inputElement) {
  		return getChildren(inputElement);
  	}
  
  	/**
  	 * @generated
  	 */
  	public void restoreState(IMemento aMemento) {
  	}
  
  	/**
  	 * @generated
  	 */
  	public void saveState(IMemento aMemento) {
  	}
  
  	/**
  	 * @generated
  	 */
  	public void init(ICommonContentExtensionSite aConfig) {
  	}
  
  	/**
  	 * @generated
  	 */
  	public Object[] getChildren(Object parentElement) {
  		if (parentElement instanceof IFile) {
  			IFile file = (IFile) parentElement;
  			URI fileURI = URI.createPlatformResourceURI(file.getFullPath()
  					.toString(), true);
  			Resource resource = myEditingDomain.getResourceSet().getResource(
  					fileURI, true);
  			ArrayList<Ed2NavigatorItem> result = new ArrayList<Ed2NavigatorItem>();
  			ArrayList<View> topViews = new ArrayList<View>(resource
  					.getContents().size());
  			for (EObject o : resource.getContents()) {
  				if (o instanceof View) {
  					topViews.add((View) o);
  				}
  			}
  			result.addAll(createNavigatorItems(
  					selectViewsByType(topViews, ModelEditPart.MODEL_ID), file,
  					false));
  			return result.toArray();
  		}
  
  		if (parentElement instanceof Ed2NavigatorGroup) {
  			Ed2NavigatorGroup group = (Ed2NavigatorGroup) parentElement;
  			return group.getChildren();
  		}
  
  		if (parentElement instanceof Ed2NavigatorItem) {
  			Ed2NavigatorItem navigatorItem = (Ed2NavigatorItem) parentElement;
  			if (navigatorItem.isLeaf() || !isOwnView(navigatorItem.getView())) {
  				return EMPTY_ARRAY;
  			}
  			return getViewChildren(navigatorItem.getView(), parentElement);
  		}
  
  		return EMPTY_ARRAY;
  	}
  
  	/**
  	 * @generated
  	 */
  	private Object[] getViewChildren(View view, Object parentElement) {
  		switch (Ed2VisualIDRegistry.getVisualID(view)) {
  
  		case ModelEditPart.VISUAL_ID: {
  			LinkedList<Ed2AbstractNavigatorItem> result = new LinkedList<Ed2AbstractNavigatorItem>();
  			Diagram sv = (Diagram) view;
  			Ed2NavigatorGroup links = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_Model_1000_links,
  					"icons/linksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Collection<View> connectedViews;
  			connectedViews = getChildrenByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(ED2EditPart.VISUAL_ID));
  			result.addAll(createNavigatorItems(connectedViews, parentElement,
  					false));
  			connectedViews = getChildrenByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeEditPart.VISUAL_ID));
  			result.addAll(createNavigatorItems(connectedViews, parentElement,
  					false));
  			connectedViews = getChildrenByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(LeafEditPart.VISUAL_ID));
  			result.addAll(createNavigatorItems(connectedViews, parentElement,
  					false));
  			connectedViews = getDiagramLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry
  							.getType(ED2TreeElementsEditPart.VISUAL_ID));
  			links.addChildren(createNavigatorItems(connectedViews, links, false));
  			connectedViews = getDiagramLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeNodesEditPart.VISUAL_ID));
  			links.addChildren(createNavigatorItems(connectedViews, links, false));
  			connectedViews = getDiagramLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeLeavesEditPart.VISUAL_ID));
  			links.addChildren(createNavigatorItems(connectedViews, links, false));
  			if (!links.isEmpty()) {
  				result.add(links);
  			}
  			return result.toArray();
  		}
  
  		case NodeEditPart.VISUAL_ID: {
  			LinkedList<Ed2AbstractNavigatorItem> result = new LinkedList<Ed2AbstractNavigatorItem>();
  			Node sv = (Node) view;
  			Ed2NavigatorGroup incominglinks = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_Node_2006_incominglinks,
  					"icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Ed2NavigatorGroup outgoinglinks = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_Node_2006_outgoinglinks,
  					"icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Collection<View> connectedViews;
  			connectedViews = getIncomingLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry
  							.getType(ED2TreeElementsEditPart.VISUAL_ID));
  			incominglinks.addChildren(createNavigatorItems(connectedViews,
  					incominglinks, true));
  			connectedViews = getIncomingLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeNodesEditPart.VISUAL_ID));
  			incominglinks.addChildren(createNavigatorItems(connectedViews,
  					incominglinks, true));
  			connectedViews = getOutgoingLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeNodesEditPart.VISUAL_ID));
  			outgoinglinks.addChildren(createNavigatorItems(connectedViews,
  					outgoinglinks, true));
  			connectedViews = getOutgoingLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeLeavesEditPart.VISUAL_ID));
  			outgoinglinks.addChildren(createNavigatorItems(connectedViews,
  					outgoinglinks, true));
  			if (!incominglinks.isEmpty()) {
  				result.add(incominglinks);
  			}
  			if (!outgoinglinks.isEmpty()) {
  				result.add(outgoinglinks);
  			}
  			return result.toArray();
  		}
  
  		case LeafEditPart.VISUAL_ID: {
  			LinkedList<Ed2AbstractNavigatorItem> result = new LinkedList<Ed2AbstractNavigatorItem>();
  			Node sv = (Node) view;
  			Ed2NavigatorGroup incominglinks = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_Leaf_2007_incominglinks,
  					"icons/incomingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Collection<View> connectedViews;
  			connectedViews = getIncomingLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry
  							.getType(ED2TreeElementsEditPart.VISUAL_ID));
  			incominglinks.addChildren(createNavigatorItems(connectedViews,
  					incominglinks, true));
  			connectedViews = getIncomingLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeLeavesEditPart.VISUAL_ID));
  			incominglinks.addChildren(createNavigatorItems(connectedViews,
  					incominglinks, true));
  			if (!incominglinks.isEmpty()) {
  				result.add(incominglinks);
  			}
  			return result.toArray();
  		}
  
  		case ED2EditPart.VISUAL_ID: {
  			LinkedList<Ed2AbstractNavigatorItem> result = new LinkedList<Ed2AbstractNavigatorItem>();
  			Node sv = (Node) view;
  			Ed2NavigatorGroup outgoinglinks = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_ED2_2008_outgoinglinks,
  					"icons/outgoingLinksNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Collection<View> connectedViews;
  			connectedViews = getOutgoingLinksByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry
  							.getType(ED2TreeElementsEditPart.VISUAL_ID));
  			outgoinglinks.addChildren(createNavigatorItems(connectedViews,
  					outgoinglinks, true));
  			if (!outgoinglinks.isEmpty()) {
  				result.add(outgoinglinks);
  			}
  			return result.toArray();
  		}
  
  		case ED2TreeElementsEditPart.VISUAL_ID: {
  			LinkedList<Ed2AbstractNavigatorItem> result = new LinkedList<Ed2AbstractNavigatorItem>();
  			Edge sv = (Edge) view;
  			Ed2NavigatorGroup target = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_ED2TreeElements_4001_target,
  					"icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Ed2NavigatorGroup source = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_ED2TreeElements_4001_source,
  					"icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Collection<View> connectedViews;
  			connectedViews = getLinksTargetByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeEditPart.VISUAL_ID));
  			target.addChildren(createNavigatorItems(connectedViews, target,
  					true));
  			connectedViews = getLinksTargetByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(LeafEditPart.VISUAL_ID));
  			target.addChildren(createNavigatorItems(connectedViews, target,
  					true));
  			connectedViews = getLinksSourceByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(ED2EditPart.VISUAL_ID));
  			source.addChildren(createNavigatorItems(connectedViews, source,
  					true));
  			if (!target.isEmpty()) {
  				result.add(target);
  			}
  			if (!source.isEmpty()) {
  				result.add(source);
  			}
  			return result.toArray();
  		}
  
  		case NodeNodesEditPart.VISUAL_ID: {
  			LinkedList<Ed2AbstractNavigatorItem> result = new LinkedList<Ed2AbstractNavigatorItem>();
  			Edge sv = (Edge) view;
  			Ed2NavigatorGroup target = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_NodeNodes_4002_target,
  					"icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Ed2NavigatorGroup source = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_NodeNodes_4002_source,
  					"icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Collection<View> connectedViews;
  			connectedViews = getLinksTargetByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeEditPart.VISUAL_ID));
  			target.addChildren(createNavigatorItems(connectedViews, target,
  					true));
  			connectedViews = getLinksSourceByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeEditPart.VISUAL_ID));
  			source.addChildren(createNavigatorItems(connectedViews, source,
  					true));
  			if (!target.isEmpty()) {
  				result.add(target);
  			}
  			if (!source.isEmpty()) {
  				result.add(source);
  			}
  			return result.toArray();
  		}
  
  		case NodeLeavesEditPart.VISUAL_ID: {
  			LinkedList<Ed2AbstractNavigatorItem> result = new LinkedList<Ed2AbstractNavigatorItem>();
  			Edge sv = (Edge) view;
  			Ed2NavigatorGroup target = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_NodeLeaves_4003_target,
  					"icons/linkTargetNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Ed2NavigatorGroup source = new Ed2NavigatorGroup(
  					Messages.NavigatorGroupName_NodeLeaves_4003_source,
  					"icons/linkSourceNavigatorGroup.gif", parentElement); //$NON-NLS-1$
  			Collection<View> connectedViews;
  			connectedViews = getLinksTargetByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(LeafEditPart.VISUAL_ID));
  			target.addChildren(createNavigatorItems(connectedViews, target,
  					true));
  			connectedViews = getLinksSourceByType(Collections.singleton(sv),
  					Ed2VisualIDRegistry.getType(NodeEditPart.VISUAL_ID));
  			source.addChildren(createNavigatorItems(connectedViews, source,
  					true));
  			if (!target.isEmpty()) {
  				result.add(target);
  			}
  			if (!source.isEmpty()) {
  				result.add(source);
  			}
  			return result.toArray();
  		}
  		}
  		return EMPTY_ARRAY;
  	}
  
  	/**
  	 * @generated
  	 */
  	private Collection<View> getLinksSourceByType(Collection<Edge> edges,
  			String type) {
  		LinkedList<View> result = new LinkedList<View>();
  