1 11 package org.eclipse.jdt.internal.core; 12 13 import org.eclipse.jdt.core.IJavaElement; 14 import org.eclipse.jdt.core.IJavaModelStatusConstants; 15 import org.eclipse.jdt.core.JavaModelException; 16 import org.eclipse.jdt.internal.core.util.Messages; 17 18 26 public class RenameResourceElementsOperation extends MoveResourceElementsOperation { 27 31 public RenameResourceElementsOperation(IJavaElement[] elements, IJavaElement[] destinations, String [] newNames, boolean force) { 32 super(elements, destinations, force); 35 setRenamings(newNames); 36 } 37 40 protected String getMainTaskName() { 41 return Messages.operation_renameResourceProgress; 42 } 43 46 protected boolean isRename() { 47 return true; 48 } 49 52 protected void verify(IJavaElement element) throws JavaModelException { 53 super.verify(element); 54 55 int elementType = element.getElementType(); 56 57 if (!(elementType == IJavaElement.COMPILATION_UNIT || elementType == IJavaElement.PACKAGE_FRAGMENT)) { 58 error(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, element); 59 } 60 if (elementType == IJavaElement.COMPILATION_UNIT) { 61 CompilationUnit cu = (CompilationUnit)element; 62 if (cu.isWorkingCopy() && !cu.isPrimary()) { 63 error(IJavaModelStatusConstants.INVALID_ELEMENT_TYPES, element); 64 } 65 } 66 verifyRenaming(element); 67 } 68 } 69 | Popular Tags |