use of org.eclipse.wst.jsdt.ui.refactoring.RenameSupport in project webtools.sourceediting by eclipse.
the class JSPRenameElementActionDelegate method run.
public void run(IAction action) {
IJavaScriptElement element = getSelectedElement();
if (element != null) {
RenameSupport renameSupport = null;
try {
switch(element.getElementType()) {
case IJavaScriptElement.TYPE:
renameSupport = RenameSupport.create((IType) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
break;
case IJavaScriptElement.METHOD:
renameSupport = RenameSupport.create((IFunction) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
break;
case IJavaScriptElement.PACKAGE_FRAGMENT:
renameSupport = RenameSupport.create((IPackageFragment) element, element.getElementName(), RenameSupport.UPDATE_REFERENCES);
break;
}
if (renameSupport != null) {
renameSupport.openDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
PlatformStatusLineUtil.clearStatusLine();
}
} catch (CoreException e) {
Logger.logException(e);
}
} else {
PlatformStatusLineUtil.displayErrorMessage(JsUIMessages.JSPRenameElementAction_0);
PlatformStatusLineUtil.addOneTimeClearListener();
}
}
Aggregations