completing the update to helios M6 (version numbers of original changesets in old svn):
r23587 change one import (see Bug 301020 - JDT debug UI should use SWTFactory from debug UI)
r23592 new in tests.compiler: src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
r23595 harness new resolve method with Dependencies, fixes new tests in StandAloneASTParserTest
r23596 add new test resource, fixes new test in FormatterRegressionTest.
r23597 fix an update-bug (ImportRewriteAnalyzer v_A39) witnessed by three failures in ImportRewriteTest
r23598 add new test resource, fixes new test in MoveInnerToToplevel
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
new file mode 100644
index 0000000..f2d6b55
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/dom/StandAloneASTParserTest.java
@@ -0,0 +1,346 @@
+/*******************************************************************************
+ * Copyright (c) 2010 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.core.tests.dom;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.Expression;
+import org.eclipse.jdt.core.dom.ExpressionStatement;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.FileASTRequestor;
+import org.eclipse.jdt.core.dom.IBinding;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.IPackageBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.core.dom.IVariableBinding;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest;
+
+//{ObjectTeams: moved from org.eclipse.jdt.core.tests.dom: 
+// avoid package overlap with tests.model to please our report generator
+public class StandAloneASTParserTest extends AbstractRegressionTest {
+	public StandAloneASTParserTest(String name) {
+		super(name);
+	}
+	public ASTNode runConversion(
+			int astLevel,
+			String source,
+			boolean resolveBindings,
+			boolean statementsRecovery,
+			boolean bindingsRecovery,
+			String unitName) {
+
+		ASTParser parser = ASTParser.newParser(astLevel);
+		parser.setSource(source.toCharArray());
+		parser.setEnvironment(null, null, null, true);
+		parser.setResolveBindings(resolveBindings);
+		parser.setStatementsRecovery(statementsRecovery);
+		parser.setBindingsRecovery(bindingsRecovery);
+		parser.setCompilerOptions(getCompilerOptions());
+		parser.setUnitName(unitName);
+		return parser.createAST(null);
+	}
+	public void test1() {
+		String contents =
+				"package p;\n" + 
+				"public class X {\n" + 
+				"	public int i;\n" + 
+				"	public static void main(String[] args) {\n" + 
+				"		int length = args.length;\n" + 
+				"		System.out.println(length);\n" + 
+				"	}\n" + 
+				"}";
+		ASTNode node = runConversion(AST.JLS3, contents, true, true, true, "p/X.java");
+		assertTrue("Should be a compilation unit", node instanceof CompilationUnit);
+		CompilationUnit unit = (CompilationUnit) node;
+		List types = unit.types();
+		TypeDeclaration typeDeclaration  = (TypeDeclaration) types.get(0);
+		ITypeBinding binding = typeDeclaration.resolveBinding();
+		assertNotNull("No binding", binding);
+		assertNull("Got a java element", binding.getJavaElement());
+		assertEquals("Wrong name", "p.X", binding.getQualifiedName());
+		MethodDeclaration methodDeclaration = (MethodDeclaration) typeDeclaration.bodyDeclarations().get(1);
+		IMethodBinding methodBinding = methodDeclaration.resolveBinding();
+		assertNotNull("No binding", methodBinding);
+		assertNull("Got a java element", methodBinding.getJavaElement());
+		Block body = methodDeclaration.getBody();
+		VariableDeclarationStatement statement = (VariableDeclarationStatement) body.statements().get(0);
+		VariableDeclarationFragment fragment = (VariableDeclarationFragment) statement.fragments().get(0);
+		IVariableBinding variableBinding = fragment.resolveBinding();
+		assertNotNull("No binding", variableBinding);
+		assertNull("Got a java element", variableBinding.getJavaElement());
+		ExpressionStatement statement2 = (ExpressionStatement) body.statements().get(1);
+		Expression expression = statement2.getExpression();
+		MethodInvocation invocation = (MethodInvocation) expression;
+		Expression expression2 = invocation.getExpression();
+		assertNotNull("No binding", expression2.resolveTypeBinding());
+		
+		FieldDeclaration fieldDeclaration = (FieldDeclaration) typeDeclaration.bodyDeclarations().get(0);
+		VariableDeclarationFragment fragment2 = (VariableDeclarationFragment) fieldDeclaration.fragments().get(0);
+		IVariableBinding variableBinding2 = fragment2.resolveBinding();
+		assertNotNull("No binding", variableBinding2);
+		assertNull("Got a java element", variableBinding2.getJavaElement());
+	}
+
+	public void test2() {
+		ASTParser parser = ASTParser.newParser(AST.JLS3);
+		parser.setEnvironment(null, null, null, true);
+		parser.setResolveBindings(true);
+		parser.setStatementsRecovery(true);
+		parser.setBindingsRecovery(true);
+		parser.setCompilerOptions(getCompilerOptions());
+
+		final String key = "Ljava/lang/String;";
+		final IBinding[] bindings = new IBinding[1];
+
+		FileASTRequestor requestor = new FileASTRequestor() {
+			public void acceptBinding(String bindingKey, IBinding binding) {
+				if (key.equals(bindingKey)) {
+					bindings[0] = binding;
+				}
+			}
+		};
+
+		parser.createASTs(new String[] {}, null, new String[] {key}, requestor, null);
+
+		assertNotNull("No binding", bindings[0]);
+		assertEquals("Wrong type of binding", IBinding.TYPE, bindings[0].getKind());
+		ITypeBinding typeBinding = (ITypeBinding) bindings[0];
+		assertEquals("Wrong binding", "java.lang.String", typeBinding.getQualifiedName());
+		assertNull("No java element", typeBinding.getJavaElement());
+	}
+
+	public void test3() throws IOException {
+		File rootDir = new File(System.getProperty("java.io.tmpdir"));
+		ASTParser parser = ASTParser.newParser(AST.JLS3);
+		parser.setEnvironment(null, null, null, true);
+		parser.setResolveBindings(true);
+		parser.setStatementsRecovery(true);
+		parser.setBindingsRecovery(true);
+		parser.setCompilerOptions(getCompilerOptions());
+
+		final String key = "Lp/X;";
+		final IBinding[] bindings = new IBinding[1];
+
+		String contents =
+			"package p;\n" + 
+			"public class X extends Y {\n" + 
+			"	public int i;\n" + 
+			"	public static void main(String[] args) {\n" + 
+			"		int length = args.length;\n" + 
+			"		System.out.println(length);\n" + 
+			"	}\n" + 
+			"}";
+		
+		File packageDir = new File(rootDir, "p");
+		packageDir.mkdir();
+		File file = new File(packageDir, "X.java");
+		Writer writer = null;
+		try {
+			writer = new BufferedWriter(new FileWriter(file));
+			writer.write(contents);
+		} finally {
+			if (writer != null) {
+				try {
+					writer.close();
+				} catch(IOException e) {
+					// ignore
+				}
+			}
+		}
+
+		String contents2 =
+			"package p;\n" + 
+			"public class Y {}";
+		File fileY = new File(packageDir, "Y.java");
+		Writer writer2 = null;
+		try {
+			writer2 = new BufferedWriter(new FileWriter(fileY));
+			writer2.write(contents2);
+		} finally {
+			if (writer2 != null) {
+				try {
+					writer2.close();
+				} catch(IOException e) {
+					// ignore
+				}
+			}
+		}
+
+		try {
+			final String canonicalPath = file.getCanonicalPath();
+			final CompilationUnit[] units = new CompilationUnit[1];
+	
+			FileASTRequestor requestor = new FileASTRequestor() {
+				public void acceptBinding(String bindingKey, IBinding binding) {
+					if (key.equals(bindingKey)) {
+						bindings[0] = binding;
+					}
+				}
+				public void acceptAST(String sourceFilePath, CompilationUnit ast) {
+					if (canonicalPath.equals(sourceFilePath)) {
+						units[0] = ast;
+					}
+				}
+			};
+	
+			parser.setEnvironment(null, new String[] { rootDir.getCanonicalPath() }, null, true);
+	
+			parser.createASTs(new String[] {canonicalPath}, null, new String[] {key}, requestor, null);
+	
+			assertNotNull("No binding", bindings[0]);
+			assertEquals("Wrong type of binding", IBinding.TYPE, bindings[0].getKind());
+			ITypeBinding typeBinding = (ITypeBinding) bindings[0];
+			assertEquals("Wrong binding", "p.X", typeBinding.getQualifiedName());
+			assertNull("No java element", typeBinding.getJavaElement());
+			assertNotNull("No ast", units[0]);
+			assertEquals("No problem", 0, units[0].getProblems().length);
+		} finally {
+			file.delete();
+			fileY.delete();
+		}
+	}
+
+	public void test4() {
+		ASTParser parser = ASTParser.newParser(AST.JLS3);
+		try {
+			parser.setEnvironment(null, null, new String[] {"UTF-8"}, true);
+			assertTrue("Should have failed", false);
+		} catch(IllegalArgumentException e) {
+			// ignore
+		}
+	}
+
+	public void test5() {
+		ASTParser parser = ASTParser.newParser(AST.JLS3);
+		try {
+			parser.setEnvironment(null, new String[] {}, new String[] {"UTF-8"}, true);
+			assertTrue("Should have failed", false);
+		} catch(IllegalArgumentException e) {
+			// ignore
+		}
+	}
+
+	public void test6() throws IOException {
+		File rootDir = new File(System.getProperty("java.io.tmpdir"));
+		ASTParser parser = ASTParser.newParser(AST.JLS3);
+		parser.setEnvironment(null, null, null, true);
+		parser.setResolveBindings(true);
+		parser.setStatementsRecovery(true);
+		parser.setBindingsRecovery(true);
+		parser.setCompilerOptions(getCompilerOptions());
+
+		final String key = "Lp/X;";
+		final IBinding[] bindings = new IBinding[2];
+
+		String contents =
+			"package p;\n" + 
+			"public class X extends Y {\n" + 
+			"	public int i;\n" + 
+			"	public static void main(String[] args) {\n" + 
+			"		int length = args.length;\n" + 
+			"		System.out.println(length);\n" + 
+			"	}\n" + 
+			"}";
+		
+		File packageDir = new File(rootDir, "p");
+		packageDir.mkdir();
+		File file = new File(packageDir, "X.java");
+		Writer writer = null;
+		try {
+			writer = new BufferedWriter(new FileWriter(file));
+			writer.write(contents);
+		} finally {
+			if (writer != null) {
+				try {
+					writer.close();
+				} catch(IOException e) {
+					// ignore
+				}
+			}
+		}
+
+		String contents2 =
+			"package p;\n" + 
+			"public class Y {}";
+		File fileY = new File(packageDir, "Y.java");
+		Writer writer2 = null;
+		try {
+			writer2 = new BufferedWriter(new FileWriter(fileY));
+			writer2.write(contents2);
+		} finally {
+			if (writer2 != null) {
+				try {
+					writer2.close();
+				} catch(IOException e) {
+					// ignore
+				}
+			}
+		}
+
+		try {
+			final String canonicalPath = file.getCanonicalPath();
+			final CompilationUnit[] units = new CompilationUnit[1];
+	
+			FileASTRequestor requestor = new FileASTRequestor() {
+				public void acceptBinding(String bindingKey, IBinding binding) {
+					if (key.equals(bindingKey)) {
+						bindings[0] = binding;
+						IBinding[] temp = createBindings(new String[] {"Ljava/lang/Object;"});
+						for (int i = 0; i < temp.length; ++i) {
+							bindings[i + 1] = temp[i];
+						}
+					}
+				}
+				public void acceptAST(String sourceFilePath, CompilationUnit ast) {
+					if (canonicalPath.equals(sourceFilePath)) {
+						units[0] = ast;
+					}
+				}
+			};
+	
+			parser.setEnvironment(null, new String[] { rootDir.getCanonicalPath() }, null, true);
+	
+			parser.createASTs(new String[] {canonicalPath}, null, new String[] {key}, requestor, null);
+	
+			assertNotNull("No binding", bindings[0]);
+			assertEquals("Wrong type of binding", IBinding.TYPE, bindings[0].getKind());
+			ITypeBinding typeBinding = (ITypeBinding) bindings[0];
+			assertEquals("Wrong binding", "p.X", typeBinding.getQualifiedName());
+			assertNull("No java element", typeBinding.getJavaElement());
+			IPackageBinding packageBinding = typeBinding.getPackage();
+			assertNull("No java element", packageBinding.getJavaElement());
+			assertNotNull("No ast", units[0]);
+			assertEquals("No problem", 0, units[0].getProblems().length);
+			assertNotNull("No binding", bindings[1]);
+			assertEquals("Wrong type of binding", IBinding.TYPE, bindings[1].getKind());
+			typeBinding = (ITypeBinding) bindings[1];
+			assertEquals("Wrong binding", "java.lang.Object", typeBinding.getQualifiedName());
+		} finally {
+			file.delete();
+			fileY.delete();
+		}
+	}
+}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test527b/A_in.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test527b/A_in.java
new file mode 100644
index 0000000..1fd12a1
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test527b/A_in.java
@@ -0,0 +1,9 @@
+package test527b;
+
+@Jpf.Controller(
+	    catches={
+	       @Jpf.Catch(type=java.lang.Exception.class, method="handleException"),
+	       @Jpf.Catch(type=PageFlowException.class, method="handlePageFlowException")
+	    }
+	)
+	public class A {}
diff --git a/org.eclipse.jdt.core.tests.model/workspace/Formatter/test527b/A_out.java b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test527b/A_out.java
new file mode 100644
index 0000000..92ecef0
--- /dev/null
+++ b/org.eclipse.jdt.core.tests.model/workspace/Formatter/test527b/A_out.java
@@ -0,0 +1,10 @@
+package test527b;
+
+@Jpf.Controller(
+		catches = {
+				@Jpf.Catch(type = java.lang.Exception.class,
+						method = "handleException"),
+				@Jpf.Catch(type = PageFlowException.class,
+						method = "handlePageFlowException") })
+public class A {
+}
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
index a164aa1..f237a06 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java
@@ -956,6 +956,9 @@
 		} finally {
 			// disconnect ourselves from ast requestor
 			astRequestor.compilationUnitResolver = null;
+//{ObjectTeams: restore:
+            Dependencies.release(this);
+// SH+KM}
 		}
 	}
 
@@ -992,6 +995,11 @@
 				}
 				sourceUnits[count++] = new org.eclipse.jdt.internal.compiler.batch.CompilationUnit(contents, sourceUnitPath, encoding);
 			}
+//{ObjectTeams:
+			Dependencies.setup(this, this.parser, this.lookupEnvironment, 
+								true/*verify*/, !this.options.ignoreMethodBodies/*analyze*/, !this.options.ignoreMethodBodies/*generate*/, 
+								true, true, false);
+// SH}
 			beginToCompile(sourceUnits, bindingKeys);
 			// process all units (some more could be injected in the loop by the lookup environment)
 			for (int i = 0; i < this.totalUnits; i++) {
@@ -1091,7 +1099,7 @@
 			astRequestor.compilationUnitResolver = null;
 //{ObjectTeams: restore:
             Dependencies.release(this);
-// SH+KM}            
+// SH}            
 		}
 	}
 
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java
index 0d58561..b92508a 100644
--- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java
+++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ImportRewriteAnalyzer.java
@@ -499,7 +499,7 @@
 	
 //{ObjectTeams: added param 'isBase':
 	public void addImport(String fullTypeName, boolean isStatic, boolean isBase) {
-		String typeContainerName= Signature.getQualifier(fullTypeName);
+		String typeContainerName= getQualifier(fullTypeName, isStatic);
 		ImportDeclEntry decl= new ImportDeclEntry(typeContainerName.length(), fullTypeName, isStatic, null);
 		if (isBase)
 			decl.setIsBase(isBase);
diff --git a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTREBlock.java b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTREBlock.java
index 45655c6..e2bc387 100644
--- a/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTREBlock.java
+++ b/plugins/org.eclipse.objectteams.otdt.debug.adaptor/src/org/eclipse/objectteams/otdt/internal/debug/adaptor/launching/OTREBlock.java
@@ -23,7 +23,7 @@
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.internal.debug.ui.SWTFactory;
+import org.eclipse.debug.internal.ui.SWTFactory; 
 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
 import org.eclipse.objectteams.otdt.debug.OTDebugPlugin;
 import org.eclipse.objectteams.otdt.internal.debug.adaptor.DebugMessages;
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_0/in/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_0/in/A.java
new file mode 100644
index 0000000..f957c4c
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_0/in/A.java
@@ -0,0 +1,9 @@
+package p;
+
+public class A {
+	
+}
+
+class Secondary {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_0/out/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_0/out/A.java
new file mode 100644
index 0000000..e9f460b
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_0/out/A.java
@@ -0,0 +1,5 @@
+package p;
+
+public class A {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_0/out/Secondary.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_0/out/Secondary.java
new file mode 100644
index 0000000..0ad7399
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_0/out/Secondary.java
@@ -0,0 +1,4 @@
+package p;
+class Secondary {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_1/in/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_1/in/A.java
new file mode 100644
index 0000000..fff8f88
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_1/in/A.java
@@ -0,0 +1,13 @@
+package p;
+
+public class A {
+	void f(){
+		new Secondary();
+	}
+}
+
+class Secondary {
+	void f(){
+		
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_1/out/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_1/out/A.java
new file mode 100644
index 0000000..f482072
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_1/out/A.java
@@ -0,0 +1,7 @@
+package p;
+
+public class A {
+	void f(){
+		new Secondary();
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_1/out/Secondary.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_1/out/Secondary.java
new file mode 100644
index 0000000..0da6c35
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_1/out/Secondary.java
@@ -0,0 +1,6 @@
+package p;
+class Secondary {
+	void f(){
+		
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_2/in/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_2/in/A.java
new file mode 100644
index 0000000..656b570
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_2/in/A.java
@@ -0,0 +1,15 @@
+package p;
+
+public class A {
+	class B {
+		void B(){
+			Secondary s= new Secondary();
+			
+		}
+	}
+}
+final class Secondary {
+	void f(){
+		new A().new B();
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_2/out/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_2/out/A.java
new file mode 100644
index 0000000..5272c52
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_2/out/A.java
@@ -0,0 +1,10 @@
+package p;
+
+public class A {
+	class B {
+		void B(){
+			Secondary s= new Secondary();
+			
+		}
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_2/out/Secondary.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_2/out/Secondary.java
new file mode 100644
index 0000000..3655456
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_2/out/Secondary.java
@@ -0,0 +1,7 @@
+package p;
+
+final class Secondary {
+	void f(){
+		new A().new B();
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/in/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/in/A.java
new file mode 100644
index 0000000..0060c64
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/in/A.java
@@ -0,0 +1,18 @@
+package p;
+
+import q.S;
+
+public class A {
+	S s= new S();
+	class B {
+		public B(){
+			Secondary sec= new Secondary();	
+			sec.f(s);
+		}
+	}
+}
+final class Secondary {	
+	void f(S s){
+		
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/in/S.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/in/S.java
new file mode 100644
index 0000000..50cb8c1
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/in/S.java
@@ -0,0 +1,5 @@
+package q;
+
+public class S {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/out/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/out/A.java
new file mode 100644
index 0000000..f70a770
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/out/A.java
@@ -0,0 +1,13 @@
+package p;
+
+import q.S;
+
+public class A {
+	S s= new S();
+	class B {
+		public B(){
+			Secondary sec= new Secondary();	
+			sec.f(s);
+		}
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/out/S.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/out/S.java
new file mode 100644
index 0000000..50cb8c1
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/out/S.java
@@ -0,0 +1,5 @@
+package q;
+
+public class S {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/out/Secondary.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/out/Secondary.java
new file mode 100644
index 0000000..a2e3a39
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_3/out/Secondary.java
@@ -0,0 +1,9 @@
+package p;
+
+import q.S;
+
+final class Secondary {	
+	void f(S s){
+		
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_4/in/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_4/in/A.java
new file mode 100644
index 0000000..f5c5f11
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_4/in/A.java
@@ -0,0 +1,11 @@
+package p;
+
+class A{
+	class Inner{
+	}
+}
+class Secondary extends A{
+	void f(){
+		new Inner();
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_4/out/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_4/out/A.java
new file mode 100644
index 0000000..cd5600e
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_4/out/A.java
@@ -0,0 +1,6 @@
+package p;
+
+class A{
+	class Inner{
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_4/out/Secondary.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_4/out/Secondary.java
new file mode 100644
index 0000000..7bcfc9c
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_4/out/Secondary.java
@@ -0,0 +1,7 @@
+package p;
+
+class Secondary extends A{
+	void f(){
+		new Inner();
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_5/in/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_5/in/A.java
new file mode 100644
index 0000000..85d5fe5
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_5/in/A.java
@@ -0,0 +1,13 @@
+package p;
+
+class A{
+	A a;
+	class Inner {
+	}
+}
+
+class Secondary {
+	void f(A a){
+		a.a.a.new Inner();
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_5/out/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_5/out/A.java
new file mode 100644
index 0000000..ba2337d
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_5/out/A.java
@@ -0,0 +1,7 @@
+package p;
+
+class A{
+	A a;
+	class Inner {
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_5/out/Secondary.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_5/out/Secondary.java
new file mode 100644
index 0000000..6d88f1b
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_5/out/Secondary.java
@@ -0,0 +1,7 @@
+package p;
+
+class Secondary {
+	void f(A a){
+		a.a.a.new Inner();
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_6/in/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_6/in/A.java
new file mode 100644
index 0000000..e971e05
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_6/in/A.java
@@ -0,0 +1,17 @@
+package p;
+
+import p.A.X.Inner;
+
+class A {
+	class X {
+		class Inner {
+			
+		}
+	}
+}
+class Secondary {
+	void f(){
+		Inner x= new A().new X().new Inner();
+			
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_6/out/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_6/out/A.java
new file mode 100644
index 0000000..84a3fed
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_6/out/A.java
@@ -0,0 +1,10 @@
+package p;
+
+
+class A {
+	class X {
+		class Inner {
+			
+		}
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_6/out/Secondary.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_6/out/Secondary.java
new file mode 100644
index 0000000..a7ca002
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_6/out/Secondary.java
@@ -0,0 +1,10 @@
+package p;
+
+import p.A.X.Inner;
+
+class Secondary {
+	void f(){
+		Inner x= new A().new X().new Inner();
+			
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/in/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/in/A.java
new file mode 100644
index 0000000..6a88933
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/in/A.java
@@ -0,0 +1,20 @@
+package p;
+
+import q.S;
+import q.T;
+
+public class A {
+	S s= new S();
+	T t= new T();
+	class B {
+		public B(){
+			Secondary sec= new Secondary();
+			sec.f(s);
+		}
+	}
+}
+final class Secondary {
+	void f(S s){
+		
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/in/S.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/in/S.java
new file mode 100644
index 0000000..50cb8c1
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/in/S.java
@@ -0,0 +1,5 @@
+package q;
+
+public class S {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/in/T.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/in/T.java
new file mode 100644
index 0000000..d49d131
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/in/T.java
@@ -0,0 +1,5 @@
+package q;
+
+public class T {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/A.java
new file mode 100644
index 0000000..82ef532
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/A.java
@@ -0,0 +1,15 @@
+package p;
+
+import q.S;
+import q.T;
+
+public class A {
+	S s= new S();
+	T t= new T();
+	class B {
+		public B(){
+			Secondary sec= new Secondary();
+			sec.f(s);
+		}
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/S.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/S.java
new file mode 100644
index 0000000..50cb8c1
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/S.java
@@ -0,0 +1,5 @@
+package q;
+
+public class S {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/Secondary.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/Secondary.java
new file mode 100644
index 0000000..d71bd83
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/Secondary.java
@@ -0,0 +1,9 @@
+package p;
+
+import q.S;
+
+final class Secondary {
+	void f(S s){
+		
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/T.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/T.java
new file mode 100644
index 0000000..d49d131
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_7/out/T.java
@@ -0,0 +1,5 @@
+package q;
+
+public class T {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/in/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/in/A.java
new file mode 100644
index 0000000..070f4b6
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/in/A.java
@@ -0,0 +1,24 @@
+package p;
+
+import q.S;
+import q.T;
+
+public class A {
+	
+	class B {
+		public B(){
+			Secondary sec= new Secondary();
+			sec.f();
+			sec.g();
+		}
+	}
+}
+
+final class Secondary {
+	void f(){
+		S s= new S();
+	}
+	void g(){
+		T t= new T();
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/in/S.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/in/S.java
new file mode 100644
index 0000000..50cb8c1
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/in/S.java
@@ -0,0 +1,5 @@
+package q;
+
+public class S {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/in/T.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/in/T.java
new file mode 100644
index 0000000..d49d131
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/in/T.java
@@ -0,0 +1,5 @@
+package q;
+
+public class T {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/A.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/A.java
new file mode 100644
index 0000000..6b3def5
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/A.java
@@ -0,0 +1,13 @@
+package p;
+
+
+public class A {
+	
+	class B {
+		public B(){
+			Secondary sec= new Secondary();
+			sec.f();
+			sec.g();
+		}
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/S.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/S.java
new file mode 100644
index 0000000..50cb8c1
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/S.java
@@ -0,0 +1,5 @@
+package q;
+
+public class S {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/Secondary.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/Secondary.java
new file mode 100644
index 0000000..33fd172
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/Secondary.java
@@ -0,0 +1,13 @@
+package p;
+
+import q.S;
+import q.T;
+
+final class Secondary {
+	void f(){
+		S s= new S();
+	}
+	void g(){
+		T t= new T();
+	}
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/T.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/T.java
new file mode 100644
index 0000000..d49d131
--- /dev/null
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/resources/MoveInnerToTopLevel/test_secondary_8/out/T.java
@@ -0,0 +1,5 @@
+package q;
+
+public class T {
+	
+}
\ No newline at end of file
diff --git a/testplugins/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInnerToTopLevelTests.java b/testplugins/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInnerToTopLevelTests.java
index bea53e8..12b7f91 100644
--- a/testplugins/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInnerToTopLevelTests.java
+++ b/testplugins/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/MoveInnerToTopLevelTests.java
@@ -39,6 +39,8 @@
 
 public class MoveInnerToTopLevelTests extends RefactoringTest {
 
+	private static final boolean BUG_304827= true; // too many imports, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=304827
+	
 	private static final String FIELD_COMMENT= "/** Comment */";
 	private static final Class clazz= MoveInnerToTopLevelTests.class;
 	private static final String REFACTORING_PATH= "MoveInnerToTopLevel/";
@@ -91,6 +93,12 @@
 		return getType(createCUfromTestFile(pack, className), className);
 	}
 
+	private void validatePassingTestSecondaryType(String primaryTypeName, String secondaryTypeName, String packageName, String[] cuNames, String[] packageNames, String enclosingInstanceName, boolean makeFinal, boolean possible, boolean mandatory, boolean createFieldIfPossible) throws Exception {
+		ICompilationUnit cu= createCUfromTestFile(getPackage(packageName), primaryTypeName);
+		IType secType= getType(cu, secondaryTypeName);
+		validatePassingTest(secondaryTypeName, secType, cuNames, packageNames, enclosingInstanceName, makeFinal, possible, mandatory, createFieldIfPossible);
+	}
+
 	private void validatePassingTest(String parentClassName, String className, String packageName, String[] cuNames, String[] packageNames, String enclosingInstanceName, boolean makeFinal, boolean possible, boolean mandatory, boolean createFieldIfPossible) throws Exception {
 		IType parentClas= getClassFromTestFile(getPackage(packageName), parentClassName);
 		IType clas= parentClas.getType(className);
@@ -541,4 +549,49 @@
 		MoveInnerToTopRefactoring ref= ((RefactoringAvailabilityTester.isMoveInnerAvailable(nestedLocal)) ? new MoveInnerToTopRefactoring(nestedLocal, JavaPreferencesSettings.getCodeGenerationSettings(parentClas.getJavaProject())) : null);
 		assertNull("refactoring was not supposed to be available", ref);
 	}
+
+	// --- Secondary classes
+	public void test_secondary_0() throws Exception {
+		validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false);
+	}
+
+	public void test_secondary_1() throws Exception {
+		validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false);
+	}
+
+	public void test_secondary_2() throws Exception {
+		if (BUG_304827)
+			return;
+		validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false);
+	}
+
+	public void test_secondary_3() throws Exception {
+		validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A", "S" }, new String[] { "p", "q" }, null, false, false, false, false);
+	}
+
+	public void test_secondary_4() throws Exception {
+		if (BUG_304827)
+			return;
+		validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false);
+	}
+
+	public void test_secondary_5() throws Exception {
+		if (BUG_304827)
+			return;
+		validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false);
+	}
+
+	public void test_secondary_6() throws Exception {
+		if (BUG_304827)
+			return;
+		validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A" }, new String[] { "p" }, null, false, false, false, false);
+	}
+
+	public void test_secondary_7() throws Exception {
+		validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A", "S", "T" }, new String[] { "p", "q", "q" }, null, false, false, false, false);
+	}
+
+	public void test_secondary_8() throws Exception {
+		validatePassingTestSecondaryType("A", "Secondary", "p", new String[] { "A", "S", "T" }, new String[] { "p", "q", "q" }, null, false, false, false, false);
+	}
 }
diff --git a/testplugins/org.eclipse.jdt.ui.tests/chkpii/org/eclipse/jdt/ui/tests/chkpii/ChkpiiTests.java b/testplugins/org.eclipse.jdt.ui.tests/chkpii/org/eclipse/jdt/ui/tests/chkpii/ChkpiiTests.java
index 5f55182..b264b4f 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/chkpii/org/eclipse/jdt/ui/tests/chkpii/ChkpiiTests.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/chkpii/org/eclipse/jdt/ui/tests/chkpii/ChkpiiTests.java
@@ -22,9 +22,9 @@
 import java.nio.charset.Charset;
 import java.util.StringTokenizer;
 
-import junit.extensions.ActiveTestSuite;
 import junit.framework.Test;
 import junit.framework.TestCase;
+import junit.framework.TestSuite;
 
 import org.eclipse.osgi.service.environment.Constants;
 
@@ -108,7 +108,7 @@
 	private final FileCategory XML= new FileCategory("XML");
 
 	public static Test suite() {
-		return new ActiveTestSuite(ChkpiiTests.class);
+		return new TestSuite(ChkpiiTests.class);
 	}
 	
 	public void testHTMLFiles() {
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit3TestFinderTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit3TestFinderTest.java
index 924b21c..b5f1078 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit3TestFinderTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit3TestFinderTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -16,6 +16,7 @@
 import junit.framework.Test;
 import junit.framework.TestCase;
 
+import org.eclipse.jdt.junit.JUnitCore;
 import org.eclipse.jdt.testplugin.JavaProjectHelper;
 import org.eclipse.jdt.testplugin.StringAsserts;
 
@@ -29,11 +30,11 @@
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.JavaCore;
 
-import org.eclipse.jdt.internal.junit.buildpath.JUnitContainerInitializer;
 import org.eclipse.jdt.internal.junit.launcher.ITestFinder;
 import org.eclipse.jdt.internal.junit.launcher.ITestKind;
 import org.eclipse.jdt.internal.junit.launcher.TestKindRegistry;
 
+
 public class JUnit3TestFinderTest extends TestCase {
 	private IJavaProject fProject;
 	private IPackageFragmentRoot fRoot;
@@ -46,7 +47,7 @@
 		super.setUp();
 		fProject= JavaProjectHelper.createJavaProject("TestProject", "bin");
 		JavaProjectHelper.addRTJar(fProject);
-		IClasspathEntry cpe= JavaCore.newContainerEntry(JUnitContainerInitializer.JUNIT3_PATH);
+		IClasspathEntry cpe= JavaCore.newContainerEntry(JUnitCore.JUNIT3_CONTAINER_PATH);
 		JavaProjectHelper.addToClasspath(fProject, cpe);
 
 		fRoot= JavaProjectHelper.addSourceContainer(fProject, "src");
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit4TestFinderTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit4TestFinderTest.java
index 97856b4..f89b38b 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit4TestFinderTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit4TestFinderTest.java
@@ -34,11 +34,11 @@
 import org.eclipse.jdt.core.IType;
 import org.eclipse.jdt.core.JavaCore;
 
-import org.eclipse.jdt.internal.junit.buildpath.JUnitContainerInitializer;
 import org.eclipse.jdt.internal.junit.launcher.ITestFinder;
 import org.eclipse.jdt.internal.junit.launcher.ITestKind;
 import org.eclipse.jdt.internal.junit.launcher.TestKindRegistry;
 
+
 public class JUnit4TestFinderTest extends TestCase {
 
 	private IJavaProject fProject;
@@ -52,7 +52,7 @@
 		super.setUp();
 		fProject= JavaProjectHelper.createJavaProject("TestProject", "bin");
 		JavaProjectHelper.addRTJar(fProject);
-		IClasspathEntry cpe= JavaCore.newContainerEntry(JUnitContainerInitializer.JUNIT4_PATH);
+		IClasspathEntry cpe= JavaCore.newContainerEntry(JUnitCore.JUNIT4_CONTAINER_PATH);
 		JavaProjectHelper.addToClasspath(fProject, cpe);
 		JavaProjectHelper.set15CompilerOptions(fProject);
 
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnitWorkspaceTestSetup.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnitWorkspaceTestSetup.java
index 5688ffa..a46d365 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnitWorkspaceTestSetup.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnitWorkspaceTestSetup.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 2010 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,13 +8,12 @@
  * Contributors:
  *     IBM Corporation - initial API and implementation
  *******************************************************************************/
-
 package org.eclipse.jdt.junit.tests;
 
-
 import junit.extensions.TestSetup;
 import junit.framework.Test;
 
+import org.eclipse.jdt.junit.JUnitCore;
 import org.eclipse.jdt.testplugin.JavaProjectHelper;
 import org.eclipse.jdt.testplugin.JavaTestPlugin;
 
@@ -25,7 +24,6 @@
 import org.eclipse.jdt.core.IPackageFragmentRoot;
 import org.eclipse.jdt.core.JavaCore;
 
-import org.eclipse.jdt.internal.junit.buildpath.JUnitContainerInitializer;
 
 public class JUnitWorkspaceTestSetup extends TestSetup {
 
@@ -60,13 +58,13 @@
 		if (fJUnit4) {
 			fgProject= JavaProjectHelper.createJavaProject(PROJECT_NAME_4, "bin");
 			JavaProjectHelper.addRTJar(fgProject);
-			IClasspathEntry cpe= JavaCore.newContainerEntry(JUnitContainerInitializer.JUNIT4_PATH);
+			IClasspathEntry cpe= JavaCore.newContainerEntry(JUnitCore.JUNIT4_CONTAINER_PATH);
 			JavaProjectHelper.addToClasspath(fgProject, cpe);
 
 		} else {
 			fgProject= JavaProjectHelper.createJavaProject(PROJECT_NAME_3, "bin");
 			JavaProjectHelper.addRTJar13(fgProject);
-			IClasspathEntry cpe= JavaCore.newContainerEntry(JUnitContainerInitializer.JUNIT3_PATH);
+			IClasspathEntry cpe= JavaCore.newContainerEntry(JUnitCore.JUNIT3_CONTAINER_PATH);
 			JavaProjectHelper.addToClasspath(fgProject, cpe);
 		}
 		fgRoot= JavaProjectHelper.addSourceContainer(fgProject, SRC_NAME);
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/AddImportTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/AddImportTest.java
index 03e3d1b..a754c56 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/AddImportTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/AddImportTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -273,6 +273,61 @@
 	}
 
 
+	public void testRemoveImports3() throws Exception {
+		IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
+		
+		IPackageFragment pack= sourceFolder.createPackageFragment("pack", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package pack;\n");
+		buf.append("\n");
+		buf.append("public class A {\n");
+		buf.append("    public class Inner {\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		pack.createCompilationUnit("A.java", buf.toString(), false, null);
+		
+		IPackageFragment test1= sourceFolder.createPackageFragment("test1", false, null);
+		buf= new StringBuffer();
+		buf.append("package test1;\n");
+		buf.append("\n");
+		buf.append("import pack.A;\n");
+		buf.append("import pack.A.Inner;\n");
+		buf.append("import pack.A.NotThere;\n");
+		buf.append("import pack.B;\n");
+		buf.append("import pack.B.Inner;\n");
+		buf.append("import pack.B.NotThere;\n");
+		buf.append("\n");
+		buf.append("public class T {\n");
+		buf.append("}\n");
+		ICompilationUnit cuT= test1.createCompilationUnit("T.java", buf.toString(), false, null);
+		
+		ASTParser parser= ASTParser.newParser(AST.JLS3);
+		parser.setSource(cuT);
+		parser.setResolveBindings(true);
+		CompilationUnit astRoot= (CompilationUnit) parser.createAST(null);
+		
+		ImportRewrite imports= newImportsRewrite(astRoot, new String[0], 99, 99, true);
+		imports.setUseContextToFilterImplicitImports(true);
+		
+		imports.removeImport("pack.A.Inner");
+		imports.removeImport("pack.A.NotThere");
+		imports.removeImport("pack.B.Inner");
+		imports.removeImport("pack.B.NotThere");
+		
+		apply(imports);
+		
+		buf= new StringBuffer();
+		buf.append("package test1;\n");
+		buf.append("\n");
+		buf.append("import pack.A;\n");
+		buf.append("import pack.B;\n");
+		buf.append("\n");
+		buf.append("public class T {\n");
+		buf.append("}\n");
+		assertEqualString(cuT.getSource(), buf.toString());
+	}
+	
+	
 	public void testAddImports_bug23078() throws Exception {
 		IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
 
@@ -892,6 +947,48 @@
 		assertEqualString(cu.getSource(), buf.toString());
 	}
 
+	public void testAddImportAction5() throws Exception {
+		IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
+		
+		IPackageFragment pack1= sourceFolder.createPackageFragment("pack1", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package pack1;\n");
+		buf.append("\n");
+		buf.append("import java.io.Serializable;\n");
+		buf.append("\n");
+		buf.append("public class C {\n");
+		buf.append("    private static class Serializable { }\n");
+		buf.append("    public void bar() {\n");
+		buf.append("        java.io.Serializable ser= null;\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		buf.append("class Secondary {\n");
+		buf.append("    Serializable s;\n");
+		buf.append("}\n");
+		ICompilationUnit cu= pack1.createCompilationUnit("C.java", buf.toString(), false, null);
+		
+		int selOffset= buf.indexOf("ser=") - 2;
+		
+		AddImportsOperation op= new AddImportsOperation(cu, selOffset, 0, null, true);
+		op.run(null);
+		
+		buf= new StringBuffer();
+		buf.append("package pack1;\n");
+		buf.append("\n");
+		buf.append("import java.io.Serializable;\n");
+		buf.append("\n");
+		buf.append("public class C {\n");
+		buf.append("    private static class Serializable { }\n");
+		buf.append("    public void bar() {\n");
+		buf.append("        java.io.Serializable ser= null;\n"); // no change
+		buf.append("    }\n");
+		buf.append("}\n");
+		buf.append("class Secondary {\n");
+		buf.append("    Serializable s;\n");
+		buf.append("}\n");
+		assertEqualString(cu.getSource(), buf.toString());
+	}
+
 	public void testAddImports_bug107206() throws Exception {
 		IPackageFragmentRoot sourceFolder= JavaProjectHelper.addSourceContainer(fJProject1, "src");
 
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTestCase.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTestCase.java
index 2ea117c..9024e6d 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTestCase.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTestCase.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 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
@@ -138,6 +138,9 @@
 	protected void tearDown() throws Exception {
 		JavaProjectHelper.clear(fJProject1, ProjectTestSetup.getDefaultClasspath());
 		disableAll();
+		fJProject1= null;
+		fSourceFolder= null;
+		fProfile= null;
 	}
 
 	private void disableAll() throws CoreException {
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertForLoopQuickFixTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertForLoopQuickFixTest.java
index a438a01..31d9953 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertForLoopQuickFixTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertForLoopQuickFixTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * Copyright (c) 2000, 2010 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
@@ -67,13 +67,8 @@
 	}
 
 	public static Test suite() {
-		if (true) {
-			return allTests();
-		} else {
-			TestSuite suite= new TestSuite();
-			suite.addTest(new ConvertForLoopQuickFixTest("testSimplestClean"));
-			return new ProjectTestSetup(suite);
-		}
+		return allTests();
+//		return new ProjectTestSetup(new ConvertForLoopQuickFixTest("testSimplestClean"));
 	}
 
 	protected void setUp() throws Exception {
@@ -93,6 +88,9 @@
 
 	protected void tearDown() throws Exception {
 		JavaProjectHelper.clear(fJProject1, ProjectTestSetup.getDefaultClasspath());
+		fJProject1= null;
+		fSourceFolder= null;
+		fConvertLoopProposal= null;
 	}
 
 	public void testSimplestSmokeCase() throws Exception {
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertIterableLoopQuickFixTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertIterableLoopQuickFixTest.java
index d0fa6c3..6159a57 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertIterableLoopQuickFixTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertIterableLoopQuickFixTest.java
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * Copyright (c) 2005, 2010 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
@@ -89,6 +89,9 @@
 
 	protected void tearDown() throws Exception {
 		JavaProjectHelper.clear(fProject, ProjectTestSetup.getDefaultClasspath());
+		fConvertLoopProposal= null;
+		fProject= null;
+		fSourceFolder= null;
 	}
 
 	public void testSimplestSmokeCase() throws Exception {
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
index cc7259f..67ca74d 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java
@@ -1071,6 +1071,97 @@
 		assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
 	}
 
+	public void testUncaughtExceptionImportConflict() throws Exception {
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test1;\n");
+		buf.append("public class Test {\n");
+		buf.append("    public void test1() {\n");
+		buf.append("        test2();\n");
+		buf.append("    }\n");
+		buf.append("\n");
+		buf.append("    public void test2() throws de.muenchen.test.Exception {\n");
+		buf.append("        throw new de.muenchen.test.Exception();\n");
+		buf.append("    }\n");
+		buf.append("\n");
+		buf.append("    public void test3() {\n");
+		buf.append("        try {\n");
+		buf.append("            java.io.File.createTempFile(\"\", \".tmp\");\n");
+		buf.append("        } catch (Exception ex) {\n");
+		buf.append("\n");
+		buf.append("        }\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		ICompilationUnit cu= pack1.createCompilationUnit("Test.java", buf.toString(), false, null);
+		
+		IPackageFragment pack2= fSourceFolder.createPackageFragment("de.muenchen.test", false, null);
+		buf= new StringBuffer();
+		buf.append("package de.muenchen.test;\n");
+		buf.append("\n");
+		buf.append("public class Exception extends java.lang.Throwable {\n");
+		buf.append("}\n");
+		pack2.createCompilationUnit("Exception.java", buf.toString(), false, null);
+		
+		CompilationUnit astRoot= getASTRoot(cu);
+		ArrayList proposals= collectCorrections(cu, astRoot);
+		assertNumberOfProposals(proposals, 2);
+		assertCorrectLabels(proposals);
+	
+	
+		CUCorrectionProposal proposal= (CUCorrectionProposal) proposals.get(0);
+		String preview1= getPreviewContent(proposal);
+	
+		buf= new StringBuffer();
+		buf.append("package test1;\n");
+		buf.append("public class Test {\n");
+		buf.append("    public void test1() {\n");
+		buf.append("        try {\n");
+		buf.append("            test2();\n");
+		buf.append("        } catch (de.muenchen.test.Exception e) {\n");
+		buf.append("        }\n");
+		buf.append("    }\n");
+		buf.append("\n");
+		buf.append("    public void test2() throws de.muenchen.test.Exception {\n");
+		buf.append("        throw new de.muenchen.test.Exception();\n");
+		buf.append("    }\n");
+		buf.append("\n");
+		buf.append("    public void test3() {\n");
+		buf.append("        try {\n");
+		buf.append("            java.io.File.createTempFile(\"\", \".tmp\");\n");
+		buf.append("        } catch (Exception ex) {\n");
+		buf.append("\n");
+		buf.append("        }\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		String expected1= buf.toString();
+	
+		proposal= (CUCorrectionProposal) proposals.get(1);
+		String preview2= getPreviewContent(proposal);
+	
+		buf= new StringBuffer();
+		buf.append("package test1;\n");
+		buf.append("public class Test {\n");
+		buf.append("    public void test1() throws de.muenchen.test.Exception {\n");
+		buf.append("        test2();\n");
+		buf.append("    }\n");
+		buf.append("\n");
+		buf.append("    public void test2() throws de.muenchen.test.Exception {\n");
+		buf.append("        throw new de.muenchen.test.Exception();\n");
+		buf.append("    }\n");
+		buf.append("\n");
+		buf.append("    public void test3() {\n");
+		buf.append("        try {\n");
+		buf.append("            java.io.File.createTempFile(\"\", \".tmp\");\n");
+		buf.append("        } catch (Exception ex) {\n");
+		buf.append("\n");
+		buf.append("        }\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		String expected2= buf.toString();
+	
+		assertEqualStringsIgnoreOrder(new String[] { preview1, preview2 }, new String[] { expected1, expected2 });
+	}
+
 	public void testUncaughtExceptionExtendedSelection() throws Exception {
 
 		IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null);
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java
index eed85cd..f2edf15 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java
@@ -474,7 +474,7 @@
 		buf= new StringBuffer();
 		IFile propertiesFile= write((IFolder)pack1.getCorrespondingResource(), buf.toString(), "Accessor.properties");
 
-		NLSSearchTestHelper.assertNumberOfProblems(accessor, propertiesFile, 1);
+		NLSSearchTestHelper.assertNumberOfProblems(accessor, propertiesFile, 0);
 	}
 
 	public void testBug247012_4() throws Exception {
@@ -513,4 +513,45 @@
 		NLSSearchTestHelper.assertNumberOfProblems(accessor, propertiesFile, 1);
 		NLSSearchTestHelper.assertHasUndefinedKey(accessor, propertiesFile, "Main.undefined", (IFile)client.getCorrespondingResource(), false);
 	}
+
+	public void testBug295040() throws Exception {
+		IPackageFragment pack1= fSourceFolder.createPackageFragment("test", false, null);
+		StringBuffer buf= new StringBuffer();
+		buf.append("package test;\n");
+		buf.append("import java.util.MissingResourceException;\n");
+		buf.append("import java.util.ResourceBundle;\n");
+		buf.append("public class Accessor {\n");
+		buf.append("    private static final String BUNDLE_NAME = \"test.Accessor\"; //$NON-NLS-1$\n");
+		buf.append("    private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);\n");
+		buf.append("    private Accessor() {}\n");
+		buf.append("    public static String getString(String key) {\n");
+		buf.append("        try {\n");
+		buf.append("            return RESOURCE_BUNDLE.getString(key);\n");
+		buf.append("        } catch (MissingResourceException e) {\n");
+		buf.append("            return '!' + key + '!';\n");
+		buf.append("        }\n");
+		buf.append("    }\n");
+		buf.append("    public static ResourceBundle getResourceBundle() {\n");
+		buf.append("        return RESOURCE_BUNDLE;\n");
+		buf.append("    }\n");
+		buf.append("}\n");
+		ICompilationUnit accessor= pack1.createCompilationUnit("Accessor.java", buf.toString(), false, null);
+
+		buf= new StringBuffer();
+		buf.append("package test;\n");
+		buf.append("public class Client {\n");
+		buf.append("	public static void main(String[] args) { \n");
+		buf.append("		System.out.println(Accessor.getString(\"Client_s1\")); //$NON-NLS-1$ \n");
+		buf.append("		Accessor.getResourceBundle(); \n");
+		buf.append("	}\n");
+		buf.append("}\n");
+
+		pack1.createCompilationUnit("Client.java", buf.toString(), false, null);
+
+		buf= new StringBuffer();
+		buf.append("Client_s1=s1\n");
+		IFile propertiesFile= write((IFolder)pack1.getCorrespondingResource(), buf.toString(), "Accessor.properties");
+
+		NLSSearchTestHelper.assertNumberOfProblems(accessor, propertiesFile, 0);
+	}
 }
diff --git a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/ui/internal/compatibility/InternalsNotRemovedTest.java b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/ui/internal/compatibility/InternalsNotRemovedTest.java
index 6454259..11562cc 100644
--- a/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/ui/internal/compatibility/InternalsNotRemovedTest.java
+++ b/testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/ui/internal/compatibility/InternalsNotRemovedTest.java
@@ -57,6 +57,7 @@
 	void internalMethods() throws Exception {
 		new org.eclipse.jdt.internal.corext.refactoring.structure.CompilationUnitRewrite(null).createChange();
 		new org.eclipse.jdt.internal.corext.refactoring.reorg.JavaMoveProcessor(null).canUpdateReferences();
+		org.eclipse.jdt.internal.ui.actions.OpenBrowserUtil.open(null, null, null);
 	}