X-Git-Url: http://secure.phpeclipse.com
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ltk/ui/actions/RenamePHPIdentifier.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ltk/ui/actions/RenamePHPIdentifier.java
index 4c58891..53d06a5 100644
--- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ltk/ui/actions/RenamePHPIdentifier.java
+++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/ltk/ui/actions/RenamePHPIdentifier.java
@@ -4,11 +4,12 @@
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.RenameIdentifierRefactoring;
+import net.sourceforge.phpdt.ltk.core.RenamePHPProcessor;
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;
@@ -38,40 +39,38 @@ import org.eclipse.ui.texteditor.ITextEditor;
*
* action that is triggered from the editor context menu.
*
- *
+ *
*
* This action is declared in the plugin.xml
.
*
- *
- * @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) {
+ 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) {
@@ -80,8 +79,10 @@ public class RenamePHPIdentifier implements IEditorActionDelegate {
if (targetEditor != null && (targetEditor instanceof PHPEditor)) {
PHPEditor editor = (PHPEditor) targetEditor;
if (editor != null) {
- ITextSelection textSelection = (ITextSelection) editor.getSelectionProvider().getSelection();
- IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
+ ITextSelection textSelection = (ITextSelection) editor
+ .getSelectionProvider().getSelection();
+ IDocument doc = editor.getDocumentProvider()
+ .getDocument(editor.getEditorInput());
int pos = textSelection.getOffset();
point = PHPWordExtractor.findWord(doc, pos);
if (point != null) {
@@ -100,14 +101,16 @@ public class RenamePHPIdentifier implements IEditorActionDelegate {
}
}
- public void selectionChanged(final IAction action, final ISelection selection) {
+ public void selectionChanged(final IAction action,
+ final ISelection selection) {
this.selection = selection;
}
// helping methods
// ////////////////
- private void applySelection(final ITextSelection textSelection, String word, Point point) {
+ private void applySelection(final ITextSelection textSelection,
+ String word, Point point) {
if (word != null) {
info.setOldName(word);
info.setNewName(word);
@@ -132,10 +135,13 @@ public class RenamePHPIdentifier implements IEditorActionDelegate {
}
private void openWizard() {
- RefactoringProcessor processor = new RenamePropertyProcessor(info);
- RenamePropertyRefactoring ref = new RenamePropertyRefactoring(processor);
- RenamePropertyWizard wizard = new RenamePropertyWizard(ref, info);
- RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
+ 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$
op.run(getShell(), titleForFailedChecks);
@@ -149,7 +155,8 @@ public class RenamePHPIdentifier implements IEditorActionDelegate {
if (targetEditor != null) {
result = targetEditor.getSite().getShell();
} else {
- result = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ result = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
}
return result;
}