Search in sources :

Example 1 with RenameEnumConstProcessor

use of org.eclipse.jdt.internal.corext.refactoring.rename.RenameEnumConstProcessor in project che by eclipse.

the class RenameSupport method create.

/**
	 * Creates a new rename support for the given {@link IField}.
	 *
	 * @param field the {@link IField} to be renamed.
	 * @param newName the field's new name. <code>null</code> is a valid value
	 * indicating that no new name is provided.
	 * @param flags flags controlling additional parameters. Valid flags are
	 * <code>UPDATE_REFERENCES</code>, <code>UPDATE_TEXTUAL_MATCHES</code>,
	 * <code>UPDATE_GETTER_METHOD</code>, and <code>UPDATE_SETTER_METHOD</code>,
	 * or their bitwise OR, or <code>NONE</code>.
	 * @return the {@link RenameSupport}.
	 * @throws CoreException if an unexpected error occurred while creating
	 * the {@link RenameSupport}.
	 */
public static RenameSupport create(IField field, String newName, int flags) throws CoreException {
    if (JdtFlags.isEnum(field))
        return new RenameSupport(new RenameEnumConstProcessor(field), newName, flags);
    else {
        final RenameFieldProcessor processor = new RenameFieldProcessor(field);
        processor.setRenameGetter(updateGetterMethod(flags));
        processor.setRenameSetter(updateSetterMethod(flags));
        return new RenameSupport(processor, newName, flags);
    }
}
Also used : RenameEnumConstProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameEnumConstProcessor) RenameFieldProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor)

Example 2 with RenameEnumConstProcessor

use of org.eclipse.jdt.internal.corext.refactoring.rename.RenameEnumConstProcessor in project che by eclipse.

the class RenameEnumConstRefactoringContribution method createRefactoring.

/**
	 * {@inheritDoc}
	 */
@Override
public Refactoring createRefactoring(JavaRefactoringDescriptor descriptor, RefactoringStatus status) {
    JavaRefactoringArguments arguments = new JavaRefactoringArguments(descriptor.getProject(), retrieveArgumentMap(descriptor));
    RenameEnumConstProcessor processor = new RenameEnumConstProcessor(arguments, status);
    return new RenameRefactoring(processor);
}
Also used : JavaRefactoringArguments(org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments) RenameEnumConstProcessor(org.eclipse.jdt.internal.corext.refactoring.rename.RenameEnumConstProcessor) RenameRefactoring(org.eclipse.ltk.core.refactoring.participants.RenameRefactoring)

Aggregations

RenameEnumConstProcessor (org.eclipse.jdt.internal.corext.refactoring.rename.RenameEnumConstProcessor)2 JavaRefactoringArguments (org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments)1 RenameFieldProcessor (org.eclipse.jdt.internal.corext.refactoring.rename.RenameFieldProcessor)1 RenameRefactoring (org.eclipse.ltk.core.refactoring.participants.RenameRefactoring)1