KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > terracotta > dso > refactoring > RenamePackageFragmentParticipant


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package org.terracotta.dso.refactoring;
5
6 import org.eclipse.core.runtime.IProgressMonitor;
7 import org.eclipse.core.runtime.OperationCanceledException;
8 import org.eclipse.jdt.core.IPackageFragment;
9 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 JavaDoc fDestination;
17
18   public RefactoringStatus checkConditions(IProgressMonitor pm,
19                                            CheckConditionsContext context)
20     throws OperationCanceledException
21   {
22     return new RefactoringStatus();
23   }
24
25   public Change createChange(IProgressMonitor pm)
26     throws OperationCanceledException
27   {
28     return createChangesForPackageFragmentRename(fPackageFragment, fDestination);
29   }
30
31   public String JavaDoc getName() {
32     return "TCRenamePackageFragmentChange";
33   }
34
35   protected boolean initialize(Object JavaDoc element) {
36     fPackageFragment = (IPackageFragment)element;
37     fDestination = getArguments().getNewName();
38     
39     return true;
40   }
41
42   public static Change createChangesForPackageFragmentRename(
43     IPackageFragment packageFragment,
44     String JavaDoc destination)
45   {
46     return new RenamePackageFragmentChange(packageFragment, destination);
47   }
48 }
49
Popular Tags