Fix for Bug 355481 - [ui] class icon in the package explorer not always updated when adding/removing team modifier
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF
index ffd3cc9..f8dd10a 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.objectteams.otdt.jdt.ui;singleton:=true
-Bundle-Version: 2.0.1.qualifier
+Bundle-Version: 2.1.0.qualifier
 Require-Bundle: org.eclipse.jdt.ui;bundle-version="[3.7.0,4.0.0)",
  org.eclipse.core.runtime;bundle-version="[3.7.0,4.0.0)",
  org.eclipse.core.resources;bundle-version="[3.7.0,4.0.0)",
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/JavaOutlinePageAdaptor.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/JavaOutlinePageAdaptor.java
index a4667e0..db25813 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/JavaOutlinePageAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/JavaOutlinePageAdaptor.java
@@ -25,7 +25,11 @@
 import base org.eclipse.jdt.internal.ui.javaeditor.JavaOutlinePage.ChildrenProvider;
 
 /**
- * The only purpose: filter generated elements from the outline page.
+ * Purpose:
+ * <ul>
+ * <li>filter generated elements from the outline page.
+ * <li>avoid object schizophrenia in StructuredViewer.elementMap
+ * </ul>
  *  
  * @author stephan
  */
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/packageview/PackageExplorerAdaptor.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/packageview/PackageExplorerAdaptor.java
index b700b2c..36b6b93 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/packageview/PackageExplorerAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/packageview/PackageExplorerAdaptor.java
@@ -40,6 +40,7 @@
 import org.eclipse.jface.viewers.IContentProvider;
 import org.eclipse.jface.viewers.TreeViewer;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Item;
 
 import org.eclipse.ui.IActionBars;
 import org.eclipse.ui.IViewSite;
@@ -213,7 +214,14 @@
 			}
 			base.add(parent, child);
 		}
-		
+
+		// avoid object schizophrenia in StructuredViewer.elementMap:
+		void unwrapOTType(Object element) <- replace void associate(Object element, Item item)
+				base when (element instanceof IOTType); 
+
+		callin void unwrapOTType(Object element) {
+			base.unwrapOTType(((IOTType)element).getCorrespondingJavaElement());
+		}
 	}
 	
 	protected class LabelProvider playedBy PackageExplorerLabelProvider {