]>
Commit | Line | Data |
---|---|---|
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 | *******************************************************************************/ | |
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.IContainer; | |
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 | import org.eclipse.jdt.ui.JavaElementLabels; | |
28 | ||
29 | import org.eclipse.jdt.internal.ui.viewsupport.BasicElementLabels; | |
30 | ||
31 | public 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 | } |