KickJava   Java API By Example, From Geeks To Geeks.

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


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.util.Messages;
24
25 public class MovePackageChange extends PackageReorgChange {
26     
27     public MovePackageChange(IPackageFragment pack, IPackageFragmentRoot dest){
28         super(pack, dest, null);
29     }
30     
31     protected Change doPerformReorg(IProgressMonitor pm) throws JavaModelException, OperationCanceledException {
32         getPackage().move(getDestination(), null, getNewName(), true, pm);
33         return null;
34     }
35     
36     public String JavaDoc getName() {
37         return Messages.format(RefactoringCoreMessages.MovePackageChange_move,
38             new String JavaDoc[]{getPackage().getElementName(), getDestination().getElementName()});
39     }
40 }
41
Popular Tags