]> git.uio.no Git - ifi-stolz-refaktor.git/blame - case-study/jdt-after/core refactoring/org/eclipse/jdt/internal/corext/refactoring/changes/MovePackageFragmentRootChange.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / core refactoring / org / eclipse / jdt / internal / corext / refactoring / changes / MovePackageFragmentRootChange.java
CommitLineData
1b2798f6
EK
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
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.eclipse.jdt.internal.corext.refactoring.changes;
12
13import org.eclipse.core.runtime.IPath;
14import org.eclipse.core.runtime.IProgressMonitor;
15
16import org.eclipse.core.resources.IContainer;
17
18import org.eclipse.ltk.core.refactoring.Change;
19
20import org.eclipse.jdt.core.IPackageFragmentRoot;
21import org.eclipse.jdt.core.JavaModelException;
22
23import org.eclipse.jdt.internal.corext.refactoring.RefactoringCoreMessages;
24import org.eclipse.jdt.internal.corext.refactoring.reorg.IPackageFragmentRootManipulationQuery;
25import org.eclipse.jdt.internal.corext.util.Messages;
26
27import org.eclipse.jdt.ui.JavaElementLabels;
28
29import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels;
30
31public class MovePackageFragmentRootChange extends PackageFragmentRootReorgChange {
32
33 public MovePackageFragmentRootChange(IPackageFragmentRoot root, IContainer destination, IPackageFragmentRootManipulationQuery updateClasspathQuery) {
34 super(root, destination, null, updateClasspathQuery);
35 }
36
37 @Override
38 protected Change doPerformReorg(IPath destinationPath, IProgressMonitor pm) throws JavaModelException {
39 getRoot().move(destinationPath, getResourceUpdateFlags(), getUpdateModelFlags(false), null, pm);
40 return null;
41 }
42
43 @Override
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 });
48 }
49}