Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Herrmann2010-04-02 07:29:49 -0400
committerStephan Herrmann2010-04-02 07:29:49 -0400
commit26da8859db038a267881744b802738ded6a36f39 (patch)
treedeef7bf85fb0ed005180e21fb5e29c0e698a0df8 /testplugins/org.eclipse.jdt.ui.tests
parent13a070b9f9759d52b4fc3ee1d3aa35b29c2867d7 (diff)
downloadorg.eclipse.objectteams-26da8859db038a267881744b802738ded6a36f39.tar.gz
org.eclipse.objectteams-26da8859db038a267881744b802738ded6a36f39.tar.xz
org.eclipse.objectteams-26da8859db038a267881744b802738ded6a36f39.zip
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
Diffstat (limited to 'testplugins/org.eclipse.jdt.ui.tests')
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/chkpii/org/eclipse/jdt/ui/tests/chkpii/ChkpiiTests.java4
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit3TestFinderTest.java7
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnit4TestFinderTest.java4
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/junit/tests/JUnitWorkspaceTestSetup.java10
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/core/AddImportTest.java99
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTestCase.java5
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertForLoopQuickFixTest.java14
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/ConvertIterableLoopQuickFixTest.java5
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/LocalCorrectionsQuickFixTest.java91
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/search/NLSSearchTest.java43
-rw-r--r--testplugins/org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/ui/internal/compatibility/InternalsNotRemovedTest.java1
11 files changed, 258 insertions, 25 deletions
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 5f55182ab..b264b4fe9 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.net.URL;
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 @@ public class ChkpiiTests extends TestCase {
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 924b21cc7..b5f107882 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 java.util.Iterator;
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.IPackageFragmentRoot;
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 @@ public class JUnit3TestFinderTest extends TestCase {
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 97856b400..f89b38b58 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.IPackageFragmentRoot;
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 @@ public class JUnit4TestFinderTest extends TestCase {
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 5688ffa9b..a46d365f1 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.IJavaProject;
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 @@ public class JUnitWorkspaceTestSetup extends TestSetup {
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 03e3d1b85..a754c563c 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 class AddImportTest extends CoreTests {
}
+ 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 @@ public class AddImportTest extends CoreTests {
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 2ea117ca0..9024e6db9 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 @@ public class CleanUpTestCase extends QuickFixTest {
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 a438a018b..31d995371 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 class ConvertForLoopQuickFixTest extends QuickFixTest {
}
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 @@ public class ConvertForLoopQuickFixTest extends QuickFixTest {
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 d0fa6c3e3..6159a5705 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 @@ public final class ConvertIterableLoopQuickFixTest extends QuickFixTest {
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 cc7259fba..67ca74d8e 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 @@ public class LocalCorrectionsQuickFixTest extends QuickFixTest {
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 eed85cdbe..f2edf15e7 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 @@ public class NLSSearchTest extends TestCase {
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 @@ public class NLSSearchTest extends TestCase {
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 6454259f7..11562cc52 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 @@ public class InternalsNotRemovedTest {
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);
}

Back to the top