import net.sourceforge.phpdt.internal.ui.util.PHPFileUtil;
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.core.RenamePHPProcessor;
import net.sourceforge.phpdt.ltk.ui.UITexts;
import net.sourceforge.phpdt.ltk.ui.wizards.RenameIdentifierWizard;
import net.sourceforge.phpeclipse.phpeditor.PHPEditor;
* <p>
* action that is triggered from the editor context menu.
* </p>
- *
+ *
* <p>
* This action is declared in the <code>plugin.xml</code>.
* </p>
- *
+ *
*/
public class RenamePHPIdentifier implements IEditorActionDelegate {
// 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;
onPHPFile = false;
IFile file = getFile();
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) {
}
}
- 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);
}
private void openWizard() {
- RenameIdentifierDelegate delegate = new RenameIdentifierDelegate( info );
+ RenameIdentifierDelegate delegate = new RenameIdentifierDelegate(info);
RefactoringProcessor processor = new RenamePHPProcessor(info, delegate);
- RenameIdentifierRefactoring ref = new RenameIdentifierRefactoring(processor);
+ RenameIdentifierRefactoring ref = new RenameIdentifierRefactoring(
+ processor);
RenameIdentifierWizard wizard = new RenameIdentifierWizard(ref, info);
- RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
+ RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(
+ wizard);
try {
String titleForFailedChecks = ""; //$NON-NLS-1$
op.run(getShell(), titleForFailedChecks);
if (targetEditor != null) {
result = targetEditor.getSite().getShell();
} else {
- result = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
+ result = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getShell();
}
return result;
}