KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > corext > refactoring > changes > CopyPackageChange


1 /*******************************************************************************
2  * Copyright (c) 2000, 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.changes;
12
13 import org.eclipse.core.runtime.IProgressMonitor;
14 import org.eclipse.core.runtime.OperationCanceledException;
15
16 import org.eclipse.ltk.core.refactoring.Change;
17
18 import org.eclipse.jdt.core.IPackageFragment;
19 import org.eclipse.jdt.core.IPackageFragmentRoot;
20 import org.eclipse.jdt.core.JavaModelException;
21
22 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
23 import org.eclipse.jdt.internal.corext.refactoring.reorg.INewNameQuery;
24 import org.eclipse.jdt.internal.corext.util.Messages;
25
26 public class CopyPackageChange extends PackageReorgChange {
27     
28     public CopyPackageChange(IPackageFragment pack, IPackageFragmentRoot dest, INewNameQuery nameQuery){
29         super(pack, dest, nameQuery);
30     }
31     
32     protected Change doPerformReorg(IProgressMonitor pm) throws JavaModelException, OperationCanceledException {
33         getPackage().copy(getDestination(), null, getNewName(), true, pm);
34         return null;
35     }
36     
37     public String JavaDoc getName() {
38         return Messages.format(RefactoringCoreMessages.CopyPackageChange_copy,
39             new String JavaDoc[]{ getPackage().getElementName(), getDestination().getElementName()});
40     }
41 }
42
Popular Tags