[343558] JEM needs to handle a flush better
diff --git a/features/org.eclipse.jem.feature.patch/buildnotes_org.eclipse.jem.feature.patch.html b/features/org.eclipse.jem.feature.patch/buildnotes_org.eclipse.jem.feature.patch.html
index 5909897..cebfb44 100644
--- a/features/org.eclipse.jem.feature.patch/buildnotes_org.eclipse.jem.feature.patch.html
+++ b/features/org.eclipse.jem.feature.patch/buildnotes_org.eclipse.jem.feature.patch.html
@@ -19,4 +19,5 @@
 <p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=249019'>249019</a>. Japanese chars in source code changed to illegible unicode</p>
 <p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=272013'>272013</a>. JEM JemProjectUtilities#getClasspathAsURLArray(IJavaProject) fails to handle class folders</p>
 <p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=290131'>290131</a>. Exceptions from JEM in adopter product</p>
+<p>Bug <a href='https://bugs.eclipse.org/bugs/show_bug.cgi?id=343558'>343558</a>. JEM needs to handle a flush better</p>
 </body></html>
\ No newline at end of file
diff --git a/features/org.eclipse.jem.feature.patch/feature.properties b/features/org.eclipse.jem.feature.patch/feature.properties
index cbd1678..7274872 100644
--- a/features/org.eclipse.jem.feature.patch/feature.properties
+++ b/features/org.eclipse.jem.feature.patch/feature.properties
@@ -32,6 +32,7 @@
 Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=249019 Japanese chars in source code changed to illegible unicode\n\
 Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=272013 JEM JemProjectUtilities#getClasspathAsURLArray(IJavaProject) fails to handle class folders\n\
 Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=290131 Exceptions from JEM in adopter product\n\
+Bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=343558 JEM needs to handle a flush better\n\
 \n\
 copyright=\
 Copyright (c) 2008 IBM Corporation and others.\n\
diff --git a/plugins/org.eclipse.jem.workbench/META-INF/MANIFEST.MF b/plugins/org.eclipse.jem.workbench/META-INF/MANIFEST.MF
index e132e4d..cea0624 100644
--- a/plugins/org.eclipse.jem.workbench/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jem.workbench/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jem.workbench; singleton:=true
-Bundle-Version: 1.2.6.qualifier
+Bundle-Version: 1.2.7.qualifier
 Bundle-Activator: org.eclipse.jem.internal.plugin.JavaPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMSearchHelper.java b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMSearchHelper.java
index 7f75aa9..467332d 100644
--- a/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMSearchHelper.java
+++ b/plugins/org.eclipse.jem.workbench/workbench/org/eclipse/jem/internal/adapters/jdom/JDOMSearchHelper.java
@@ -11,7 +11,7 @@
 package org.eclipse.jem.internal.adapters.jdom;
 /*
  *  $RCSfile: JDOMSearchHelper.java,v $
- *  $Revision: 1.8 $  $Date: 2006/05/17 20:13:58 $ 
+ *  $Revision: 1.8.4.1 $  $Date: 2011/08/05 20:09:52 $ 
  */
 
 import java.io.File;
@@ -148,7 +148,12 @@
 		return result;
 	}
 	private static boolean needsToResolveName(IType type, String simpleName, boolean isForReflection) {
-		return !(type.isBinary() || (!isForReflection && simpleName.indexOf(PERIOD) > -1) || isPrimitiveOrVoid(simpleName));
+		boolean retVal = false;
+		if (type != null)
+		{
+			retVal = !(type.isBinary() || (!isForReflection && simpleName.indexOf(PERIOD) > -1) || isPrimitiveOrVoid(simpleName));
+		}
+		return retVal;
 	}
 	/**
 	 * Returns the qualified name for the simple name within the scope of the type.
diff --git a/plugins/org.eclipse.jem/META-INF/MANIFEST.MF b/plugins/org.eclipse.jem/META-INF/MANIFEST.MF
index 2d62d26..64f6487 100644
--- a/plugins/org.eclipse.jem/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.jem/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.jem; singleton:=true
-Bundle-Version: 1.2.4.qualifier
+Bundle-Version: 1.2.5.qualifier
 Bundle-Activator: org.eclipse.jem.internal.core.JEMPlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaClassImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaClassImpl.java
index 42e872c..84281ee 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaClassImpl.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/JavaClassImpl.java
@@ -10,7 +10,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: JavaClassImpl.java,v $
- *  $Revision: 1.4.6.1 $  $Date: 2009/10/01 22:01:28 $ 
+ *  $Revision: 1.4.6.2 $  $Date: 2011/08/05 20:09:53 $ 
  */
 package org.eclipse.jem.java.internal.impl;
 
@@ -255,7 +255,15 @@
 
 	protected void collectMethodsExtended(Map methods, boolean onlyPublic, List excludedClasses, List excludedMethods) {
 		Iterator it1, it2;
-		it2 = getExtendedLookupIterator();
+		// copy over the contents
+		List extendedLookupClasses = new ArrayList();
+		EList extendedLookupEList = null;
+		if (isInterface())
+			extendedLookupEList = getImplementsInterfaces();
+		else
+			extendedLookupEList = getESuperTypes();
+		extendedLookupClasses.addAll(extendedLookupEList);
+		it2 = extendedLookupClasses.iterator();
 		JavaClassImpl javaClass;
 		while (it2.hasNext()) {
 			javaClass = (JavaClassImpl) it2.next();
diff --git a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/MethodImpl.java b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/MethodImpl.java
index 4486cbb..f8aa419 100644
--- a/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/MethodImpl.java
+++ b/plugins/org.eclipse.jem/mofjava/org/eclipse/jem/java/internal/impl/MethodImpl.java
@@ -12,7 +12,7 @@
 
 /*
  *  $RCSfile: MethodImpl.java,v $
- *  $Revision: 1.2 $  $Date: 2005/09/15 20:28:03 $ 
+ *  $Revision: 1.2.6.1 $  $Date: 2011/08/05 20:09:53 $ 
  */
 
 import java.util.Collection;
@@ -44,8 +44,7 @@
 import org.eclipse.jem.java.Method;
 
 
-import org.eclipse.jem.internal.java.adapters.IJavaMethodAdapter;
-import org.eclipse.jem.internal.java.adapters.ReadAdaptor;
+import org.eclipse.jem.internal.java.adapters.*;
 
 /**
  * @generated
@@ -1043,7 +1042,13 @@
 				case JavaRefPackage.METHOD__PARAMETERS:
 					return ((InternalEList)getParameters()).basicRemove(otherEnd, msgs);
 				case JavaRefPackage.METHOD__JAVA_CLASS:
-					return eBasicSetContainer(null, JavaRefPackage.METHOD__JAVA_CLASS, msgs);
+					JavaClass newContainer = null;
+					ReadAdaptor readAdaptor = getReadAdapter();
+					if (readAdaptor instanceof JavaReflectionAdaptor && otherEnd instanceof JavaClass)
+					{
+						newContainer = ((JavaReflectionAdaptor)readAdaptor).createJavaClassRef(((JavaClass)otherEnd).getJavaName());
+					}
+					return eBasicSetContainer((InternalEObject)newContainer, JavaRefPackage.METHOD__JAVA_CLASS, msgs);
 				default:
 					return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
 			}
@@ -1129,5 +1134,23 @@
 		return eDynamicGet(eFeature, resolve);
 	}
 
+	/**
+	   * <!-- begin-user-doc -->
+	   * <!-- end-user-doc -->
+	   */
+	public void setEType(EClassifier newEType)
+	{
+		EClassifier newContainer = newEType;
+		if (eType != null && newEType == null)
+		{
+			ReadAdaptor readAdaptor = getReadAdapter();
+			if (readAdaptor instanceof JavaReflectionAdaptor)
+			{
+				newContainer = ((JavaReflectionAdaptor)readAdaptor).createJavaClassRef(((JavaHelpers)eType).getJavaName());
+			}
+		}
+	    super.setEType(newContainer);
+	  }
+
 }