1 11 package org.eclipse.jdt.internal.corext.refactoring.changes; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.core.runtime.IProgressMonitor; 15 import org.eclipse.core.runtime.OperationCanceledException; 16 17 import org.eclipse.ltk.core.refactoring.Change; 18 import org.eclipse.ltk.core.refactoring.RefactoringStatus; 19 20 import org.eclipse.jdt.core.ICompilationUnit; 21 import org.eclipse.jdt.core.IPackageFragment; 22 23 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages; 24 import org.eclipse.jdt.internal.corext.refactoring.reorg.INewNameQuery; 25 import org.eclipse.jdt.internal.corext.util.Messages; 26 27 public class CopyCompilationUnitChange extends CompilationUnitReorgChange { 28 29 public CopyCompilationUnitChange(ICompilationUnit cu, IPackageFragment dest, INewNameQuery newNameQuery){ 30 super(cu, dest, newNameQuery); 31 } 32 33 public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException { 34 return super.isValid(pm, NONE); 39 } 40 41 Change doPerformReorg(IProgressMonitor pm) throws CoreException, OperationCanceledException { 42 getCu().copy(getDestinationPackage(), null, getNewName(), true, pm); 43 return null; 44 } 45 46 public String getName() { 47 return Messages.format(RefactoringCoreMessages.CopyCompilationUnitChange_copy, 48 new String []{getCu().getElementName(), getPackageName(getDestinationPackage())}); 49 } 50 } 51 | Popular Tags |