Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoopur Gupta2013-09-05 12:33:19 +0000
committerManju Mathew2013-10-30 06:50:20 +0000
commit36d99828a30ceeda09de6d664e47bb807714c2cd (patch)
treeaded67f9e941c5938a608df02cd1892061421bd6
parent0c4d2623ca8ce8bb439653a78f9fe03c769646c0 (diff)
downloadeclipse.jdt.ui-36d99828a30ceeda09de6d664e47bb807714c2cd.tar.gz
eclipse.jdt.ui-36d99828a30ceeda09de6d664e47bb807714c2cd.tar.xz
eclipse.jdt.ui-36d99828a30ceeda09de6d664e47bb807714c2cd.zip
Fixed bug 409723: [1.8][introduce indirection] Unable to introduce
indirection on methods in an interface
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_35/in/Foo.java9
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_35/out/Foo.java16
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_36/in/Foo.java9
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_36/out/Foo.java16
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_37/in/Foo.java5
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_37/out/Foo.java12
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/in/C.java7
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/in/Foo.java4
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/out/C.java7
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/out/Foo.java11
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/in/C.java7
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/in/Foo.java4
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/out/C.java7
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/out/Foo.java11
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/in/C.java4
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/in/Foo.java9
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/out/C.java11
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/out/Foo.java9
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java1
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceIndirectionTests.java6
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceIndirectionTests18.java60
-rw-r--r--org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/reorg/IntroduceIndirectionPerfAcceptanceTests.java11
-rw-r--r--org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java8
-rw-r--r--org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/IntroduceIndirectionRefactoring.java115
-rw-r--r--org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties16
-rw-r--r--org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/IntroduceIndirectionInputPage.java14
26 files changed, 311 insertions, 78 deletions
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_35/in/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_35/in/Foo.java
new file mode 100644
index 0000000000..b33139528e
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_35/in/Foo.java
@@ -0,0 +1,9 @@
+package p;
+
+public interface Foo {
+
+ default void d() {
+
+ }
+
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_35/out/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_35/out/Foo.java
new file mode 100644
index 0000000000..6644110b14
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_35/out/Foo.java
@@ -0,0 +1,16 @@
+package p;
+
+public interface Foo {
+
+ /**
+ * @param foo
+ */
+ public static void d(Foo foo) {
+ foo.d();
+ }
+
+ default void d() {
+
+ }
+
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_36/in/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_36/in/Foo.java
new file mode 100644
index 0000000000..fd7e8abfb1
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_36/in/Foo.java
@@ -0,0 +1,9 @@
+package p;
+
+public interface Foo {
+
+ static void s() {
+
+ }
+
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_36/out/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_36/out/Foo.java
new file mode 100644
index 0000000000..e472044a6e
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_36/out/Foo.java
@@ -0,0 +1,16 @@
+package p;
+
+public interface Foo {
+
+ static void s() {
+
+ }
+
+ /**
+ *
+ */
+ public static void s() {
+ Foo.s();
+ }
+
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_37/in/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_37/in/Foo.java
new file mode 100644
index 0000000000..8782ad0c0b
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_37/in/Foo.java
@@ -0,0 +1,5 @@
+package p;
+
+public interface Foo {
+ void a();
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_37/out/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_37/out/Foo.java
new file mode 100644
index 0000000000..f5a6d8eb59
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_37/out/Foo.java
@@ -0,0 +1,12 @@
+package p;
+
+public interface Foo {
+ /**
+ * @param foo
+ */
+ public static void a(Foo foo) {
+ foo.a();
+ }
+
+ void a();
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/in/C.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/in/C.java
new file mode 100644
index 0000000000..cb1ae22d51
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/in/C.java
@@ -0,0 +1,7 @@
+package p;
+
+public class C {
+ void d() {
+
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/in/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/in/Foo.java
new file mode 100644
index 0000000000..2a04996bda
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/in/Foo.java
@@ -0,0 +1,4 @@
+package p;
+
+public interface Foo {
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/out/C.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/out/C.java
new file mode 100644
index 0000000000..cb1ae22d51
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/out/C.java
@@ -0,0 +1,7 @@
+package p;
+
+public class C {
+ void d() {
+
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/out/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/out/Foo.java
new file mode 100644
index 0000000000..629ea2b0b8
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_38/out/Foo.java
@@ -0,0 +1,11 @@
+package p;
+
+public interface Foo {
+
+ /**
+ * @param c
+ */
+ public static void d(C c) {
+ c.d();
+ }
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/in/C.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/in/C.java
new file mode 100644
index 0000000000..5e22c3a5a3
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/in/C.java
@@ -0,0 +1,7 @@
+package p;
+
+public class C {
+ static void s() {
+
+ }
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/in/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/in/Foo.java
new file mode 100644
index 0000000000..2a04996bda
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/in/Foo.java
@@ -0,0 +1,4 @@
+package p;
+
+public interface Foo {
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/out/C.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/out/C.java
new file mode 100644
index 0000000000..5e22c3a5a3
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/out/C.java
@@ -0,0 +1,7 @@
+package p;
+
+public class C {
+ static void s() {
+
+ }
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/out/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/out/Foo.java
new file mode 100644
index 0000000000..1a6dd775b1
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_39/out/Foo.java
@@ -0,0 +1,11 @@
+package p;
+
+public interface Foo {
+
+ /**
+ *
+ */
+ public static void s() {
+ C.s();
+ }
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/in/C.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/in/C.java
new file mode 100644
index 0000000000..cca21a281a
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/in/C.java
@@ -0,0 +1,4 @@
+package p;
+
+public class C {
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/in/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/in/Foo.java
new file mode 100644
index 0000000000..b33139528e
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/in/Foo.java
@@ -0,0 +1,9 @@
+package p;
+
+public interface Foo {
+
+ default void d() {
+
+ }
+
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/out/C.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/out/C.java
new file mode 100644
index 0000000000..9d87367f64
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/out/C.java
@@ -0,0 +1,11 @@
+package p;
+
+public class C {
+
+ /**
+ * @param foo
+ */
+ public static void d(Foo foo) {
+ foo.d();
+ }
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/out/Foo.java b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/out/Foo.java
new file mode 100644
index 0000000000..b33139528e
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/resources/IntroduceIndirection/test18_40/out/Foo.java
@@ -0,0 +1,9 @@
+package p;
+
+public interface Foo {
+
+ default void d() {
+
+ }
+
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java
index 6da9dfab36..e264a4e513 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/AllRefactoringTests.java
@@ -71,6 +71,7 @@ public class AllRefactoringTests {
suite.addTest(MoveInstanceMethodTests.suite());
suite.addTest(IntroduceIndirectionTests.suite());
suite.addTest(IntroduceIndirectionTests17.suite());
+ suite.addTest(IntroduceIndirectionTests18.suite());
//--types
suite.addTest(RenameTypeTests.suite());
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceIndirectionTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceIndirectionTests.java
index 3e8c633a80..897af3ec23 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceIndirectionTests.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceIndirectionTests.java
@@ -4,6 +4,10 @@
* 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
+ *
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -89,7 +93,7 @@ public class IntroduceIndirectionTests extends RefactoringTest {
IntroduceIndirectionRefactoring ref= new IntroduceIndirectionRefactoring(cu[0], selection.getOffset(), selection.getLength());
ref.setEnableUpdateReferences(updateReferences);
if (qTypeName != null)
- ref.setIntermediaryClassName(qTypeName);
+ ref.setIntermediaryTypeName(qTypeName);
if (newName != null)
ref.setIntermediaryMethodName(newName);
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceIndirectionTests18.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceIndirectionTests18.java
new file mode 100644
index 0000000000..0e3743b418
--- /dev/null
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/IntroduceIndirectionTests18.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2013 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
+ *
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.jdt.ui.tests.refactoring;
+
+import junit.framework.Test;
+
+public class IntroduceIndirectionTests18 extends IntroduceIndirectionTests{
+ private static final Class clazz= IntroduceIndirectionTests18.class;
+
+ public IntroduceIndirectionTests18(String name) {
+ super(name);
+ }
+
+ public static Test setUpTest(Test test) {
+ return new Java18Setup(test);
+ }
+
+ public static Test suite() {
+ return setUpTest(new NoSuperTestsSuite(clazz));
+ }
+
+// ---
+
+ public void test18_35() throws Exception {
+ helperPass(new String[] { "p.Foo" }, "d", "p.Foo", 5, 17, 5, 18);
+ }
+
+ public void test18_36() throws Exception {
+ helperErr(new String[] { "p.Foo" }, "s", "p.Foo", 5, 16, 5, 17);
+ }
+
+ public void test18_37() throws Exception {
+ helperPass(new String[] { "p.Foo" }, "a", "p.Foo", 4, 9, 4, 10);
+ }
+
+ public void test18_38() throws Exception {
+ helperPass(new String[] { "p.C", "p.Foo" }, "d", "p.Foo", 4, 9, 4, 10);
+ }
+
+ public void test18_39() throws Exception {
+ helperPass(new String[] { "p.C", "p.Foo" }, "s", "p.Foo", 4, 16, 4, 17);
+ }
+
+ public void test18_40() throws Exception {
+ helperPass(new String[] { "p.Foo", "p.C" }, "d", "p.C", 5, 17, 5, 18);
+ }
+}
diff --git a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/reorg/IntroduceIndirectionPerfAcceptanceTests.java b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/reorg/IntroduceIndirectionPerfAcceptanceTests.java
index 74a1e58881..276661d8b5 100644
--- a/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/reorg/IntroduceIndirectionPerfAcceptanceTests.java
+++ b/org.eclipse.jdt.ui.tests.refactoring/test cases/org/eclipse/jdt/ui/tests/refactoring/reorg/IntroduceIndirectionPerfAcceptanceTests.java
@@ -1,16 +1,19 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jdt.ui.tests.refactoring.reorg;
-import junit.framework.Assert;
import junit.framework.Test;
import org.eclipse.test.OrderedTestSuite;
@@ -55,10 +58,10 @@ public class IntroduceIndirectionPerfAcceptanceTests extends RefactoringPerforma
IType control= fProject.findType("org.eclipse.swt.widgets.Widget");
IMethod m= control.getMethod("getDisplay", new String[0]);
- Assert.assertTrue(m != null && m.exists());
+ assertTrue(m != null && m.exists());
fRefactoring= new IntroduceIndirectionRefactoring(m);
fRefactoring.setEnableUpdateReferences(true);
- fRefactoring.setIntermediaryClassName("org.eclipse.swt.widgets.Widget");
+ fRefactoring.setIntermediaryTypeName("org.eclipse.swt.widgets.Widget");
fRefactoring.setIntermediaryMethodName("bar");
}
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
index 83ab4a32fd..e125f96de1 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/RefactoringCoreMessages.java
@@ -977,11 +977,11 @@ public final class RefactoringCoreMessages extends NLS {
public static String IntroduceIndirectionRefactoring_checking_conditions;
- public static String IntroduceIndirectionRefactoring_class_does_not_exist_error;
+ public static String IntroduceIndirectionRefactoring_type_does_not_exist_error;
- public static String IntroduceIndirectionRefactoring_class_not_selected_error;
+ public static String IntroduceIndirectionRefactoring_type_not_selected_error;
- public static String IntroduceIndirectionRefactoring_could_not_parse_declaring_class_error;
+ public static String IntroduceIndirectionRefactoring_could_not_parse_declaring_type_error;
public static String IntroduceIndirectionRefactoring_declaring_pattern;
@@ -989,7 +989,7 @@ public final class RefactoringCoreMessages extends NLS {
public static String IntroduceIndirectionRefactoring_descriptor_description_short;
- public static String IntroduceIndirectionRefactoring_duplicate_method_name_in_declaring_class_error;
+ public static String IntroduceIndirectionRefactoring_duplicate_method_name_in_declaring_type_error;
public static String IntroduceIndirectionRefactoring_group_description_create_new_method;
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/IntroduceIndirectionRefactoring.java b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/IntroduceIndirectionRefactoring.java
index 884c25554e..39a42ef7b8 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/IntroduceIndirectionRefactoring.java
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/code/IntroduceIndirectionRefactoring.java
@@ -111,6 +111,7 @@ import org.eclipse.jdt.internal.corext.refactoring.structure.MemberVisibilityAdj
import org.eclipse.jdt.internal.corext.refactoring.structure.MemberVisibilityAdjustor.IncomingMemberVisibilityAdjustment;
import org.eclipse.jdt.internal.corext.refactoring.util.ResourceUtil;
import org.eclipse.jdt.internal.corext.refactoring.util.TextChangeManager;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.JdtFlags;
import org.eclipse.jdt.internal.corext.util.Messages;
import org.eclipse.jdt.internal.corext.util.MethodOverrideTester;
@@ -174,13 +175,13 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
// Intermediary information:
/**
- * The class in which to place the intermediary method
+ * The type in which to place the intermediary method
*/
- private IType fIntermediaryClass;
+ private IType fIntermediaryType;
/**
- * The binding of the intermediary class
+ * The binding of the intermediary type
*/
- private ITypeBinding fIntermediaryClassBinding;
+ private ITypeBinding fIntermediaryTypeBinding;
/**
* The name of the intermediary method
*/
@@ -260,11 +261,11 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
initialize(0, 0);
}
- public IntroduceIndirectionRefactoring(JavaRefactoringArguments arguments, RefactoringStatus status) {
- this((ICompilationUnit) null, 0, 0);
- RefactoringStatus initializeStatus= initialize(arguments);
- status.merge(initializeStatus);
- }
+ public IntroduceIndirectionRefactoring(JavaRefactoringArguments arguments, RefactoringStatus status) {
+ this((ICompilationUnit) null, 0, 0);
+ RefactoringStatus initializeStatus= initialize(arguments);
+ status.merge(initializeStatus);
+ }
private void initialize(int offset, int length) {
fSelectionStart= offset;
@@ -304,7 +305,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
public RefactoringStatus setIntermediaryMethodName(String newMethodName) {
Assert.isNotNull(newMethodName);
fIntermediaryMethodName= newMethodName;
- IJavaElement context= fIntermediaryClass != null ? fIntermediaryClass : (IMember) fTargetMethod;
+ IJavaElement context= fIntermediaryType != null ? fIntermediaryType : (IMember) fTargetMethod;
RefactoringStatus stat= Checks.checkMethodName(newMethodName, context);
stat.merge(checkOverloading());
return stat;
@@ -312,17 +313,17 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
private RefactoringStatus checkOverloading() {
try {
- if (fIntermediaryClass != null) {
- IMethod[] toCheck= fIntermediaryClass.getMethods();
+ if (fIntermediaryType != null) {
+ IMethod[] toCheck= fIntermediaryType.getMethods();
for (int i= 0; i < toCheck.length; i++) {
IMethod method= toCheck[i];
if (method.getElementName().equals(fIntermediaryMethodName))
- return RefactoringStatus.createWarningStatus(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_duplicate_method_name_in_declaring_class_error,
+ return RefactoringStatus.createWarningStatus(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_duplicate_method_name_in_declaring_type_error,
BasicElementLabels.getJavaElementName(fIntermediaryMethodName)));
}
}
} catch (JavaModelException e) {
- return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_could_not_parse_declaring_class_error);
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_could_not_parse_declaring_type_error);
}
return new RefactoringStatus();
}
@@ -335,20 +336,20 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
* @param fullyQualifiedTypeName the fully qualified name of the intermediary method
* @return status for type name. Use {@link #setIntermediaryMethodName(String)} to check for overridden methods.
*/
- public RefactoringStatus setIntermediaryClassName(String fullyQualifiedTypeName) {
+ public RefactoringStatus setIntermediaryTypeName(String fullyQualifiedTypeName) {
IType target= null;
try {
if (fullyQualifiedTypeName.length() == 0)
- return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_class_not_selected_error);
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_type_not_selected_error);
// find type (now including secondaries)
target= getProject().findType(fullyQualifiedTypeName, new NullProgressMonitor());
if (target == null || !target.exists())
- return RefactoringStatus.createErrorStatus(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_class_does_not_exist_error, BasicElementLabels.getJavaElementName(fullyQualifiedTypeName)));
+ return RefactoringStatus.createErrorStatus(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_type_does_not_exist_error, BasicElementLabels.getJavaElementName(fullyQualifiedTypeName)));
if (target.isAnnotation())
return RefactoringStatus.createErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_cannot_create_in_annotation);
- if (target.isInterface())
+ if (target.isInterface() && !JavaModelUtil.is18OrHigher(getProject()))
return RefactoringStatus.createErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_cannot_create_on_interface);
} catch (JavaModelException e) {
return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_unable_determine_declaring_type);
@@ -360,17 +361,17 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
if (target.isBinary())
return RefactoringStatus.createErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_cannot_create_in_binary);
- fIntermediaryClass= target;
+ fIntermediaryType= target;
return new RefactoringStatus();
}
/**
- * Returns the class name of the intermediary class, or the empty string if none has been set yet.
- * @return the intermediary class name or the empty string
+ * Returns the type name of the intermediary type, or the empty string if none has been set yet.
+ * @return the intermediary type name or the empty string
*/
- public String getIntermediaryClassName() {
- return fIntermediaryClass != null ? fIntermediaryClass.getFullyQualifiedName('.') : ""; //$NON-NLS-1$
+ public String getIntermediaryTypeName() {
+ return fIntermediaryType != null ? fIntermediaryType.getFullyQualifiedName('.') : ""; //$NON-NLS-1$
}
// ********** CONDITION CHECKING **********
@@ -462,11 +463,11 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
if (fIntermediaryMethodName == null)
fIntermediaryMethodName= fTargetMethod.getElementName();
- if (fIntermediaryClass == null) {
+ if (fIntermediaryType == null) {
if (fSelectionCompilationUnit != null && !fSelectionCompilationUnit.isReadOnly())
- fIntermediaryClass= getEnclosingInitialSelectionMember().getDeclaringType();
+ fIntermediaryType= getEnclosingInitialSelectionMember().getDeclaringType();
else if (!fTargetMethod.isBinary() && !fTargetMethod.isReadOnly())
- fIntermediaryClass= fTargetMethod.getDeclaringType();
+ fIntermediaryType= fTargetMethod.getDeclaringType();
}
return new RefactoringStatus();
@@ -481,7 +482,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
RefactoringStatus result= new RefactoringStatus();
fTextChangeManager= new TextChangeManager();
fIntermediaryFirstParameterType= null;
- fIntermediaryClassBinding= null;
+ fIntermediaryTypeBinding= null;
for (Iterator<CompilationUnitRewrite> iter= fRewrites.values().iterator(); iter.hasNext();)
iter.next().clearASTAndImportRewrites();
@@ -494,23 +495,23 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
pm.beginTask("", startupTicks + hierarchyTicks + visibilityTicks + referenceTicks + creationTicks); //$NON-NLS-1$
pm.setTaskName(RefactoringCoreMessages.IntroduceIndirectionRefactoring_checking_conditions);
- result.merge(Checks.checkMethodName(fIntermediaryMethodName, fIntermediaryClass));
+ result.merge(Checks.checkMethodName(fIntermediaryMethodName, fIntermediaryType));
if (result.hasFatalError())
return result;
- if (fIntermediaryClass == null)
+ if (fIntermediaryType == null)
return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_cannot_run_without_intermediary_type);
- // intermediary class is already non binary/non-enum/non-interface.
- CompilationUnitRewrite imRewrite= getCachedCURewrite(fIntermediaryClass.getCompilationUnit());
- fIntermediaryClassBinding= typeToBinding(fIntermediaryClass, imRewrite.getRoot());
+ // intermediary type is already non binary/non-enum
+ CompilationUnitRewrite imRewrite= getCachedCURewrite(fIntermediaryType.getCompilationUnit());
+ fIntermediaryTypeBinding= typeToBinding(fIntermediaryType, imRewrite.getRoot());
- fAdjustor= new MemberVisibilityAdjustor(fIntermediaryClass, fIntermediaryClass);
+ fAdjustor= new MemberVisibilityAdjustor(fIntermediaryType, fIntermediaryType);
fIntermediaryAdjustments= new HashMap<IMember, IncomingMemberVisibilityAdjustment>();
// check static method in non-static nested type
- if (fIntermediaryClassBinding.isNested() && !Modifier.isStatic(fIntermediaryClassBinding.getModifiers()))
- return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_cannot_create_in_nested_nonstatic, JavaStatusContext.create(fIntermediaryClass));
+ if (fIntermediaryTypeBinding.isNested() && !Modifier.isStatic(fIntermediaryTypeBinding.getModifiers()))
+ return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.IntroduceIndirectionRefactoring_cannot_create_in_nested_nonstatic, JavaStatusContext.create(fIntermediaryType));
pm.worked(startupTicks);
if (pm.isCanceled())
@@ -533,7 +534,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
// does call see the intermediary method?
// => increase visibility of the type of the intermediary method.
- result.merge(adjustVisibility(fIntermediaryClass, enclosing.getDeclaringType(), new NoOverrideProgressMonitor(pm, 0)));
+ result.merge(adjustVisibility(fIntermediaryType, enclosing.getDeclaringType(), new NoOverrideProgressMonitor(pm, 0)));
}
pm.worked(referenceTicks);
}
@@ -564,7 +565,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
pm.worked(visibilityTicks);
pm.setTaskName(RefactoringCoreMessages.IntroduceIndirectionRefactoring_checking_conditions);
- createChangeAndDiscardRewrite(fIntermediaryClass.getCompilationUnit());
+ createChangeAndDiscardRewrite(fIntermediaryType.getCompilationUnit());
result.merge(Checks.validateModifiesFiles(getAllFilesToModify(), getValidationContext()));
pm.done();
@@ -583,11 +584,11 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
// This method is called after all other changes have been
// created. Changes induced by this method will be attached to those changes.
- result.merge(adjustVisibility((IType) fIntermediaryFirstParameterType.getJavaElement(), fIntermediaryClass, monitor));
+ result.merge(adjustVisibility((IType) fIntermediaryFirstParameterType.getJavaElement(), fIntermediaryType, monitor));
if (result.hasError())
return result; // binary
- ModifierKeyword neededVisibility= getNeededVisibility(fTargetMethod, fIntermediaryClass);
+ ModifierKeyword neededVisibility= getNeededVisibility(fTargetMethod, fIntermediaryType);
if (neededVisibility != null) {
result.merge(adjustVisibility(fTargetMethod, neededVisibility, monitor));
@@ -685,7 +686,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
// does call see the intermediary method?
// => increase visibility of the type of the intermediary method.
- result.merge(adjustVisibility(fIntermediaryClass, enclosingMember.getDeclaringType(), new NoOverrideProgressMonitor(monitor, 0)));
+ result.merge(adjustVisibility(fIntermediaryType, enclosingMember.getDeclaringType(), new NoOverrideProgressMonitor(monitor, 0)));
if (monitor.isCanceled())
throw new OperationCanceledException();
@@ -763,13 +764,13 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
final JDTRefactoringDescriptorComment comment= new JDTRefactoringDescriptorComment(project, this, header);
comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_original_pattern, JavaElementLabels.getTextLabel(fTargetMethod, JavaElementLabels.ALL_FULLY_QUALIFIED)));
comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_method_pattern, BasicElementLabels.getJavaElementName(fIntermediaryMethodName)));
- comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_declaring_pattern, JavaElementLabels.getTextLabel(fIntermediaryClass, JavaElementLabels.ALL_FULLY_QUALIFIED)));
+ comment.addSetting(Messages.format(RefactoringCoreMessages.IntroduceIndirectionRefactoring_declaring_pattern, JavaElementLabels.getTextLabel(fIntermediaryType, JavaElementLabels.ALL_FULLY_QUALIFIED)));
if (fUpdateReferences)
comment.addSetting(RefactoringCoreMessages.JavaRefactoringDescriptor_update_references);
final IntroduceIndirectionDescriptor descriptor= RefactoringSignatureDescriptorFactory.createIntroduceIndirectionDescriptor(project, description, comment.asString(), arguments, flags);
arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_INPUT, JavaRefactoringDescriptorUtil.elementToHandle(project, fTargetMethod));
arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_NAME, fIntermediaryMethodName);
- arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + 1, JavaRefactoringDescriptorUtil.elementToHandle(project, fIntermediaryClass));
+ arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + 1, JavaRefactoringDescriptorUtil.elementToHandle(project, fIntermediaryType));
arguments.put(JavaRefactoringDescriptorUtil.ATTRIBUTE_REFERENCES, Boolean.valueOf(fUpdateReferences).toString());
return new DynamicValidationRefactoringChange(descriptor, RefactoringCoreMessages.IntroduceIndirectionRefactoring_introduce_indirection, fTextChangeManager.getAllChanges());
}
@@ -788,17 +789,17 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
if (!isStaticTarget())
parameterBindings.add(fIntermediaryFirstParameterType);
parameterBindings.addAll(Arrays.asList(fTargetMethodBinding.getParameterTypes()));
- return Checks.checkMethodInType(fIntermediaryClassBinding, fIntermediaryMethodName, parameterBindings.toArray(new ITypeBinding[parameterBindings.size()]));
+ return Checks.checkMethodInType(fIntermediaryTypeBinding, fIntermediaryMethodName, parameterBindings.toArray(new ITypeBinding[parameterBindings.size()]));
}
private void createIntermediaryMethod() throws CoreException {
- CompilationUnitRewrite imRewrite= getCachedCURewrite(fIntermediaryClass.getCompilationUnit());
+ CompilationUnitRewrite imRewrite= getCachedCURewrite(fIntermediaryType.getCompilationUnit());
AST ast= imRewrite.getAST();
MethodDeclaration intermediary= ast.newMethodDeclaration();
// Intermediary class is non-anonymous
- AbstractTypeDeclaration type= (AbstractTypeDeclaration)typeToDeclaration(fIntermediaryClass, imRewrite.getRoot());
+ AbstractTypeDeclaration type= (AbstractTypeDeclaration)typeToDeclaration(fIntermediaryType, imRewrite.getRoot());
// Name
intermediary.setName(ast.newSimpleName(fIntermediaryMethodName));
@@ -830,7 +831,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
// Add other params
copyArguments(intermediary, imRewrite);
- // Add type parameters of declaring class (and enclosing classes)
+ // Add type parameters of declaring type (and enclosing types)
if (!isStaticTarget() && fIntermediaryFirstParameterType.isGenericType())
addTypeParameters(imRewrite, intermediary.typeParameters(), fIntermediaryFirstParameterType);
@@ -862,7 +863,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
// method comment
ICompilationUnit targetCU= imRewrite.getCu();
if (StubUtility.doAddComments(targetCU.getJavaProject())) {
- String comment= CodeGeneration.getMethodComment(targetCU, getIntermediaryClassName(), intermediary, null, StubUtility.getLineDelimiterUsed(targetCU));
+ String comment= CodeGeneration.getMethodComment(targetCU, getIntermediaryTypeName(), intermediary, null, StubUtility.getLineDelimiterUsed(targetCU));
if (comment != null) {
Javadoc javadoc= (Javadoc) imRewrite.getASTRewrite().createStringPlaceholder(comment, ASTNode.JAVADOC);
intermediary.setJavadoc(javadoc);
@@ -870,7 +871,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
}
// Add the completed method to the intermediary type:
- ChildListPropertyDescriptor typeBodyDeclarationsProperty= typeToBodyDeclarationProperty(fIntermediaryClass, imRewrite.getRoot());
+ ChildListPropertyDescriptor typeBodyDeclarationsProperty= typeToBodyDeclarationProperty(fIntermediaryType, imRewrite.getRoot());
ListRewrite bodyDeclarationsListRewrite= imRewrite.getASTRewrite().getListRewrite(type, typeBodyDeclarationsProperty);
bodyDeclarationsListRewrite.insertAt(intermediary, ASTNodes.getInsertionIndex(intermediary, type.bodyDeclarations()), imRewrite
@@ -971,7 +972,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
List<Expression> originalInvocationArgs= originalInvocation.arguments();
// static call => always use a qualifier
- String qualifier= unitRewriter.getImportRewrite().addImport(fIntermediaryClassBinding);
+ String qualifier= unitRewriter.getImportRewrite().addImport(fIntermediaryTypeBinding);
newInvocation.setExpression(ASTNodeFactory.newName(unitRewriter.getAST(), qualifier));
newInvocation.setName(unitRewriter.getAST().newSimpleName(getIntermediaryMethodName()));
@@ -994,7 +995,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
}
} else {
if (expression != null) {
- // Check if expression is the class name. If not, there may
+ // Check if expression is the type name. If not, there may
// be side effects (e.g. inside methods) -> don't update
if (! (expression instanceof Name) || ASTNodes.getTypeBinding((Name) expression) == null)
return createWarningAboutCall(enclosing, originalInvocation, RefactoringCoreMessages.IntroduceIndirectionRefactoring_call_warning_static_expression_access);
@@ -1043,13 +1044,13 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
ITypeBinding currentTypeBinding= null;
if (methodDeclaration != null) {
- // Case 1) : Declaring class is inside this cu => use its name if it's declared in an enclosing type
+ // Case 1) : Declaring type is inside this cu => use its name if it's declared in an enclosing type
if (ASTNodes.isParent(originalInvocation, methodDeclaration.getParent()))
currentTypeBinding= methodBinding.getDeclaringClass();
else
currentTypeBinding= ASTNodes.getEnclosingType(originalInvocation);
} else {
- // Case 2) : Declaring class is outside of this cu => find subclass in this cu
+ // Case 2) : Declaring type is outside of this cu => find subclass in this cu
ASTNode currentTypeDeclaration= getEnclosingTypeDeclaration(originalInvocation);
currentTypeBinding= ASTNodes.getEnclosingType(currentTypeDeclaration);
while (currentTypeDeclaration != null && (Bindings.findMethodInHierarchy(currentTypeBinding, methodBinding.getName(), methodBinding.getParameterTypes()) == null)) {
@@ -1138,7 +1139,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
}
private boolean isRewriteKept(ICompilationUnit compilationUnit) {
- return fIntermediaryClass.getCompilationUnit().equals(compilationUnit);
+ return fIntermediaryType.getCompilationUnit().equals(compilationUnit);
}
private void createChangeAndDiscardRewrite(ICompilationUnit compilationUnit) throws CoreException {
@@ -1151,7 +1152,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
private SearchResultGroup[] getReferences(IMethod[] methods, IProgressMonitor pm, RefactoringStatus status) throws CoreException {
SearchPattern pattern= RefactoringSearchEngine.createOrPattern(methods, IJavaSearchConstants.REFERENCES);
- IJavaSearchScope scope= RefactoringScopeFactory.create(fIntermediaryClass, false);
+ IJavaSearchScope scope= RefactoringScopeFactory.create(fIntermediaryType, false);
return RefactoringSearchEngine.search(pattern, scope, pm, status);
}
@@ -1335,8 +1336,8 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
&& MemberVisibilityAdjustor.needsVisibilityAdjustments(whoToAdjust, neededVisibility, adjustments))
adjustments.put(whoToAdjust, new MemberVisibilityAdjustor.IncomingMemberVisibilityAdjustment(whoToAdjust, neededVisibility,
RefactoringStatus.createWarningStatus(Messages.format(MemberVisibilityAdjustor.getMessage(whoToAdjust), new String[] {
- MemberVisibilityAdjustor.getLabel(whoToAdjust), MemberVisibilityAdjustor.getLabel(neededVisibility) }), JavaStatusContext
- .create(whoToAdjust))));
+ MemberVisibilityAdjustor.getLabel(whoToAdjust), MemberVisibilityAdjustor.getLabel(neededVisibility) }), JavaStatusContext
+ .create(whoToAdjust))));
}
private RefactoringStatus initialize(JavaRefactoringArguments arguments) {
@@ -1355,7 +1356,7 @@ public class IntroduceIndirectionRefactoring extends Refactoring {
if (element == null || !element.exists() || element.getElementType() != IJavaElement.TYPE)
return JavaRefactoringDescriptorUtil.createInputFatalStatus(element, getName(), IJavaRefactorings.INTRODUCE_INDIRECTION);
else
- fIntermediaryClass= (IType) element;
+ fIntermediaryType= (IType) element;
} else
return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.InitializableRefactoring_argument_not_exist, JavaRefactoringDescriptorUtil.ATTRIBUTE_ELEMENT + 1));
final String references= arguments.getAttribute(JavaRefactoringDescriptorUtil.ATTRIBUTE_REFERENCES);
diff --git a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
index a074811087..9bfa55b149 100644
--- a/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
+++ b/org.eclipse.jdt.ui/core refactoring/org/eclipse/jdt/internal/corext/refactoring/refactoring.properties
@@ -1301,15 +1301,15 @@ ChangeTypeRefactoring_uniontypeNotSupported=Generalize Declared Type is not supp
#--- Introduce Indirection
IntroduceIndirectionRefactoring_introduce_indirection_name=Introduce Indirection
-IntroduceIndirectionRefactoring_duplicate_method_name_in_declaring_class_error=Duplicate method name ''{0}'' in declaring class
-IntroduceIndirectionRefactoring_could_not_parse_declaring_class_error=Could not parse declaring class.
-IntroduceIndirectionRefactoring_class_does_not_exist_error=Class ''{0}'' does not exist.
-IntroduceIndirectionRefactoring_class_not_selected_error=Please select a declaring class.
+IntroduceIndirectionRefactoring_duplicate_method_name_in_declaring_type_error=Duplicate method name ''{0}'' in declaring type
+IntroduceIndirectionRefactoring_could_not_parse_declaring_type_error=Could not parse declaring type.
+IntroduceIndirectionRefactoring_type_does_not_exist_error=Type ''{0}'' does not exist.
+IntroduceIndirectionRefactoring_type_not_selected_error=Please select a declaring type.
IntroduceIndirectionRefactoring_cannot_create_in_annotation=Cannot place new method on an annotation.
IntroduceIndirectionRefactoring_cannot_create_on_interface=Cannot place new method on an interface.
IntroduceIndirectionRefactoring_unable_determine_declaring_type=Unable to determine whether declaring type is an interface.
-IntroduceIndirectionRefactoring_cannot_create_in_readonly=Cannot place new method in a read-only class.
-IntroduceIndirectionRefactoring_cannot_create_in_binary=Cannot place new method in a binary class.
+IntroduceIndirectionRefactoring_cannot_create_in_readonly=Cannot place new method in a read-only type.
+IntroduceIndirectionRefactoring_cannot_create_in_binary=Cannot place new method in a binary type.
IntroduceIndirectionRefactoring_checking_activation=Checking activation of Introduce Indirection...
IntroduceIndirectionRefactoring_not_available_on_this_selection=Introduce Indirection is not available on this selection. Select a method invocation or a method declaration.
IntroduceIndirectionRefactoring_not_available_on_annotation=Introduce Indirection is not supported on annotation types.
@@ -1329,12 +1329,12 @@ IntroduceIndirectionRefactoring_original_pattern=Original element: ''{0}''
IntroduceIndirectionRefactoring_introduce_indirection=Introduce Indirection
IntroduceIndirectionRefactoring_group_description_create_new_method=Create new method
IntroduceIndirectionRefactoring_call_warning_type_arguments=A method invocation in ''{0}'' in type ''{1}'' uses type arguments. This occurrence will not be updated.
-IntroduceIndirectionRefactoring_call_warning_static_expression_access=The target method is static, but a method invocation in ''{0}'' in type ''{1}'' is based on an expression rather than the class itself. This occurrence will not be updated.
+IntroduceIndirectionRefactoring_call_warning_static_expression_access=The target method is static, but a method invocation in ''{0}'' in type ''{1}'' is based on an expression rather than the type itself. This occurrence will not be updated.
IntroduceIndirectionRefactoring_group_description_replace_call=Replace method invocation
IntroduceIndirectionRefactoring_call_warning_declaring_type_not_found=The declaring type of a method invocation in ''{0}'' in type ''{1}'' could not be found. This occurrence will not be updated.
IntroduceIndirectionRefactoring_call_warning_anonymous_cannot_qualify=The declaring type of a method invocation in ''{0}'' in type ''{1}'' is anonymous and therefore cannot be qualified. This occurrence will not be updated.
IntroduceIndirectionRefactoring_cannot_update_binary_target_visibility=A visibility update is needed for the member ''{0}'' or an enclosing type, but the member is not writable. Refactoring will introduce compile errors.
-IntroduceIndirectionRefactoring_cannot_run_without_intermediary_type=Cannot run Introduce Indirection without a target class.
+IntroduceIndirectionRefactoring_cannot_run_without_intermediary_type=Cannot run Introduce Indirection without a target type.
#--- Infer Type Arguments
InferTypeArgumentsRefactoring_name=Infer Type Arguments
diff --git a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/IntroduceIndirectionInputPage.java b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/IntroduceIndirectionInputPage.java
index b1d759ef45..cd6d41d4e0 100644
--- a/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/IntroduceIndirectionInputPage.java
+++ b/org.eclipse.jdt.ui/ui refactoring/org/eclipse/jdt/internal/ui/refactoring/IntroduceIndirectionInputPage.java
@@ -1,10 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2000, 2011 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 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
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -42,6 +46,7 @@ import org.eclipse.jdt.core.search.IJavaSearchScope;
import org.eclipse.jdt.core.search.SearchEngine;
import org.eclipse.jdt.internal.corext.refactoring.code.IntroduceIndirectionRefactoring;
+import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.dialogs.FilteredTypesSelectionDialog;
@@ -138,7 +143,7 @@ public class IntroduceIndirectionInputPage extends UserInputWizardPage {
enableReferencesCheckBox.setLayoutData(gd);
fIntermediaryMethodName.setText(getIntroduceIndirectionRefactoring().getIntermediaryMethodName());
- fIntermediaryTypeName.setText(getIntroduceIndirectionRefactoring().getIntermediaryClassName());
+ fIntermediaryTypeName.setText(getIntroduceIndirectionRefactoring().getIntermediaryTypeName());
fIntermediaryMethodName.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
@@ -195,7 +200,8 @@ public class IntroduceIndirectionInputPage extends UserInputWizardPage {
IJavaElement[] elements= new IJavaElement[] { proj };
IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
- FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, IJavaSearchConstants.CLASS);
+ int elementKinds= JavaModelUtil.is18OrHigher(proj) ? IJavaSearchConstants.CLASS_AND_INTERFACE : IJavaSearchConstants.CLASS;
+ FilteredTypesSelectionDialog dialog= new FilteredTypesSelectionDialog(getShell(), false, getWizard().getContainer(), scope, elementKinds);
dialog.setTitle(RefactoringMessages.IntroduceIndirectionInputPage_dialog_choose_declaring_class);
dialog.setMessage(RefactoringMessages.IntroduceIndirectionInputPage_dialog_choose_declaring_class_long);
@@ -212,7 +218,7 @@ public class IntroduceIndirectionInputPage extends UserInputWizardPage {
private void validateInput() {
RefactoringStatus merged= new RefactoringStatus();
- merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryClassName(fIntermediaryTypeName.getText()));
+ merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryTypeName(fIntermediaryTypeName.getText()));
merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryMethodName(fIntermediaryMethodName.getText()));
setPageComplete(!merged.hasError());

Back to the top