[260433] Resource handlers load all sub-fragments
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/resource/UML2122UMLResourceHandler.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/resource/UML2122UMLResourceHandler.java
index 83b6894..ada391c 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/resource/UML2122UMLResourceHandler.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/resource/UML2122UMLResourceHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
  * 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
@@ -8,7 +8,7 @@
  * Contributors:
  *   IBM - initial API and implementation
  *
- * $Id: UML2122UMLResourceHandler.java,v 1.2 2008/11/04 14:29:52 khussey Exp $
+ * $Id: UML2122UMLResourceHandler.java,v 1.3 2009/02/24 23:19:53 jbruck Exp $
  */
 package org.eclipse.uml2.uml.resource;
 
@@ -26,6 +26,7 @@
 import org.eclipse.emf.ecore.resource.ResourceSet;
 import org.eclipse.emf.ecore.util.ExtendedMetaData;
 import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.InternalEList;
 import org.eclipse.emf.ecore.xmi.XMLResource;
 import org.eclipse.emf.ecore.xmi.impl.BasicResourceHandler;
 import org.eclipse.emf.ecore.xml.type.AnyType;
@@ -52,7 +53,9 @@
 public class UML2122UMLResourceHandler
 		extends BasicResourceHandler {
 
-	protected static final boolean DEBUG = true;
+	protected static final boolean DEBUG = false;
+	
+	protected boolean resolveProxies = true;
 
 	protected static final String STEREOTYPE__TIME_EVENT = "TimeEvent"; //$NON-NLS-1$
 
@@ -317,8 +320,14 @@
 					}
 				}
 
-				for (EObject eContent : eObject.eContents()) {
-					doSwitch(eContent);
+				Iterator<?> contents = resolveProxies
+					? eObject.eContents().iterator()
+					: ((InternalEList<?>) eObject.eContents()).basicIterator();
+
+				if (contents != null) {
+					while (contents.hasNext()) {
+						doSwitch((EObject) contents.next());
+					}
 				}
 
 				return eObject;
diff --git a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/resource/UML22UMLResourceHandler.java b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/resource/UML22UMLResourceHandler.java
index 0415450..bc9b922 100644
--- a/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/resource/UML22UMLResourceHandler.java
+++ b/plugins/org.eclipse.uml2.uml/src/org/eclipse/uml2/uml/resource/UML22UMLResourceHandler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * Copyright (c) 2006, 2009 IBM Corporation and others.
  * 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
@@ -8,7 +8,7 @@
  * Contributors:
  *   IBM - initial API and implementation
  * 
- * $Id: UML22UMLResourceHandler.java,v 1.36 2008/10/03 20:50:37 jbruck Exp $
+ * $Id: UML22UMLResourceHandler.java,v 1.37 2009/02/24 23:19:53 jbruck Exp $
  */
 package org.eclipse.uml2.uml.resource;
 
@@ -128,6 +128,8 @@
 
 	protected static final boolean DEBUG = false;
 
+	protected boolean resolveProxies = true;
+	
 	protected static final String STEREOTYPE__ACTION = "Action"; //$NON-NLS-1$
 
 	protected static final String STEREOTYPE__ACTIVITY = "Activity"; //$NON-NLS-1$
@@ -1927,8 +1929,14 @@
 					}
 				}
 
-				for (EObject eContent : eObject.eContents()) {
-					doSwitch(eContent);
+				Iterator<?> contents = resolveProxies
+					? eObject.eContents().iterator()
+					: ((InternalEList<?>) eObject.eContents()).basicIterator();
+
+				if (contents != null) {
+					while (contents.hasNext()) {
+						doSwitch((EObject) contents.next());
+					}
 				}
 
 				return eObject;