use of org.eclipse.wst.jsdt.core.IPackageFragment 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();
}
}
use of org.eclipse.wst.jsdt.core.IPackageFragment in project webtools.sourceediting by eclipse.
the class JSPTypeMoveParticipant method createChange.
/*
* (non-Javadoc)
*
* @see org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant#createChange(org.eclipse.core.runtime.IProgressMonitor)
*/
public Change createChange(IProgressMonitor pm) throws CoreException {
if (pm != null && pm.isCanceled()) {
return null;
}
CompositeChange multiChange = null;
Object dest = getArguments().getDestination();
if (dest instanceof IPackageFragment) {
Change[] changes = JSPTypeMoveChange.createChangesFor(fType, ((IPackageFragment) dest).getElementName());
if (changes.length > 0) {
multiChange = new CompositeChange(JsUIMessages.JSP_changes, changes);
}
}
return multiChange;
}
Aggregations