KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > refactoring > rename > JavaRenameRefactoring


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.corext.refactoring.rename;
12
13 import org.eclipse.core.runtime.Assert;
14
15 import org.eclipse.ltk.core.refactoring.RefactoringStatus;
16 import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
17 import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
18 import org.eclipse.ltk.core.refactoring.participants.RenameProcessor;
19 import org.eclipse.ltk.core.refactoring.participants.RenameRefactoring;
20
21 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
22 import org.eclipse.jdt.internal.corext.refactoring.tagging.IScriptableRefactoring;
23 import org.eclipse.jdt.internal.corext.util.Messages;
24
25 /**
26  * A rename refactoring which can be initialized with refactoring arguments.
27  *
28  * @since 3.2
29  */

30 public final class JavaRenameRefactoring extends RenameRefactoring implements IScriptableRefactoring {
31
32     /**
33      * Creates a new java rename refactoring.
34      *
35      * @param processor
36      * the rename processor to use
37      */

38     public JavaRenameRefactoring(final RenameProcessor processor) {
39         super(processor);
40     }
41
42     /**
43      * {@inheritDoc}
44      */

45     public RefactoringStatus initialize(final RefactoringArguments arguments) {
46         Assert.isNotNull(arguments);
47         final RefactoringProcessor processor= getProcessor();
48         if (processor instanceof IScriptableRefactoring) {
49             return ((IScriptableRefactoring) processor).initialize(arguments);
50         }
51         return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.ProcessorBasedRefactoring_error_unsupported_initialization, getProcessor().getIdentifier()));
52     }
53 }
54
Popular Tags