Source:
protected void renameResource ( @ com.android.annotations.NonNull org.eclipse.core.resources.IProject project , @ com.android.annotations.NonNull java.lang.Object resource , boolean updateReferences , @ com.android.annotations.NonNull java.lang.String newName , @ com.android.annotations.NonNull java.lang.String expected ) throws java.lang.Exception { org.eclipse.ltk.core.refactoring.participants.RenameProcessor processor = null ; if ( resource instanceof java.lang.String ) { java.lang.String url = ( ( java.lang.String ) ( resource ) ) ; assert url.startsWith ( "@" ) : resource ; com.android.utils.Pair < com.android.resources.ResourceType , java.lang.String > pair = com.android.ide.eclipse.adt.internal.editors.Hyperlinks.parseResource ( url ) ; assertNotNull ( url , pair ) ; com.android.resources.ResourceType type = pair.getFirst ( ) ; java.lang.String currentName = pair.getSecond ( ) ; com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor p ; p = new com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor ( project , type , currentName , newName ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else if ( resource instanceof org.eclipse.core.resources.IResource ) { org.eclipse.core.resources.IResource r = ( ( org.eclipse.core.resources.IResource ) ( resource ) ) ; com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor p ; p = new com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor ( r ) ; java.lang.String fileName = r.getName ( ) ; int dot = fileName.indexOf ( '.' ) ; java.lang.String extension = ( dot != ( - 1 ) ) ? fileName.substring ( dot ) : "" ; p.setNewResourceName ( ( newName + extension ) ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else if ( resource instanceof org.eclipse.jdt.core.IField ) { org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor p = new org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor ( ( ( org.eclipse.jdt.core.IField ) ( resource ) ) ) ; p.setNewElementName ( newName ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else { fail ( ( "Unsupported resource element in tests: " + resource ) ) ; } assertNotNull ( processor ) ; org.eclipse.ltk.core.refactoring.participants.RenameRefactoring refactoring = new org.eclipse.ltk.core.refactoring.participants.RenameRefactoring ( processor ) ; checkRefactoring ( refactoring , expected ) ; }

Target:
protected void renameResource ( @ com.android.annotations.NonNull org.eclipse.core.resources.IProject project , @ com.android.annotations.NonNull java.lang.Object resource , boolean updateReferences , @ com.android.annotations.NonNull java.lang.String newName , @ com.android.annotations.NonNull java.lang.String expected , @ com.android.annotations.NonNull java.lang.String expectedWarnings ) throws java.lang.Exception { org.eclipse.ltk.core.refactoring.participants.RenameProcessor processor = null ; if ( resource instanceof java.lang.String ) { java.lang.String url = ( ( java.lang.String ) ( resource ) ) ; assert url.startsWith ( "@" ) : resource ; com.android.utils.Pair < com.android.resources.ResourceType , java.lang.String > pair = com.android.ide.eclipse.adt.internal.editors.Hyperlinks.parseResource ( url ) ; assertNotNull ( url , pair ) ; com.android.resources.ResourceType type = pair.getFirst ( ) ; java.lang.String currentName = pair.getSecond ( ) ; com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor p ; p = new com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor ( project , type , currentName , newName ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else if ( resource instanceof org.eclipse.core.resources.IResource ) { org.eclipse.core.resources.IResource r = ( ( org.eclipse.core.resources.IResource ) ( resource ) ) ; com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor p ; p = new com.android.ide.eclipse.adt.internal.refactorings.core.RenameResourceProcessor ( r ) ; java.lang.String fileName = r.getName ( ) ; int dot = fileName.indexOf ( '.' ) ; java.lang.String extension = ( dot != ( - 1 ) ) ? fileName.substring ( dot ) : "" ; p.setNewResourceName ( ( newName + extension ) ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else if ( resource instanceof org.eclipse.jdt.core.IField ) { org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor p = new org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor ( ( ( org.eclipse.jdt.core.IField ) ( resource ) ) ) ; p.setNewElementName ( newName ) ; p.setUpdateReferences ( updateReferences ) ; processor = p ; } else { fail ( ( "Unsupported resource element in tests: " + resource ) ) ; } assertNotNull ( processor ) ; org.eclipse.ltk.core.refactoring.participants.RenameRefactoring refactoring = new org.eclipse.ltk.core.refactoring.participants.RenameRefactoring ( processor ) ; checkRefactoring ( refactoring , expected , expectedWarnings ) ; }