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.CoreException;
7 import org.eclipse.core.runtime.IProgressMonitor;
8 import org.eclipse.ltk.core.refactoring.Change;
9 import org.eclipse.ltk.core.refactoring.CompositeChange;
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.RefactoringParticipant;
13 import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
14 import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
18 * The processor is where the work is delegated to if participants are involved.
19 * The processor loads the participants and manages the lifecycle of the
20 * refactoring. In order to do that, the refactoring entry point methods must be
25 public class RenamePHPProcessor extends RefactoringProcessor {
27 private final RenameIdentifierInfo info;
29 private final RenameIdentifierDelegate delegate;
31 public RenamePHPProcessor(final RenameIdentifierInfo info,
32 final RenameIdentifierDelegate delegate) {
34 this.delegate = delegate;
37 public Object[] getElements() {
38 // usually, this would be some element object in the object model on
40 // we work (e.g. a Java element if we were in the Java Model); in this
42 // we have only the property name
43 return new Object[] { info.getOldName() };
46 public String getIdentifier() {
47 return getClass().getName();
50 public String getProcessorName() {
51 return CoreTexts.renamePropertyProcessor_name;
54 public boolean isApplicable() throws CoreException {
58 public RefactoringStatus checkInitialConditions(final IProgressMonitor pm) {
59 return delegate.checkInitialConditions();
62 public RefactoringStatus checkFinalConditions(final IProgressMonitor pm,
63 final CheckConditionsContext context) {
64 return delegate.checkFinalConditions(pm, context);
67 public Change createChange(final IProgressMonitor pm) {
68 CompositeChange result = new CompositeChange(getProcessorName());
69 delegate.createChange(pm, result);
73 public RefactoringParticipant[] loadParticipants(
74 final RefactoringStatus status,
75 final SharableParticipants sharedParticipants) {
76 // This would be the place to load the participants via the
77 // ParticipantManager and decide which of them are allowed to
79 return new RefactoringParticipant[0];