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;
6 import org.eclipse.core.runtime.*;
7 import org.eclipse.ltk.core.refactoring.*;
8 import org.eclipse.ltk.core.refactoring.participants.*;
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>
16 public class RenamePHPProcessor extends RefactoringProcessor {
18 private final RenameIdentifierInfo info;
19 private final RenameIdentifierDelegate delegate;
21 public RenamePHPProcessor( final RenameIdentifierInfo info, final RenameIdentifierDelegate delegate ) {
23 this.delegate = delegate;
27 public Object[] getElements() {
28 // usually, this would be some element object in the object model on which
29 // we work (e.g. a Java element if we were in the Java Model); in this case
30 // we have only the property name
31 return new Object[] { info.getOldName() };
34 public String getIdentifier() {
35 return getClass().getName();
38 public String getProcessorName() {
39 return CoreTexts.renamePropertyProcessor_name;
42 public boolean isApplicable() throws CoreException {
46 public RefactoringStatus checkInitialConditions( final IProgressMonitor pm ) {
47 return delegate.checkInitialConditions();
50 public RefactoringStatus checkFinalConditions(
51 final IProgressMonitor pm, final CheckConditionsContext context ) {
52 return delegate.checkFinalConditions( pm, context );
55 public Change createChange( final IProgressMonitor pm ) {
56 CompositeChange result = new CompositeChange( getProcessorName() );
57 delegate.createChange( pm, result );
61 public RefactoringParticipant[] loadParticipants(
62 final RefactoringStatus status,
63 final SharableParticipants sharedParticipants ) {
64 // This would be the place to load the participants via the
65 // ParticipantManager and decide which of them are allowed to participate.
66 return new RefactoringParticipant[ 0 ];