]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - plugins/org.argeo.slc.client.ui.dist/src/main/java/org/argeo/slc/client/ui/dist/commands/OpenGenerateBinariesWizard.java
git-svn-id: https://svn.argeo.org/slc/trunk@6893 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc
[gpl/argeo-slc.git] / plugins / org.argeo.slc.client.ui.dist / src / main / java / org / argeo / slc / client / ui / dist / commands / OpenGenerateBinariesWizard.java
index d9f72d16bee93a71e2029dda9c37bc9e9a504e3d..288475f23e8c9170a8352aab4f31fe3f5270e3ab 100644 (file)
@@ -17,8 +17,14 @@ package org.argeo.slc.client.ui.dist.commands;
 
 import java.util.Iterator;
 
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+
+import org.argeo.slc.SlcException;
 import org.argeo.slc.client.ui.dist.DistPlugin;
 import org.argeo.slc.client.ui.dist.model.ModularDistBaseElem;
+import org.argeo.slc.client.ui.dist.model.WorkspaceElem;
 import org.argeo.slc.client.ui.dist.utils.CommandHelpers;
 import org.argeo.slc.client.ui.dist.wizards.GenerateBinariesWizard;
 import org.eclipse.core.commands.AbstractHandler;
@@ -56,14 +62,27 @@ public class OpenGenerateBinariesWizard extends AbstractHandler {
                                Object element = it.next();
                                if (element instanceof ModularDistBaseElem) {
                                        ModularDistBaseElem elem = (ModularDistBaseElem) element;
+                                       Session newSession = null;
+                                       try {
+                                               Node cBase = elem.getCategoryBase();
+                                               String path = cBase.getPath();
+                                               newSession = ((WorkspaceElem) elem.getParent())
+                                                               .getNewSession();
+                                               GenerateBinariesWizard wizard = new GenerateBinariesWizard(
+                                                               newSession.getNode(path));
+
+                                               WizardDialog dialog = new WizardDialog(
+                                                               HandlerUtil.getActiveShell(event), wizard);
+                                               int result = dialog.open();
 
-                                       GenerateBinariesWizard wizard = new GenerateBinariesWizard(
-                                                       elem.getCategoryBase());
-                                       WizardDialog dialog = new WizardDialog(
-                                                       HandlerUtil.getActiveShell(event), wizard);
-                                       int result = dialog.open();
-                                       if (result == Dialog.OK)
-                                               CommandHelpers.callCommand(RefreshDistributionsView.ID);
+                                               if (result == Dialog.OK)
+                                                       CommandHelpers
+                                                                       .callCommand(RefreshDistributionsView.ID);
+                                       } catch (RepositoryException re) {
+                                               throw new SlcException(
+                                                               "Unable to duplicate session for node " + elem,
+                                                               re);
+                                       }
                                }
 
                        }