X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui.workbench%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Fworkbench%2Finternal%2Fjcr%2Fcommands%2FRenameNode.java;h=07c722b23acb390a08ff15fa8457064fecea6dac;hb=5330a39edafd14df2e6cdc57aae4e9393ebca75c;hp=7d3194022ec5490b3ae782ad0819d546d83e16e9;hpb=f8cb8d9383c303f993ca411408c244b9873c046d;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/internal/jcr/commands/RenameNode.java b/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/internal/jcr/commands/RenameNode.java index 7d3194022..07c722b23 100644 --- a/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/internal/jcr/commands/RenameNode.java +++ b/org.argeo.cms.ui.workbench/src/org/argeo/cms/ui/workbench/internal/jcr/commands/RenameNode.java @@ -36,8 +36,8 @@ import org.eclipse.ui.IWorkbenchPage; 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 */ @@ -45,8 +45,7 @@ public class RenameNode extends AbstractHandler { 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)) @@ -63,22 +62,19 @@ public class RenameNode extends AbstractHandler { 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); } } }