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