KickJava   Java API By Example, From Geeks To Geeks.

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


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.IType;
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 RenameTypeParticipant extends RenameParticipant {
15   private IType fType;
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 createChangesForTypeRename(fType, fDestination);
29   }
30
31   public String JavaDoc getName() {
32     return "TCRenameTypeChange";
33   }
34
35   protected boolean initialize(Object JavaDoc element) {
36     fType = (IType)element;
37     fDestination = getArguments().getNewName();
38     
39     return true;
40   }
41
42   public static Change createChangesForTypeRename(IType type, String JavaDoc destination) {
43     return new RenameTypeChange(type, destination);
44   }
45 }
46
Popular Tags