Bug 412486 - 40 failures in Rename* tests
Change-Id: I54a0062f4872d1008bc9b83c6e7a142e3f2d7be4
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/AbstractRefactoringDebugTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/AbstractRefactoringDebugTest.java
index f208921..27dd609 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/AbstractRefactoringDebugTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/AbstractRefactoringDebugTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 2012 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
+import org.eclipse.core.internal.resources.ResourceException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IWorkspaceRunnable;
@@ -27,6 +28,10 @@
import org.eclipse.jdt.core.search.SearchPattern;
import org.eclipse.jdt.core.search.TypeNameRequestor;
import org.eclipse.jdt.debug.tests.AbstractDebugTest;
+import org.eclipse.jdt.debug.tests.TestAgainException;
+import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;
+import org.eclipse.ltk.core.refactoring.PerformRefactoringOperation;
+import org.eclipse.ltk.core.refactoring.Refactoring;
/**
* Common refactoring utils.
@@ -39,6 +44,38 @@
super(name);
}
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.debug.tests.AbstractDebugTest#setUp()
+ */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ cleanTestFiles();
+ }
+
+ /**
+ * Performs the given refactoring. If a {@link ResourceException} occurs during the refactoring,
+ * we trap it and throw a {@link TestAgainException} to try the test again.
+ *
+ * @param refactoring
+ * @throws Exception
+ */
+ public void performRefactor(final Refactoring refactoring) throws Exception {
+ if(refactoring == null) {
+ return;
+ }
+ PerformRefactoringOperation op = new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
+ try {
+ ResourcesPlugin.getWorkspace().run(op, new NullProgressMonitor());
+ waitForBuild();
+ assertEquals(true, op.getValidationStatus().isOK());
+ }
+ catch(ResourceException re) {
+ //try the test again - the tests reset the workspace to remove any half-moved / change files
+ throw new TestAgainException(re.getLocalizedMessage());
+ }
+ }
+
/**
* Clean up all the test files
* @throws CoreException
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ChangeAnonymousTypeMethodSignatureUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ChangeAnonymousTypeMethodSignatureUnitTests.java
index 342e8ae..bd7b30e 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ChangeAnonymousTypeMethodSignatureUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ChangeAnonymousTypeMethodSignatureUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -19,8 +18,6 @@
import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
@@ -33,8 +30,6 @@
public void testAnonymousTypeMethodChange() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -62,9 +57,7 @@
}
}//end testBreakPoint
-//////////////////////////////////////////////////////////////////////////////////////
private Refactoring setupRefactor(String root, String packageName, String cuName, String fullTargetName) throws Exception {
-
IJavaProject javaProject = get14Project();
ICompilationUnit cunit = getCompilationUnit(javaProject, root, packageName, cuName);
IMethod method = (IMethod)(getMember(cunit,fullTargetName));
@@ -85,15 +78,4 @@
}
return ref;
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ChangeMethodSignatureUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ChangeMethodSignatureUnitTests.java
index c37f318..849cdf4 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ChangeMethodSignatureUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ChangeMethodSignatureUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -21,8 +20,6 @@
import org.eclipse.jdt.core.dom.Modifier;
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.internal.corext.refactoring.structure.ChangeSignatureProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
@@ -34,8 +31,6 @@
}
public void testPublicTypeMethodChange() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -64,8 +59,6 @@
}//end testBreakPoint
public void testInnerTypeMethodChange() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -94,8 +87,6 @@
}//end testBreakPoint
public void testNonPublicTypeMethodChange() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -196,15 +187,4 @@
return enclosing.getType(name);
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertInnerAnonymousTypeToNestedUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertInnerAnonymousTypeToNestedUnitTests.java
index f10dde9..a319c4d 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertInnerAnonymousTypeToNestedUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertInnerAnonymousTypeToNestedUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -22,8 +21,6 @@
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.code.ConvertAnonymousToNestedRefactoring;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -35,8 +32,6 @@
public void testLineBreakpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -67,8 +62,6 @@
}//end testBreakPoint
public void testMethodBreakpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -97,8 +90,6 @@
}//end testBreakPoint
public void testWatchpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -128,8 +119,6 @@
}//end testBreakPoint
public void testClassLoadpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -158,7 +147,6 @@
//////////////////////////////////////////////////////////////////////////////////////
private Refactoring setupRefactor(String root, String packageName, String cuName, String targetName) throws Exception {
-
IJavaProject javaProject = get14Project();
ICompilationUnit cunit = getCompilationUnit(javaProject, root, packageName, cuName);
IType type = (IType)getMember(cunit,targetName);
@@ -182,15 +170,4 @@
ref.setClassName("NewAnonymousClass");
return ref;
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertNonPublicAnonymousTypeToNestedUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertNonPublicAnonymousTypeToNestedUnitTests.java
index 5b4251e..44920ec 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertNonPublicAnonymousTypeToNestedUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertNonPublicAnonymousTypeToNestedUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -22,8 +21,6 @@
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.code.ConvertAnonymousToNestedRefactoring;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -32,11 +29,8 @@
public ConvertNonPublicAnonymousTypeToNestedUnitTests(String name) {
super(name);
}
-
public void testLineBreakpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -67,8 +61,6 @@
}//end testBreakPoint
public void testMethodBreakpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -97,8 +89,6 @@
}//end testBreakPoint
public void testWatchpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -128,8 +118,6 @@
}//end testBreakPoint
public void testClassLoadpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -158,7 +146,6 @@
//////////////////////////////////////////////////////////////////////////////////////
private Refactoring setupRefactor(String root, String packageName, String cuName, String targetName) throws Exception {
-
IJavaProject javaProject = get14Project();
ICompilationUnit cunit = getCompilationUnit(javaProject, root, packageName, cuName);
IType type = (IType)getMember(cunit,targetName);
@@ -183,15 +170,4 @@
ref.setClassName("NewAnonymousClass");
return ref;
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertPublicAnonymousTypeToNestedUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertPublicAnonymousTypeToNestedUnitTests.java
index b73d336..de761e5 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertPublicAnonymousTypeToNestedUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ConvertPublicAnonymousTypeToNestedUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -22,8 +21,6 @@
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.code.ConvertAnonymousToNestedRefactoring;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -33,10 +30,7 @@
super(name);
}
-
public void testLineBreakpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -67,8 +61,6 @@
}//end testBreakPoint
public void testMethodBreakpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -97,8 +89,6 @@
}//end testBreakPoint
public void testWatchpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -128,8 +118,6 @@
}//end testBreakPoint
public void testClassLoadpoint() throws Exception {
- cleanTestFiles();
-
try {
String src = "src",
pack = "a.b.c",
@@ -156,15 +144,11 @@
}
}//end testBreakPoint
-//////////////////////////////////////////////////////////////////////////////////////
private Refactoring setupRefactor(String root, String packageName, String cuName, String targetName) throws Exception {
-
IJavaProject javaProject = get14Project();
ICompilationUnit cunit = getCompilationUnit(javaProject, root, packageName, cuName);
IType type = (IType)getMember(cunit,targetName);
- //IDocument compUnitSource = new Document(cunit.getSource());
-
ISourceRange typeInfo = type.getSourceRange();
int target = typeInfo.getOffset();
@@ -182,15 +166,4 @@
ref.setClassName("NewAnonymousClass");
return ref;
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ExtractMethodUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ExtractMethodUnitTests.java
index 4e264af..195ff56 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ExtractMethodUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/ExtractMethodUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -20,8 +19,6 @@
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -32,8 +29,6 @@
}
public void testExtractionFromPublicType() throws Exception {
- cleanTestFiles();
-
try {
int lineNumber = 21;
int newLineNumber = 25;
@@ -58,8 +53,6 @@
}//end testLineBreakPoint
public void testExtractionFromNonPublicType() throws Exception {
- cleanTestFiles();
-
try {
int lineNumber = 40;
int newLineNumber = 44;
@@ -84,8 +77,6 @@
}//end testLineBreakPoint
public void testExtractionFromInternalType() throws Exception {
- cleanTestFiles();
-
try {
int lineNumber = 29;
int newLineNumber = 32;
@@ -130,15 +121,4 @@
}
return ref;
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/IntroduceParameterUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/IntroduceParameterUnitTests.java
index 80ae272..f2b26f7 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/IntroduceParameterUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/IntroduceParameterUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -20,8 +19,6 @@
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -32,8 +29,6 @@
}
public void testExtractionFromPublicType() throws Exception {
- cleanTestFiles();
-
try {
int lineNumber = 21;
//create breakpoint to test
@@ -57,8 +52,6 @@
}//end testLineBreakPoint
public void testExtractionFromNonPublicType() throws Exception {
- cleanTestFiles();
-
try {
int lineNumber = 40;
//create breakpoint to test
@@ -82,8 +75,6 @@
}//end testLineBreakPoint
public void testExtractionFromInternalType() throws Exception {
- cleanTestFiles();
-
try {
int lineNumber = 29;
//create breakpoint to test
@@ -126,15 +117,4 @@
}
return ref;
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveCompilationUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveCompilationUnitTests.java
index 1866e6f..5acd60a 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveCompilationUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveCompilationUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -12,7 +12,6 @@
package org.eclipse.jdt.debug.tests.refactoring;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
@@ -22,15 +21,10 @@
import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
+import org.eclipse.jdt.internal.corext.refactoring.reorg.IReorgPolicy.IMovePolicy;
import org.eclipse.jdt.internal.corext.refactoring.reorg.JavaMoveProcessor;
import org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgDestinationFactory;
import org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgPolicyFactory;
-import org.eclipse.jdt.internal.corext.refactoring.reorg.IReorgPolicy.IMovePolicy;
-import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;
-import org.eclipse.ltk.core.refactoring.PerformRefactoringOperation;
-import org.eclipse.ltk.core.refactoring.Refactoring;
-import org.eclipse.ltk.core.refactoring.RefactoringCore;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.MoveRefactoring;
//
//then check number of and location of created breakpoint
@@ -61,7 +55,7 @@
if(processor.canUpdateJavaReferences()) {
processor.setUpdateReferences(true);
}
- executeRefactoring(new MoveRefactoring(processor), RefactoringStatus.WARNING);
+ performRefactor(new MoveRefactoring(processor));
}
/**
@@ -69,7 +63,6 @@
* @throws Exception
*/
public void testLineBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
try {
@@ -95,7 +88,6 @@
* @throws Exception
*/
public void testMethodBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
@@ -121,7 +113,6 @@
* @throws Exception
*/
public void testWatchPointBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
@@ -147,7 +138,6 @@
* @throws Exception
*/
public void testClassLoadBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
@@ -166,20 +156,4 @@
removeAllBreakpoints();
}
}
-
- protected void executeRefactoring(Refactoring refactoring, int maxSeverity) throws Exception {
- PerformRefactoringOperation operation= new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
- waitForBuild();
- // Flush the undo manager to not count any already existing undo objects
- // into the heap consumption
- RefactoringCore.getUndoManager().flush();
-
- ResourcesPlugin.getWorkspace().run(operation, null);
-
- assertEquals(true, operation.getConditionStatus().getSeverity() <= maxSeverity);
- assertEquals(true, operation.getValidationStatus().isOK());
-
- RefactoringCore.getUndoManager().flush();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveFieldUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveFieldUnitTests.java
index 8e74e81..c08ad8f 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveFieldUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveFieldUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -33,7 +33,6 @@
* @throws Exception
*/
public void testPublicTypeFieldMove() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IJavaElement type = cunit.getType("Movee").getField("anInt");
@@ -61,7 +60,6 @@
* @throws Exception
*/
public void testInnerTypeFieldMove() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IJavaElement type = cunit.getType("Movee").getType("InnerType").getField("innerTypeInt");
@@ -89,7 +87,6 @@
* @throws Exception
*/
public void testNonPublicTypeFieldMove() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IJavaElement type = cunit.getType("NonPublicType").getField("differentInt");
@@ -111,5 +108,4 @@
removeAllBreakpoints();
}
}
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeMethodUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeMethodUnitTests.java
index e47befb..15c26f2 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeMethodUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeMethodUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -34,7 +34,6 @@
* @throws Exception
*/
public void testLineBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IJavaElement type = cunit.getType("Movee").getType("InnerType").getMethod("innerTypeMethod", Signature.getParameterTypes("()V"));
@@ -62,7 +61,6 @@
* @throws Exception
*/
public void testMethodBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IJavaElement type = cunit.getType("Movee").getType("InnerType").getMethods()[0];
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeToNewFileUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeToNewFileUnitTests.java
index 878e7f2..3c1ff7a 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeToNewFileUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeToNewFileUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.IJavaProject;
@@ -21,8 +20,6 @@
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.structure.MoveInnerToTopRefactoring;
import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
public class MoveInnerTypeToNewFileUnitTests extends AbstractRefactoringDebugTest {
@@ -32,8 +29,6 @@
}
public void testLineBreakPoint() throws Exception {
- cleanTestFiles();
-
try {
int lineNumber = 29;
//create breakpoint to test
@@ -57,8 +52,6 @@
public void testMethodBreakPoint() throws Exception {
- cleanTestFiles();
-
try {
//create Breakpoint to test
createMethodBreakpoint("a.b.c.Movee$InnerType", "innerTypeMethod", "()V", true, false);
@@ -79,8 +72,6 @@
}//end testBreakPoint
public void testWatchPoint() throws Exception {
- cleanTestFiles();
-
try {
//create Breakpoint to test
createWatchpoint("a.b.c.Movee$InnerType", "innerTypeInt", true, true);
@@ -101,8 +92,6 @@
}//end testBreakPoint
public void testClassLoadBreakPoint() throws Exception {
- cleanTestFiles();
-
try {
//create Breakpoint to test
createClassPrepareBreakpoint("a.b.c.Movee$InnerType");
@@ -121,10 +110,7 @@
}
}//end testBreakPoint
-/////////////////////////////////////////
-
private Refactoring setupRefactor(String parentClassName, String className, String root, String targetPackageName, String cuName) throws Exception {
-
IJavaProject javaProject = get14Project();
IType parentClas= getCompilationUnit(javaProject, root, targetPackageName, cuName).getType(parentClassName);
IType clas= parentClas.getType(className);
@@ -134,14 +120,4 @@
return ref;
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());
- waitForBuild();
- }
-
}
-
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeUnitTests.java
index beded65..40f4e15 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveInnerTypeUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -35,7 +35,6 @@
* @throws Exception
*/
public void testLineBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IType type = cunit.getType("Movee").getType("InnerType");
@@ -62,7 +61,6 @@
* @throws Exception
*/
public void testMethodBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IType type = cunit.getType("Movee").getType("InnerType");
@@ -88,7 +86,6 @@
* @throws Exception
*/
public void testWatchPointBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IType type = cunit.getType("Movee").getType("InnerType");
@@ -113,7 +110,6 @@
* @throws Exception
*/
public void testClassLoadBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IType type = cunit.getType("Movee").getType("InnerType");
@@ -134,5 +130,4 @@
removeAllBreakpoints();
}
}
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveNonPublicTypeMethodUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveNonPublicTypeMethodUnitTests.java
index 28d260d..b8a3f98 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveNonPublicTypeMethodUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveNonPublicTypeMethodUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -34,7 +34,6 @@
* @throws Exception
*/
public void testLineBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IJavaElement type = cunit.getType("NonPublicType").getMethod("nonPublicMethod", Signature.getParameterTypes("()V"));
@@ -62,7 +61,6 @@
* @throws Exception
*/
public void testMethodBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IJavaElement type = cunit.getType("NonPublicType").getMethods()[0];//1st method is nonPublicMethod
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveNonPublicTypeUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveNonPublicTypeUnitTests.java
index 83b9225..1f5133e 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveNonPublicTypeUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveNonPublicTypeUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -35,7 +35,6 @@
* @throws Exception
*/
public void testLineBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IType type = cunit.getType("NonPublicType");
@@ -62,7 +61,6 @@
* @throws Exception
*/
public void testMethodBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IType type = cunit.getType("NonPublicType");
@@ -88,7 +86,6 @@
* @throws Exception
*/
public void testWatchPointBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IType type = cunit.getType("NonPublicType");
@@ -115,7 +112,6 @@
* @throws Exception
*/
public void testClassLoadBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IType type = cunit.getType("NonPublicType");
@@ -136,5 +132,4 @@
removeAllBreakpoints();
}
}
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MovePublicTypeMethodUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MovePublicTypeMethodUnitTests.java
index e7d1ff2..54bdb68 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MovePublicTypeMethodUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MovePublicTypeMethodUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -34,7 +34,6 @@
* @throws Exception
*/
public void testLineBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IJavaElement type = cunit.getType("Movee").getMethod("testMethod1", Signature.getParameterTypes("()V"));
@@ -62,7 +61,6 @@
* @throws Exception
*/
public void testMethodBreakPoint() throws Exception {
- cleanTestFiles();
IJavaProject javaProject = get14Project();
ICompilationUnit cunit= getCompilationUnit(javaProject, "src", "a.b.c", "Movee.java");
IJavaElement type = cunit.getType("Movee").getMethods()[0];
@@ -82,5 +80,4 @@
removeAllBreakpoints();
}
}
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveRefactoringTest.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveRefactoringTest.java
index 807e4c7..e470673 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveRefactoringTest.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/MoveRefactoringTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * Copyright (c) 2007, 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
@@ -11,19 +11,13 @@
package org.eclipse.jdt.debug.tests.refactoring;
import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.corext.refactoring.reorg.IReorgPolicy.IMovePolicy;
import org.eclipse.jdt.internal.corext.refactoring.reorg.JavaMoveProcessor;
import org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgDestinationFactory;
import org.eclipse.jdt.internal.corext.refactoring.reorg.ReorgPolicyFactory;
-import org.eclipse.jdt.internal.corext.refactoring.reorg.IReorgPolicy.IMovePolicy;
-import org.eclipse.ltk.core.refactoring.CheckConditionsOperation;
-import org.eclipse.ltk.core.refactoring.PerformRefactoringOperation;
-import org.eclipse.ltk.core.refactoring.Refactoring;
-import org.eclipse.ltk.core.refactoring.RefactoringCore;
-import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.MoveRefactoring;
/**
@@ -67,21 +61,6 @@
*/
protected void refactor(IJavaProject javaProject, IJavaElement type) throws JavaModelException, Exception {
JavaMoveProcessor processor = setupRefactor(javaProject, type);
- executeRefactoring(new MoveRefactoring(processor), RefactoringStatus.WARNING);
+ performRefactor(new MoveRefactoring(processor));
}
-
- protected void executeRefactoring(Refactoring refactoring, int maxSeverity) throws Exception {
- PerformRefactoringOperation operation= new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
- waitForBuild();
- // Flush the undo manager to not count any already existing undo objects
- // into the heap consumption
- RefactoringCore.getUndoManager().flush();
-
- ResourcesPlugin.getWorkspace().run(operation, null);
-
- assertEquals(true, operation.getConditionStatus().getSeverity() <= maxSeverity);
- assertEquals(true, operation.getValidationStatus().isOK());
-
- RefactoringCore.getUndoManager().flush();
- }
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/PushDownFieldUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/PushDownFieldUnitTests.java
index 57e9b07..4cd97f9 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/PushDownFieldUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/PushDownFieldUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.IField;
@@ -18,8 +17,6 @@
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.structure.PushDownRefactoringProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
@@ -30,8 +27,6 @@
}
public void testWatchPoint() throws Exception {
- cleanTestFiles();
-
try {
//create Breakpoint to test
createWatchpoint("a.b.c.Movee", "anInt", true, true);
@@ -75,13 +70,4 @@
return ref;
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());
- waitForBuild();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/PushDownMethodUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/PushDownMethodUnitTests.java
index e6a6933..2916480 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/PushDownMethodUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/PushDownMethodUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.IJavaProject;
@@ -20,8 +19,6 @@
import org.eclipse.jdt.debug.core.IJavaLineBreakpoint;
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.internal.corext.refactoring.structure.PushDownRefactoringProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring;
@@ -32,8 +29,6 @@
}
public void testLineBreakPoint() throws Exception {
- cleanTestFiles();
-
try {
int lineNumber = 29;
//create breakpoint to test
@@ -57,8 +52,6 @@
public void testMethodBreakPoint() throws Exception {
- cleanTestFiles();
-
try {
//create Breakpoint to test
createMethodBreakpoint("a.b.c.Movee", "testMethod1", "()V", true, false);
@@ -79,27 +72,14 @@
}//end testBreakPoint
-/////////////////////////////////////////
-
private Refactoring setupRefactor(String parentClassName, String className, String root, String targetPackageName, String cuName) throws Exception {
-
IJavaProject javaProject = get14Project();
IType parentClas= getCompilationUnit(javaProject, root, targetPackageName, cuName).getType(parentClassName);
IMethod clas= parentClas.getMethod(className, Signature.getParameterTypes("()V"));
-
PushDownRefactoringProcessor processor = new PushDownRefactoringProcessor(new IMethod[] {clas});
ProcessorBasedRefactoring ref= new ProcessorBasedRefactoring(processor);
ref.checkInitialConditions(new NullProgressMonitor());
return ref;
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());
- waitForBuild();
- }
-
}
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameCompilationUnitUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameCompilationUnitUnitTests.java
index c487ad4..442a245 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameCompilationUnitUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameCompilationUnitUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -21,8 +20,6 @@
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor;
import org.eclipse.jdt.internal.corext.refactoring.rename.RenameCompilationUnitProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
@@ -33,16 +30,6 @@
super(name);
}
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
/**
* @param src
* @param pack
@@ -52,7 +39,6 @@
* @throws Exception
*/
private void runClassLoadBreakpointTest(String src, String pack, String cunit, String fullTargetName, String newTargetLineage) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaClassPrepareBreakpoint breakpoint = createClassPrepareBreakpoint(src, pack, cunit, fullTargetName);
@@ -82,7 +68,6 @@
* @throws Exception
*/
private void runLineBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetsParentName, int lineNumber) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaLineBreakpoint breakpoint = createLineBreakpoint(lineNumber, src, pack, cunit, fullTargetName);
@@ -113,7 +98,6 @@
* @throws Exception
*/
private void runMethodBreakpointTest(String src, String pack, String cunit, String fullTargetName, String newTargetLineage, String methodName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaMethodBreakpoint breakpoint = createMethodBreakpoint(src, pack, cunit,fullTargetName, true, false);
@@ -144,7 +128,6 @@
* @throws Exception
*/
private void runWatchPointTest(String src, String pack, String cunit, String fullTargetName, String newTargetLineage, String fieldName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaWatchpoint breakpoint = createNestedTypeWatchPoint(src, pack, cunit, fullTargetName, true, true);
@@ -166,13 +149,10 @@
}
private Refactoring setupRefactor(String root, String packageName, String cuName) throws Exception {
-
IJavaProject javaProject = get14Project();
ICompilationUnit cunit = getCompilationUnit(javaProject, root, packageName, cuName);
-
JavaRenameProcessor proc = new RenameCompilationUnitProcessor(cunit);
proc.setNewElementName("RenamedCompilationUnit.java");
-
RenameRefactoring ref= new RenameRefactoring(proc);
//setup final refactoring conditions
@@ -186,8 +166,6 @@
return ref;
}
- //////////////////////////////////////////////////////////////////////////////////////
-
public void testInnerAnonmyousTypeClassLoadpoint() throws Exception {
String src = "src",
pack = "a.b.c",
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameFieldUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameFieldUnitTests.java
index 1c89648..214a915 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameFieldUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameFieldUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -19,8 +18,6 @@
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor;
import org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
@@ -31,18 +28,6 @@
super(name);
}
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- try {
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- } catch (NullPointerException e) { e.printStackTrace(); }
- waitForBuild();
- }
-
/**
* @param src
* @param pack
@@ -52,7 +37,6 @@
* @throws Exception
*/
protected void runWatchPointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage) throws Exception {
- cleanTestFiles();
String newFieldName = "renamedField";
try {
//create breakpoint to test
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameInnerTypeUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameInnerTypeUnitTests.java
index cd20d88..451b133 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameInnerTypeUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameInnerTypeUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -24,8 +23,6 @@
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor;
import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
@@ -36,16 +33,6 @@
super(name);
}
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
/**
* @param src
* @param pack
@@ -55,7 +42,6 @@
* @throws Exception
*/
private void runClassLoadBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaClassPrepareBreakpoint breakpoint = createClassPrepareBreakpoint(src, pack, cunit, fullTargetName);
@@ -85,7 +71,6 @@
* @throws Exception
*/
private void runLineBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage, int lineNumber) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaLineBreakpoint breakpoint = createLineBreakpoint(lineNumber, src, pack, cunit, fullTargetName);
@@ -116,7 +101,6 @@
* @throws Exception
*/
private void runMethodBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage, String methodName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaMethodBreakpoint breakpoint = createMethodBreakpoint(src, pack, cunit,fullTargetName, true, false);
@@ -147,7 +131,6 @@
* @throws Exception
*/
private void runWatchPointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage, String fieldName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaWatchpoint breakpoint = createNestedTypeWatchPoint(src, pack, cunit, fullTargetName, true, true);
@@ -178,7 +161,6 @@
* @throws Exception
*/
private Refactoring setupRefactor(String root, String packageName, String cuName, String type) throws Exception {
-
IJavaProject javaProject = get14Project();
ICompilationUnit cunit = getCompilationUnit(javaProject, root, packageName, cuName);
IMember target = getMember(cunit, type);
@@ -187,12 +169,9 @@
target = (IMember)target.getParent();
IType targetType = (IType)target;
-
JavaRenameProcessor proc = new RenameTypeProcessor(targetType);
proc.setNewElementName("RenamedType");
-
RenameRefactoring ref= new RenameRefactoring(proc);
-
//setup final refactoring conditions
RefactoringStatus refactoringStatus= ref.checkAllConditions(new NullProgressMonitor());
if(!refactoringStatus.isOK())
@@ -259,7 +238,6 @@
* @throws Exception
*/
protected void runExceptionBreakpointTest(String src, String pack, String cunit, String targetName, String exceptionName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaExceptionBreakpoint breakpoint = createExceptionBreakpoint(exceptionName, true, true);
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameMethodUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameMethodUnitTests.java
index 51fbd4b..d31210a 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameMethodUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameMethodUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -20,8 +19,6 @@
import org.eclipse.jdt.debug.core.IJavaMethodBreakpoint;
import org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor;
import org.eclipse.jdt.internal.corext.refactoring.rename.RenameNonVirtualMethodProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
@@ -31,18 +28,6 @@
public RenameMethodUnitTests(String name) {
super(name);
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- try {
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- } catch (NullPointerException e) { e.printStackTrace(); }
- waitForBuild();
- }
/**
* @param src
@@ -53,7 +38,6 @@
* @throws Exception
*/
protected void runMethodBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage) throws Exception {
- cleanTestFiles();
String newMethodName = "renamedMethod";
try {
//create breakpoint to test
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameNonPublicTypeUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameNonPublicTypeUnitTests.java
index cb365f9..527d5ae 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameNonPublicTypeUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenameNonPublicTypeUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -24,8 +23,6 @@
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor;
import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
@@ -35,21 +32,6 @@
public RenameNonPublicTypeUnitTests(String name) {
super(name);
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- try {
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- } catch (NullPointerException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- waitForBuild();
- }
/**
* @param src
@@ -59,9 +41,7 @@
* @param targetLineage
* @throws Exception
*/
- protected void runClassLoadBreakpointTest(String src, String pack, String cunit,
- String fullTargetName) throws Exception {
- cleanTestFiles();
+ protected void runClassLoadBreakpointTest(String src, String pack, String cunit, String fullTargetName) throws Exception {
String targetLineage = pack +"."+"RenamedType";
try {
//create breakpoint to test
@@ -91,9 +71,7 @@
* @param lineNumber
* @throws Exception
*/
- protected void runLineBreakpointTest(String src, String pack, String cunit, String fullTargetName,
- int lineNumber) throws Exception {
- cleanTestFiles();
+ protected void runLineBreakpointTest(String src, String pack, String cunit, String fullTargetName, int lineNumber) throws Exception {
String targetLineage = pack +"."+"RenamedType";
try {
//create breakpoint to test
@@ -124,9 +102,7 @@
* @param methodName
* @throws Exception
*/
- protected void runMethodBreakpointTest(String src, String pack, String cunit,
- String fullTargetName, String methodName) throws Exception {
- cleanTestFiles();
+ protected void runMethodBreakpointTest(String src, String pack, String cunit, String fullTargetName, String methodName) throws Exception {
String targetLineage = pack +"."+"RenamedType";
try {
//create breakpoint to test
@@ -157,9 +133,7 @@
* @param fieldName
* @throws Exception
*/
- protected void runWatchPointTest(String src, String pack, String cunit, String fullTargetName,
- String fieldName) throws Exception {
- cleanTestFiles();
+ protected void runWatchPointTest(String src, String pack, String cunit, String fullTargetName, String fieldName) throws Exception {
String targetLineage = pack +"."+"RenamedType";
try {
//create breakpoint to test
@@ -269,7 +243,6 @@
* @throws Exception
*/
protected void runExceptionBreakpointTest(String src, String pack, String cunit, String targetName) throws Exception {
- cleanTestFiles();
String newTypeName = "RenamedType",
fullTargetName = pack + "."+ targetName;
try {
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenamePackageUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenamePackageUnitTests.java
index 447c708..9cc9b31 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenamePackageUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenamePackageUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -12,7 +12,6 @@
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -24,8 +23,6 @@
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor;
import org.eclipse.jdt.internal.corext.refactoring.rename.RenamePackageProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
@@ -35,18 +32,6 @@
public RenamePackageUnitTests(String name) {
super(name);
}
-
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- try {
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- } catch (NullPointerException e) { e.printStackTrace(); }
- waitForBuild();
- }
/**
* @param src
@@ -57,7 +42,6 @@
* @throws Exception
*/
protected void runClassLoadBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaClassPrepareBreakpoint breakpoint = createClassPrepareBreakpoint(src, pack, cunit, fullTargetName);
@@ -87,7 +71,6 @@
* @throws Exception
*/
protected void runLineBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetsLineage, int lineNumber) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaLineBreakpoint breakpoint = createLineBreakpoint(lineNumber, src, pack, cunit, fullTargetName);
@@ -118,7 +101,6 @@
* @throws Exception
*/
protected void runMethodBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage, String methodName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaMethodBreakpoint breakpoint = createMethodBreakpoint(src, pack, cunit,fullTargetName, true, false);
@@ -149,7 +131,6 @@
* @throws Exception
*/
protected void runWatchPointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage, String fieldName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaWatchpoint breakpoint = createNestedTypeWatchPoint(src, pack, cunit, fullTargetName, true, true);
@@ -171,13 +152,11 @@
}
protected Refactoring setupRefactor(String root, String packageName, String cuName) throws Exception {
-
IJavaProject javaProject = get14Project();
ICompilationUnit cunit = getCompilationUnit(javaProject, root, packageName, cuName);
IPackageFragment packageFragment = (IPackageFragment )cunit.getParent();
JavaRenameProcessor proc = new RenamePackageProcessor(packageFragment);
proc.setNewElementName("renamedPackage");
-
RenameRefactoring ref= new RenameRefactoring(proc);
//setup final refactoring conditions
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenamePublicTypeUnitTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenamePublicTypeUnitTests.java
index cd4b5e2..965b684 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenamePublicTypeUnitTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/refactoring/RenamePublicTypeUnitTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2011 IBM Corporation and others.
+ * Copyright (c) 2005, 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.refactoring;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.core.ICompilationUnit;
@@ -24,8 +23,6 @@
import org.eclipse.jdt.debug.core.IJavaWatchpoint;
import org.eclipse.jdt.internal.corext.refactoring.rename.JavaRenameProcessor;
import org.eclipse.jdt.internal.corext.refactoring.rename.RenameTypeProcessor;
-import org.eclipse.ltk.core.refactoring.CreateChangeOperation;
-import org.eclipse.ltk.core.refactoring.PerformChangeOperation;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
@@ -36,16 +33,6 @@
super(name);
}
- protected final void performRefactor(final Refactoring refactoring) throws Exception {
- if(refactoring==null)
- return;
- CreateChangeOperation create= new CreateChangeOperation(refactoring);
- refactoring.checkFinalConditions(new NullProgressMonitor());
- PerformChangeOperation perform= new PerformChangeOperation(create);
- ResourcesPlugin.getWorkspace().run(perform, new NullProgressMonitor());//maybe SubPM?
- waitForBuild();
- }
-
/**
* @param src
* @param pack
@@ -55,7 +42,6 @@
* @throws Exception
*/
protected void runClassLoadBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaClassPrepareBreakpoint breakpoint = createClassPrepareBreakpoint(src, pack, cunit, fullTargetName);
@@ -86,7 +72,6 @@
* @throws Exception
*/
protected void runExceptionBreakpointTest(String src, String pack, String cunit, String targetName, String exceptionName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaExceptionBreakpoint breakpoint = createExceptionBreakpoint(exceptionName, true, true);
@@ -117,7 +102,6 @@
* @throws Exception
*/
protected void runLineBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage, int lineNumber) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaLineBreakpoint breakpoint = createLineBreakpoint(lineNumber, src, pack, cunit, fullTargetName);
@@ -148,7 +132,6 @@
* @throws Exception
*/
protected void runMethodBreakpointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage, String methodName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaMethodBreakpoint breakpoint = createMethodBreakpoint(src, pack, cunit,fullTargetName, true, false);
@@ -179,7 +162,6 @@
* @throws Exception
*/
protected void runWatchPointTest(String src, String pack, String cunit, String fullTargetName, String targetLineage, String fieldName) throws Exception {
- cleanTestFiles();
try {
//create breakpoint to test
IJavaWatchpoint breakpoint = createNestedTypeWatchPoint(src, pack, cunit, fullTargetName, true, true);
@@ -200,9 +182,6 @@
}
}
- //////////////////////////////////////////////////////////////////////////////////////
-
-
/**
*
* @param root
@@ -213,7 +192,6 @@
* @throws Exception
*/
protected Refactoring setupRefactor(String root, String packageName, String cuName, String type) throws Exception {
-
IJavaProject javaProject = get14Project();
ICompilationUnit cunit = getCompilationUnit(javaProject, root, packageName, cuName);
IMember target = getMember(cunit, type);
@@ -227,7 +205,6 @@
proc.setNewElementName("RenamedType");
RenameRefactoring ref= new RenameRefactoring(proc);
-
//setup final refactoring conditions
RefactoringStatus refactoringStatus= ref.checkAllConditions(new NullProgressMonitor());
if(!refactoringStatus.isOK())