- * 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
*/
* (...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 {
public final static String ID = WorkbenchUiPlugin.PLUGIN_ID + ".renameNode";
public Object execute(ExecutionEvent event) throws ExecutionException {
ISelection selection = iwp.getSelection();
if (selection == null || !(selection instanceof IStructuredSelection))
ISelection selection = iwp.getSelection();
if (selection == null || !(selection instanceof IStructuredSelection))
// TODO sanity check and user feedback
newName = JcrUtils.replaceInvalidChars(newName);
oldPath = node.getPath();
session = node.getSession();
// TODO sanity check and user feedback
newName = JcrUtils.replaceInvalidChars(newName);
oldPath = node.getPath();
session = node.getSession();
session.save();
// Manually refresh the browser view. Must be enhanced
if (iwp.getActivePart() instanceof JcrBrowserView)
((JcrBrowserView) iwp.getActivePart()).refresh(sjn);
} catch (RepositoryException e) {
session.save();
// Manually refresh the browser view. Must be enhanced
if (iwp.getActivePart() instanceof JcrBrowserView)
((JcrBrowserView) iwp.getActivePart()).refresh(sjn);
} catch (RepositoryException e) {