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.refactoring.reorg.INewNameQuery;
23: import org.eclipse.jdt.internal.corext.util.Messages;
24:
25: public class CopyPackageChange extends PackageReorgChange {
26:
27: public CopyPackageChange(IPackageFragment pack,
28: IPackageFragmentRoot dest, INewNameQuery nameQuery) {
29: super (pack, dest, nameQuery);
30: }
31:
32: protected Change doPerformReorg(IProgressMonitor pm)
33: throws JavaModelException, OperationCanceledException {
34: getPackage().copy(getDestination(), null, getNewName(), true,
35: pm);
36: return null;
37: }
38:
39: public String getName() {
40: return Messages.format(
41: RefactoringCoreMessages.CopyPackageChange_copy,
42: new String[] { getPackage().getElementName(),
43: getDestination().getElementName() });
44: }
45: }
|