KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > refactoring > structure > JavaMoveRefactoring


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.structure;
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.MoveProcessor;
17 import org.eclipse.ltk.core.refactoring.participants.MoveRefactoring;
18 import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments;
19 import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
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 move refactoring which can be initialized with refactoring arguments.
27  *
28  * @since 3.2
29  */

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

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

45     public final 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