01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package org.terracotta.dso.refactoring;
05:
06: import org.eclipse.core.runtime.IProgressMonitor;
07: import org.eclipse.core.runtime.OperationCanceledException;
08: import org.eclipse.jdt.core.IPackageFragment;
09: import org.eclipse.ltk.core.refactoring.Change;
10: import org.eclipse.ltk.core.refactoring.RefactoringStatus;
11: import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
12: import org.eclipse.ltk.core.refactoring.participants.RenameParticipant;
13:
14: public class RenamePackageFragmentParticipant extends RenameParticipant {
15: private IPackageFragment fPackageFragment;
16: private String fDestination;
17:
18: public RefactoringStatus checkConditions(IProgressMonitor pm,
19: CheckConditionsContext context)
20: throws OperationCanceledException {
21: return new RefactoringStatus();
22: }
23:
24: public Change createChange(IProgressMonitor pm)
25: throws OperationCanceledException {
26: return createChangesForPackageFragmentRename(fPackageFragment,
27: fDestination);
28: }
29:
30: public String getName() {
31: return "TCRenamePackageFragmentChange";
32: }
33:
34: protected boolean initialize(Object element) {
35: fPackageFragment = (IPackageFragment) element;
36: fDestination = getArguments().getNewName();
37:
38: return true;
39: }
40:
41: public static Change createChangesForPackageFragmentRename(
42: IPackageFragment packageFragment, String destination) {
43: return new RenamePackageFragmentChange(packageFragment,
44: destination);
45: }
46: }
|