KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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.IPath;
14 import org.eclipse.core.runtime.IProgressMonitor;
15
16 import org.eclipse.core.resources.IProject;
17
18 import org.eclipse.ltk.core.refactoring.Change;
19
20 import org.eclipse.jdt.core.IPackageFragmentRoot;
21 import org.eclipse.jdt.core.JavaModelException;
22
23 import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
24 import org.eclipse.jdt.internal.corext.refactoring.reorg.IPackageFragmentRootManipulationQuery;
25 import org.eclipse.jdt.internal.corext.util.Messages;
26
27 public class MovePackageFragmentRootChange extends PackageFragmentRootReorgChange {
28
29     public MovePackageFragmentRootChange(IPackageFragmentRoot root, IProject destination, IPackageFragmentRootManipulationQuery updateClasspathQuery) {
30         super(root, destination, null, updateClasspathQuery);
31     }
32
33     protected Change doPerformReorg(IPath destinationPath, IProgressMonitor pm) throws JavaModelException {
34         getRoot().move(destinationPath, getResourceUpdateFlags(), getUpdateModelFlags(false), null, pm);
35         return null;
36     }
37     
38     public String JavaDoc getName() {
39         String JavaDoc[] keys= {getRoot().getElementName(), getDestinationProject().getName()};
40         return Messages.format(RefactoringCoreMessages.MovePackageFragmentRootChange_move, keys);
41     }
42 }
43
Popular Tags