unified title and description handling in wizards
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / ltk / core / RenamePropertyProcessor.java
1 // Copyright (c) 2005 by Leif Frenzel. All rights reserved.
2 // See http://leiffrenzel.de
3 // modified for phpeclipse.de project by axelcl
4 package net.sourceforge.phpdt.ltk.core;
5
6 import org.eclipse.core.runtime.*;
7 import org.eclipse.ltk.core.refactoring.*;
8 import org.eclipse.ltk.core.refactoring.participants.*;
9
10 /** <p>The processor is where the work is delegated to if participants are
11   * involved. The processor loads the participants and manages the lifecycle
12   * of the refactoring. In order to do that, the refactoring entry point
13   * methods must be implemented.</p>
14   *
15   * @author Leif Frenzel
16   */
17 public class RenamePropertyProcessor extends RefactoringProcessor {
18
19   private final RenamePropertyInfo info;
20   private final RenamePropertyDelegate delegate;
21
22   public RenamePropertyProcessor( final RenamePropertyInfo info ) {
23     this.info = info;
24     delegate = new RenamePropertyDelegate( info );
25   }
26
27
28   // interface methods of RefactoringProcessor
29   ////////////////////////////////////////////
30
31   public Object[] getElements() {
32     // usually, this would be some element object in the object model on which
33     // we work (e.g. a Java element if we were in the Java Model); in this case
34     // we have only the property name
35     return new Object[] { info.getOldName() };
36   }
37
38   public String getIdentifier() {
39     return getClass().getName();
40   }
41
42   public String getProcessorName() {
43     return CoreTexts.renamePropertyProcessor_name;
44   }
45
46   public boolean isApplicable() throws CoreException {
47     return true;
48   }
49
50   public RefactoringStatus checkInitialConditions( final IProgressMonitor pm ) {
51     return delegate.checkInitialConditions();
52   }
53
54   public RefactoringStatus checkFinalConditions(
55             final IProgressMonitor pm,  final CheckConditionsContext context ) {
56     return delegate.checkFinalConditions( pm, context );
57   }
58
59   public Change createChange( final IProgressMonitor pm ) {
60     CompositeChange result = new CompositeChange( getProcessorName() );
61     delegate.createChange( pm, result );
62     return result;
63   }
64
65   public RefactoringParticipant[] loadParticipants(
66                                final RefactoringStatus status,
67                                final SharableParticipants sharedParticipants ) {
68     // This would be the place to load the participants via the
69     // ParticipantManager and decide which of them are allowed to participate.
70     return new RefactoringParticipant[ 0 ];
71   }
72 }