01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.corext.refactoring.changes;
11:
12: import org.eclipse.core.runtime.IProgressMonitor;
13: import org.eclipse.core.runtime.OperationCanceledException;
14:
15: import org.eclipse.ltk.core.refactoring.Change;
16:
17: import org.eclipse.jdt.core.IPackageFragment;
18: import org.eclipse.jdt.core.IPackageFragmentRoot;
19: import org.eclipse.jdt.core.JavaModelException;
20:
21: import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
22: import org.eclipse.jdt.internal.corext.util.Messages;
23:
24: public class MovePackageChange extends PackageReorgChange {
25:
26: public MovePackageChange(IPackageFragment pack,
27: IPackageFragmentRoot dest) {
28: super (pack, dest, null);
29: }
30:
31: protected Change doPerformReorg(IProgressMonitor pm)
32: throws JavaModelException, OperationCanceledException {
33: getPackage().move(getDestination(), null, getNewName(), true,
34: pm);
35: return null;
36: }
37:
38: public String getName() {
39: return Messages.format(
40: RefactoringCoreMessages.MovePackageChange_move,
41: new String[] { getPackage().getElementName(),
42: getDestination().getElementName() });
43: }
44: }
|