1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 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
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.corext.refactoring.changes;
13 import org.eclipse.core.runtime.IPath;
14 import org.eclipse.core.runtime.IProgressMonitor;
16 import org.eclipse.core.resources.IContainer;
18 import org.eclipse.ltk.core.refactoring.Change;
20 import org.eclipse.jdt.core.IPackageFragmentRoot;
21 import org.eclipse.jdt.core.JavaModelException;
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;
27 import org.eclipse.jdt.ui.JavaElementLabels;
29 import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels;
31 public class MovePackageFragmentRootChange extends PackageFragmentRootReorgChange {
33 public MovePackageFragmentRootChange(IPackageFragmentRoot root, IContainer destination, IPackageFragmentRootManipulationQuery updateClasspathQuery) {
34 super(root, destination, null, updateClasspathQuery);
38 protected Change doPerformReorg(IPath destinationPath, IProgressMonitor pm) throws JavaModelException {
39 getRoot().move(destinationPath, getResourceUpdateFlags(), getUpdateModelFlags(false), null, pm);
44 public String getName() {
45 String rootName= JavaElementLabels.getElementLabel(getRoot(), JavaElementLabels.ALL_DEFAULT);
46 String destinationName= BasicElementLabels.getResourceName(getDestination());
47 return Messages.format(RefactoringCoreMessages.MovePackageFragmentRootChange_move, new String[] { rootName, destinationName });