Lines 4485-4491
Link Here
|
4485 |
public void testAddFinal01() throws Exception { |
4485 |
public void testAddFinal01() throws Exception { |
4486 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4486 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4487 |
StringBuffer buf= new StringBuffer(); |
4487 |
StringBuffer buf= new StringBuffer(); |
4488 |
buf.append("package test;\n"); |
4488 |
buf.append("package test1;\n"); |
4489 |
buf.append("public class E {\n"); |
4489 |
buf.append("public class E {\n"); |
4490 |
buf.append(" private int i= 0;\n"); |
4490 |
buf.append(" private int i= 0;\n"); |
4491 |
buf.append(" public void foo(int j, int k) {\n"); |
4491 |
buf.append(" public void foo(int j, int k) {\n"); |
Lines 4502-4508
Link Here
|
4502 |
refactoring.addCleanUp(cleanUp); |
4502 |
refactoring.addCleanUp(cleanUp); |
4503 |
|
4503 |
|
4504 |
buf= new StringBuffer(); |
4504 |
buf= new StringBuffer(); |
4505 |
buf.append("package test;\n"); |
4505 |
buf.append("package test1;\n"); |
4506 |
buf.append("public class E {\n"); |
4506 |
buf.append("public class E {\n"); |
4507 |
buf.append(" private final int i= 0;\n"); |
4507 |
buf.append(" private final int i= 0;\n"); |
4508 |
buf.append(" public void foo(final int j, final int k) {\n"); |
4508 |
buf.append(" public void foo(final int j, final int k) {\n"); |
Lines 4519-4525
Link Here
|
4519 |
public void testAddFinal02() throws Exception { |
4519 |
public void testAddFinal02() throws Exception { |
4520 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4520 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4521 |
StringBuffer buf= new StringBuffer(); |
4521 |
StringBuffer buf= new StringBuffer(); |
4522 |
buf.append("package test;\n"); |
4522 |
buf.append("package test1;\n"); |
4523 |
buf.append("public class E {\n"); |
4523 |
buf.append("public class E {\n"); |
4524 |
buf.append(" private Object obj1;\n"); |
4524 |
buf.append(" private Object obj1;\n"); |
4525 |
buf.append(" protected Object obj2;\n"); |
4525 |
buf.append(" protected Object obj2;\n"); |
Lines 4535-4541
Link Here
|
4535 |
refactoring.addCleanUp(cleanUp); |
4535 |
refactoring.addCleanUp(cleanUp); |
4536 |
|
4536 |
|
4537 |
buf= new StringBuffer(); |
4537 |
buf= new StringBuffer(); |
4538 |
buf.append("package test;\n"); |
4538 |
buf.append("package test1;\n"); |
4539 |
buf.append("public class E {\n"); |
4539 |
buf.append("public class E {\n"); |
4540 |
buf.append(" private final Object obj1;\n"); |
4540 |
buf.append(" private final Object obj1;\n"); |
4541 |
buf.append(" protected Object obj2;\n"); |
4541 |
buf.append(" protected Object obj2;\n"); |
Lines 4550-4556
Link Here
|
4550 |
public void testAddFinal03() throws Exception { |
4550 |
public void testAddFinal03() throws Exception { |
4551 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4551 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4552 |
StringBuffer buf= new StringBuffer(); |
4552 |
StringBuffer buf= new StringBuffer(); |
4553 |
buf.append("package test;\n"); |
4553 |
buf.append("package test1;\n"); |
4554 |
buf.append("public class E {\n"); |
4554 |
buf.append("public class E {\n"); |
4555 |
buf.append(" private int i = 0;\n"); |
4555 |
buf.append(" private int i = 0;\n"); |
4556 |
buf.append(" public void foo() throws Exception {\n"); |
4556 |
buf.append(" public void foo() throws Exception {\n"); |
Lines 4572-4578
Link Here
|
4572 |
refactoring.addCleanUp(cleanUp); |
4572 |
refactoring.addCleanUp(cleanUp); |
4573 |
|
4573 |
|
4574 |
buf= new StringBuffer(); |
4574 |
buf= new StringBuffer(); |
4575 |
buf.append("package test;\n"); |
4575 |
buf.append("package test1;\n"); |
4576 |
buf.append("public class E {\n"); |
4576 |
buf.append("public class E {\n"); |
4577 |
buf.append(" private int i = 0;\n"); |
4577 |
buf.append(" private int i = 0;\n"); |
4578 |
buf.append(" public void foo() throws Exception {\n"); |
4578 |
buf.append(" public void foo() throws Exception {\n"); |
Lines 4593-4599
Link Here
|
4593 |
public void testAddFinal04() throws Exception { |
4593 |
public void testAddFinal04() throws Exception { |
4594 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4594 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4595 |
StringBuffer buf= new StringBuffer(); |
4595 |
StringBuffer buf= new StringBuffer(); |
4596 |
buf.append("package test;\n"); |
4596 |
buf.append("package test1;\n"); |
4597 |
buf.append("public class E {\n"); |
4597 |
buf.append("public class E {\n"); |
4598 |
buf.append(" private int i = 0;\n"); |
4598 |
buf.append(" private int i = 0;\n"); |
4599 |
buf.append(" public void foo() throws Exception {\n"); |
4599 |
buf.append(" public void foo() throws Exception {\n"); |
Lines 4615-4621
Link Here
|
4615 |
refactoring.addCleanUp(cleanUp); |
4615 |
refactoring.addCleanUp(cleanUp); |
4616 |
|
4616 |
|
4617 |
buf= new StringBuffer(); |
4617 |
buf= new StringBuffer(); |
4618 |
buf.append("package test;\n"); |
4618 |
buf.append("package test1;\n"); |
4619 |
buf.append("public class E {\n"); |
4619 |
buf.append("public class E {\n"); |
4620 |
buf.append(" private int i = 0;\n"); |
4620 |
buf.append(" private int i = 0;\n"); |
4621 |
buf.append(" public void foo() throws Exception {\n"); |
4621 |
buf.append(" public void foo() throws Exception {\n"); |
Lines 4636-4642
Link Here
|
4636 |
public void testAddFinal05() throws Exception { |
4636 |
public void testAddFinal05() throws Exception { |
4637 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4637 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4638 |
StringBuffer buf= new StringBuffer(); |
4638 |
StringBuffer buf= new StringBuffer(); |
4639 |
buf.append("package test;\n"); |
4639 |
buf.append("package test1;\n"); |
4640 |
buf.append("public class E {\n"); |
4640 |
buf.append("public class E {\n"); |
4641 |
buf.append(" public void foo() {\n"); |
4641 |
buf.append(" public void foo() {\n"); |
4642 |
buf.append(" int i= 0;\n"); |
4642 |
buf.append(" int i= 0;\n"); |
Lines 4654-4660
Link Here
|
4654 |
refactoring.addCleanUp(new ExpressionsCleanUp(ExpressionsCleanUp.ADD_PARANOIC_PARENTHESIS)); |
4654 |
refactoring.addCleanUp(new ExpressionsCleanUp(ExpressionsCleanUp.ADD_PARANOIC_PARENTHESIS)); |
4655 |
|
4655 |
|
4656 |
buf= new StringBuffer(); |
4656 |
buf= new StringBuffer(); |
4657 |
buf.append("package test;\n"); |
4657 |
buf.append("package test1;\n"); |
4658 |
buf.append("public class E {\n"); |
4658 |
buf.append("public class E {\n"); |
4659 |
buf.append(" public void foo() {\n"); |
4659 |
buf.append(" public void foo() {\n"); |
4660 |
buf.append(" final int i= 0;\n"); |
4660 |
buf.append(" final int i= 0;\n"); |
Lines 4670-4676
Link Here
|
4670 |
public void testAddFinalBug129807() throws Exception { |
4670 |
public void testAddFinalBug129807() throws Exception { |
4671 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4671 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4672 |
StringBuffer buf= new StringBuffer(); |
4672 |
StringBuffer buf= new StringBuffer(); |
4673 |
buf.append("package test;\n"); |
4673 |
buf.append("package test1;\n"); |
4674 |
buf.append("public abstract class E {\n"); |
4674 |
buf.append("public abstract class E {\n"); |
4675 |
buf.append(" public interface I {\n"); |
4675 |
buf.append(" public interface I {\n"); |
4676 |
buf.append(" void foo(int i);\n"); |
4676 |
buf.append(" void foo(int i);\n"); |
Lines 4690-4696
Link Here
|
4690 |
refactoring.addCleanUp(cleanUp); |
4690 |
refactoring.addCleanUp(cleanUp); |
4691 |
|
4691 |
|
4692 |
buf= new StringBuffer(); |
4692 |
buf= new StringBuffer(); |
4693 |
buf.append("package test;\n"); |
4693 |
buf.append("package test1;\n"); |
4694 |
buf.append("public abstract class E {\n"); |
4694 |
buf.append("public abstract class E {\n"); |
4695 |
buf.append(" public interface I {\n"); |
4695 |
buf.append(" public interface I {\n"); |
4696 |
buf.append(" void foo(int i);\n"); |
4696 |
buf.append(" void foo(int i);\n"); |
Lines 4767-4770
Link Here
|
4767 |
assertRefactoringResultAsExpected(refactoring, new String[] {expected1}); |
4767 |
assertRefactoringResultAsExpected(refactoring, new String[] {expected1}); |
4768 |
} |
4768 |
} |
4769 |
|
4769 |
|
|
|
4770 |
public void testRemoveQualifiedNames01() throws Exception { |
4771 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4772 |
StringBuffer buf= new StringBuffer(); |
4773 |
buf.append("import java.awt.List;\n"); |
4774 |
buf.append("package test1;\n"); |
4775 |
buf.append("public class E1 {\n"); |
4776 |
buf.append(" private java.util.BitSet set;\n"); |
4777 |
buf.append(" private void foo(java.util.AbstractList al) {\n"); |
4778 |
buf.append(" List awtList;\n"); |
4779 |
buf.append(" java.util.List l;\n"); |
4780 |
buf.append(" l= new java.util.ArrayList();\n"); |
4781 |
buf.append(" }\n"); |
4782 |
buf.append("}\n"); |
4783 |
ICompilationUnit cu1= pack1.createCompilationUnit("E1.java", buf.toString(), false, null); |
4784 |
|
4785 |
CleanUpRefactoring refactoring= new CleanUpRefactoring(); |
4786 |
refactoring.addCompilationUnit(cu1); |
4787 |
|
4788 |
ICleanUp cleanUp= new VariableDeclarationCleanUp(VariableDeclarationCleanUp.REPLACE_QUALIFIED_NAMES_WITH_IMPORT); |
4789 |
refactoring.addCleanUp(cleanUp); |
4790 |
|
4791 |
buf= new StringBuffer(); |
4792 |
buf.append("import java.awt.List;\n"); |
4793 |
buf.append("import java.util.AbstractList;\n"); |
4794 |
buf.append("import java.util.ArrayList;\n"); |
4795 |
buf.append("import java.util.BitSet;\n"); |
4796 |
buf.append("package test1;\n"); |
4797 |
buf.append("public class E1 {\n"); |
4798 |
buf.append(" private BitSet set;\n"); |
4799 |
buf.append(" private void foo(AbstractList al) {\n"); |
4800 |
buf.append(" List awtList;\n"); |
4801 |
buf.append(" java.util.List l;\n"); |
4802 |
buf.append(" l= new ArrayList();\n"); |
4803 |
buf.append(" }\n"); |
4804 |
buf.append("}\n"); |
4805 |
String expected1= buf.toString(); |
4806 |
|
4807 |
assertRefactoringResultAsExpected(refactoring, new String[] {expected1}); |
4808 |
} |
4809 |
|
4810 |
public void testRemoveQualifiedNames02() throws Exception { |
4811 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4812 |
StringBuffer buf= new StringBuffer(); |
4813 |
buf.append("package test1;\n"); |
4814 |
buf.append("import test2.E2;\n"); |
4815 |
buf.append("public class E1 {\n"); |
4816 |
buf.append(" E2.Sub sub;\n"); |
4817 |
buf.append("}\n"); |
4818 |
ICompilationUnit cu1= pack1.createCompilationUnit("E1.java", buf.toString(), false, null); |
4819 |
|
4820 |
IPackageFragment pack2= fSourceFolder.createPackageFragment("test2", false, null); |
4821 |
buf= new StringBuffer(); |
4822 |
buf.append("package test2;\n"); |
4823 |
buf.append("public class E2 {\n"); |
4824 |
buf.append(" public class Sub {}\n"); |
4825 |
buf.append("}\n"); |
4826 |
pack2.createCompilationUnit("E2.java", buf.toString(), false, null); |
4827 |
|
4828 |
CleanUpRefactoring refactoring= new CleanUpRefactoring(); |
4829 |
refactoring.addCompilationUnit(cu1); |
4830 |
|
4831 |
ICleanUp cleanUp= new VariableDeclarationCleanUp(VariableDeclarationCleanUp.REPLACE_QUALIFIED_NAMES_WITH_IMPORT); |
4832 |
refactoring.addCleanUp(cleanUp); |
4833 |
|
4834 |
buf= new StringBuffer(); |
4835 |
buf.append("package test1;\n"); |
4836 |
buf.append("import test2.E2.Sub;\n"); |
4837 |
buf.append("public class E1 {\n"); |
4838 |
buf.append(" Sub sub;\n"); |
4839 |
buf.append("}\n"); |
4840 |
String expected1= buf.toString(); |
4841 |
|
4842 |
assertRefactoringResultAsExpected(refactoring, new String[] {expected1}); |
4843 |
} |
4844 |
|
4845 |
public void testRemoveQualifiedNames03() throws Exception { |
4846 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4847 |
StringBuffer buf= new StringBuffer(); |
4848 |
buf.append("package test1;\n"); |
4849 |
buf.append("public class E1 {\n"); |
4850 |
buf.append(" private E1Sub.E1SubSub e1;\n"); |
4851 |
buf.append(" private static class E1Sub {\n"); |
4852 |
buf.append(" private static class E1SubSub {}\n"); |
4853 |
buf.append(" }\n"); |
4854 |
buf.append("}\n"); |
4855 |
ICompilationUnit cu1= pack1.createCompilationUnit("E1.java", buf.toString(), false, null); |
4856 |
|
4857 |
CleanUpRefactoring refactoring= new CleanUpRefactoring(); |
4858 |
refactoring.addCompilationUnit(cu1); |
4859 |
|
4860 |
ICleanUp cleanUp= new VariableDeclarationCleanUp(VariableDeclarationCleanUp.REPLACE_QUALIFIED_NAMES_WITH_IMPORT); |
4861 |
refactoring.addCleanUp(cleanUp); |
4862 |
|
4863 |
assertRefactoringHasNoChange(refactoring); |
4864 |
} |
4865 |
|
4866 |
public void testRemoveQualifiedNames04() throws Exception { |
4867 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4868 |
StringBuffer buf= new StringBuffer(); |
4869 |
buf.append("package test1;\n"); |
4870 |
buf.append("public class E1 extends test2.E1 {}\n"); |
4871 |
ICompilationUnit cu1= pack1.createCompilationUnit("E1.java", buf.toString(), false, null); |
4872 |
|
4873 |
IPackageFragment pack2= fSourceFolder.createPackageFragment("test2", false, null); |
4874 |
buf= new StringBuffer(); |
4875 |
buf.append("package test2;\n"); |
4876 |
buf.append("public class E1 {}\n"); |
4877 |
pack2.createCompilationUnit("E1.java", buf.toString(), false, null); |
4878 |
|
4879 |
CleanUpRefactoring refactoring= new CleanUpRefactoring(); |
4880 |
refactoring.addCompilationUnit(cu1); |
4881 |
|
4882 |
ICleanUp cleanUp= new VariableDeclarationCleanUp(VariableDeclarationCleanUp.REPLACE_QUALIFIED_NAMES_WITH_IMPORT); |
4883 |
refactoring.addCleanUp(cleanUp); |
4884 |
|
4885 |
assertRefactoringHasNoChange(refactoring); |
4886 |
} |
4887 |
|
4888 |
public void testRemoveQualifiedNames05() throws Exception { |
4889 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4890 |
StringBuffer buf= new StringBuffer(); |
4891 |
buf.append("package test1;\n"); |
4892 |
buf.append("import test2.E2;\n"); |
4893 |
buf.append("public class E1 extends E2 {\n"); |
4894 |
buf.append(" E2.Sub sub;\n"); |
4895 |
buf.append("}\n"); |
4896 |
ICompilationUnit cu1= pack1.createCompilationUnit("E1.java", buf.toString(), false, null); |
4897 |
|
4898 |
IPackageFragment pack2= fSourceFolder.createPackageFragment("test2", false, null); |
4899 |
buf= new StringBuffer(); |
4900 |
buf.append("package test2;\n"); |
4901 |
buf.append("public class E2 {\n"); |
4902 |
buf.append(" public class Sub {}\n"); |
4903 |
buf.append("}\n"); |
4904 |
pack2.createCompilationUnit("E2.java", buf.toString(), false, null); |
4905 |
|
4906 |
CleanUpRefactoring refactoring= new CleanUpRefactoring(); |
4907 |
refactoring.addCompilationUnit(cu1); |
4908 |
|
4909 |
ICleanUp cleanUp= new VariableDeclarationCleanUp(VariableDeclarationCleanUp.REPLACE_QUALIFIED_NAMES_WITH_IMPORT); |
4910 |
refactoring.addCleanUp(cleanUp); |
4911 |
|
4912 |
buf= new StringBuffer(); |
4913 |
buf.append("package test1;\n"); |
4914 |
buf.append("import test2.E2;\n"); |
4915 |
buf.append("public class E1 extends E2 {\n"); |
4916 |
buf.append(" Sub sub;\n"); |
4917 |
buf.append("}\n"); |
4918 |
String expected1= buf.toString(); |
4919 |
|
4920 |
assertRefactoringResultAsExpected(refactoring, new String[] {expected1}); |
4921 |
} |
4922 |
|
4923 |
public void testRemoveQualifiedNames06() throws Exception { |
4924 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4925 |
StringBuffer buf= new StringBuffer(); |
4926 |
buf.append("package test1;\n"); |
4927 |
buf.append("public class E1 {\n"); |
4928 |
buf.append(" java.util.List/*<Foo>*/l;\n"); |
4929 |
buf.append("}\n"); |
4930 |
ICompilationUnit cu1= pack1.createCompilationUnit("E1.java", buf.toString(), false, null); |
4931 |
|
4932 |
CleanUpRefactoring refactoring= new CleanUpRefactoring(); |
4933 |
refactoring.addCompilationUnit(cu1); |
4934 |
|
4935 |
ICleanUp cleanUp= new VariableDeclarationCleanUp(VariableDeclarationCleanUp.REPLACE_QUALIFIED_NAMES_WITH_IMPORT); |
4936 |
refactoring.addCleanUp(cleanUp); |
4937 |
|
4938 |
buf= new StringBuffer(); |
4939 |
buf.append("package test1;\n\n"); |
4940 |
buf.append("import java.util.List;\n\n"); |
4941 |
buf.append("public class E1 {\n"); |
4942 |
buf.append(" List/*<Foo>*/l;\n"); |
4943 |
buf.append("}\n"); |
4944 |
String expected1= buf.toString(); |
4945 |
|
4946 |
assertRefactoringResultAsExpected(refactoring, new String[] {expected1}); |
4947 |
} |
4948 |
|
4949 |
public void testQualifyNames01() throws Exception { |
4950 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4951 |
StringBuffer buf= new StringBuffer(); |
4952 |
buf.append("package test1;\n"); |
4953 |
buf.append("import java.util.List;\n"); |
4954 |
buf.append("public class E1 {\n"); |
4955 |
buf.append(" List/*<Foo>*/l;\n"); |
4956 |
buf.append("}\n"); |
4957 |
ICompilationUnit cu1= pack1.createCompilationUnit("E1.java", buf.toString(), false, null); |
4958 |
|
4959 |
CleanUpRefactoring refactoring= new CleanUpRefactoring(); |
4960 |
refactoring.addCompilationUnit(cu1); |
4961 |
|
4962 |
ICleanUp cleanUp= new VariableDeclarationCleanUp(VariableDeclarationCleanUp.FULLY_QUALIFY_TYPE_NAMES); |
4963 |
refactoring.addCleanUp(cleanUp); |
4964 |
|
4965 |
buf= new StringBuffer(); |
4966 |
buf.append("package test1;\n"); |
4967 |
buf.append("public class E1 {\n"); |
4968 |
buf.append(" java.util.List/*<Foo>*/l;\n"); |
4969 |
buf.append("}\n"); |
4970 |
String expected1= buf.toString(); |
4971 |
|
4972 |
assertRefactoringResultAsExpected(refactoring, new String[] {expected1}); |
4973 |
} |
4974 |
|
4975 |
public void testQualifiedNames02() throws Exception { |
4976 |
IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
4977 |
StringBuffer buf= new StringBuffer(); |
4978 |
buf.append("package test1;\n"); |
4979 |
buf.append("import test2.E2;\n"); |
4980 |
buf.append("public class E1 extends E2 {\n"); |
4981 |
buf.append(" public void foo() {\n"); |
4982 |
buf.append(" System.out.println(I);\n"); |
4983 |
buf.append(" }\n"); |
4984 |
buf.append("}\n"); |
4985 |
ICompilationUnit cu1= pack1.createCompilationUnit("E1.java", buf.toString(), false, null); |
4986 |
|
4987 |
IPackageFragment pack2= fSourceFolder.createPackageFragment("test2", false, null); |
4988 |
buf= new StringBuffer(); |
4989 |
buf.append("package test2;\n"); |
4990 |
buf.append("public class E2 {\n"); |
4991 |
buf.append(" public static int I;\n"); |
4992 |
buf.append("}\n"); |
4993 |
pack2.createCompilationUnit("E2.java", buf.toString(), false, null); |
4994 |
|
4995 |
CleanUpRefactoring refactoring= new CleanUpRefactoring(); |
4996 |
refactoring.addCompilationUnit(cu1); |
4997 |
|
4998 |
refactoring.addCleanUp(new CodeStyleCleanUp(CodeStyleCleanUp.QUALIFY_STATIC_FIELD_ACCESS)); |
4999 |
ICleanUp cleanUp= new VariableDeclarationCleanUp(VariableDeclarationCleanUp.FULLY_QUALIFY_TYPE_NAMES); |
5000 |
refactoring.addCleanUp(cleanUp); |
5001 |
|
5002 |
buf= new StringBuffer(); |
5003 |
buf.append("package test1;\n"); |
5004 |
buf.append("import test2.E2;\n"); |
5005 |
buf.append("public class E1 extends test2.E2 {\n"); |
5006 |
buf.append(" public void foo() {\n"); |
5007 |
buf.append(" System.out.println(E2.I);\n"); |
5008 |
buf.append(" }\n"); |
5009 |
buf.append("}\n"); |
5010 |
String expected1= buf.toString(); |
5011 |
|
5012 |
assertRefactoringResultAsExpected(refactoring, new String[] {expected1}); |
5013 |
} |
5014 |
|
5015 |
// public void testRemoveQualifiedNames06() throws Exception { |
5016 |
// IPackageFragment pack1= fSourceFolder.createPackageFragment("test1", false, null); |
5017 |
// StringBuffer buf= new StringBuffer(); |
5018 |
// buf.append("package test1;\n"); |
5019 |
// buf.append("import test2.*;\n"); |
5020 |
// buf.append("public class E1 {\n"); |
5021 |
// buf.append(" E2.Sub sub;\n"); |
5022 |
// buf.append("}\n"); |
5023 |
// ICompilationUnit cu1= pack1.createCompilationUnit("E1.java", buf.toString(), false, null); |
5024 |
// |
5025 |
// IPackageFragment pack2= fSourceFolder.createPackageFragment("test2", false, null); |
5026 |
// buf= new StringBuffer(); |
5027 |
// buf.append("package test2;\n"); |
5028 |
// buf.append("public class E2 {\n"); |
5029 |
// buf.append(" public class Sub {}\n"); |
5030 |
// buf.append("}\n"); |
5031 |
// pack2.createCompilationUnit("E2.java", buf.toString(), false, null); |
5032 |
// |
5033 |
// CleanUpRefactoring refactoring= new CleanUpRefactoring(); |
5034 |
// refactoring.addCompilationUnit(cu1); |
5035 |
// |
5036 |
// ICleanUp cleanUp= new VariableDeclarationCleanUp(VariableDeclarationCleanUp.REPLACE_QUALIFIED_NAMES_WITH_IMPORT); |
5037 |
// refactoring.addCleanUp(cleanUp); |
5038 |
// |
5039 |
// buf= new StringBuffer(); |
5040 |
// buf.append("package test1;\n"); |
5041 |
// buf.append("import test2.E2.Sub;\n"); |
5042 |
// buf.append("public class E1 {\n"); |
5043 |
// buf.append(" Sub sub;\n"); |
5044 |
// buf.append("}\n"); |
5045 |
// String expected1= buf.toString(); |
5046 |
// |
5047 |
// assertRefactoringResultAsExpected(refactoring, new String[] {expected1}); |
5048 |
// } |
5049 |
|
4770 |
} |
5050 |
} |