1 11 package org.eclipse.jdt.internal.ui.refactoring.reorg; 12 13 import org.eclipse.core.resources.IResource; 14 15 import org.eclipse.ltk.core.refactoring.RefactoringStatus; 16 import org.eclipse.ltk.core.refactoring.participants.CopyRefactoring; 17 import org.eclipse.ltk.ui.refactoring.RefactoringWizard; 18 19 import org.eclipse.jdt.core.IJavaElement; 20 import org.eclipse.jdt.core.JavaModelException; 21 22 import org.eclipse.jdt.internal.corext.refactoring.reorg.IReorgDestinationValidator; 23 import org.eclipse.jdt.internal.corext.refactoring.reorg.JavaCopyProcessor; 24 25 26 public class ReorgCopyWizard extends RefactoringWizard { 27 28 public ReorgCopyWizard(CopyRefactoring ref) { 29 super(ref, DIALOG_BASED_USER_INTERFACE | NO_PREVIEW_PAGE); 30 setDefaultPageTitle(ReorgMessages.ReorgCopyWizard_1); 31 } 32 33 36 protected void addUserInputPages() { 37 addPage(new CopyInputPage()); 38 } 39 40 private static class CopyInputPage extends ReorgUserInputPage{ 41 42 private static final String PAGE_NAME= "CopyInputPage"; 44 public CopyInputPage() { 45 super(PAGE_NAME); 46 } 47 48 private JavaCopyProcessor getCopyProcessor(){ 49 return (JavaCopyProcessor)((CopyRefactoring)getRefactoring()).getCopyProcessor(); 50 } 51 52 protected Object getInitiallySelectedElement() { 53 return getCopyProcessor().getCommonParentForInputElements(); 54 } 55 56 protected IJavaElement[] getJavaElements() { 57 return getCopyProcessor().getJavaElements(); 58 } 59 60 protected IResource[] getResources() { 61 return getCopyProcessor().getResources(); 62 } 63 64 protected IReorgDestinationValidator getDestinationValidator() { 65 return getCopyProcessor(); 66 } 67 68 protected RefactoringStatus verifyDestination(Object selected) throws JavaModelException{ 69 if (selected instanceof IJavaElement) 70 return getCopyProcessor().setDestination((IJavaElement)selected); 71 if (selected instanceof IResource) 72 return getCopyProcessor().setDestination((IResource)selected); 73 return RefactoringStatus.createFatalErrorStatus(ReorgMessages.ReorgCopyWizard_2); 74 } 75 } 76 } 77 | Popular Tags |