]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.eclipse.ui.workbench/src/org/argeo/eclipse/ui/workbench/commands/DumpNode.java
Introduce UX context
[lgpl/argeo-commons.git] / org.argeo.eclipse.ui.workbench / src / org / argeo / eclipse / ui / workbench / commands / DumpNode.java
index e919eb26b4f99fe2b8d04531acadc940f09042cf..4943ccbf35140d6a6b310cebd2f70aa898f96a79 100644 (file)
@@ -27,13 +27,13 @@ import java.util.Map;
 
 import javax.jcr.Node;
 import javax.jcr.RepositoryException;
+import javax.jcr.Session;
 
 import org.argeo.ArgeoException;
-import org.argeo.eclipse.ui.specific.OpenFile;
-import org.argeo.eclipse.ui.utils.CommandUtils;
+import org.argeo.eclipse.ui.workbench.CommandUtils;
 import org.argeo.eclipse.ui.workbench.WorkbenchUiPlugin;
-import org.argeo.jcr.JcrUtils;
 import org.argeo.eclipse.ui.workbench.jcr.internal.model.SingleJcrNodeElem;
+import org.argeo.jcr.JcrUtils;
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
@@ -42,13 +42,12 @@ import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.handlers.HandlerUtil;
 
 /**
- * If the method
- * <code> HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection() </code>
- * exits and has a SingleJcrNodeElem as first element, it canonically calls the
- * JCR Session.exportSystemView() method on the underlying node with both
- * skipBinary & noRecurse boolean flags set to false.
+ * Canonically call JCR {@link Session#exportSystemView()} on the first element
+ * returned by {@link HandlerUtil#getActiveWorkbenchWindow()}
+ * (...getActivePage().getSelection()), if it is a {@link SingleJcrNodeElem},
+ * with both skipBinary & noRecurse boolean flags set to false.
  * 
- * Resulting stream is saved in a tmp file and opened via the "open file"
+ * Resulting stream is saved in a tmp file and opened via the {@link OpenFile}
  * single-sourced command.
  */
 public class DumpNode extends AbstractHandler {
@@ -86,8 +85,9 @@ public class DumpNode extends AbstractHandler {
                                                        .getTime());
                                        node.getSession().exportSystemView(node.getPath(), fos,
                                                        true, false);
-                                       openGeneratedFile(tmpFile.getAbsolutePath(),
-                                                       "Dump-" + JcrUtils.replaceInvalidChars(node.getName())+ "-" + dateVal + ".xml");
+                                       openGeneratedFile(tmpFile.getAbsolutePath(), "Dump-"
+                                                       + JcrUtils.replaceInvalidChars(node.getName())
+                                                       + "-" + dateVal + ".xml");
                                } catch (RepositoryException e) {
                                        throw new ArgeoException(
                                                        "Unable to perform SystemExport on " + node, e);
@@ -104,7 +104,6 @@ public class DumpNode extends AbstractHandler {
                Map<String, String> params = new HashMap<String, String>();
                params.put(OpenFile.PARAM_FILE_NAME, fileName);
                params.put(OpenFile.PARAM_FILE_URI, "file://" + path);
-               CommandUtils.callCommand("org.argeo.security.ui.specific.openFile",
-                               params);
+               CommandUtils.callCommand(OpenFile.ID, params);
        }
 }