public Object execute(ExecutionEvent event) throws ExecutionException {
fEditor = HandlerUtil.getActiveEditor(event);
IJavaElement element = getSelectedElement();
if(element != null) {
RenameSupport renameSupport = null;
try {
switch(element.getElementType()) {
case IJavaElement.TYPE:
renameSupport= RenameSupport.create((IType)element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
break;
case IJavaElement.METHOD:
renameSupport= RenameSupport.create((IMethod)element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
break;
case IJavaElement.PACKAGE_FRAGMENT:
renameSupport= RenameSupport.create((IPackageFragment)element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
break;
case IJavaElement.FIELD:
renameSupport = RenameSupport.create((IField)element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
break;
}
if(renameSupport != null) {
renameSupport.openDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
PlatformStatusLineUtil.clearStatusLine();
}
}
catch (CoreException e) {
Logger.logException(e);