|
From: <net...@us...> - 2003-02-15 13:37:47
|
Update of /cvsroot/cpptool/rfta/src/eclipseplugin/PluginCode/src/org/eclipse/cpprefactoring/ui
In directory sc8-pr-cvs1:/tmp/cvs-serv31495/org/eclipse/cpprefactoring/ui
Added Files:
RenameLocalVariableDialog.java
Log Message:
Eclipse Plugin JAVA code
--- NEW FILE: RenameLocalVariableDialog.java ---
package org.eclipse.cpprefactoring.ui;
import org.eclipse.core.runtime.Path;
import org.eclipse.cpprefactoring.RefactorPluginMain;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.InputDialog;
import org.eclipse.jface.text.IRewriteTarget;
import org.eclipse.jface.viewers.ISelectionProvider;
/**
* @author Andre Baresel
*
* Dialog to enable user to enter the new name of a
* local variable.
*/
public class RenameLocalVariableDialog extends Dialog {
public RenameLocalVariableDialog() {
super(null);
}
/**
* Callback function executed from 'applyRftaRenameLocaleVariable' for
* user interaction. When the function returns, the refactoring will
* be done.
*/
static public boolean callback_userrequest(String oldname,StringBuffer newname) {
if (newname==null) {
System.out.println("DEBUG: Caller has to initialize second parameter.");
return false;
}
InputDialog dialog = new InputDialog(null,"Rename Local Variable","Select the new name for variable '"+oldname+"'",newname.toString(),null);
dialog.setBlockOnOpen(true);
if (dialog.open()==dialog.OK)
{
if (newname.length()>0)
newname.delete(0,newname.length()-1);
newname.append(dialog.getValue());
System.out.println("OK - do refactoring");
return true;
} else
return false;
}
}
|