import org.eclipse.ui.handlers.HandlerUtil;
/**
- * Canonically call JCR {@link Session#move(String, String)} on the first
- * element returned by {@link HandlerUtil#getActiveWorkbenchWindow()}
+ * Canonically call JCR Session#move(String, String) on the first element
+ * returned by HandlerUtil#getActiveWorkbenchWindow()
* (...getActivePage().getSelection()), if it is a {@link SingleJcrNodeElem}.
* The user must then fill a new name in and confirm
*/
public final static String ID = WorkbenchUiPlugin.PLUGIN_ID + ".renameNode";
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchPage iwp = HandlerUtil.getActiveWorkbenchWindow(event)
- .getActivePage();
+ IWorkbenchPage iwp = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage();
ISelection selection = iwp.getSelection();
if (selection == null || !(selection instanceof IStructuredSelection))
String oldPath = null;
try {
newName = SingleValue.ask("New node name",
- "Please provide a new name for [" + node.getName()
- + "]");
+ "Please provide a new name for [" + node.getName() + "]");
// TODO sanity check and user feedback
newName = JcrUtils.replaceInvalidChars(newName);
oldPath = node.getPath();
session = node.getSession();
- session.move(oldPath, JcrUtils.parentPath(oldPath) + "/"
- + newName);
+ session.move(oldPath, JcrUtils.parentPath(oldPath) + "/" + newName);
session.save();
// Manually refresh the browser view. Must be enhanced
if (iwp.getActivePart() instanceof JcrBrowserView)
((JcrBrowserView) iwp.getActivePart()).refresh(sjn);
} catch (RepositoryException e) {
- throw new EclipseUiException("Unable to rename " + node
- + " to " + newName, e);
+ throw new EclipseUiException("Unable to rename " + node + " to " + newName, e);
}
}
}