Get rid of some more deadlock problems
diff --git a/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoClassAdapter.java b/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoClassAdapter.java
index c7c4300..db387b4 100644
--- a/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoClassAdapter.java
+++ b/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoClassAdapter.java
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: BeaninfoClassAdapter.java,v $
- *  $Revision: 1.14 $  $Date: 2004/06/09 22:46:55 $ 
+ *  $Revision: 1.15 $  $Date: 2004/06/16 20:58:31 $ 
  */
 
 import java.io.FileNotFoundException;
@@ -883,15 +883,29 @@
 		// to get rid of the decorator and recreate it. If it is not implicit, then
 		// we have to use it as is because the user specified, so it won't become
 		// an indexed if the user did not created it as an index, and visa-versa.
-		if (pd != null && pd.isImplicitlyCreated() == FeatureDecorator.NOT_IMPLICIT) {
-			// We can't change the type for explicit.
-			indexed = pd instanceof IndexedPropertyDecorator;
-		} else if (
-			pd != null
-				&& pd.isImplicitlyCreated() != FeatureDecorator.NOT_IMPLICIT
-				&& ((indexed && !(pd instanceof IndexedPropertyDecorator)) || (!indexed && pd instanceof IndexedPropertyDecorator))) {
-			prop.getEAnnotations().remove(pd);
-			pd = null;
+		// Also if it is implicit, then we need to unset certain features that may of
+		// been set by a previous reflection which has now become introspected.
+		// When reflected we set the actual fields instead of the letting proxy determine them.
+		if (pd != null) {
+			if (pd.isImplicitlyCreated() == FeatureDecorator.NOT_IMPLICIT) {
+				// We can't change the type for explicit.
+				indexed = pd instanceof IndexedPropertyDecorator;
+			} else {
+				if ((indexed && !(pd instanceof IndexedPropertyDecorator)) || (!indexed && pd instanceof IndexedPropertyDecorator)) {
+					prop.getEAnnotations().remove(pd);
+					pd = null;
+				} else {
+					// It is implicit and could of been reflected, so clear the explict sets.
+					pd.unsetBound();
+					pd.unsetConstrained();
+					pd.eUnset(BeaninfoPackage.eINSTANCE.getPropertyDecorator_ReadMethod());
+					pd.eUnset(BeaninfoPackage.eINSTANCE.getPropertyDecorator_WriteMethod());
+					if (pd instanceof IndexedPropertyDecorator) {
+						pd.eUnset(BeaninfoPackage.eINSTANCE.getIndexedPropertyDecorator_IndexedReadMethod());
+						pd.eUnset(BeaninfoPackage.eINSTANCE.getIndexedPropertyDecorator_IndexedWriteMethod());
+					}
+				}
+			}
 		}
 
 		int implicit = pd == null ? FeatureDecorator.IMPLICIT_DECORATOR : pd.isImplicitlyCreated();
@@ -1557,6 +1571,14 @@
 			event = (JavaEvent) b;
 		}
 
+		if (ed != null && ed.isImplicitlyCreated() != FeatureDecorator.NOT_IMPLICIT) {
+			// It is implicit and could of been reflected, so clear the explict sets.
+			ed.unsetUnicast();
+			ed.setAddListenerMethod(null);
+			ed.setRemoveListenerMethod(null);
+			ed.setListenerType(null);
+		}
+		
 		int implicit = ed == null ? FeatureDecorator.IMPLICIT_DECORATOR : FeatureDecorator.NOT_IMPLICIT;
 		if (event == null) {
 			// We will create a new Event.
diff --git a/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoNature.java b/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoNature.java
index 909eaaa..7d0faf0 100644
--- a/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoNature.java
+++ b/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/BeaninfoNature.java
@@ -11,7 +11,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: BeaninfoNature.java,v $
- *  $Revision: 1.20 $  $Date: 2004/06/11 15:35:03 $ 
+ *  $Revision: 1.21 $  $Date: 2004/06/16 20:58:31 $ 
  */
 
 import java.io.*;
@@ -67,16 +67,14 @@
 	private class ResourceTracker implements IResourceChangeListener{
 		public void resourceChanged(IResourceChangeEvent e) {
 			// About to close or delete the project and it is ours, so we need to cleanup.
-			if (e.getType() == IResourceChangeEvent.PRE_CLOSE || e.getType() == IResourceChangeEvent.PRE_DELETE) {
-				// Performance: It has been noted that dres.equals(...) can be slow with the number
-				// of visits done. Checking just the last segment (getName()) first before checking
-				// the entire resource provides faster testing. If the last segment is not equal,
-				// then the entire resource could not be equal.
-				IResource eventResource = e.getResource();
-				if (eventResource.getName().equals(getProject().getName()) && eventResource.equals(getProject())) {
-					cleanup(false);
-					return;
-				}
+			// Performance: It has been noted that dres.equals(...) can be slow with the number
+			// of visits done. Checking just the last segment (getName()) first before checking
+			// the entire resource provides faster testing. If the last segment is not equal,
+			// then the entire resource could not be equal.
+			IResource eventResource = e.getResource();
+			if (eventResource.getName().equals(getProject().getName()) && eventResource.equals(getProject())) {
+				cleanup(false);
+				return;
 			}
 			// Note: the BeaninfoModelSynchronizer takes care of both .classpath and .beaninfoconfig changes
 			// in this project and any required projects.
@@ -306,7 +304,7 @@
 					(BeaninfoAdapterFactory) EcoreUtil.getAdapterFactory(javaRSet.getAdapterFactories(), IIntrospectionAdapter.ADAPTER_KEY),
 					JavaCore.create(javaNature.getProject()));
 			resourceTracker = new ResourceTracker();
-			project.getWorkspace().addResourceChangeListener(resourceTracker);
+			project.getWorkspace().addResourceChangeListener(resourceTracker, IResourceChangeEvent.PRE_CLOSE | IResourceChangeEvent.PRE_DELETE);
 		} catch (CoreException e) {
 			BeaninfoPlugin.getPlugin().getLogger().log(e.getStatus());
 		}
diff --git a/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/CreateRegistryJobHandler.java b/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/CreateRegistryJobHandler.java
index 7ba9188..8047757 100644
--- a/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/CreateRegistryJobHandler.java
+++ b/plugins/org.eclipse.jem.beaninfo/beaninfo/org/eclipse/jem/internal/beaninfo/adapters/CreateRegistryJobHandler.java
@@ -10,7 +10,7 @@
  *******************************************************************************/
 /*
  *  $RCSfile: CreateRegistryJobHandler.java,v $
- *  $Revision: 1.7 $  $Date: 2004/06/14 16:07:26 $ 
+ *  $Revision: 1.8 $  $Date: 2004/06/16 20:58:31 $ 
  */
 package org.eclipse.jem.internal.beaninfo.adapters;
 
@@ -60,14 +60,16 @@
 		Job currentJob = jobManager.currentJob();
 		if (currentJob == null || (!currentJob.belongsTo(ResourcesPlugin.FAMILY_AUTO_BUILD) && !currentJob.belongsTo(ResourcesPlugin.FAMILY_MANUAL_BUILD))) {
 			// See if autojob is waiting or sleeping.
-			if (isAutoWaiting()) {
+			// Give it up to a second at .2 second intervals to try (i.e. 5 tries)
+			int tries = 5;
+			while (isAutoWaiting() && --tries>0) {
 				try {
 					Thread.sleep(200);	// Wait just .2 seconds to give build a chance to start. If it is still not started, then just go on.
 				} catch (InterruptedException e) {
 				}
-				if (isAutoWaiting())
-					BeaninfoPlugin.getPlugin().getLogger().log("Build job waiting when trying to start beaninfo registry. Possible race.", Level.WARNING);	// $NON-NLS-1$
 			}
+			if (tries==0)
+				BeaninfoPlugin.getPlugin().getLogger().log("Build job waiting when trying to start beaninfo registry. Possible race.", Level.WARNING);	// $NON-NLS-1$
 		}
 		
 		jobHandler.processCreateRegistry(nature);