Refactoringaction: net.sourceforge.phpdt.ltk.ui.actions.RenameLocalVariable
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / ltk / ui / actions / RenameLocalVariable.java
index 9bc7415..0b1a91c 100644 (file)
@@ -51,9 +51,6 @@ public class RenameLocalVariable implements IEditorActionDelegate {
 
        private RenameIdentifierInfo info = new RenameIdentifierInfo();
 
-       // interface methods of IEditorActionDelegate
-       // ///////////////////////////////////////////
-
        public void setActiveEditor(final IAction action, final IEditorPart targetEditor) {
                this.targetEditor = targetEditor;
                onPHPFile = false;
@@ -86,17 +83,17 @@ public class RenameLocalVariable implements IEditorActionDelegate {
                                                                SourceMethod method = (SourceMethod) findEnclosingElement(point.x, unit, IJavaElement.METHOD);
                                                                if (word == null || word.charAt(0) != '$' || method == null || !(method instanceof SourceMethod)) {
                                                                        refuseLocalVariable();
+                                                               } else {
+                                                                       applySelection((ITextSelection) selection, word, point, method);
+                                                                       if (saveAll()) {
+                                                                               openWizard();
+                                                                       }
                                                                }
-                                                               applySelection((ITextSelection) selection, word, point, method);
-
                                                        } catch (BadLocationException e) {
                                                        }
                                                }
                                        }
                                }
-                               if (saveAll()) {
-                                       openWizard();
-                               }
                        }
                }
        }
@@ -148,6 +145,7 @@ public class RenameLocalVariable implements IEditorActionDelegate {
                String message = UITexts.renameLocalVariable_refuseDlg_message;
                MessageDialog.openInformation(getShell(), title, message);
        }
+
        private void refuse() {
                String title = UITexts.renameProperty_refuseDlg_title;
                String message = UITexts.renameProperty_refuseDlg_message;