Bug 406518 - migrate OT/Equinox to the standard OSGi WeavingHook
OTDT:
- avoid referring to TypeReference where it caused ClassCircularityError
- export packages containing teams (for dynamic import by base)
- disambiguate one split package for use in dynamic import
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 625bc95..3097294 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
@@ -28,5 +28,10 @@
 Bundle-Localization: plugin
 Export-Package: org.eclipse.objectteams.otdt.internal.ui.assist;x-friends:="org.eclipse.objectteams.otdt.ui.tests",
  org.eclipse.objectteams.otdt.internal.ui.packageview;x-friends:="org.eclipse.objectteams.otdt.ui.tests",
- org.eclipse.objectteams.otdt.internal.ui.javaeditor;x-internal:="true"
+ org.eclipse.objectteams.otdt.internal.ui.javaeditor;x-friends:="org.eclipse.jdt.ui",
+ org.eclipse.objectteams.otdt.internal.ui.util;x-friends:="org.eclipse.jdt.ui",
+ org.eclipse.objectteams.otdt.internal.ui.search;x-friends:="org.eclipse.jdt.ui",
+ org.eclipse.objectteams.otdt.internal.ui.viewsupport;x-friends:="org.eclipse.jdt.ui",
+ org.eclipse.objectteams.otdt.internal.corext;x-friends:="org.eclipse.jdt.ui",
+ org.eclipse.objectteams.otdt.internal.ui.text;ot-base:="org.eclipse.jdt.ui"
 
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/BaseImportRewriting.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/BaseImportRewriting.java
index 63927c7..47c1d74 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/BaseImportRewriting.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/assist/BaseImportRewriting.java
@@ -38,6 +38,7 @@
 import org.eclipse.jdt.core.dom.Type;
 import org.eclipse.jdt.core.dom.TypeDeclaration;
 import org.eclipse.jdt.core.dom.rewrite.ImportRewrite.ImportRewriteContext;
+import base org.eclipse.jdt.internal.codeassist.complete.CompletionOnSingleTypeReference;
 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
 import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
 import org.eclipse.jdt.internal.compiler.lookup.Binding;
@@ -48,7 +49,7 @@
 import base org.eclipse.jdt.internal.codeassist.CompletionEngine;
 import base org.eclipse.jdt.internal.codeassist.InternalCompletionProposal;
 import base org.eclipse.jdt.internal.codeassist.complete.CompletionParser;
-import base org.eclipse.jdt.internal.compiler.ast.TypeReference;
+import org.eclipse.jdt.internal.compiler.ast.TypeReference;
 
 /**
  * This team advises the completion engine et al to produce base-imports if appropriate.
@@ -102,8 +103,9 @@
 		
 		/** Entry (output) conditionally passing data to next role. */
 		void checkRecordBaseclassReference(CompletionOnBaseTypeRef ref)
-			<- after TypeReference createSingleAssistTypeReference(char[] assistName, long position) 
-			with { ref <- result }
+			<- after TypeReference createSingleAssistTypeReference(char[] assistName, long position)
+			base when (result instanceof CompletionOnSingleTypeReference)
+			with { ref <- (CompletionOnSingleTypeReference)result }
 		void checkRecordBaseclassReference(CompletionOnBaseTypeRef ref) {
 			if (!this.nextIsBaseclass)
 				// not within required context, cancel the role:
@@ -115,7 +117,7 @@
 	 * This role is registered by lifting in {@link CompletionParser#checkRecordBaseclassReference(CompletionOnBaseTypeRef)}.
 	 * Its presence marks a type reference as completion on base class.
 	 */
-	protected class CompletionOnBaseTypeRef	playedBy TypeReference
+	protected class CompletionOnBaseTypeRef	playedBy CompletionOnSingleTypeReference
 		base when (BaseImportRewriting.this.hasRole(base, CompletionOnBaseTypeRef.class))
 	{
 		/** adjust pretty printing for testing and debugging. */
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/AnnotationAdaptor.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/AnnotationAdaptor.java
index 5977e03..8f5b837 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/AnnotationAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/AnnotationAdaptor.java
@@ -18,7 +18,7 @@
 
 import org.eclipse.jface.text.source.Annotation;
 import org.eclipse.jface.text.source.VerticalRulerEvent;
-import org.eclipse.objectteams.otdt.internal.ui.javaeditor.RoleOverrideIndicatorManager;
+import org.eclipse.objectteams.otdt.internal.ui.javaeditor0.RoleOverrideIndicatorManager;
 import org.eclipse.swt.widgets.Event;
 
 import base org.eclipse.jdt.internal.ui.javaeditor.JavaSelectAnnotationRulerAction;
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/JavaEditorAdaptor.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/JavaEditorAdaptor.java
index 529f73b..4c57c48 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/JavaEditorAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/JavaEditorAdaptor.java
@@ -30,8 +30,8 @@
 import org.eclipse.ui.IEditorInput;

 import org.eclipse.ui.texteditor.ITextEditor;

 import org.eclipse.objectteams.otdt.core.OTModelManager;

-import org.eclipse.objectteams.otdt.internal.ui.javaeditor.RoleOverrideIndicatorManager;
-

+import org.eclipse.objectteams.otdt.internal.ui.javaeditor0.RoleOverrideIndicatorManager;
+
 import base org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor;

 import base org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;

 import base org.eclipse.jdt.ui.text.JavaSourceViewerConfiguration;
diff --git a/plugins/org.eclipse.objectteams.otdt.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.ui/META-INF/MANIFEST.MF
index 2f20ee5..e0ac0af 100644
--- a/plugins/org.eclipse.objectteams.otdt.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otdt.ui/META-INF/MANIFEST.MF
@@ -33,7 +33,7 @@
 Bundle-ActivationPolicy: lazy
 Export-Package: 
  org.eclipse.objectteams.otdt.internal.ui.callinmarkers;x-friends:="org.eclipse.objectteams.otdt.ui.tests",
- org.eclipse.objectteams.otdt.internal.ui.javaeditor;x-friends:="org.eclipse.objectteams.otdt.debug.ui,org.eclipse.objectteams.otdt.jdt.ui",
+ org.eclipse.objectteams.otdt.internal.ui.javaeditor0;x-friends:="org.eclipse.objectteams.otdt.debug.ui,org.eclipse.objectteams.otdt.jdt.ui",
  org.eclipse.objectteams.otdt.internal.ui.preferences;x-friends:="org.eclipse.objectteams.otdt.ui.tests",
  org.eclipse.objectteams.otdt.internal.ui.wizards;x-friends:="org.eclipse.objectteams.otdt.ui.tests",
  org.eclipse.objectteams.otdt.internal.ui.wizards.listeners;x-friends:="org.eclipse.objectteams.otdt.ui.tests",
diff --git a/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/OTJavaEditorMessages.java b/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor0/OTJavaEditorMessages.java
similarity index 91%
rename from plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/OTJavaEditorMessages.java
rename to plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor0/OTJavaEditorMessages.java
index 9a2a0be..52c5bac 100644
--- a/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/OTJavaEditorMessages.java
+++ b/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor0/OTJavaEditorMessages.java
@@ -18,13 +18,13 @@
  * Fraunhofer FIRST - Initial API and implementation
  * Technical University Berlin - Initial API and implementation
  **********************************************************************/
-package org.eclipse.objectteams.otdt.internal.ui.javaeditor;
+package org.eclipse.objectteams.otdt.internal.ui.javaeditor0;
 
 import org.eclipse.osgi.util.NLS;;
 
 public class OTJavaEditorMessages extends NLS {
 	
-	private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.internal.ui.javaeditor.OTJavaEditorMessages"; //$NON-NLS-1$
+	private static final String BUNDLE_NAME = "org.eclipse.objectteams.otdt.internal.ui.javaeditor0.OTJavaEditorMessages"; //$NON-NLS-1$
 	
 	public static String RoleOverrideIndicator_open_error_message;
 	public static String RoleOverrideIndicator_open_error_messageHasLogEntry;
diff --git a/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/OTJavaEditorMessages.properties b/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor0/OTJavaEditorMessages.properties
similarity index 100%
rename from plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/OTJavaEditorMessages.properties
rename to plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor0/OTJavaEditorMessages.properties
diff --git a/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/RoleOverrideIndicatorManager.java b/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor0/RoleOverrideIndicatorManager.java
similarity index 99%
rename from plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/RoleOverrideIndicatorManager.java
rename to plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor0/RoleOverrideIndicatorManager.java
index 3c727ee..54c8b9a 100644
--- a/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor/RoleOverrideIndicatorManager.java
+++ b/plugins/org.eclipse.objectteams.otdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/javaeditor0/RoleOverrideIndicatorManager.java
@@ -10,7 +10,7 @@
  *     IBM Corporation - initial API and implementation
  * 	   Technical University Berlin - Initial API and implementation
  *******************************************************************************/
-package org.eclipse.objectteams.otdt.internal.ui.javaeditor;
+package org.eclipse.objectteams.otdt.internal.ui.javaeditor0;
 
 import java.util.HashMap;
 import java.util.Iterator;