private static void renameJavaElement(IJavaElement element, String newName,
			IProgressMonitor monitor) throws CoreException, IllegalArgumentException {
		String id;
		if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
			id = IJavaRefactorings.RENAME_PACKAGE;
		}
		else if (element.getElementType() == IJavaElement.COMPILATION_UNIT) {
			id = IJavaRefactorings.RENAME_COMPILATION_UNIT;
		}
		else {
			throw new IllegalArgumentException("Can only rename packages and compilation units!");
		}
		RefactoringContribution contribution = RefactoringCore.getRefactoringContribution(id);
		RenameJavaElementDescriptor descriptor =
			(RenameJavaElementDescriptor) contribution.createDescriptor();
		descriptor.setProject(element.getResource().getProject().getName());
		descriptor.setNewName(newName);
		descriptor.setJavaElement(element);
		RefactoringStatus status = new RefactoringStatus();
		Refactoring refactoring = descriptor.createRefactoring(status);
		refactoring.checkInitialConditions(monitor);
		refactoring.checkFinalConditions(monitor);
		Change change = refactoring.createChange(monitor);
		change.perform(monitor);
	}
Renames the given Java element to the given new name.  Currently only supports renaming 
packages and compilation units.

@param element The Java element to rename.
@param newName The desired new name of the element.
@param monitor The progress monitor.
@throws CoreException If there is an Eclipse-related problem with the rename.
@throws IllegalArgumentException If the given Java element is not a package or compilation unit.
GhidraBuild/EclipsePlugins/GhidraDev/GhidraDevPlugin/src/main/java/ghidradev/ghidraprojectcreator/utils/GhidraModuleUtils.java