Added a new refactoring action: net.sourceforge.phpdt.ltk.ui.actions.RenameLocalVariable
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / ltk / ui / actions / RenamePHPIdentifier.java
index 9e38cd5..c73d1f4 100644 (file)
@@ -1,13 +1,15 @@
 // Copyright (c) 2005 by Leif Frenzel. All rights reserved.
 // See http://leiffrenzel.de
+// modified for phpeclipse.de project by axelcl
 package net.sourceforge.phpdt.ltk.ui.actions;
 
 import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
-import net.sourceforge.phpdt.ltk.core.RenamePropertyInfo;
-import net.sourceforge.phpdt.ltk.core.RenamePropertyProcessor;
-import net.sourceforge.phpdt.ltk.core.RenamePropertyRefactoring;
+import net.sourceforge.phpdt.ltk.core.RenameIdentifierDelegate;
+import net.sourceforge.phpdt.ltk.core.RenameIdentifierInfo;
+import net.sourceforge.phpdt.ltk.core.RenamePHPProcessor;
+import net.sourceforge.phpdt.ltk.core.RenameIdentifierRefactoring;
 import net.sourceforge.phpdt.ltk.ui.UITexts;
-import net.sourceforge.phpdt.ltk.ui.wizards.RenamePropertyWizard;
+import net.sourceforge.phpdt.ltk.ui.wizards.RenameIdentifierWizard;
 import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
 import net.sourceforge.phpeclipse.phpeditor.php.PHPWordExtractor;
 
@@ -42,35 +44,32 @@ import org.eclipse.ui.texteditor.ITextEditor;
  * This action is declared in the <code>plugin.xml</code>.
  * </p>
  *
- * @author Leif Frenzel
  */
 public class RenamePHPIdentifier implements IEditorActionDelegate {
 
-       private static final String EXT_PROPERTIES = "properties"; //$NON-NLS-1$
-
        private ISelection selection;
 
        private IEditorPart targetEditor;
 
-       private boolean onPropertiesFile;
+       private boolean onPHPFile;
 
-       private RenamePropertyInfo info = new RenamePropertyInfo();
+       private RenameIdentifierInfo info = new RenameIdentifierInfo();
 
        // interface methods of IEditorActionDelegate
        // ///////////////////////////////////////////
 
        public void setActiveEditor(final IAction action, final IEditorPart targetEditor) {
                this.targetEditor = targetEditor;
-               onPropertiesFile = false;
+               onPHPFile = false;
                IFile file = getFile();
 
                if (file != null && PHPFileUtil.isPHPFile(file)) {
-                       onPropertiesFile = true;
+                       onPHPFile = true;
                }
        }
 
        public void run(final IAction action) {
-               if (!onPropertiesFile) {
+               if (!onPHPFile) {
                        refuse();
                } else {
                        if (selection != null && selection instanceof ITextSelection) {
@@ -131,9 +130,10 @@ public class RenamePHPIdentifier implements IEditorActionDelegate {
        }
 
        private void openWizard() {
-               RefactoringProcessor processor = new RenamePropertyProcessor(info);
-               RenamePropertyRefactoring ref = new RenamePropertyRefactoring(processor);
-               RenamePropertyWizard wizard = new RenamePropertyWizard(ref, info);
+               RenameIdentifierDelegate delegate = new RenameIdentifierDelegate( info );
+               RefactoringProcessor processor = new RenamePHPProcessor(info, delegate);
+               RenameIdentifierRefactoring ref = new RenameIdentifierRefactoring(processor);
+               RenameIdentifierWizard wizard = new RenameIdentifierWizard(ref, info);
                RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
                try {
                        String titleForFailedChecks = ""; //$NON-NLS-1$